1178232204@qq.com 3 yıl önce
ebeveyn
işleme
a72aec1f44
1 değiştirilmiş dosya ile 30 ekleme ve 10 silme
  1. 30 10
      src/components/knowledgeExtra/AddNewRule.vue

+ 30 - 10
src/components/knowledgeExtra/AddNewRule.vue

@@ -347,11 +347,30 @@ export default {
         } else if (item.subEqValue) {
           item.dataType = '2';
         }
-
+        const del =
+          localStorage
+            .getItem('zskDelDict')
+            .match(
+              new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')
+            ) || [];
         // disable
         if (this.form.parHasSub && this.firstPlace) {
           if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
             this.$set(item, 'disabled', false);
+            if (del.length > 0) {
+              const delType = del[0].split('-');
+              const types = del[0].split('-');
+              let baseTypeList = JSON.parse(JSON.stringify(this.baseTypeList));
+              const subobj = this.baseTypeList.find(it => it.type == types[2]);
+              const screenArr = subobj.subMenuList.filter(item => {
+                return !types[3].includes(item.code);
+              });
+              this.$set(
+                item,
+                'baseTermTypeList',
+                screenArr
+              );
+            }
           } else {
             this.$set(item, 'disabled', true);
           }
@@ -439,8 +458,9 @@ export default {
           const del =
             localStorage
               .getItem('zskDelDict')
-              .match(new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')) ||
-            [];
+              .match(
+                new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')
+              ) || [];
           const types = dict[0].split('-');
           let obj = this.form.klRuleByIdSub;
           obj.forEach((item, i, arr) => {
@@ -448,11 +468,14 @@ export default {
               this.$set(item, 'disabled', false);
               if (del.length > 0) {
                 const delType = del[0].split('-');
-                if (item.subType == delType[2] || item.subLenCode == delType[3]) {
+                if (
+                  item.subType == delType[2] ||
+                  item.subLenCode == delType[3]
+                ) {
                   this.$set(this.form.klRuleByIdSub, i, {
-                    groupId:item.groupId,
+                    groupId: item.groupId,
                     groupChildId: 'child' + new Date().valueOf(),
-                    baseTypes:this.baseTypeList,
+                    baseTypes: this.baseTypeList,
                     baseTermTypeList: [],
                     conceptList: [],
                     subDescription: '',
@@ -485,7 +508,6 @@ export default {
           });
           this.$set(this.form, 'klRuleByIdSub', obj);
         }
-        
       });
     },
     // 初始化表格
@@ -538,8 +560,6 @@ export default {
     },
     // 基础规则类型切换
     subTypeChange(val, index) {
-      console.log(val);
-      
       // index
       let isDel = false;
       let screenArr;
@@ -564,7 +584,7 @@ export default {
       this.$set(
         this.form.klRuleByIdSub[index],
         'baseTermTypeList',
-        isDel && val == 2?screenArr:obj.subMenuList
+        isDel && val == 2 ? screenArr : obj.subMenuList
       );
       this.$set(this.form.klRuleByIdSub[index], 'subLenCode', '');
       this.$set(this.form.klRuleByIdSub[index], 'dataType', '');