Explorar o código

【bug-8125】风险管理评估时,评估风险项数据丢失

shenQiLong hai 18 horas
pai
achega
ed81a369c2
Modificáronse 1 ficheiros con 32 adicións e 2 borrados
  1. 32 2
      src/views/platform/risk/riskDetail.vue

+ 32 - 2
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,8 @@ export default {
       fengXianJiSuan: [],
       muban: '2',
       leixing: '安全',
-      riskResponse: ['风险降低', '风险接受', '风险回避']
+      riskResponse: ['风险降低', '风险接受', '风险回避'],
+      pzYishanIds: []
     }
   },
   computed: {
@@ -598,7 +611,8 @@ export default {
             }
             this.tableList.forEach((item) => {
               const cunZai = data1.find((i) => i.id_ === item.shi_bie_xiang_)
-              if (!cunZai) {
+              const yiShan = this.pzYishanIds.includes(item.shi_bie_xiang_)
+              if (!cunZai && !yiShan) {
                 this.tableList = this.tableList.filter(
                   (ii) => ii.shi_bie_xiang_ !== item.shi_bie_xiang_
                 )
@@ -696,7 +710,11 @@ export default {
         this.form.xuan_ze_feng_xian_mc = data.map((t) => t.yao_su_tiao_kuan_)
         data.sort((a, b) => a.tenant_id_ - b.tenant_id_)
         this.tableList = data
+        this.pzYishanIds = this.tableList
+          .filter((item) => item.pz == '已删除')
+          .map((item) => item.shi_bie_xiang_)
         this.tableList.forEach((i) => {
+          delete i.pz
           if (!Object.hasOwn(i, 'qian_zai_yuan_yin')) i.qian_zai_yuan_yin = ''
         })
         // 存储原始数据的 id 数组
@@ -1243,6 +1261,18 @@ 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)
     }
   }
 }