Explorar el Código

风险管理评估时,评估风险项数据丢失

shenQiLong hace 3 semanas
padre
commit
6e016d17e4
Se han modificado 1 ficheros con 48 adiciones y 1 borrados
  1. 48 1
      src/views/platform/risk/riskDetail.vue

+ 48 - 1
src/views/platform/risk/riskDetail.vue

@@ -351,6 +351,18 @@
                 />
               </template>
             </el-table-column>
+            <el-table-column v-if="!readonly">
+              <template slot-scope="scope">
+                <el-button
+                  type="danger"
+                  size="mini"
+                  icon="ibps-icon-remove"
+                  @click="handleDelete(scope.$index, scope.row)"
+                >
+                  删除
+                </el-button>
+              </template>
+            </el-table-column>
           </el-table>
         </div>
 
@@ -488,7 +500,9 @@ export default {
       fengXianJiSuan: [],
       muban: '2',
       leixing: '安全',
-      riskResponse: ['风险降低', '风险接受', '风险回避']
+      riskResponse: ['风险降低', '风险接受', '风险回避'],
+      yiShanChuFengXianList: [],
+      yiShanChuFengXianId: []
     }
   },
   computed: {
@@ -556,6 +570,7 @@ export default {
         this.loading = true
         const order = data.replace(/,/g, "','")
         // const sql = `select * from t_fxkzb where find_in_set(id_ , '${data}') ORDER BY FIELD(id_, '${order}')`
+        const tableList = JSON.parse(JSON.stringify(this.tableList))
         this.$common
           .request('query', {
             key: 'getRiskLibraryData',
@@ -604,6 +619,22 @@ export default {
                 )
               }
             })
+            //处理在风险库被删除的风险项
+            const bIdSet = new Set(data1.map((item) => item.id_))
+            this.yiShanChuFengXianList =
+              this.Ids.filter((item) => !bIdSet.has(item)) || []
+            //处理在风险库被删除同时风险评估里点击了删除的风险项
+            const idsYiShanChu =
+              this.yiShanChuFengXianList.filter(
+                (item) =>
+                  !this.yiShanChuFengXianId.includes(item.shi_bie_xiang_)
+              ) || []
+            console.log(tableList, this.tableList, idsYiShanChu, data1)
+            const tableListYiShanChu =
+              tableList.filter((item) =>
+                idsYiShanChu.includes(item.shi_bie_xiang_)
+              ) || []
+            this.tableList = [...this.tableList, ...tableListYiShanChu]
             this.loading = false
           })
       }
@@ -857,6 +888,7 @@ export default {
     },
     close() {
       this.dialogVisible = false
+      this.isNotFengxianku = true
       this.$emit('close')
       setTimeout(() => {
         this.rowParams = {}
@@ -871,6 +903,7 @@ export default {
         this.rowParams = row
       }
       this.dialogVisible = true
+      this.yiShanChuFengXianId = []
       !this.readonly && this.refreshSortable()
     },
     // 计算风险指数
@@ -1243,6 +1276,20 @@ export default {
         this.$message.warning(error.message)
         throw new Error(error.message)
       }
+    },
+    handleDelete(index, row) {
+      const xuan_ze_feng_xian = JSON.parse(
+        JSON.stringify(this.form.xuan_ze_feng_xian)
+      )
+
+      this.form.xuan_ze_feng_xian = xuan_ze_feng_xian
+        ?.split(',')
+        .filter((item) => item !== row.shi_bie_xiang_)
+        .join(',')
+
+      this.tableList.splice(index, 1)
+      this.yiShanChuFengXianId.push(row.shi_bie_xiang_)
+      // console.log(this.yiShanChuFengXianId)
     }
   }
 }