隐患问题多图片上传

main
limingtao 11 months ago
parent 3ee74fd9a4
commit 70791d044e
  1. 56
      pages/investigation/task.vue

@ -251,7 +251,7 @@
<view class="problem-item">
<view style="display: flex; justify-content: space-between">
<view style="width: 80%;line-height: 30px;">
{{ item.hdTermName }}
{{ item.hdTermName||item.dangerProblem }}
</view>
<view>
<view class="check" @click="onHiddenDangerList(item,index)">
@ -312,17 +312,20 @@
</view>
<view class="detail-item">
<uni-forms-item label="隐患描述" label-position="top" label-width="200px" />
<u-textarea :disabled="type=='view'" placeholder="请输入" border="none" v-model="describe.hdDesc" />
<u-textarea :disabled="type=='view'" placeholder="请输入" border="none"
v-model="describe.hdDesc" />
</view>
<view class="detail-item">
<uni-forms-item label="隐患图片" label-position="top" label-width="200px" />
<u-upload :disabled="type=='view'" :fileList="fileList" @afterRead="(e) => afterRead(e, 'fileList')"
@delete="(e) => deletePic(e, 'fileList')" name="1" :maxCount="1"></u-upload>
<u-upload :disabled="type=='view'" :fileList="fileList"
@afterRead="(e) => afterRead(e, 'fileList')" @delete="(e) => deletePic(e, 'fileList')"
name="1" :maxCount="9"></u-upload>
</view>
<view class="detail-item">
<uni-forms-item label="补充信息" label-position="top" label-width="200px" />
<u-textarea :disabled="type=='view'" placeholder="请输入" border="none" v-model="describe.hdInfo" />
<u-textarea :disabled="type=='view'" placeholder="请输入" border="none"
v-model="describe.hdInfo" />
</view>
</view>
<view class="blank" />
@ -700,9 +703,16 @@
// console.log(this.hiddenDangerList2)
if (v.hdPic) {
this.fileList = [{
url: v.hdPic
}];
this.fileList = [];
let arr = []
try {
arr=v.hdPic.split(',')
} catch (error) {
console.error(error)
}
for (let item of arr) {
this.fileList.push({ url: item, name: '' })
}
} else {
this.fileList = [];
}
@ -921,6 +931,15 @@
}
},
investigationHandle2() {
let hdPic = ''
for (let i = 0; i < this.fileList.length; i++) {
if (i == this.fileList.length - 1) {
hdPic += this.fileList[i].url
} else {
hdPic += this.fileList[i].url + ','
}
}
if (this.hiddenDangerList2.length > 0) {
let form = {
bigCategory: this.hiddenDangerList2[0].id,
@ -930,7 +949,7 @@
hdTerm: this.hiddenDangerList2[2].id,
hdTermName: this.hiddenDangerList2[2].itemname,
hdDesc: this.describe.hdDesc,
hdPic: this.fileList.length > 0 ? this.fileList : '',
hdPic: hdPic,
hdInfo: this.describe.hdInfo,
dangerProblem: this.hiddenDangerList2[0].itemname + '/' + this.hiddenDangerList2[1].itemname +
'/' + this.hiddenDangerList2[2].itemname
@ -1008,14 +1027,14 @@
status: "uploading",
message: "上传中",
});
const result = await this.uploadFilePromise(this[key][0].url);
const result = await this.uploadFilePromise(event.file.url);
const resultInfo = JSON.parse(result);
const index = this[key].findIndex((v) => v.id === id);
if (resultInfo.code == 200) {
this[key].splice(
index,
1,
Object.assign(this[key][0], {
Object.assign(event.file, {
status: "success",
message: "",
result: resultInfo,
@ -1028,10 +1047,7 @@
this[key].splice(
index,
1,
Object.assign(this[key][0], {
status: "error",
message: "失败",
})
);
}
},
@ -1142,11 +1158,11 @@
} else {
this.$.toast("暂存成功");
}
setTimeout(() => {
uni.navigateBack({
delta: 2, // 1
});
}, 1000);
// setTimeout(() => {
// uni.navigateBack({
// delta: 2, // 1
// });
// }, 1000);
// this.data = res.result;
// this.rname = this.data[0].name;

Loading…
Cancel
Save