浏览代码

Merge remote-tracking branch 'origin/hideRule1020'

zhouna 3 年之前
父节点
当前提交
4192b152a5
共有 2 个文件被更改,包括 77 次插入5 次删除
  1. 76 5
      src/components/knowledgeExtra/AddNewRule.vue
  2. 1 0
      src/components/knowledgeExtra/RuleManager.vue

+ 76 - 5
src/components/knowledgeExtra/AddNewRule.vue

@@ -350,8 +350,24 @@ export default {
 
         // disable
         if (this.form.parHasSub && this.firstPlace) {
+          const del =
+            localStorage
+              .getItem('zskDelDict')
+              .match(
+                new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')
+              ) || [];
           if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
             this.$set(item, 'disabled', false);
+            if (del.length > 0 && item.subType == del[0].split('-')[2]) {
+              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);
           }
@@ -436,11 +452,45 @@ export default {
               .getItem('zskDicts')
               .match(new RegExp(this.firstPlace.checkedType + '-\\d+', 'g')) ||
             [];
+          const del =
+            localStorage
+              .getItem('zskDelDict')
+              .match(
+                new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')
+              ) || [];
           const types = dict[0].split('-');
           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);
+              if (del.length > 0) {
+                const delType = del[0].split('-');
+                if (
+                  item.subType == delType[2] ||
+                  item.subLenCode == delType[3]
+                ) {
+                  this.$set(this.form.klRuleByIdSub, i, {
+                    groupId: item.groupId,
+                    groupChildId: 'child' + new Date().valueOf(),
+                    baseTypes: this.baseTypeList,
+                    baseTermTypeList: [],
+                    conceptList: [],
+                    subDescription: '',
+                    parRuleType: '',
+                    subConceptId: '',
+                    subType: '',
+                    subMaxOperator: '',
+                    subMaxUnit: '',
+                    subMaxValue: '',
+                    subMinOperator: '',
+                    subMinUnit: '',
+                    subMinValue: '',
+                    subEqValue: '',
+                    subLenCode: '',
+                    dataType: ''
+                  });
+                }
+              }
             } else {
               this.$set(item, 'disabled', true);
               this.$set(item, 'subType', parseInt(types[2]));
@@ -508,12 +558,30 @@ export default {
     // 基础规则类型切换
     subTypeChange(val, index) {
       // index
+      let isDel = false;
+      let screenArr;
       const obj = this.baseTypeList.find(it => it.type === val);
-
+      if (this.form.parHasSub && this.firstPlace) {
+        const del =
+          localStorage
+            .getItem('zskDelDict')
+            .match(
+              new RegExp(this.firstPlace.checkedType + '-\\d+' + '-\\d+', 'g')
+            ) || [];
+        if (del.length > 0) {
+          isDel = true;
+          const types = del[0].split('-');
+          let baseTypeList = JSON.parse(JSON.stringify(this.baseTypeList));
+          const subobj = this.baseTypeList.find(it => it.type == types[2]);
+          screenArr = subobj.subMenuList.filter(item => {
+            return !types[3].includes(item.code);
+          });
+        }
+      }
       this.$set(
         this.form.klRuleByIdSub[index],
         'baseTermTypeList',
-        obj.subMenuList
+        isDel && val == 2 ? screenArr : obj.subMenuList
       );
       this.$set(this.form.klRuleByIdSub[index], 'subLenCode', '');
       this.$set(this.form.klRuleByIdSub[index], 'dataType', '');
@@ -547,6 +615,7 @@ export default {
        *    arg:{index:添加规则用索引,groupId:添加分组用确切id}
        */
       !date && (date = new Date().valueOf());
+
       const obj = {
         groupId: date,
         groupChildId: 'child' + new Date().valueOf(),
@@ -567,6 +636,8 @@ export default {
         subLenCode: '',
         dataType: ''
       };
+      console.log(obj);
+
       if (typeof arg.index == 'number') {
         // 添加规则 直接在当前位置之后添加
         this.form.klRuleByIdSub.splice(arg.index + 1, 0, obj);
@@ -637,7 +708,7 @@ export default {
       const param = {
         excludedConceptIds: [this.form.parRuleType],
         libType: this.form.parLenCode,
-        name: val,
+        name: val
       };
       api
         .searchConcept(param)
@@ -754,7 +825,7 @@ export default {
       if (str.length <= 1) {
         return '';
       }
-      
+
       return str;
     },
     ruleTermCodeStrs: function() {
@@ -777,7 +848,7 @@ export default {
       );
     },
     showHasSub() {
-      console.log(this.subDict.indexOf(this.ruleTermCodeStrs))
+      console.log(this.subDict.indexOf(this.ruleTermCodeStrs));
       if (this.ruleTermCodeStrs.length > 2) {
         return this.subDict.indexOf(this.ruleTermCodeStrs) != -1;
       }

+ 1 - 0
src/components/knowledgeExtra/RuleManager.vue

@@ -202,6 +202,7 @@ export default {
             );
             localStorage.setItem('zskNumDict', data['22'][0].val);
             localStorage.setItem('zskSubDict', (data['23'].map(it => it.val) || []).join(','));
+            localStorage.setItem('zskDelDict', data['26'][0].val);
           }
         })
         .catch(error => {