zhouna 4 年之前
父节点
当前提交
073057545b
共有 2 个文件被更改,包括 14 次插入17 次删除
  1. 1 0
      src/components/knowledgeExtra/AddNewRule.vue
  2. 13 17
      src/components/knowledgeExtra/SubConditions.vue

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

@@ -63,6 +63,7 @@
                     <el-form-item v-if="form.parHasSub===1" label="规则内容:" prop="remind" class="discDesc">
                         <SubRulesGroup v-for="(group,i) in subGroups"
                                        ref="groups"
+                                       :key="i"
                                        :data="group"
                                        :baseTypes="baseTypeList"
                                        :inx="i"

+ 13 - 17
src/components/knowledgeExtra/SubConditions.vue

@@ -130,7 +130,7 @@
         props:['groupData','ind','isLast','baseTypes','firstPlace','disabled','showAdd'],
         data(){
             return {
-                baseTermTypeList:[],
+                //baseTermTypeList:[],
                 typeList:[],
                 numTypes:'',    //只有数值类型的类型id
                 operMaxList:[
@@ -145,7 +145,7 @@
                 rules:{
                     subDescription:[{ required: true, message: '请输入基础规则名称',trigger: ['blur'] },{
                         validator: (rule,value,callback)=>{
-                            if(value.length>100){
+                            if(value&&value.length>100){
                                 callback(new Error('规则名称不能超过100字'));
                             }else{
                                 callback();
@@ -221,7 +221,7 @@
                 },
                 deep:true
             },
-            'baseTypes':{
+            /*'baseTypes':{
                 handler:function(val){
                     if(!this.groupData.subType){
                         this.baseTermTypeList =[];
@@ -231,16 +231,14 @@
                     this.baseTermTypeList = obj.subMenuList;
                 },
                 deep:true
-            },
+            },*/
             'firstPlace':{
                 handler:function(val) {
                     if (this.ind!==0||!val) return;
                     const dict = localStorage.getItem("zskDicts").match(new RegExp(val.checkedType+'-\\d+','g'))||[];
                     const types = dict[0].split("-");
-                    const sub = this.baseTypes.find((it) => it.ruleType === +types[0] && it.type === +types[2]);
-                    this.groupData.subType = sub.type;
-                    this.baseTermTypeList = sub.subMenuList;
-                    this.groupData.subLenCode = (this.baseTermTypeList.find((it) => it.ruleType === +types[0])||{}).code;
+                    this.groupData.subType = +types[2];
+                    this.groupData.subLenCode = types[1];
                     this.conceptList = [val];
                     this.groupData.subDescription = val.conceptName;
                     this.groupData.subConceptId = val.conceptId;
@@ -252,11 +250,15 @@
         created(){
             this.numTypes = localStorage.getItem("zskNumDict");
             this.conceptList=[{conceptName:this.groupData.subLibName||this.groupData.subConceptName,conceptId:this.groupData.subConceptId}];
-            if(this.groupData.subLenCode){
-                this.baseTermTypeList=[{name:this.groupData.subLenName,code:this.groupData.subLenCode}];
-            }
         },
         computed:{
+            baseTermTypeList:function(){
+                if(!this.baseTypes.length){
+                    return [];
+                }
+                const sub = this.baseTypes.find((it) => it.type === this.groupData.subType)||{};
+                return sub.subMenuList;
+            },
             showDataType:function(){
                return (this.numTypes+',').indexOf(this.groupData.subLenCode+',')===-1;
             },
@@ -276,12 +278,6 @@
                 this.groupData.dataType='';
                 this.clearConcept();
                 this.clearNumText();
-                if(!val){
-                    this.baseTermTypeList =[];
-                    return;
-                }
-                const obj = this.baseTypes.find((it)=>it.type===val);
-                this.baseTermTypeList = obj.subMenuList;
             },
             subCodeChange(val){        //基础规则术语类型修改
                 this.groupData.subLenCode=val;