|
|
@ -154,15 +154,16 @@ |
|
|
|
<div> |
|
|
|
<span class="label">是否有隐患:</span> |
|
|
|
<el-radio-group |
|
|
|
@change="$forceUpdate()" |
|
|
|
:disabled="!canEdit" |
|
|
|
size="small" |
|
|
|
v-model="currentItem.hasProblem2" |
|
|
|
v-model="currentItem.hasProblem" |
|
|
|
> |
|
|
|
<el-radio label="0">无</el-radio> |
|
|
|
<el-radio label="1">有</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</div> |
|
|
|
<template v-if="currentItem.hasProblem2"> |
|
|
|
<template v-if="currentItem.hasProblem === '1'"> |
|
|
|
<div> |
|
|
|
<span class="label">隐患描述:</span> |
|
|
|
<el-input |
|
|
@ -256,8 +257,9 @@ export default { |
|
|
|
lineName: "", |
|
|
|
lineType: "", //巡查路线类型 |
|
|
|
dutyHolders: [], |
|
|
|
items: [], // 巡查项 |
|
|
|
// items: [], // 巡查项 |
|
|
|
}, |
|
|
|
items: [], |
|
|
|
rules: { |
|
|
|
planId: [{ required: true, message: "请选择计划", trigger: "change" }], |
|
|
|
}, |
|
|
@ -297,7 +299,11 @@ export default { |
|
|
|
this.$refs.treeRef?.filter(val); |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() {}, |
|
|
|
created() { |
|
|
|
this.getDicts("person_type").then((response) => { |
|
|
|
this.dutyHolderTypeOptions = response.data; |
|
|
|
}); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
isSameArray(arr1, arr2) { |
|
|
|
let str1 = arr1.join(","); |
|
|
@ -310,7 +316,8 @@ export default { |
|
|
|
// 获取详情数据 |
|
|
|
getRecordDetails(id).then((res) => { |
|
|
|
this.formData = res.data; |
|
|
|
this.formData.items?.forEach((v) => { |
|
|
|
this.items = [...res.data.items]; |
|
|
|
this.items?.forEach((v) => { |
|
|
|
v.hasProblem = !!v.problem ? "1" : "0"; |
|
|
|
}); |
|
|
|
if (res.data.subPlanStartDate && res.data.subPlanEndDate) { |
|
|
@ -349,7 +356,7 @@ export default { |
|
|
|
this.formData.lineType = ""; |
|
|
|
this.formData.dutyHolderType = ""; |
|
|
|
this.formData.scope = ""; |
|
|
|
this.formData.items = []; |
|
|
|
this.items = []; |
|
|
|
this.entries = []; |
|
|
|
this.checkTreeData = []; |
|
|
|
this.currentItem = {}; |
|
|
@ -495,7 +502,7 @@ export default { |
|
|
|
status: "0", |
|
|
|
}; |
|
|
|
}); |
|
|
|
this.formData.items = items; |
|
|
|
this.items = items; |
|
|
|
} |
|
|
|
let _treeData = []; |
|
|
|
// 处理三级节点,最多三级 |
|
|
@ -524,7 +531,7 @@ export default { |
|
|
|
let _treeItem3 = treeItem2.children.find( |
|
|
|
(v) => v.key === item.parts[2] |
|
|
|
); |
|
|
|
let nodeLink = this.formData.items.find((v) => |
|
|
|
let nodeLink = this.items.find((v) => |
|
|
|
this.isSameArray(v.parts, [ |
|
|
|
treeItem.key, |
|
|
|
treeItem2.key, |
|
|
@ -545,7 +552,7 @@ export default { |
|
|
|
let _treeItem2 = treeItem.children.find( |
|
|
|
(v) => v.key === item.parts[1] |
|
|
|
); |
|
|
|
let nodeLink = this.formData.items.find((v) => |
|
|
|
let nodeLink = this.items.find((v) => |
|
|
|
this.isSameArray(v.parts, [treeItem.key, _treeItem2.key]) |
|
|
|
); |
|
|
|
exitTreeItem1.children.push({ |
|
|
@ -561,7 +568,7 @@ export default { |
|
|
|
// 不存在一级节点 |
|
|
|
let treeItem = this.treeData.find((v) => v.key === item.parts[0]); |
|
|
|
if (treeItem) { |
|
|
|
let nodeLink = this.formData.items.find((v) => |
|
|
|
let nodeLink = this.items.find((v) => |
|
|
|
this.isSameArray(v.parts, [treeItem.key]) |
|
|
|
); |
|
|
|
let _treeItem1 = { |
|
|
@ -577,7 +584,7 @@ export default { |
|
|
|
(v) => v.key === item.parts[1] |
|
|
|
); |
|
|
|
if (treeItem2) { |
|
|
|
let nodeLink = this.formData.items.find((v) => |
|
|
|
let nodeLink = this.items.find((v) => |
|
|
|
this.isSameArray(v.parts, [treeItem.key, treeItem2.key]) |
|
|
|
); |
|
|
|
let _treeItem2 = { |
|
|
@ -593,7 +600,7 @@ export default { |
|
|
|
(v) => v.key === item.parts[2] |
|
|
|
); |
|
|
|
if (treeItem3) { |
|
|
|
let nodeLink = this.formData.items.find((v) => |
|
|
|
let nodeLink = this.items.find((v) => |
|
|
|
this.isSameArray(v.parts, [ |
|
|
|
treeItem.key, |
|
|
|
treeItem2.key, |
|
|
@ -643,10 +650,10 @@ export default { |
|
|
|
}, |
|
|
|
handleNodeClick(data, node) { |
|
|
|
if (node.isLeaf) { |
|
|
|
this.currentItem = data.nodeLink; |
|
|
|
// this.$set(this, "currentItem", data.nodeLink); |
|
|
|
this.currentItem.key = |
|
|
|
this.currentItem.parts[this.currentItem.parts.length - 1]; |
|
|
|
let currentItem = data.nodeLink; |
|
|
|
currentItem.key = currentItem.parts[currentItem.parts.length - 1]; |
|
|
|
this.$set(this, "currentItem", currentItem); |
|
|
|
console.log("当前的currentItem >>>> ", this.currentItem); |
|
|
|
setTimeout(() => { |
|
|
|
this.$refs.treeRef.setCurrentKey(this.currentItem.key); |
|
|
|
}, 30); |
|
|
@ -657,15 +664,17 @@ export default { |
|
|
|
return new Promise((r, j) => { |
|
|
|
this.$refs.formRef.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
this.formData.items?.forEach((v) => { |
|
|
|
this.items?.forEach((v) => { |
|
|
|
if (v.hasProblem != "1") { |
|
|
|
v.problem = ""; |
|
|
|
v.problemImages = []; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
(this.id ? updateRecordData : addRecordData)({ |
|
|
|
id: this.id || null, |
|
|
|
...this.formData, |
|
|
|
items: this.items, |
|
|
|
startDate: this.xcDateArr[0] || "", |
|
|
|
endDate: this.xcDateArr[1] || "", |
|
|
|
subPlanStartDate: this.subPlanDateArr[0] || "", |
|
|
@ -709,7 +718,7 @@ export default { |
|
|
|
this.formData.lineType = ""; |
|
|
|
this.formData.dutyHolderType = ""; |
|
|
|
this.formData.scope = ""; |
|
|
|
this.formData.items = []; |
|
|
|
this.items = []; |
|
|
|
this.entries = []; |
|
|
|
this.checkTreeData = []; |
|
|
|
this.currentItem = {}; |
|
|
|