隐患排查图片多选

main
limingtao 11 months ago
parent 37b8ba12b3
commit 4f4e9cdd59
  1. 97
      pages/investigation/components/investigation-item2.vue
  2. 24
      pages/investigation/task.vue

@ -10,28 +10,29 @@
style="width: 96%; padding: 0">
<view class="detail-item" v-if="item.type === 'number' || item.type === '1'">
<uni-forms-item :label="item.name" label-width="450rpx" style="display: flex; align-items: center">
<u-input :disabled="type=='view'" placeholder="请输入" border="none" v-model="item.standar" inputAlign="right"
type="number">
<u-input :disabled="type=='view'" placeholder="请输入" border="none" v-model="item.standar"
inputAlign="right" type="number">
<u-text :text="item.unit" slot="suffix" margin="0 3px 0 0" type="tips"></u-text>
</u-input>
</uni-forms-item>
</view>
<view class="detail-item" v-else-if="item.type === 'text' || item.type === '2'">
<uni-forms-item :label="item.name" label-width="450rpx" style="display: flex; align-items: center">
<u-input :disabled="type=='view'" placeholder="请输入" border="none" v-model="item.standar" inputAlign="right" />
<u-input :disabled="type=='view'" placeholder="请输入" border="none" v-model="item.standar"
inputAlign="right" />
</uni-forms-item>
</view>
<view class="detail-item" v-else-if="item.type === 'check' || item.type === '3'">
<uni-forms-item :label="item.name" label-width="450rpx" style="display: flex; align-items: center">
<u-checkbox :disabled="type=='view'" v-model="item.standar" :customStyle="{ justifyContent: 'space-between' }"
:name="'sdfs'" />
<u-checkbox :disabled="type=='view'" v-model="item.standar"
:customStyle="{ justifyContent: 'space-between' }" :name="'sdfs'" />
</uni-forms-item>
</view>
<view class="detail-item" v-else-if="item.type === 'upload' || item.type === '4'">
<uni-forms-item :label="item.name" label-position="top" label-width="450rpx"
style="display: flex; align-items: center" />
<u-upload :disabled="type=='view'" :fileList="item.fileList" @afterRead="(e) => afterRead(e, item)"
@delete="(e) => deletePic(e, item)" name="1" :maxCount="1"></u-upload>
@delete="(e) => deletePic(e, item)" name="1" :maxCount="10"></u-upload>
</view>
</view>
<view class="investigation-item" style="width: 96%; padding: 0">
@ -43,8 +44,9 @@
<view class="investigation-item" style="width: 96%; padding: 0">
<view class="detail-item">
<uni-forms-item label="隐患图片" label-position="top" label-width="200px" />
<u-upload :fileList="fileList" :disabled="type=='view'" @afterRead="(e) => afterRead2(e, 'fileList')"
@delete="(e) => deletePic2(e, 'fileList')" name="1" :maxCount="1"></u-upload>
<u-upload :fileList="fileList" :disabled="type=='view'"
@afterRead="(e) => afterRead2(e, 'fileList')" @delete="(e) => deletePic2(e, 'fileList')"
name="1" :maxCount="10"></u-upload>
</view>
</view>
<view class="investigation-item" style="width: 96%; padding: 0">
@ -113,6 +115,8 @@
}
switch (
item.type
) {
// case "1":
// item.standar = 0
// break;
@ -122,7 +126,12 @@
// case "3":
// item.standar = false
// break;
// case "4":
case "4":
item.fileList = []
let arr=item.standar.split(',')
for(let itm of arr){
item.fileList.push({url:itm,name:''})
}
// item.fileList = [
// // {
// // "id": "20229a8c-db46-4447-be3e-6731665f7bd0",
@ -140,8 +149,7 @@
// // }
// // }
// ]
// break;
) {
break;
}
return item;
});
@ -149,6 +157,22 @@
this.getData();
}
if (this.json.checkedSelect) {
console.log(this.json.checkedSelect.hdPic, 11111)
if (this.json.checkedSelect.hdPic) {
this.fileList = [];
let arr = []
try {
arr = this.json.checkedSelect.hdPic.split(',')
} catch (error) {
console.error(error)
}
console.log(arr, 4343242342423)
for (let item of arr) {
this.fileList.push({ url: item, name: '' })
}
} else {
this.fileList = [];
}
this.formData = {
hdPic: this.json.checkedSelect.hdPic || "",
hdDesc: this.json.checkedSelect.hdDesc || "",
@ -188,18 +212,20 @@
status: "uploading",
message: "上传中",
});
const result = await this.uploadFilePromise(item.fileList[0].url);
const result = await this.uploadFilePromise(event.file.url);
const resultInfo = JSON.parse(result);
const index = item.fileList.findIndex((v) => v.id === id);
if (resultInfo.code == 200) {
item.fileList.splice(
index,
1,
Object.assign(item.fileList[index], {
Object.assign(event.file, {
status: "success",
message: "",
result: resultInfo,
// url: 'https://raw.githubusercontent.com/Chanzhaoyu/chatgpt-web/main/src/assets/avatar.jpg',
url: resultInfo.result,
})
);
} else {
@ -207,10 +233,7 @@
item.fileList.splice(
index,
1,
Object.assign(item.fileList[index], {
status: "error",
message: "失败",
})
);
}
},
@ -245,18 +268,20 @@
status: "uploading",
message: "上传中",
});
const result = await this.uploadFilePromise(this[key][0].url);
console.log(event.file)
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][index], {
Object.assign(event.file, {
status: "success",
message: "",
result: resultInfo,
url: resultInfo.result,
// url: 'https://raw.githubusercontent.com/Chanzhaoyu/chatgpt-web/main/src/assets/avatar.jpg',
})
);
} else {
@ -264,16 +289,18 @@
this[key].splice(
index,
1,
Object.assign(this[key][index], {
status: "error",
message: "失败",
})
);
}
this.formData.hdPic = this[key]
.filter((item) => item.status === "success")
.map((item) => item.url)
.toString();
let arr = []
for (let i = 0; i < this[key].length; i++) {
arr.push(this[key][i].url)
}
this.formData.hdPic = arr.toString();
// this.formData.hdPic = this[key]
// .filter((item) => item.status === "success")
// .map((item) => item.url)
// .toString();
this.changeEmit();
},
changeEmit() {
@ -362,10 +389,24 @@
// this.$emit('select', this.investigationSelect, this.investigationList[index])
},
investigationDetailHandle() {
let investigationDetailList = JSON.parse(JSON.stringify(this.investigationDetailList))
for (let items of investigationDetailList) {
if (items.type == '4') {
let arr = []
let standar = ''
for (let item of items.fileList) {
arr.push(item.url)
}
items.standar = arr.toString()
}
}
// console.log(investigationDetailList)
this.$emit("select", {
...this.json,
checkedSelect: this.formData,
extraConfigs: this.investigationDetailList,
extraConfigs: investigationDetailList,
});
},
},

@ -234,7 +234,7 @@
<view class="detail-item" v-else-if="item.type === 'upload'">
<uni-forms-item label="平峰流量" label-position="top" label-width="100px"
style="display: flex; align-items: center" />
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1"
:maxCount="10"></u-upload>
</view>
</view>
@ -661,7 +661,7 @@
// r = v;
// }
// });
console.log(v)
// console.log(v)
this.showInvestigation2Item = {};
this.showInvestigation2 = false;
this.troubleshootingData.map(r => {
@ -1099,7 +1099,7 @@
});
},
async afterRead(event, key) {
console.log(key)
// console.log(key)
// multiple true , file
const id = this.uuid();
this[key].push({
@ -1108,6 +1108,7 @@
status: "uploading",
message: "上传中",
});
console.log(event.file)
const result = await this.uploadFilePromise(event.file.url);
const resultInfo = JSON.parse(result);
const index = this[key].findIndex((v) => v.id === id);
@ -1120,6 +1121,7 @@
message: "",
result: resultInfo,
url: resultInfo.result,
})
);
console.log(this[key])
@ -1144,12 +1146,18 @@
checkedArr.map((r) => {
if (!r.extraConfigs) return
r.extraConfigs.map((s) => {
// let arr = []
// let standar=''
// for (let i = 0; i < s.fileList.length; i++) {
// arr.push(s.fileList[i].url)
// }
s.scenesId = r.nid;
s.dangerId = r.id;
if (s.type == 4) {
s.standar =
s.fileList && s.fileList.length > 0 ? s.fileList[0].url : "";
}
// if (s.type == 4) {
// s.standar=arr.toString();
// // s.standar =
// // s.fileList && s.fileList.length > 0 ? s.fileList[0].url : "";
// }
delete s.fileList;
delete s.nid;
extraConfigs.push(s);
@ -1216,7 +1224,7 @@
hdInfo: item2.checkedSelect ? item2.checkedSelect.hdInfo : '',
pcType: 1
}
console.log(obj, 111111)
// console.log(obj, 111111)
describe[foundIndex] = obj;
// hdTermdescribe
// describe[foundIndex] = { hdTerm: idToFind };

Loading…
Cancel
Save