Browse Source

有无子条件判断

1178232204@qq.com 3 years ago
parent
commit
557996ac27
3 changed files with 21577 additions and 8455 deletions
  1. 13736 34
      package-lock.json
  2. 68 27
      src/components/knowledgeExtra/AddNewRule.vue
  3. 7773 8394
      yarn.lock

File diff suppressed because it is too large
+ 13736 - 34
package-lock.json


+ 68 - 27
src/components/knowledgeExtra/AddNewRule.vue

@@ -74,7 +74,11 @@
 </style>
 <template>
   <div>
-    <crumbs :title="title" :param="$route.params" linkTo="ZskRuleManager"></crumbs>
+    <crumbs
+      :title="title"
+      :param="$route.params"
+      linkTo="ZskRuleManager"
+    ></crumbs>
     <div id="AddRuleContent">
       <el-form size="mini" :model="form" ref="ruleForm">
         <div class="table_form">
@@ -86,7 +90,10 @@
               :rules="rules.parDescription"
               prop="parDescription"
             >
-              <el-input style="width: 100%" v-model.trim="form.parDescription" />
+              <el-input
+                style="width: 100%"
+                v-model.trim="form.parDescription"
+              />
             </el-form-item>
           </div>
 
@@ -98,7 +105,11 @@
               :rules="rules.parRuleType"
               prop="parRuleType"
             >
-              <el-select v-model="form.parRuleType" placeholder="请选择" @change="ruleTypeChange">
+              <el-select
+                v-model="form.parRuleType"
+                placeholder="请选择"
+                @change="ruleTypeChange"
+              >
                 <el-option
                   v-for="item in ruleTypeList"
                   :key="item.id"
@@ -119,7 +130,9 @@
                   </el-tooltip>
                 </div>
               </template>
-              <div class="tip_text">注:更改规则类型,将会清空已填写的规则内容~</div>
+              <div class="tip_text">
+                注:更改规则类型,将会清空已填写的规则内容~
+              </div>
             </el-form-item>
           </div>
           <div class="table_cell">
@@ -143,7 +156,11 @@
                   </el-tooltip>
                 </div>
               </template>
-              <el-select v-model="form.parLenCode" placeholder="请选择" @change="ruleTermChange">
+              <el-select
+                v-model="form.parLenCode"
+                placeholder="请选择"
+                @change="ruleTermChange"
+              >
                 <el-option
                   v-for="item in ruleTermTypeList"
                   :key="item.id"
@@ -151,7 +168,9 @@
                   :value="item.code"
                 ></el-option>
               </el-select>
-              <div class="tip_text">注:更改规则术语类型,将会清空已填写的规则内容~</div>
+              <div class="tip_text">
+                注:更改规则术语类型,将会清空已填写的规则内容~
+              </div>
             </el-form-item>
           </div>
           <div class="table_cell">
@@ -180,14 +199,23 @@
               </el-select>
             </el-form-item>
           </div>
-          <div class="table_cell" v-if="showHasSub" style="max-width: 25%">
+          <div
+            class="table_cell"
+            v-if="showHasSub && isShow"
+            style="max-width: 25%"
+          >
             <el-form-item
               label-width="130px"
               label="有无子条件:"
               :rules="rules.parHasSub"
               prop="parHasSub"
+              :disabled="form.parHasSub ? true : false"
             >
-              <el-select v-model="form.parHasSub" placeholder="请选择" @change="hasSubChange">
+              <el-select
+                v-model="form.parHasSub"
+                placeholder="请选择"
+                @change="hasSubChange"
+              >
                 <el-option label="有" :value="1"></el-option>
                 <el-option label="无" :value="0"></el-option>
               </el-select>
@@ -238,7 +266,12 @@
         />
         <el-form-item>
           <div class="form_btn">
-            <el-button type="primary" size="medium " @click="submitForm('ruleForm')">确定</el-button>
+            <el-button
+              type="primary"
+              size="medium "
+              @click="submitForm('ruleForm')"
+              >确定</el-button
+            >
           </div>
         </el-form-item>
       </el-form>
@@ -275,6 +308,7 @@ export default {
         parLenCode: "",
         klRuleByIdSub: [],
       },
+      isShow: false,
       rules: formRules,
       dragVal: null,
       dragArr: null,
@@ -310,6 +344,7 @@ export default {
       const obj = await this.ruleTermTypeList.find(
         (it1) => it1.code == this.form.parLenCode
       );
+      console.log(obj);
       this.baseTypeList = obj.subMenuList;
       this.subRuleMaxNum = obj.number;
 
@@ -409,7 +444,7 @@ export default {
               const dragArr = list[0].remark.split("|")[1].split(",");
               this.dragArr = dragArr;
               this.dragVal = item.subLenCode;
-              item.dragArr = dragArr
+              item.dragArr = dragArr;
               //取出互斥项
               const screenArr = obj.subMenuList.filter((item) =>
                 dragArr.some(
@@ -524,6 +559,7 @@ export default {
       this.baseTypeList = obj.subMenuList;
       this.subRuleMaxNum = obj.number;
       this.form.parHasSub = obj.subMenuList.length ? 1 : 0;
+      this.isShow = obj.subMenuList.length ? 1 : 0;
       this.setInitGroupData();
     },
     // 医学标准术语
@@ -679,9 +715,9 @@ export default {
         }
         if (arr.length == 3 && key != 0 && type) {
           //获取互斥项code
-          const val = key==1?arr[2].subLenCode:arr[1].subLenCode
+          const val = key == 1 ? arr[2].subLenCode : arr[1].subLenCode;
           const list = obj.subMenuList.filter((it) => {
-            return it.code ==val && it.remark.split("|")[0] == 3;
+            return it.code == val && it.remark.split("|")[0] == 3;
           });
           console.log(obj.subMenuList);
           const dragArr = list[0].remark.split("|")[1].split(",");
@@ -740,7 +776,7 @@ export default {
       this.$set(
         this.form.klRuleByIdSub[index],
         "baseTermTypeList",
-        (isDel && val == 1) || dragType ? screenArr : obj.subMenuList
+        (isDel && val == 2) || dragType ? screenArr : obj.subMenuList
       );
       this.$set(this.form.klRuleByIdSub[index], "subLenCode", "");
       this.$set(this.form.klRuleByIdSub[index], "dataType", "");
@@ -821,14 +857,16 @@ export default {
               }
             });
           });
-          if (len.length == 3 && (key == 1 || key == 0) && key==0?len[2].subLenCode:len[1].subLenCode) {
-            const dragVal = key==0?len[2].subLenCode:len[1].subLenCode
-            this.dragVal =dragVal;
+          if (
+            len.length == 3 && (key == 1 || key == 0) && key == 0
+              ? len[2].subLenCode
+              : len[1].subLenCode
+          ) {
+            const dragVal = key == 0 ? len[2].subLenCode : len[1].subLenCode;
+            this.dragVal = dragVal;
             const subobj = this.baseTypeList.find((it) => it.type == 1);
             const list = subobj.subMenuList.filter((it) => {
-              return (
-                it.code == dragVal && it.remark.split("|")[0] == 3
-              );
+              return it.code == dragVal && it.remark.split("|")[0] == 3;
             });
             // //获取互斥项code
             const dragArr = list[0].remark.split("|")[1].split(",");
@@ -953,7 +991,7 @@ export default {
             });
             len[1].baseTermTypeList = screenArr;
           }
-          
+
           this.dragVal = len[1].subLenCode;
         }
       } else {
@@ -1183,17 +1221,17 @@ export default {
     },
   },
   computed: {
-    disable: function() {
+    disable: function () {
       return Object.keys(this.firstPlace || {}).length > 0;
     },
-    ruleTermCodeStr: function() {
+    ruleTermCodeStr: function () {
       const str = this.form.parRuleType + "-" + this.form.parLenCode + "-" + 1;
       if (str.length <= 1) {
         return "";
       }
       return str;
     },
-    ruleTermCodeStr2: function() {
+    ruleTermCodeStr2: function () {
       const str = this.form.parRuleType + "-" + this.form.parLenCode + "-" + 0;
       if (str.length <= 1) {
         return "";
@@ -1201,32 +1239,35 @@ export default {
 
       return str;
     },
-    ruleTermCodeStrs: function() {
+    ruleTermCodeStrs: function () {
       const str = this.form.parRuleType + "-" + this.form.parLenCode;
       if (str.length <= 1) {
         return "";
       }
       return str;
     },
-    showMsg: function() {
+    showMsg: function () {
       return (
         this.ruleTermCodeStr.length > 2 &&
         this.msgDict.indexOf(this.ruleTermCodeStr) > -1
       );
     },
-    showMsg2: function() {
+    showMsg2: function () {
       return (
         this.ruleTermCodeStr2.length > 2 &&
         this.msgDict.indexOf(this.ruleTermCodeStr2) > -1
       );
     },
     showHasSub() {
+      console.log(this.ruleTermCodeStrs);
+      console.log(this.subDict);
       if (this.ruleTermCodeStrs.length > 2) {
+        console.log(this.subDict.indexOf(this.ruleTermCodeStrs) != -1);
         return this.subDict.indexOf(this.ruleTermCodeStrs) != -1;
       }
       return false;
     },
-    checkFirstPlace: function() {
+    checkFirstPlace: function () {
       return this.dict.indexOf(this.ruleTermCodeStrs) > -1;
     },
   },

File diff suppressed because it is too large
+ 7773 - 8394
yarn.lock