zhouna преди 4 години
родител
ревизия
8991a8f487
променени са 2 файла, в които са добавени 16 реда и са изтрити 4 реда
  1. 1 0
      src/components/knowledgeExtra/RuleManager.vue
  2. 15 4
      src/components/knowledgeExtra/SubConditions.vue

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

@@ -213,6 +213,7 @@
                         //this.msgDict=(data['21'].map((it)=>it.val)||[]).join(",");
                         localStorage.setItem("zskDicts",arr.join(","));
                         localStorage.setItem("zskMsgDict",(data['21'].map((it)=>it.val)||[]).join(","));
+                        localStorage.setItem("zskNumDict",data['22'][0].val);
                     }
                 }).catch((error) => {
                     console.log(error);

+ 15 - 4
src/components/knowledgeExtra/SubConditions.vue

@@ -42,7 +42,7 @@
                     </el-option>
                 </el-select>
             </el-form-item>
-            <el-form-item v-if="groupData.subType===2" label="选择类型:" prop="dataType">
+            <el-form-item v-if="groupData.subType===2&&showDataType" label="选择类型:" prop="dataType">
                 <el-select v-model="groupData.dataType"
                            placeholder="请选择"
                            size="small" @change="dataTypeChange">
@@ -132,6 +132,7 @@
             return {
                 baseTermTypeList:[],
                 typeList:[],
+                numTypes:'',    //只有数值类型的类型id
                 operMaxList:[
                     {name:'<=',key:'<='},
                     {name:'<',key:'<'},
@@ -178,7 +179,7 @@
                         validator: (rule,value,callback)=>{
                             const {subMaxOperator,subMinOperator,subMinValue}=this.groupData;
                             const val=value+subMaxOperator+subMinValue+subMinOperator;
-                            const isNum=/^\d+$/.test(value);
+                            const isNum=/^(\-|\+)?\d+(\.\d+)?$/.test(value);
                             if(!val||(value==''&&subMaxOperator)){
                                 callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
                             }else if(value!==''&&!isNum){
@@ -191,7 +192,7 @@
                         validator: (rule,value,callback)=>{
                             const {subMaxValue,subMinOperator,subMaxOperator}=this.groupData;
                             const val=value+subMaxOperator+subMaxValue+subMinOperator;
-                            const isNum=/^\d+$/.test(value);
+                            const isNum=/^(\-|\+)?\d+(\.\d+)?$/.test(value);
                             if(!val||(value==''&&subMinOperator)){
                                 callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
                             }else if(value!==''&&!isNum){
@@ -240,11 +241,17 @@
             }
         },
         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:{
+            showDataType:function(){
+               return (this.numTypes+',').indexOf(this.groupData.subLenCode+',')===-1;
+            }
+        },
         methods:{
             dataTypeChange(val){
                 this.groupData.subEqOperator=val==='2'?'=':undefined;
@@ -265,7 +272,11 @@
             },
             subCodeChange(val){        //基础规则术语类型修改
                 this.groupData.subLenCode=val;
-                this.groupData.dataType='';
+                if((this.numTypes+',').indexOf(val+',')>-1){
+                    this.groupData.dataType='1';
+                }else{
+                    this.groupData.dataType='';
+                }
                 this.clearConcept();
                 this.clearNumText();
             },