|
|
|
@ -247,7 +247,8 @@ |
|
|
|
|
|
|
|
|
|
<u-row :gutter="0" justify="flex-start" style="flex-wrap: wrap"> |
|
|
|
|
<scroll-view style="max-height: 400px;" :scroll-top="0" scroll-y="true" show-scrollbar="true"> |
|
|
|
|
<view v-for="(item,index) in hiddenDangerList" :key="item" style="width: 100%"> |
|
|
|
|
<view v-for="(item,index) in hiddenDangerList" :key="item" v-show="item.pcType!=1" |
|
|
|
|
style="width: 100%"> |
|
|
|
|
<view class="problem-item"> |
|
|
|
|
<view style="display: flex; justify-content: space-between"> |
|
|
|
|
<view style="width: 80%;line-height: 30px;"> |
|
|
|
@ -579,6 +580,11 @@ |
|
|
|
|
if (this.checked.includes(v.id)) { |
|
|
|
|
this.showInvestigation2 = true; |
|
|
|
|
this.showInvestigation2Item = v |
|
|
|
|
for (let item of this.hiddenDangerList) { |
|
|
|
|
if (v.id == item.hdTerm) { |
|
|
|
|
this.$set(this.showInvestigation2Item, 'checkedSelect', item) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
@ -706,7 +712,7 @@ |
|
|
|
|
this.fileList = []; |
|
|
|
|
let arr = [] |
|
|
|
|
try { |
|
|
|
|
arr=v.hdPic.split(',') |
|
|
|
|
arr = v.hdPic.split(',') |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error(error) |
|
|
|
|
} |
|
|
|
@ -800,16 +806,32 @@ |
|
|
|
|
.then((res) => { |
|
|
|
|
if (res.code === 200) { |
|
|
|
|
// todo 无数据结构 |
|
|
|
|
for (let items of res.result) { |
|
|
|
|
for (let item of items.dangerItems) { |
|
|
|
|
item.nid = items.nid |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// console.log(res.result,11111) |
|
|
|
|
this.investigationSelectList = res.result; |
|
|
|
|
this.investigationSelectList.map((r) => { |
|
|
|
|
|
|
|
|
|
this.troubleshootingData = [...this.troubleshootingData, ...r.dangerItems] |
|
|
|
|
}); |
|
|
|
|
// console.log(this.troubleshootingData, 11111) |
|
|
|
|
this.checked = this.troubleshootingData.map(r => { |
|
|
|
|
if (r.checked == 1) { |
|
|
|
|
return r.id |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.checked = this.checked.filter(item => item !== undefined); |
|
|
|
|
for (let i in this.troubleshootingData) { |
|
|
|
|
if (this.troubleshootingData[i].checked == 1) { |
|
|
|
|
// alert(111) |
|
|
|
|
|
|
|
|
|
this.initTroubleshootingData(this.troubleshootingData[i].id, i) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// console.log(this.troubleshootingData) |
|
|
|
|
// this.$request |
|
|
|
|
// .globalRequest( |
|
|
|
|
// "/hiddenDanger/highDanger/getImportDangerDisplayDetail", { |
|
|
|
@ -857,10 +879,10 @@ |
|
|
|
|
) |
|
|
|
|
.then((res) => { |
|
|
|
|
if (res.code === 200) { |
|
|
|
|
console.log(res.result); |
|
|
|
|
this.hiddenDangerList = res.result; |
|
|
|
|
this.hiddenDangerList.push(...res.result) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.$request |
|
|
|
|
.globalRequest( |
|
|
|
|
"/hiddenDanger/highDanger/getDangerItems", { |
|
|
|
@ -886,9 +908,68 @@ |
|
|
|
|
JSON.stringify(this.hiddenDangerList3) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
console.log(this.hiddenDangerList2) |
|
|
|
|
}, |
|
|
|
|
initCheckedSelect() { |
|
|
|
|
this.$request |
|
|
|
|
.globalRequest( |
|
|
|
|
"/hiddenDanger/highDanger/getUserHiddenDangerList", { |
|
|
|
|
nuserid: this.$.getData("token"), |
|
|
|
|
pcType: 1, |
|
|
|
|
businessId: this.businessId |
|
|
|
|
}, |
|
|
|
|
"GET" |
|
|
|
|
) |
|
|
|
|
.then((res) => { |
|
|
|
|
if (res.code === 200) { |
|
|
|
|
this.hiddenDangerList.push(...res.result) |
|
|
|
|
console.log(this.troubleshootingData, 123) |
|
|
|
|
console.log(res.result, 321) |
|
|
|
|
|
|
|
|
|
for (let i in this.troubleshootingData) { |
|
|
|
|
for (let j in res.result) { |
|
|
|
|
if (this.troubleshootingData[i].id == res.result[j].hdTerm) { |
|
|
|
|
this.$set(this.troubleshootingData[i], "checkedSelect", { |
|
|
|
|
hdInfo: res.result[j].hdInfo, |
|
|
|
|
hdPic: res.result[j].hdPic, |
|
|
|
|
hdDesc: res.result[j].hdDesc, |
|
|
|
|
hdTerm: res.result[j].hdTerm, |
|
|
|
|
pcType: 1 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
initTroubleshootingData(id, index) { |
|
|
|
|
this.troubleshootingData[index].extraConfigs = [] |
|
|
|
|
this.$request |
|
|
|
|
.globalRequest( |
|
|
|
|
"/hiddenDanger/highDanger/getImportDangerDisplayDetail", |
|
|
|
|
{ |
|
|
|
|
dangerId: id, |
|
|
|
|
businessId: this.businessId, |
|
|
|
|
}, |
|
|
|
|
"GET" |
|
|
|
|
) |
|
|
|
|
.then((res) => { |
|
|
|
|
if (res.code == 200) { |
|
|
|
|
this.troubleshootingData[index].extraConfigs.push(...res.result) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.checked.length - 1 == index) { |
|
|
|
|
// alert(1111) |
|
|
|
|
this.initCheckedSelect(index) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
// this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangers', {}, 'GET').then(res => { |
|
|
|
|
// if (res.code == 200) { |
|
|
|
|
// this.investigationList = res.result |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
}, |
|
|
|
|
select(v) { |
|
|
|
|
this.hiddenDangerList3 = v; |
|
|
|
|
}, |
|
|
|
@ -1057,7 +1138,7 @@ |
|
|
|
|
return uni.navigateBack(); |
|
|
|
|
} |
|
|
|
|
let checkedArr = this.troubleshootingData.filter(r => this.checked.includes(r.id)) |
|
|
|
|
console.log(checkedArr) |
|
|
|
|
// console.log(11111111, checkedArr) |
|
|
|
|
|
|
|
|
|
let extraConfigs = []; |
|
|
|
|
checkedArr.map((r) => { |
|
|
|
@ -1074,7 +1155,9 @@ |
|
|
|
|
extraConfigs.push(s); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let describe = JSON.parse(JSON.stringify(this.hiddenDangerList)) |
|
|
|
|
console.log(describe) |
|
|
|
|
try { |
|
|
|
|
for (let item of describe) { |
|
|
|
|
if (item.nid) { |
|
|
|
@ -1094,37 +1177,108 @@ |
|
|
|
|
} catch (e) { |
|
|
|
|
//TODO handle the exception |
|
|
|
|
} |
|
|
|
|
setTimeout(() => { |
|
|
|
|
// let describe = [{ hdTerm: 1 }, { hdTerm: 2 }, { hdTerm: 3 }]; |
|
|
|
|
// let checkedArr = [{ id: 1 }, { hdTerm: 5 }, { hdTerm: 3 }]; |
|
|
|
|
|
|
|
|
|
// 用于存储不存在于checkedArr.id中的describe元素的副本 |
|
|
|
|
let notFoundIncheckedArr = []; |
|
|
|
|
|
|
|
|
|
// 用于记录describe和checkedArr中元素的索引 |
|
|
|
|
let indexes = []; |
|
|
|
|
if (describe.length <= 0) { |
|
|
|
|
checkedArr.map(r => { |
|
|
|
|
describe.push({ |
|
|
|
|
hdTerm: r.id, |
|
|
|
|
hdDesc: r.checkedSelect ? r.checkedSelect.hdDesc : '', |
|
|
|
|
hdPic: r.checkedSelect ? r.checkedSelect.hdPic : '', |
|
|
|
|
hdInfo: r.checkedSelect ? r.checkedSelect.hdInfo : '', |
|
|
|
|
pcType: 1 |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
checkedArr.forEach((item2, index2) => { |
|
|
|
|
let idToFind = item2.id; |
|
|
|
|
let foundIndex = describe.findIndex(item1 => item1.hdTerm === idToFind); |
|
|
|
|
|
|
|
|
|
checkedArr.map(r => { |
|
|
|
|
describe.push({ |
|
|
|
|
hdTerm: r.id, |
|
|
|
|
hdDesc: r.checkedSelect ? r.checkedSelect.hdDesc : '', |
|
|
|
|
hdPic: r.checkedSelect ? r.checkedSelect.hdPic : '', |
|
|
|
|
hdInfo: r.checkedSelect ? r.checkedSelect.hdInfo : '', |
|
|
|
|
pcType: 1 |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
console.log(this.investigationSelectList); |
|
|
|
|
console.log(this.troubleshootingData); |
|
|
|
|
console.log({ |
|
|
|
|
...this.formData, |
|
|
|
|
businessId: this.businessId, |
|
|
|
|
extraConfigs: extraConfigs, |
|
|
|
|
describe: describe, |
|
|
|
|
}); |
|
|
|
|
this.extraConfigs = extraConfigs |
|
|
|
|
this.describeArr = describe |
|
|
|
|
this.temporary = temporary |
|
|
|
|
console.log(this.extraConfigs, this.describeArr) |
|
|
|
|
if (!temporary) { |
|
|
|
|
this.postSaveManualInvestigation() |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if (this.extraConfigs.length <= 0 || this.describeArr.length <= 0) { |
|
|
|
|
this.modalShow = true |
|
|
|
|
} else { |
|
|
|
|
this.postSaveManualInvestigation() |
|
|
|
|
} |
|
|
|
|
if (foundIndex === -1) { |
|
|
|
|
if (item2.checkedSelect) { |
|
|
|
|
describe.push({ ...item2.checkedSelect, pcType: 1, hdTerm: item2.id, }); |
|
|
|
|
} |
|
|
|
|
// 如果在describe中找不到对应的hdTerm,将item2添加到describe中 |
|
|
|
|
|
|
|
|
|
// console.log(`添加: ${idToFind} 到 describe`); |
|
|
|
|
} else { |
|
|
|
|
let obj = { |
|
|
|
|
hdTerm: item2.id, |
|
|
|
|
hdDesc: item2.checkedSelect ? item2.checkedSelect.hdDesc : '', |
|
|
|
|
hdPic: item2.checkedSelect ? item2.checkedSelect.hdPic : '', |
|
|
|
|
hdInfo: item2.checkedSelect ? item2.checkedSelect.hdInfo : '', |
|
|
|
|
pcType: 1 |
|
|
|
|
} |
|
|
|
|
console.log(obj, 111111) |
|
|
|
|
describe[foundIndex] = obj; |
|
|
|
|
// 如果找到匹配的hdTerm,替换describe中的对应项 |
|
|
|
|
// describe[foundIndex] = { hdTerm: idToFind }; |
|
|
|
|
// console.log(`替换: describe[${foundIndex}] = ${idToFind}`); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// console.log(`describe:`, describe); |
|
|
|
|
}); |
|
|
|
|
// describe.forEach((item1, index1) => { |
|
|
|
|
// let found = false; |
|
|
|
|
// checkedArr.forEach((item2, index2) => { |
|
|
|
|
// if (item1.hdTerm === item2.id) { |
|
|
|
|
// found = true; |
|
|
|
|
// let obj = { |
|
|
|
|
// hdTerm: item2.id, |
|
|
|
|
// hdDesc: item2.checkedSelect ? item2.checkedSelect.hdDesc : '', |
|
|
|
|
// hdPic: item2.checkedSelect ? item2.checkedSelect.hdPic : '', |
|
|
|
|
// hdInfo: item2.checkedSelect ? item2.checkedSelect.hdInfo : '', |
|
|
|
|
// pcType: 1 |
|
|
|
|
// } |
|
|
|
|
// describe.splice(index1, 1, obj); |
|
|
|
|
// // indexes.push({ describeIndex: index1, checkedArrIndex: index2 }); |
|
|
|
|
// } |
|
|
|
|
// if (!found) { |
|
|
|
|
// // 注意:这里不直接push到arr1,而是到notFoundIncheckedArr |
|
|
|
|
// describe.push({ ...item2 }); // 创建副本以避免直接修改arr1 |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
// }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log("Not found in checkedArr:", notFoundIncheckedArr); |
|
|
|
|
console.log("Indexes of matching elements:", indexes); |
|
|
|
|
|
|
|
|
|
// 如果确实需要将这些元素添加到arr1(虽然通常不推荐),可以这样做: |
|
|
|
|
// arr1.push(...notFoundInArr2); // 但这里我们没有做,因为可能改变原始意图 |
|
|
|
|
|
|
|
|
|
// console.log(describe) |
|
|
|
|
// return false |
|
|
|
|
// console.log(this.investigationSelectList); |
|
|
|
|
// console.log(this.troubleshootingData); |
|
|
|
|
// console.log({ |
|
|
|
|
// ...this.formData, |
|
|
|
|
// businessId: this.businessId, |
|
|
|
|
// extraConfigs: extraConfigs, |
|
|
|
|
// describe: describe, |
|
|
|
|
// }); |
|
|
|
|
this.extraConfigs = extraConfigs |
|
|
|
|
this.describeArr = describe |
|
|
|
|
this.temporary = temporary |
|
|
|
|
console.log(this.extraConfigs, this.describeArr) |
|
|
|
|
if (!temporary) { |
|
|
|
|
this.postSaveManualInvestigation() |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if (this.extraConfigs.length <= 0 || this.describeArr.length <= 0) { |
|
|
|
|
this.modalShow = true |
|
|
|
|
} else { |
|
|
|
|
this.postSaveManualInvestigation() |
|
|
|
|
} |
|
|
|
|
}, 1); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
postSaveManualInvestigation() { |
|
|
|
@ -1158,11 +1312,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; |
|
|
|
|