Selaa lähdekoodia

判断是否存在收尾固定项

1178232204@qq.com 3 vuotta sitten
vanhempi
commit
cfdc80e52f
1 muutettua tiedostoa jossa 19 lisäystä ja 12 poistoa
  1. 19 12
      src/components/knowledgeExtra/AddNewRule.vue

+ 19 - 12
src/components/knowledgeExtra/AddNewRule.vue

@@ -442,16 +442,21 @@ export default {
               .match(new RegExp(this.firstPlace.checkedType + '-\\d+', 'g')) ||
             [];
           const types = dict[0].split('-');
-          const delType = del[0].split('-');
-          const baseTypeList = JSON.parse(JSON.stringify(this.baseTypeList));
-          const screenArr = baseTypeList.filter(item => {
-            return !delType[2].includes(item.type);
-          });
+          let screenArr;
+          if (del.length > 0) {
+            const delType = del[0].split('-');
+            const baseTypeList = JSON.parse(JSON.stringify(this.baseTypeList));
+            screenArr = baseTypeList.filter(item => {
+              return !delType[2].includes(item.type);
+            });
+          }
           let obj = this.form.klRuleByIdSub;
           obj.forEach((item, i, arr) => {
             if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
               this.$set(item, 'disabled', false);
-              this.$set(item, 'baseTypes', screenArr);
+              if (del.length > 0) {
+                this.$set(item, 'baseTypes', screenArr);
+              }
             } else {
               this.$set(item, 'disabled', true);
               this.$set(item, 'subType', parseInt(types[2]));
@@ -562,17 +567,19 @@ export default {
       let isDel = false;
       let screenArr;
       if (this.form.parHasSub && this.firstPlace) {
-        isDel = true;
         const del =
           localStorage
             .getItem('zskDelDict')
             .match(new RegExp(this.firstPlace.checkedType + '-\\d+', 'g')) ||
           [];
-        const types = del[0].split('-');
-        let baseTypeList = JSON.parse(JSON.stringify(this.baseTypeList));
-        screenArr = baseTypeList.filter(item => {
-          return !types[2].includes(item.type);
-        });
+        if (del.length > 0) {
+          isDel = true;
+          const types = del[0].split('-');
+          let baseTypeList = JSON.parse(JSON.stringify(this.baseTypeList));
+          screenArr = baseTypeList.filter(item => {
+            return !types[2].includes(item.type);
+          });
+        }
       }
       const obj = {
         groupId: date,