Kaynağa Gözat

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

LAPTOP-16IUEB3P\Lenovo 3 yıl önce
ebeveyn
işleme
3ab8510f7a

+ 25 - 6
src/views/system/dictionary/components/dict-edit.vue

@@ -325,7 +325,8 @@
         // 提交状态
         loading: false,
         // 是否是修改
-        isUpdate: false
+        isUpdate: false,
+        delectId: 1
       };
     },
     created() {},
@@ -336,8 +337,10 @@
           code: '',
           enable: 1,
           name: '',
-          sort: ''
+          sort: '',
+          delectId: this.delectId
         });
+        this.delectId = this.delectId + 1;
         this.filterArr();
       },
       //
@@ -346,14 +349,30 @@
       },
       removeArr(row) {
         console.log(row);
-        let falg = this.form.dictStaticSubmitPOList[row.$index].deleted === 0;
-        if (falg) {
-          this.form.dictStaticSubmitPOList[row.$index].deleted = 1;
+        if (row.row.id) {
+          this.form.dictStaticSubmitPOList.forEach((item) => {
+            if (item.id === row.row.id) {
+              item.deleted = 1;
+            }
+          });
           this.filterArr();
         } else {
-          this.form.dictStaticSubmitPOList.splice(row.$index, 1);
+          let index = this.form.dictStaticSubmitPOList.findIndex(
+            (item) => item.delectId === row.row.delectId
+          );
+          console.log(index);
+          this.form.dictStaticSubmitPOList.splice(index, 1); // 在数组的指定位置移除对应的元素。 返回移除的
           this.filterArr();
         }
+
+        // let falg = this.form.dictStaticSubmitPOList[row.$index].deleted === 0;
+        // if (falg) {
+        //   this.form.dictStaticSubmitPOList[row.$index].deleted = 1;
+        //   this.filterArr();
+        // } else {
+        //   this.form.dictStaticSubmitPOList.splice(row.$index, 1);
+        //   this.filterArr();
+        // }
       },
       handleSelectionChange() {},
       /* 保存编辑 */