|
|
@ -41,7 +41,6 @@ export default { |
|
|
|
}, 0) |
|
|
|
); |
|
|
|
}, 0); |
|
|
|
console.log("hasDoneLevel >>>>> ", hasDoneLevel); |
|
|
|
return Math.floor((hasDoneLevel / sum) * 100); |
|
|
|
} else { |
|
|
|
return 0; |
|
|
@ -100,10 +99,17 @@ export default { |
|
|
|
id: item.id, |
|
|
|
projectId: item.projectId, |
|
|
|
projectName: item.projectName, |
|
|
|
problemDescribe: "", |
|
|
|
siteSituationRecords: "", |
|
|
|
siteSituationRecordsArr: [], |
|
|
|
children: [{ ...item, level: null }], |
|
|
|
|
|
|
|
children: [ |
|
|
|
{ |
|
|
|
...item, |
|
|
|
projectItemId: item.id, |
|
|
|
problemDescribe: "", |
|
|
|
siteSituationRecords: "", |
|
|
|
siteSituationRecordsArr: [], |
|
|
|
level: null, |
|
|
|
}, |
|
|
|
], |
|
|
|
}); |
|
|
|
} else { |
|
|
|
let exitItem = list.find((v) => v.projectId === item.projectId); |
|
|
@ -112,14 +118,25 @@ export default { |
|
|
|
id: item.id, |
|
|
|
projectId: item.projectId, |
|
|
|
projectName: item.projectName, |
|
|
|
problemDescribe: "", |
|
|
|
siteSituationRecords: "", |
|
|
|
siteSituationRecordsArr: [], |
|
|
|
children: [{ ...item, level: null }], |
|
|
|
|
|
|
|
children: [ |
|
|
|
{ |
|
|
|
...item, |
|
|
|
projectItemId: item.id, |
|
|
|
problemDescribe: "", |
|
|
|
siteSituationRecords: "", |
|
|
|
siteSituationRecordsArr: [], |
|
|
|
level: null, |
|
|
|
}, |
|
|
|
], |
|
|
|
}); |
|
|
|
} else { |
|
|
|
exitItem.children.push({ |
|
|
|
...item, |
|
|
|
projectItemId: item.id, |
|
|
|
problemDescribe: "", |
|
|
|
siteSituationRecords: "", |
|
|
|
siteSituationRecordsArr: [], |
|
|
|
level: null, |
|
|
|
}); |
|
|
|
} |
|
|
@ -137,29 +154,34 @@ export default { |
|
|
|
this.formData.taskId = data.taskId; |
|
|
|
this.formData.weather = data.weather; |
|
|
|
this.formData.problemList = []; |
|
|
|
const { engineeringList, problemList } = data; |
|
|
|
const { problemList } = data; |
|
|
|
list.forEach((item) => { |
|
|
|
let exitItem = engineeringList.find( |
|
|
|
let exitItem = problemList?.find( |
|
|
|
(v) => v.projectId === item.projectId |
|
|
|
); |
|
|
|
if (exitItem) { |
|
|
|
item.newId = item.id === exitItem.id ? null : exitItem.id; |
|
|
|
item.problemDescribe = exitItem.problemDescribe; |
|
|
|
item.siteSituationRecords = exitItem.siteSituationRecords; |
|
|
|
item.siteSituationRecordsArr = exitItem.siteSituationRecords |
|
|
|
? exitItem.siteSituationRecords.split(",") |
|
|
|
: []; |
|
|
|
|
|
|
|
let itemTemp = cloneDeep(item); |
|
|
|
itemTemp.children = []; |
|
|
|
|
|
|
|
item.children.forEach((item2) => { |
|
|
|
let exitItem2 = problemList.find( |
|
|
|
(v) => v.projectItemId === item2.id |
|
|
|
); |
|
|
|
if (exitItem2) { |
|
|
|
itemTemp.children.push(exitItem2); |
|
|
|
item2.projectName = exitItem2.projectName; |
|
|
|
item2.level = exitItem2.level; |
|
|
|
item2.newId = item2.id === exitItem2.id ? null : exitItem2.id; |
|
|
|
item2.problemDescribe = exitItem2.problemDescribe; |
|
|
|
item2.siteSituationRecords = exitItem2.siteSituationRecords; |
|
|
|
item2.siteSituationRecordsArr = exitItem2.siteSituationRecords |
|
|
|
? exitItem2.siteSituationRecords.split(",") |
|
|
|
: []; |
|
|
|
exitItem2.siteSituationRecordsArr = |
|
|
|
exitItem2.siteSituationRecords |
|
|
|
? exitItem2.siteSituationRecords.split(",") |
|
|
|
: []; |
|
|
|
} |
|
|
|
}); |
|
|
|
if (data.state === "1") { |
|
|
@ -177,7 +199,6 @@ export default { |
|
|
|
}, |
|
|
|
// 上传前 |
|
|
|
beforeUpload(e) { |
|
|
|
console.log("beforeUpload >>>>> ", e); |
|
|
|
if (this.currentItem.siteSituationRecordsArr?.length >= 99) { |
|
|
|
this.$message.warning("最多上传99张图片"); |
|
|
|
return false; |
|
|
@ -190,81 +211,36 @@ export default { |
|
|
|
fData.append("file", file); |
|
|
|
uploadFileData(fData) |
|
|
|
.then((res) => { |
|
|
|
this.currentItem.siteSituationRecordsArr.push(res.url); |
|
|
|
this.currentItem.siteSituationRecordsArr?.push(res.url); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log("err >>>>> ", err); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 获取启用的方法配置项 |
|
|
|
getEnableSuperviseWayData() { |
|
|
|
getEnableSuperviseWayData({ wayId: this.$route.query.wayId }).then( |
|
|
|
(res) => { |
|
|
|
console.log(res); |
|
|
|
let list = []; |
|
|
|
res.data?.itemList?.forEach((item, index) => { |
|
|
|
if (index === 0) { |
|
|
|
list.push({ |
|
|
|
projectId: item.projectId, |
|
|
|
projectName: item.projectName, |
|
|
|
problemDescribe: "", |
|
|
|
siteSituationRecords: "", |
|
|
|
siteSituationRecordsArr: [], |
|
|
|
children: [{ ...item, level: null }], |
|
|
|
}); |
|
|
|
} else { |
|
|
|
let exitItem = list.find((v) => v.projectId === item.projectId); |
|
|
|
if (!exitItem) { |
|
|
|
list.push({ |
|
|
|
projectId: item.projectId, |
|
|
|
projectName: item.projectName, |
|
|
|
problemDescribe: "", |
|
|
|
siteSituationRecords: "", |
|
|
|
siteSituationRecordsArr: [], |
|
|
|
children: [{ ...item, level: null }], |
|
|
|
}); |
|
|
|
} else { |
|
|
|
exitItem.children.push({ |
|
|
|
...item, |
|
|
|
level: null, |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
this.problemList = list; |
|
|
|
this.activeName = list[0]?.projectId || ""; |
|
|
|
} |
|
|
|
); |
|
|
|
}, |
|
|
|
// 处理提交数据 |
|
|
|
dealFormData() { |
|
|
|
this.formData.taskId = this.$route.query.id; |
|
|
|
this.problemList.forEach((item) => { |
|
|
|
let problemItem = { |
|
|
|
id: item.newId || null, |
|
|
|
levelList: [], |
|
|
|
problemDescribe: item.problemDescribe, |
|
|
|
siteSituationRecords: item.siteSituationRecordsArr.join(",") || "", |
|
|
|
projectId: item.projectId, |
|
|
|
}; |
|
|
|
if (item.children.length) { |
|
|
|
item.children.forEach((item2) => { |
|
|
|
problemItem.levelList.push({ |
|
|
|
let problemItem = { |
|
|
|
id: item2.newId || null, |
|
|
|
level: item2.level, |
|
|
|
projectItemId: item2.id, |
|
|
|
}); |
|
|
|
problemDescribe: item2.problemDescribe, |
|
|
|
siteSituationRecords: |
|
|
|
item2.siteSituationRecordsArr?.join(",") || "", |
|
|
|
projectId: item2.projectId, |
|
|
|
projectItemId: item2.projectItemId, |
|
|
|
}; |
|
|
|
this.formData.problemList.push(problemItem); |
|
|
|
}); |
|
|
|
} |
|
|
|
this.formData.problemList.push(problemItem); |
|
|
|
}); |
|
|
|
return cloneDeep(this.formData); |
|
|
|
}, |
|
|
|
handleSave() { |
|
|
|
console.log("保存"); |
|
|
|
let data = this.dealFormData(); |
|
|
|
data.state = "0"; |
|
|
|
console.log("data >>>>> ", data); |
|
|
|
addSuperviseEngineeringReportData(data).then((res) => { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
@ -277,6 +253,10 @@ export default { |
|
|
|
this.$message.warning("检查进度未达到100%,请检查"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.formData.patrolUid) { |
|
|
|
this.$message.warning("请选择巡查人员"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 二次确认提交 |
|
|
|
this.$confirm("是否确认提交?", "提示", { |
|
|
|
confirmButtonText: "确定", |
|
|
@ -286,13 +266,13 @@ export default { |
|
|
|
.then(() => { |
|
|
|
let data = this.dealFormData(); |
|
|
|
data.state = "1"; |
|
|
|
console.log("data >>>>> ", data); |
|
|
|
addSuperviseEngineeringReportData(data).then((res) => { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message: "提交成功", |
|
|
|
}); |
|
|
|
this.formData.state = "1"; |
|
|
|
this.$router.go(-1); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch(() => {}); |
|
|
@ -411,66 +391,72 @@ export default { |
|
|
|
>严重</el-button |
|
|
|
> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="question-row w-full"> |
|
|
|
<div class="question-col flex-shrink-0">描述</div> |
|
|
|
<div class="question-col flex-1"> |
|
|
|
<el-input |
|
|
|
type="textarea" |
|
|
|
v-model="item.problemDescribe" |
|
|
|
:rows="4" |
|
|
|
:disabled="isDisabled" |
|
|
|
placeholder="请输入内容" |
|
|
|
/> |
|
|
|
<div |
|
|
|
class="question-row w-full" |
|
|
|
v-if="['2', '3'].includes(item2.level)" |
|
|
|
> |
|
|
|
<div class="question-col flex-shrink-0">描述</div> |
|
|
|
<div class="question-col flex-1"> |
|
|
|
<el-input |
|
|
|
type="textarea" |
|
|
|
v-model="item2.problemDescribe" |
|
|
|
:rows="4" |
|
|
|
:disabled="isDisabled" |
|
|
|
placeholder="请输入内容" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="question-row w-full"> |
|
|
|
<div class="question-col flex-shrink-0">照片</div> |
|
|
|
<div class="question-col flex-1"> |
|
|
|
<div class="flex flex-wrap"> |
|
|
|
<div |
|
|
|
class="w-100 h-100 mr-12 mb-12" |
|
|
|
v-for="(item, index) in item.siteSituationRecordsArr" |
|
|
|
:key="index" |
|
|
|
> |
|
|
|
<el-image |
|
|
|
style="width: 200px; min-height: 100px; height: auto" |
|
|
|
:src="item" |
|
|
|
:preview-src-list="[item]" |
|
|
|
<div |
|
|
|
class="question-row w-full" |
|
|
|
v-if="['2', '3'].includes(item2.level)" |
|
|
|
> |
|
|
|
<div class="question-col flex-shrink-0">照片</div> |
|
|
|
<div class="question-col flex-1"> |
|
|
|
<div class="flex flex-wrap"> |
|
|
|
<div |
|
|
|
class="w-100 h-100 mr-12 mb-12" |
|
|
|
v-for="(url, urlIndex) in item2.siteSituationRecordsArr" |
|
|
|
:key="urlIndex" |
|
|
|
> |
|
|
|
<template #error> |
|
|
|
<div |
|
|
|
class="w-full flex justify-center items-center" |
|
|
|
style=" |
|
|
|
height: 100px; |
|
|
|
border: 1px solid #f0f0f0; |
|
|
|
font-style: italic; |
|
|
|
color: #ccc; |
|
|
|
" |
|
|
|
> |
|
|
|
图片加载失败 |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-image> |
|
|
|
<el-image |
|
|
|
style="width: 200px; min-height: 100px; height: auto" |
|
|
|
:src="url" |
|
|
|
:preview-src-list="[url]" |
|
|
|
> |
|
|
|
<template #error> |
|
|
|
<div |
|
|
|
class="w-full flex justify-center items-center" |
|
|
|
style=" |
|
|
|
height: 100px; |
|
|
|
border: 1px solid #f0f0f0; |
|
|
|
font-style: italic; |
|
|
|
color: #ccc; |
|
|
|
" |
|
|
|
> |
|
|
|
图片加载失败 |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-image> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-upload |
|
|
|
action="#" |
|
|
|
:disabled="isDisabled" |
|
|
|
:http-request="handleUpload" |
|
|
|
:auto-upload="true" |
|
|
|
:before-upload="beforeUpload" |
|
|
|
:showFileList="false" |
|
|
|
accept=".jpg,.png,.jpeg" |
|
|
|
:maxLength="99" |
|
|
|
> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
@click="handleClickItem(item)" |
|
|
|
<el-upload |
|
|
|
action="#" |
|
|
|
:disabled="isDisabled" |
|
|
|
>上传</el-button |
|
|
|
:http-request="handleUpload" |
|
|
|
:auto-upload="true" |
|
|
|
:before-upload="beforeUpload" |
|
|
|
:showFileList="false" |
|
|
|
accept=".jpg,.png,.jpeg" |
|
|
|
:maxLength="99" |
|
|
|
> |
|
|
|
</el-upload> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
@click="handleClickItem(item2)" |
|
|
|
:disabled="isDisabled" |
|
|
|
>上传</el-button |
|
|
|
> |
|
|
|
</el-upload> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|