提交 ed9a8d91 authored 作者: lidongxu's avatar lidongxu

feat(examine): 删除照片完成

并调整是否执行状态调整单选框默认显示
上级 9bff4700
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
accept="image/*" accept="image/*"
v-model="form.storePicture" v-model="form.storePicture"
:after-read="storePictureRead" :after-read="storePictureRead"
preview-size="120"> preview-size="120"
@delete="deleteStorePicture">
</van-uploader> </van-uploader>
</div> </div>
</div> </div>
...@@ -39,7 +40,7 @@ ...@@ -39,7 +40,7 @@
</div> </div>
<div class="form-item" <div class="form-item"
style="display: flex; align-items: center;"> style="display: flex; align-items: center;">
<label>促销员数量</label> <label>促销员人数</label>
<div class="custom-counter"> <div class="custom-counter">
<button @click="decreaseCount">-</button> <button @click="decreaseCount">-</button>
<span>{{ form.temNum }}</span> <span>{{ form.temNum }}</span>
...@@ -114,7 +115,8 @@ ...@@ -114,7 +115,8 @@
accept="image/*" accept="image/*"
v-model="form.temWorkPhotos" v-model="form.temWorkPhotos"
:after-read="temWorkPhotosRead" :after-read="temWorkPhotosRead"
preview-size="120"> preview-size="120"
@delete="deleteTemWorkPhotos">
</van-uploader> </van-uploader>
</div> </div>
...@@ -126,7 +128,8 @@ ...@@ -126,7 +128,8 @@
accept="image/*" accept="image/*"
v-model="form.storeTcPhoto" v-model="form.storeTcPhoto"
:after-read="storeTcPhotoRead" :after-read="storeTcPhotoRead"
preview-size="120"> preview-size="120"
@delete="deleteStoreTcPhoto">
</van-uploader> </van-uploader>
</div> </div>
...@@ -138,11 +141,20 @@ ...@@ -138,11 +141,20 @@
accept="image/*" accept="image/*"
v-model="form.storeZhjPhoto" v-model="form.storeZhjPhoto"
:after-read="temOnWorkPictureRead" :after-read="temOnWorkPictureRead"
preview-size="120"> preview-size="120"
@delete="deleteStoreZhjPhoto">
</van-uploader> </van-uploader>
</div> </div>
<div class="form-item">
<label>POS金额:</label>
<van-field v-model="form.posRmb"
type="number"
:controls="true"
placeholder="请输入POS金额"
style="margin-top: 10px;"
@input="posRmbChange" />
</div>
<div class="form-item"> <div class="form-item">
<label>POS照片(两张):</label> <label>POS照片(两张):</label>
</div> </div>
...@@ -151,19 +163,12 @@ ...@@ -151,19 +163,12 @@
accept="image/*" accept="image/*"
v-model="form.posPhotos" v-model="form.posPhotos"
:after-read="posPhotosRead" :after-read="posPhotosRead"
preview-size="120"> preview-size="120"
@delete="deletePosPhotos">
</van-uploader> </van-uploader>
</div> </div>
<div class="form-item">
<label>POS金额:</label>
<van-field v-model="form.posRmb"
type="number"
:controls="true"
placeholder="请输入POS金额"
style="margin-top: 10px;"
@input="posRmbChange" />
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -240,13 +245,25 @@ const getDetail = async () => { ...@@ -240,13 +245,25 @@ const getDetail = async () => {
form.value.storePicture = res.data.storePicture ? [{ form.value.storePicture = res.data.storePicture ? [{
url: res.data.storePicture url: res.data.storePicture
}] : [] }] : []
form.value.planStatus = Boolean(res.data.planStatus * 1) form.value.planStatus = Boolean(res.data.planStatus * 1) // 0 未执行(false) 1 执行(true)
form.value.temNum = res.data.temNum || 0 // 如果执行了促销人数默认为 1,否则为 0
form.value.storeDd = res.data.storeDd === null ? '否' : res.data.storeDd form.value.temNum = res.data.temNum || (res.data.planStatus ? 1 : 0)
form.value.temOnWork = res.data.temOnWork === null ? '离岗' : res.data.temOnWork // 如果执行了则所有单选框的值默认有值,否则为否
form.value.temHs = res.data.temHs === null ? '未达标' : res.data.temHs if (form.value.planStatus) {
form.value.temWl = res.data.temWl === null ? '缺少' : res.data.temWl // 执行
form.value.temZz = res.data.temZz === null ? '未达标' : res.data.temZz form.value.storeDd = res.data.storeDd === null ? '是' : res.data.storeDd
form.value.temOnWork = res.data.temOnWork === null ? '在岗' : res.data.temOnWork
form.value.temHs = res.data.temHs === null ? '达标' : res.data.temHs
form.value.temWl = res.data.temWl === null ? '齐全' : res.data.temWl
form.value.temZz = res.data.temZz === null ? '达标' : res.data.temZz
} else {
form.value.storeDd = res.data.storeDd === null ? '否' : res.data.storeDd
form.value.temOnWork = res.data.temOnWork === null ? '离岗' : res.data.temOnWork
form.value.temHs = res.data.temHs === null ? '未达标' : res.data.temHs
form.value.temWl = res.data.temWl === null ? '缺少' : res.data.temWl
form.value.temZz = res.data.temZz === null ? '未达标' : res.data.temZz
}
form.value.temWorkPhotos = res.data?.temWorkPhotos ? (res.data.temWorkPhotos.map(o => { form.value.temWorkPhotos = res.data?.temWorkPhotos ? (res.data.temWorkPhotos.map(o => {
return { return {
url: o url: o
...@@ -280,6 +297,13 @@ const storePictureRead = async (file) => { ...@@ -280,6 +297,13 @@ const storePictureRead = async (file) => {
storePicture: pictureUrl storePicture: pictureUrl
}) })
} }
// 删除店铺门头照
const deleteStorePicture = async () => {
await createExamine({
id: form.value.id,
storePicture: ''
})
}
// 执行状态改变 // 执行状态改变
const planStatusChange = async (val) => { const planStatusChange = async (val) => {
...@@ -359,6 +383,14 @@ const temWorkPhotosRead = async (file) => { ...@@ -359,6 +383,14 @@ const temWorkPhotosRead = async (file) => {
}) })
} }
// 删除在/离岗照片
const deleteTemWorkPhotos = async () => {
await createExamine({
id: form.value.id,
temWorkPhotos: form.value.temWorkPhotos.map(o => o.url)
})
}
// 特陈照片上传 // 特陈照片上传
const storeTcPhotoRead = async (file) => { const storeTcPhotoRead = async (file) => {
// 处理上传的文件 // 处理上传的文件
...@@ -373,11 +405,19 @@ const storeTcPhotoRead = async (file) => { ...@@ -373,11 +405,19 @@ const storeTcPhotoRead = async (file) => {
}) })
} }
// 删除特陈照片
const deleteStoreTcPhoto = async () => {
await createExamine({
id: form.value.id,
storeTcPhoto: ''
})
}
// 主货架照片 // 主货架照片
const temOnWorkPictureRead = async (file) => { const temOnWorkPictureRead = async (file) => {
// 处理上传的文件 // 处理上传的文件
const date = new Date() const date = new Date()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
const theDate = date.getDate() const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file) const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file)
...@@ -386,12 +426,19 @@ const temOnWorkPictureRead = async (file) => { ...@@ -386,12 +426,19 @@ const temOnWorkPictureRead = async (file) => {
storeZhjPhoto: pictureUrl storeZhjPhoto: pictureUrl
}) })
} }
// 删除主货架照片
const deleteStoreZhjPhoto = async () => {
await createExamine({
id: form.value.id,
storeZhjPhoto: ''
})
}
// POS 两张照片 // POS 两张照片
const posPhotosRead = async (file) => { const posPhotosRead = async (file) => {
// 处理上传的文件 // 处理上传的文件
const date = new Date() const date = new Date()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
const theDate = date.getDate() const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file) const pictureUrl = await uploadFileToOSSAPI(`examine/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${userStore().getEmployeeNo}/${uuidv4()}.png`, file.file)
// 判断 objectUrl // 判断 objectUrl
...@@ -405,13 +452,20 @@ const posPhotosRead = async (file) => { ...@@ -405,13 +452,20 @@ const posPhotosRead = async (file) => {
posPhotos: form.value.posPhotos.map(o => o.url) posPhotos: form.value.posPhotos.map(o => o.url)
}) })
} }
// 删除 POS 照片
const deletePosPhotos = async () => {
await createExamine({
id: form.value.id,
posPhotos: form.value.posPhotos.map(o => o.url)
})
}
// POS 金额修改 // POS 金额修改
const posRmbChange = async () => { const posRmbChange = async () => {
await createExamine({ await createExamine({
id: form.value.id, id: form.value.id,
posRmb: form.value.posRmb || 0 posRmb: form.value.posRmb || 0
}) })
} }
</script> </script>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
:right-text="(examined ? '已' : '未') + '稽查'" :right-text="(examined ? '已' : '未') + '稽查'"
left-arrow left-arrow
@click-left="clickBack()" @click-left="clickBack()"
@click-right="clickExamine()" @click-right="clickExamine()"
fixed fixed
placeholder /> placeholder />
<van-cell-group> <van-cell-group>
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
<script setup> <script setup>
import { getPlanDetailAPI, createExamine } from '@/api' import { getPlanDetailAPI, createExamine } from '@/api'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
const { proxy } = getCurrentInstance()
// 获取路由路径上的 id 参数 // 获取路由路径上的 id 参数
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
...@@ -195,16 +196,19 @@ getPlanDetail() ...@@ -195,16 +196,19 @@ getPlanDetail()
// 点击稽查按钮 // 点击稽查按钮
const clickExamine = async () => { const clickExamine = async () => {
// 如果稽查 ID 是空则创建一个 // 确认是否开始稽查
if (!examined.value) { proxy.$modal.confirm("确认开始稽查吗?").then(async () => {
const result = await createExamine({ // 如果稽查 ID 是空则创建一个
...planDetail.value, if (!examined.value) {
id: '', const result = await createExamine({
planId: planDetail.value.id ...planDetail.value,
}) id: '',
newExamined.value = result.data.id planId: planDetail.value.id
} })
router.push({ path: `/examine/${examined?.value || newExamined.value}` }) newExamined.value = result.data.id
}
router.push({ path: `/examine/${examined?.value || newExamined.value}` })
})
} }
const refreshLoading = ref(false) const refreshLoading = ref(false)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论