|
|
@ -5,13 +5,15 @@ |
|
|
|
<div class="top-box"> |
|
|
|
<span>巡视检查名称:</span> |
|
|
|
<el-input |
|
|
|
:disabled="isEdit" |
|
|
|
v-model="formData.name" |
|
|
|
:maxlength="50" |
|
|
|
size="small" |
|
|
|
class="search-input" |
|
|
|
placeholder="请输入巡视检查名称" |
|
|
|
></el-input> |
|
|
|
<span>巡检类型:</span> |
|
|
|
<el-select v-model="formData.type" placeholder="请选择"> |
|
|
|
<el-select :disabled="isEdit" v-model="formData.type" placeholder="请选择"> |
|
|
|
<el-option |
|
|
|
v-for="item in xcTypeOptions" |
|
|
|
:key="item.dictValue" |
|
|
@ -89,7 +91,7 @@ |
|
|
|
class="flex flex-1 items-center p-4 r-b-border h-full" |
|
|
|
> |
|
|
|
<el-input |
|
|
|
:disabled="!item3.check" |
|
|
|
:disabled="!item3.check || isEdit" |
|
|
|
v-model="item3.content" |
|
|
|
type="textarea" |
|
|
|
:rows="1" |
|
|
@ -101,11 +103,12 @@ |
|
|
|
class="w-120 flex justify-center items-center p-4 r-b-border h-full" |
|
|
|
> |
|
|
|
<el-radio-group |
|
|
|
:disabled="isEdit" |
|
|
|
class="inspection-radio-group" |
|
|
|
v-model="item3.check" |
|
|
|
> |
|
|
|
<el-radio :label="true">是</el-radio> |
|
|
|
<el-radio :label="false">否</el-radio> |
|
|
|
<el-radio :disabled="isEdit" :label="true">是</el-radio> |
|
|
|
<el-radio :disabled="isEdit" :label="false">否</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -115,7 +118,7 @@ |
|
|
|
<div v-else class="flex flex-1 items-center"> |
|
|
|
<div class="flex-1 flex items-center p-4 r-b-border h-full"> |
|
|
|
<el-input |
|
|
|
:disabled="!item2.check" |
|
|
|
:disabled="!item2.check || isEdit" |
|
|
|
v-model="item2.content" |
|
|
|
type="textarea" |
|
|
|
:rows="1" |
|
|
@ -127,10 +130,11 @@ |
|
|
|
class="w-120 flex justify-center items-center p-4 r-b-border h-full" |
|
|
|
> |
|
|
|
<el-radio-group |
|
|
|
:disabled="isEdit" |
|
|
|
class="inspection-radio-group" |
|
|
|
v-model="item2.check" |
|
|
|
> |
|
|
|
<el-radio :label="true">是</el-radio> |
|
|
|
<el-radio :label="true">是</el-radio> |
|
|
|
<el-radio :label="false">否</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</div> |
|
|
@ -141,7 +145,7 @@ |
|
|
|
<div v-else class="flex flex-1 items-center"> |
|
|
|
<div class="flex-1 flex items-center p-4 r-b-border h-full"> |
|
|
|
<el-input |
|
|
|
:disabled="!item.check" |
|
|
|
:disabled="!item.check || isEdit" |
|
|
|
v-model="item.content" |
|
|
|
type="textarea" |
|
|
|
:rows="1" |
|
|
@ -153,6 +157,7 @@ |
|
|
|
class="w-120 flex justify-center items-center p-4 r-b-border h-full" |
|
|
|
> |
|
|
|
<el-radio-group |
|
|
|
:disabled="isEdit" |
|
|
|
class="inspection-radio-group" |
|
|
|
v-model="item.check" |
|
|
|
> |
|
|
@ -168,7 +173,7 @@ |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="bottom-btns"> |
|
|
|
<el-button type="primary" @click="handleSave">保存</el-button> |
|
|
|
<el-button :disabled="isEdit" type="primary" @click="handleSave">保存</el-button> |
|
|
|
<el-button @click="$router.go(-1)">返回</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -177,6 +182,7 @@ |
|
|
|
import { intersection } from "lodash"; |
|
|
|
import { |
|
|
|
putInspectionProjectData, |
|
|
|
checkUsed, |
|
|
|
postInspectionProjectData, |
|
|
|
getCheckingDictTree, |
|
|
|
getInspectionProjectDetails, |
|
|
@ -187,6 +193,7 @@ export default { |
|
|
|
return { |
|
|
|
xcTreeData: [], |
|
|
|
xcTypeOptions: [], |
|
|
|
isEdit: false, |
|
|
|
formData: { |
|
|
|
id: null, |
|
|
|
name: "", |
|
|
@ -208,17 +215,19 @@ export default { |
|
|
|
async getDetailsData() { |
|
|
|
const dictData = await getCheckingDictTree("df_xs_c_classfy"); |
|
|
|
let _xcTreeData = this.transformArr(dictData?.data); |
|
|
|
|
|
|
|
const detailData = await getInspectionProjectDetails( |
|
|
|
this.$route.query.id |
|
|
|
); |
|
|
|
if (detailData?.data?.items) { |
|
|
|
// 匹配xcTreeData |
|
|
|
this.formData.name = detailData.data.name; |
|
|
|
this.formData.type = detailData.data.type; |
|
|
|
this.matchXcTreeData(_xcTreeData, detailData.data.items); |
|
|
|
const checkId = this.$route.query.id; |
|
|
|
if(checkId){ |
|
|
|
const detailData = await getInspectionProjectDetails(checkId); |
|
|
|
if (detailData?.data?.items) { |
|
|
|
// 匹配xcTreeData |
|
|
|
this.formData.name = detailData.data.name; |
|
|
|
this.formData.type = detailData.data.type; |
|
|
|
this.matchXcTreeData(_xcTreeData, detailData.data.items); |
|
|
|
} |
|
|
|
const checkUsedData = await checkUsed(this.$route.query.id); |
|
|
|
this.isEdit = checkUsedData?.data; |
|
|
|
} |
|
|
|
this.xcTreeData = _xcTreeData; |
|
|
|
this.xcTreeData = _xcTreeData; |
|
|
|
}, |
|
|
|
// 树转换 |
|
|
|
transformArr(treeList) { |
|
|
@ -229,6 +238,7 @@ export default { |
|
|
|
item.children.forEach((v) => { |
|
|
|
if (!v.children || v.children.length === 0) { |
|
|
|
v.parts = [...item.parts, v.key]; |
|
|
|
v.content = v.remark || ""; |
|
|
|
} else { |
|
|
|
deepCalc(v, item.parts); |
|
|
|
} |
|
|
@ -245,8 +255,7 @@ export default { |
|
|
|
matchXcTreeData(treeData, dataList) { |
|
|
|
treeData.forEach((v) => { |
|
|
|
if (!v.children?.length) { |
|
|
|
for (let i = 0; i < dataList.length; i++) { |
|
|
|
const item = dataList[i]; |
|
|
|
for (const item of dataList) { |
|
|
|
v.id = item.id; |
|
|
|
if (intersection(v.parts, item.parts).length === v.parts.length) { |
|
|
|
// 证明匹配成功 |
|
|
|