From c819024e241b9f7c54cc3786373ad0d2998f2190 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期五, 05 五月 2023 08:55:46 +0800
Subject: [PATCH] 修改

---
 src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue |   76 ++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 31 deletions(-)

diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue b/src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue
index 777f7d5..d892430 100644
--- a/src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue
+++ b/src/views/doublePreventAction/hiddenDanger/inspectionTask/components/inpectionPoint.vue
@@ -15,18 +15,18 @@
             >
                 <el-table-column label="序号" type="index" width="150" align="center">
                 </el-table-column>
-                 <el-table-column label="管控方式描述" prop="content" align="center">
+                 <el-table-column label="隐患排查内容" prop="content" align="center">
                 </el-table-column>
                    <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
                     <template slot-scope="scope">
-                        <el-button type="text" @click="showMeasureDetail(scope.row)">详情</el-button>
-                        <el-button type="text" style="color:red;" @click="deleteById(scope.row)">删除</el-button>
+                        <el-button type="text" @click="showMeasureDetail(scope.row)" v-show="ifEdit">详情</el-button>
+                        <el-button type="text" style="color:red;" @click="deleteById(scope.$index,scope.row)">删除</el-button>
                     </template>
                 </el-table-column>
             </el-table>
         </div>
         <el-dialog :visible.sync="controlActionVisible"  append-to-body :close-on-click-modal="false" width="80%">
-            <control-action ref="controlAction" @closeDialog="closeDialog" @giveRiskControlId="receiveRiskControlId"></control-action>
+            <control-action ref="controlAction" @closeDialog="closeDialog" @giveRiskControlId="receiveRiskControlId" @keepValue="keepValue"></control-action>
         </el-dialog>
     </div>
 </template>
@@ -41,11 +41,13 @@
             return{
                 tableKey:'',
                 listLoading:false,
+                ifEdit:false,
                 ifShowControl:true,
                 controlActionVisible:false,
                 riskControlMeasureVisible:false,
                 riskControlMeasureForm:[],
                 inspectionPointData:[],
+                keepValueList:[],
                 controlActionForm:{
                     workId:'',
                     measureId:'',
@@ -59,15 +61,16 @@
             showControlAction (){
                 this.controlActionVisible = true
                 setTimeout( () => {
-                    this.$refs.controlAction.ifShowButton()
+                    this.$refs.controlAction.ifShowButton(this.inspectionPointData)
                 })
             },
             showMeasureDetail(val){
                 this.controlActionVisible = true
                 setTimeout( () => {
-                    this.$refs.controlAction.showMeasureDetail(val)    
+                    this.$refs.controlAction.showMeasureDetail(val)
+                    this.$refs.controlAction.ifShowSelf = false
                 })
-         
+
             },
             closeDialog(){
                 this.controlActionVisible = false
@@ -76,15 +79,18 @@
                 this.controlActionVisible  = false
                 if(this.title === '新建巡检计划设定'){
                     if(value){
-                        //     this.inspectionPointData = JSON.parse(JSON.stringify(value.map( item => {
-                        //     return {
-                        //         id:item.id,
-                        //         content:item.riskMeasureDesc    
-                        //     }
-                        // })))
-                        this.inspectionPointData.push({id:value.id,content:value.riskMeasureDesc})
+                        this.inspectionPointData = JSON.parse(JSON.stringify(value.map( item => {
+                            return {
+                                id:item.id,
+                                content:item.troubleshootContent
+                            }
+                        })))
                         this.$emit('giveToForm',this.inspectionPointData)
-                        }
+                            // if(this.inspectionPointData.findIndex(item => item.id === value.id) === -1) {
+                            //     this.inspectionPointData.push({id:value.id,content:value.troubleshootContent})
+                            //     this.$emit('giveToForm',this.inspectionPointData)
+                            // }
+                    }
                 }else{
                     this.controlActionForm.workId = JSON.stringify(this.inspectionTaskForm.workId)
                     this.controlActionForm.measureId =JSON.stringify(value.id)
@@ -103,31 +109,39 @@
                             message:res.data.message
                         })
                     }
-                }    
+                }
             },
-            deleteById(value){
-                this.$confirm('删除此条措施,是否继续','提示',{
+            deleteById(value,scope){
+                if(this.title === '新建巡检计划设定'){
+                    this.inspectionPointData.splice(value,1)
+                }else{
+                    this.$confirm('删除此条措施,是否继续','提示',{
                     confirmButtonText:'确定',
                     cancelButtonText:'取消',
                     type:'warning',
-                }).then(()=> {
-                    deleteInspectionControlAction({workId:value.workId,measureId:value.measureId}).then( (res)=>{
-                        if(res.data.code === '200'){
-                            this.getControlActionList()
-                            this.$notify({
-                            title:'成功',
-                            message:'删除成功',
-                            type:'success',
-                            duration:2000,
-                            })
-                        }
-                  
+                    }).then(()=> {
+                        deleteInspectionControlAction({workId:scope.workId,measureId:scope.measureId}).then( (res)=>{
+                            if(res.data.code === '200'){
+                                this.getControlActionList()
+                                this.$notify({
+                                title:'成功',
+                                message:'删除成功',
+                                type:'success',
+                                duration:2000,
+                                })
+                            }
+
+                        })
                     })
-                })
+                }
+
             },
             async getControlActionList(){
                 let res = await getInspectionControlAction(this.inspectionTaskForm.workId)
                 this.inspectionPointData = res.data.result.checkContents
+            },
+            keepValue(value){
+                this.keepValueList = value
             }
         }
     }

--
Gitblit v1.9.2