安全环保检查增加内容图片

dev-2.0
shan ao 2025-10-23 16:02:00 +08:00
parent 0fa01e3826
commit 8849c35d96
3 changed files with 82 additions and 8 deletions

View File

@ -90,6 +90,19 @@
<view slot="label"> <view slot="label">
<view class="pr mt-10 textarea-box" v-for="(item,index) in form.situationList" :key="item.id"> <view class="pr mt-10 textarea-box" v-for="(item,index) in form.situationList" :key="item.id">
<u--textarea v-model="item.SITUATION" placeholder="请输入检查情况" :disabled="disabled"></u--textarea> <u--textarea v-model="item.SITUATION" placeholder="请输入检查情况" :disabled="disabled"></u--textarea>
<!-- 检查情况图片上传 -->
<view class="mt-10">
<view class="title mb-10">图片</view>
<u-upload
:fileList="item.IMAGE"
@afterRead="handleSituationImageUpload($event, index)"
@delete="handleSituationImageDelete($event, index)"
:disabled="disabled"
:deletable="!disabled"
multiple
:maxCount="1">
</u-upload>
</view>
<u-badge value="X" type="error" :offset="[-9,-10]" absolute <u-badge value="X" type="error" :offset="[-9,-10]" absolute
@click.native="removeSituation(item,index)" v-if="!disabled"></u-badge> @click.native="removeSituation(item,index)" v-if="!disabled"></u-badge>
</view> </view>
@ -402,8 +415,8 @@ import {
setImgFilesAdd, setImgFilesAdd,
setSafetyenvironmentalAdd, setSafetyenvironmentalAdd_plus, setSafetyenvironmentalAdd, setSafetyenvironmentalAdd_plus,
setSafetyenvironmentalEdit, setSafetyenvironmentalEdit_plus, setSafetyenvironmentalEdit, setSafetyenvironmentalEdit_plus,
setVideoAdd setVideoAdd, uploadSmd
} from "../../../api"; } from "@/api";
export default { export default {
data() { data() {
@ -420,7 +433,7 @@ export default {
INSPECTION_TYPE_OTHER: '', INSPECTION_TYPE_OTHER: '',
INSPECTION_TIME_START: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'), INSPECTION_TIME_START: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
INSPECTION_TIME_END: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'), INSPECTION_TIME_END: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''}], situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: '', IMAGE: []}],
inspectorList: [{ inspectorList: [{
id: Math.random(), id: Math.random(),
inspectionUserShow: false, inspectionUserShow: false,
@ -532,6 +545,16 @@ export default {
} }
}, },
methods: { methods: {
handleSituationImageUpload(event, index) {
//
const { file } = event;
this.form.situationList[index].IMAGE = [...(this.form.situationList[index].IMAGE || []), ...file];
},
handleSituationImageDelete(event, index) {
//
const { index: imageIndex } = event;
this.form.situationList[index].IMAGE.splice(imageIndex, 1);
},
async fnGetInspectedDepartment() { async fnGetInspectedDepartment() {
let resData = await getInspectedDepartment({'CORPINFO_ID': ''}); let resData = await getInspectedDepartment({'CORPINFO_ID': ''});
this.inspectedDepartmentTreeList = JSON.parse(resData.zTreeNodes); this.inspectedDepartmentTreeList = JSON.parse(resData.zTreeNodes);
@ -577,6 +600,11 @@ export default {
resData.pd.hiddenList[i].hiddenVideos[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].hiddenVideos[j].FILEPATH resData.pd.hiddenList[i].hiddenVideos[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].hiddenVideos[j].FILEPATH
} }
} }
for (let i = 0; i < resData.pd.situationList.length; i++) {
if (resData.pd.situationList[i].IMAGE_PATH) {
resData.pd.situationList[i].IMAGE = [{ url: this.$store.state.filePath + resData.pd.situationList[i].IMAGE_PATH}];
}
}
console.log(resData.pd.inspectorVerifyList) console.log(resData.pd.inspectorVerifyList)
this.form = resData.pd this.form = resData.pd
}, },
@ -637,7 +665,7 @@ export default {
this.inspectionTimeEndShow = false; this.inspectionTimeEndShow = false;
}, },
addSituation() { addSituation() {
this.form.situationList.push({id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''}) this.form.situationList.push({id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: '',IMAGE: []})
}, },
removeSituation(item, index) { removeSituation(item, index) {
uni.showModal({ uni.showModal({
@ -706,6 +734,7 @@ export default {
return; return;
} }
} }
const situations = [];
for (let i = 0; i < this.form.situationList.length; i++) { for (let i = 0; i < this.form.situationList.length; i++) {
if (!this.form.situationList[i].SITUATION) { if (!this.form.situationList[i].SITUATION) {
uni.showToast({ uni.showToast({
@ -714,6 +743,19 @@ export default {
}) })
return return
} }
let imagePath = '';
if (this.form.situationList[i].IMAGE.length) {
const { imgUrl } = await uploadSmd({
filePath: this.form.situationList[i].IMAGE[0].url,
name: "file",
});
imagePath = imgUrl;
}
situations.push({
imagePath: imagePath,
...this.form.situationList[i],
IMAGE: null
})
} }
for (let i = 0; i < this.form.inspectorList.length; i++) { for (let i = 0; i < this.form.inspectorList.length; i++) {
if (!this.form.inspectorList[i].INSPECTION_USER_NAME) { if (!this.form.inspectorList[i].INSPECTION_USER_NAME) {
@ -776,7 +818,7 @@ export default {
delHiddens: this.delHiddens.join(','), delHiddens: this.delHiddens.join(','),
delHiddenFiles: this.delHiddenFiles.join(','), delHiddenFiles: this.delHiddenFiles.join(','),
INSPECTORJSON: JSON.stringify(this.form.inspectorList), INSPECTORJSON: JSON.stringify(this.form.inspectorList),
SITUATIONJSON: JSON.stringify(this.form.situationList), SITUATIONJSON: JSON.stringify(situations),
HIDDENJSON: JSON.stringify(this.form.hiddenList), HIDDENJSON: JSON.stringify(this.form.hiddenList),
} }
} }
@ -791,7 +833,7 @@ export default {
delHiddens: this.delHiddens.join(','), delHiddens: this.delHiddens.join(','),
delHiddenFiles: this.delHiddenFiles.join(','), delHiddenFiles: this.delHiddenFiles.join(','),
INSPECTORJSON: JSON.stringify(this.form.inspectorList), INSPECTORJSON: JSON.stringify(this.form.inspectorList),
SITUATIONJSON: JSON.stringify(this.form.situationList), SITUATIONJSON: JSON.stringify(situations),
HIDDENJSON: JSON.stringify(this.form.hiddenList), HIDDENJSON: JSON.stringify(this.form.hiddenList),
} }
resData = this.INSPECTION_ID ? await setSafetyenvironmentalEdit(params) : await setSafetyenvironmentalAdd(params) resData = this.INSPECTION_ID ? await setSafetyenvironmentalEdit(params) : await setSafetyenvironmentalAdd(params)

View File

@ -62,6 +62,17 @@
<view slot="label textarea-box"> <view slot="label textarea-box">
<view class="pr mt-10" v-for="(item,index) in form.situationList" :key="item.id"> <view class="pr mt-10" v-for="(item,index) in form.situationList" :key="item.id">
<u--textarea v-model="item.SITUATION" placeholder="请输入检查情况" disabled></u--textarea> <u--textarea v-model="item.SITUATION" placeholder="请输入检查情况" disabled></u--textarea>
<!-- 检查情况图片上传 -->
<view class="mt-10">
<view class="title mb-10">图片</view>
<u-upload
:fileList="item.IMAGE"
:disabled="true"
:deletable="false"
multiple
:maxCount="1">
</u-upload>
</view>
</view> </view>
</view> </view>
</u-cell> </u-cell>
@ -262,7 +273,7 @@ export default {
INSPECTION_TIME_START: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'), INSPECTION_TIME_START: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
INSPECTION_TIME_END: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'), INSPECTION_TIME_END: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
CREATTIME: '', CREATTIME: '',
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''}], situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: '', IMAGE: []}],
inspectorList: [{ inspectorList: [{
id: Math.random(), id: Math.random(),
inspectionUserShow: false, inspectionUserShow: false,
@ -317,6 +328,11 @@ export default {
resData.pd.hiddenList[i].hiddenVideos[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].hiddenVideos[j].FILEPATH resData.pd.hiddenList[i].hiddenVideos[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].hiddenVideos[j].FILEPATH
} }
} }
for (let i = 0; i < resData.pd.situationList.length; i++) {
if (resData.pd.situationList[i].IMAGE_PATH) {
resData.pd.situationList[i].IMAGE = [{ url: this.$store.state.filePath + resData.pd.situationList[i].IMAGE_PATH}];
}
}
this.form = resData.pd this.form = resData.pd
}, },
showHidden(item) { showHidden(item) {

View File

@ -60,6 +60,17 @@
<view slot="label" class="title"> <view slot="label" class="title">
<view class="pr mt-10" v-for="(item,index) in form.situationList" :key="item.id"> <view class="pr mt-10" v-for="(item,index) in form.situationList" :key="item.id">
<u--textarea v-model="item.SITUATION" placeholder="请输入检查情况" disabled></u--textarea> <u--textarea v-model="item.SITUATION" placeholder="请输入检查情况" disabled></u--textarea>
<!-- 检查情况图片上传 -->
<view class="mt-10">
<view class="title mb-10">图片</view>
<u-upload
:fileList="item.IMAGE"
:disabled="true"
:deletable="false"
multiple
:maxCount="1">
</u-upload>
</view>
</view> </view>
</view> </view>
</u-cell> </u-cell>
@ -305,7 +316,7 @@ export default {
INSPECTION_TIME_START: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'), INSPECTION_TIME_START: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
INSPECTION_TIME_END: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'), INSPECTION_TIME_END: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
CREATTIME: '', CREATTIME: '',
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''}], situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: '', IMAGE: []}],
inspectorList: [{ inspectorList: [{
id: Math.random(), id: Math.random(),
inspectionUserShow: false, inspectionUserShow: false,
@ -376,6 +387,11 @@ export default {
resData.pd.hiddenList[i].hiddenVideos[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].hiddenVideos[j].FILEPATH resData.pd.hiddenList[i].hiddenVideos[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].hiddenVideos[j].FILEPATH
} }
} }
for (let i = 0; i < resData.pd.situationList.length; i++) {
if (resData.pd.situationList[i].IMAGE_PATH) {
resData.pd.situationList[i].IMAGE = [{ url: this.$store.state.filePath + resData.pd.situationList[i].IMAGE_PATH}];
}
}
this.form = resData.pd this.form = resData.pd
this.esipList = resData.esipList this.esipList = resData.esipList
}, },