安全环保检查增加内容图片
parent
0fa01e3826
commit
8849c35d96
|
|
@ -90,6 +90,19 @@
|
|||
<view slot="label">
|
||||
<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>
|
||||
<!-- 检查情况图片上传 -->
|
||||
<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
|
||||
@click.native="removeSituation(item,index)" v-if="!disabled"></u-badge>
|
||||
</view>
|
||||
|
|
@ -402,8 +415,8 @@ import {
|
|||
setImgFilesAdd,
|
||||
setSafetyenvironmentalAdd, setSafetyenvironmentalAdd_plus,
|
||||
setSafetyenvironmentalEdit, setSafetyenvironmentalEdit_plus,
|
||||
setVideoAdd
|
||||
} from "../../../api";
|
||||
setVideoAdd, uploadSmd
|
||||
} from "@/api";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
|
@ -420,7 +433,7 @@ export default {
|
|||
INSPECTION_TYPE_OTHER: '',
|
||||
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'),
|
||||
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''}],
|
||||
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: '', IMAGE: []}],
|
||||
inspectorList: [{
|
||||
id: Math.random(),
|
||||
inspectionUserShow: false,
|
||||
|
|
@ -532,6 +545,16 @@ export default {
|
|||
}
|
||||
},
|
||||
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() {
|
||||
let resData = await getInspectedDepartment({'CORPINFO_ID': ''});
|
||||
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
|
||||
}
|
||||
}
|
||||
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)
|
||||
this.form = resData.pd
|
||||
},
|
||||
|
|
@ -637,7 +665,7 @@ export default {
|
|||
this.inspectionTimeEndShow = false;
|
||||
},
|
||||
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) {
|
||||
uni.showModal({
|
||||
|
|
@ -706,6 +734,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
}
|
||||
const situations = [];
|
||||
for (let i = 0; i < this.form.situationList.length; i++) {
|
||||
if (!this.form.situationList[i].SITUATION) {
|
||||
uni.showToast({
|
||||
|
|
@ -714,6 +743,19 @@ export default {
|
|||
})
|
||||
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++) {
|
||||
if (!this.form.inspectorList[i].INSPECTION_USER_NAME) {
|
||||
|
|
@ -776,7 +818,7 @@ export default {
|
|||
delHiddens: this.delHiddens.join(','),
|
||||
delHiddenFiles: this.delHiddenFiles.join(','),
|
||||
INSPECTORJSON: JSON.stringify(this.form.inspectorList),
|
||||
SITUATIONJSON: JSON.stringify(this.form.situationList),
|
||||
SITUATIONJSON: JSON.stringify(situations),
|
||||
HIDDENJSON: JSON.stringify(this.form.hiddenList),
|
||||
}
|
||||
}
|
||||
|
|
@ -791,7 +833,7 @@ export default {
|
|||
delHiddens: this.delHiddens.join(','),
|
||||
delHiddenFiles: this.delHiddenFiles.join(','),
|
||||
INSPECTORJSON: JSON.stringify(this.form.inspectorList),
|
||||
SITUATIONJSON: JSON.stringify(this.form.situationList),
|
||||
SITUATIONJSON: JSON.stringify(situations),
|
||||
HIDDENJSON: JSON.stringify(this.form.hiddenList),
|
||||
}
|
||||
resData = this.INSPECTION_ID ? await setSafetyenvironmentalEdit(params) : await setSafetyenvironmentalAdd(params)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,17 @@
|
|||
<view slot="label textarea-box">
|
||||
<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>
|
||||
<!-- 检查情况图片上传 -->
|
||||
<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>
|
||||
</u-cell>
|
||||
|
|
@ -262,7 +273,7 @@ export default {
|
|||
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'),
|
||||
CREATTIME: '',
|
||||
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''}],
|
||||
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: '', IMAGE: []}],
|
||||
inspectorList: [{
|
||||
id: Math.random(),
|
||||
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
|
||||
}
|
||||
}
|
||||
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
|
||||
},
|
||||
showHidden(item) {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,17 @@
|
|||
<view slot="label" class="title">
|
||||
<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>
|
||||
<!-- 检查情况图片上传 -->
|
||||
<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>
|
||||
</u-cell>
|
||||
|
|
@ -305,7 +316,7 @@ export default {
|
|||
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'),
|
||||
CREATTIME: '',
|
||||
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''}],
|
||||
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: '', IMAGE: []}],
|
||||
inspectorList: [{
|
||||
id: Math.random(),
|
||||
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
|
||||
}
|
||||
}
|
||||
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.esipList = resData.esipList
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue