Jelajahi Sumber

Merge branch 'uiUpdate0507' into test

reaper 4 tahun lalu
induk
melakukan
f42488981a

+ 77 - 29
src/components/knowledgeExtra/AddNewRule.vue

@@ -61,16 +61,15 @@
 }
 </style>
 <style lang="less">
-
 .popper_class {
   // background: #fff !important;
-  border: 1px solid #FFA0A0 !important;
+  border: 1px solid #ffa0a0 !important;
   color: #999999 !important;
   padding: 3px 50px 3px 10px !important;
   margin-left: -10px;
 }
-.popper__arrow{
-  border-top-color: #FFA0A0!important;
+.popper__arrow {
+  border-top-color: #ffa0a0 !important;
 }
 </style>
 <template>
@@ -253,6 +252,10 @@
           @setFormData="setFormData"
           @editKlRuleByIdSub="editKlRuleByIdSub"
           @clearValidate="clearValidate"
+          @childClearConcept="childClearConcept"
+          @childClearNumText="childClearNumText"
+          @ChildDataTypeChange="ChildDataTypeChange"
+          @childSubCodeChange="childSubCodeChange"
         />
         <el-form-item>
           <div class="form_btn">
@@ -384,6 +387,7 @@ export default {
     },
     // 提交
     submitForm(formName) {
+      console.log(this.form);
       this.$refs[formName].validate((valid) => {
         if (valid) {
           let params = JSON.parse(JSON.stringify(this.form));
@@ -420,7 +424,7 @@ export default {
     },
     // 子集修改父级的数组
     setFormData(index, data) {
-      this.form.klRuleByIdSub[index].conceptList = data;
+      this.$set(this.form.klRuleByIdSub[index], "conceptList", data);
     },
     // table_form 规则类型选中
     ruleTypeChange(val) {
@@ -536,28 +540,35 @@ export default {
     subTypeChange(val, index) {
       // index
       const obj = this.baseTypeList.find((it) => it.type === val);
-      this.form.klRuleByIdSub[index].baseTermTypeList = obj.subMenuList;
-      this.form.klRuleByIdSub[index].subLenCode = "";
-      this.form.klRuleByIdSub[index].dataType = "";
+
+      this.$set(
+        this.form.klRuleByIdSub[index],
+        "baseTermTypeList",
+        obj.subMenuList
+      );
+      this.$set(this.form.klRuleByIdSub[index], "subLenCode", "");
+      this.$set(this.form.klRuleByIdSub[index], "dataType", "");
+
       this.clearConcept(index);
       this.clearNumText(index);
     },
     clearConcept(index) {
-      this.form.klRuleByIdSub[index].subConceptId = "";
+      this.$set(this.form.klRuleByIdSub[index], "subConceptId", "");
       this.conceptList = [];
     },
     clearNumText(index) {
-      this.form.klRuleByIdSub[index].subMaxOperator = "";
-      this.form.klRuleByIdSub[index].subMaxValue = "";
-      this.form.klRuleByIdSub[index].subMaxUnit = "";
-      this.form.klRuleByIdSub[index].subMinOperator = "";
-      this.form.klRuleByIdSub[index].subMinValue = "";
-      this.form.klRuleByIdSub[index].subMinUnit = "";
-      this.form.klRuleByIdSub[index].subEqValue = "";
-      this.form.klRuleByIdSub[index].subEqOperator = "";
+      this.$set(this.form.klRuleByIdSub[index], "subMaxOperator", "");
+      this.$set(this.form.klRuleByIdSub[index], "subMaxValue", "");
+      this.$set(this.form.klRuleByIdSub[index], "subMaxUnit", "");
+      this.$set(this.form.klRuleByIdSub[index], "subMinOperator", "");
+      this.$set(this.form.klRuleByIdSub[index], "subMinValue", "");
+      this.$set(this.form.klRuleByIdSub[index], "subMinUnit", "");
+      this.$set(this.form.klRuleByIdSub[index], "subEqValue", "");
+      this.$set(this.form.klRuleByIdSub[index], "subEqOperator", "");
     },
     editKlRuleByIdSub(data) {
-      this.form.klRuleByIdSub = data;
+      this.$set(this.form, "klRuleByIdSub", data);
+      // this.form.klRuleByIdSub = data;
     },
     // 添加分组 || 规则
     addGroup(date, arg = { index: null, groupId: null }) {
@@ -622,7 +633,6 @@ export default {
       }
       this.$nextTick(() => {
         this.$refs.tableView.scrollFun();
-        
       });
     },
     // 删除分组
@@ -693,6 +703,54 @@ export default {
           });
         }
       });
+    },
+    /**
+     * 子组件调用方法
+     */
+    childClearConcept(index) {
+      this.$set(this.form.klRuleByIdSub[index], "subConceptId", "");
+      this.$set(this.form.klRuleByIdSub[index], "conceptList", []);
+    },
+    childClearNumText(index) {
+      let obj = JSON.parse(JSON.stringify(this.form.klRuleByIdSub));
+
+      obj[index].subMaxOperator = "";
+      obj[index].subMaxValue = "";
+      obj[index].subMaxUnit = "";
+      obj[index].subMinOperator = "";
+      obj[index].subMinValue = "";
+      obj[index].subMinUnit = "";
+      obj[index].subEqValue = "";
+      // this.$set(obj[index], "subEqValue", "");
+      obj[index].subEqOperator = "";
+      // this.klRuleByIdSub = obj;
+      // this.$emit("editKlRuleByIdSub", obj);
+      this.editKlRuleByIdSub(obj);
+    },
+    ChildDataTypeChange(val, index) {
+      // this.form.klRuleByIdSub[index].subEqOperator = val === "2" ? "=" : "";
+      this.$set(
+        this.form.klRuleByIdSub[index],
+        "subEqOperator",
+        val === "2" ? "=" : ""
+      );
+
+      this.childClearNumText(index);
+      // TODO 新增的内容追踪不到
+      this.form.klRuleByIdSub.forEach((item, i) => {
+        if (index === i) {
+          this.$set(item, "dataType", val);
+        }
+      });
+    },
+    childSubCodeChange(val, index, numTypes) {
+      if ((numTypes + ",").indexOf(val + ",") > -1) {
+        this.$set(this.form.klRuleByIdSub[index], "dataType", "1");
+      } else {
+        this.$set(this.form.klRuleByIdSub[index], "dataType", "1");
+      }
+      this.childClearConcept(index);
+      this.childClearNumText(index);
     }
   },
   watch: {
@@ -710,16 +768,6 @@ export default {
       },
       deep: true
     }
-    // "form.parHasSub"(val) {
-    //   console.log(val);
-    //   console.log(this.form);
-    //   // if (!val || val == 0) {
-    //   //   // this.form.klRuleByIdSub = [];
-    //   //   this.$set(this.form, "klRuleByIdSub", []);
-
-    //   //   console.log(this.form);
-    //   // }
-    // }
   },
   computed: {
     disable: function () {

+ 76 - 88
src/components/knowledgeExtra/AddNewRuleTable.vue

@@ -1,5 +1,5 @@
 <style lang="less" scoped>
-.AddNewRuleTable {
+#AddNewRuleTable {
   width: 100%;
   background: #fff;
   margin-top: 10px;
@@ -91,12 +91,15 @@
     font-size: 14px;
     font-weight: 400;
   }
+  /deep/ .el-select{
+    font-size: 12px;
+  }
 }
 </style>
 
 <template>
   <!-- :prop="`klRuleByIdSub[${scope.$index}].subDescription`" -->
-  <div class="AddNewRuleTable">
+  <div id="AddNewRuleTable">
     <h4 style="margin-bottom: 24px">规则内容:</h4>
     <!-- 隔行换色  :row-style="rowStyle" -->
     <el-table
@@ -363,7 +366,6 @@
                 <el-col :span="6">
                   <el-form-item
                     :prop="`klRuleByIdSub[${scope.$index}].subMaxUnit`"
-                    :rules="rules.subMaxUnit"
                   >
                     <el-input
                       type="text"
@@ -442,7 +444,7 @@
                 <el-col :span="6">
                   <el-form-item
                     :prop="`klRuleByIdSub[${scope.$index}].subMinUnit`"
-                    :rules="rules.subMinUnit"
+                    :rules="[{ required: true, trigger: 'blur' }]"
                   >
                     <el-input
                       type="text"
@@ -455,65 +457,74 @@
               </el-row>
             </el-form-item>
             <!-- v-if="klRuleByIdSub[scope.$index].subType !== 6 && klRuleByIdSub[scope.$index].dataType === '2'" -->
-            <el-form-item
-              class="type_content_item"
+            <div
               style="flex: 2"
-              v-if="scope.row.subType !== 6 && scope.row.dataType === '2'"
-              label="医学内容:"
-              label-width="100px"
-              :prop="`klRuleByIdSub[${scope.$index}].subEqValue`"
-              :rules="[
-                {
-                  required: true,
-                  message: '请输入' + textName(scope.$index),
-                  trigger: 'blur'
-                },
-                {
-                  validator: (rule, value, callback) => {
-                    subEqValue(scope, rule, value, callback);
-                  },
-                  trigger: 'blur'
-                }
-              ]"
+              v-if="scope.row.subType != 6 && scope.row.dataType == '2'"
             >
-              <el-input
-                type="textarea"
-                rows="1"
-                placeholder="请输入医学内容"
-                @focus="setScrollRight"
-                v-model.trim="scope.row.subEqValue"
-              ></el-input>
-            </el-form-item>
+              <el-form-item
+                class="type_content_item"
+                style="width: 100%"
+                label="医学内容:"
+                label-width="100px"
+                :prop="`klRuleByIdSub[${scope.$index}].subEqValue`"
+                :rules="[
+                  {
+                    required: true,
+                    message: '请输入' + textName(scope.$index),
+                    trigger: 'blur'
+                  },
+                  {
+                    validator: (rule, value, callback) => {
+                      subEqValue(scope, rule, value, callback);
+                    },
+                    trigger: 'blur'
+                  }
+                ]"
+              >
+                <el-input
+                  type="textarea"
+                  rows="1"
+                  placeholder="请输入医学内容"
+                  @focus="setScrollRight"
+                  v-model.trim="scope.row.subEqValue"
+                ></el-input>
+              </el-form-item>
+            </div>
+
             <!-- v-if="groupData.subType === 6" -->
-            <el-form-item
-              class="type_content_item"
-              label="正则表达式:"
-              label-width="120px"
+            <div
               style="flex: 2"
-              v-if="scope.row.subType === 6"
-              :prop="`klRuleByIdSub[${scope.$index}].subEqValue1`"
-              :rules="[
-                {
-                  required: true,
-                  message: '请输入' + textName(scope.$index),
-                  trigger: 'blur'
-                },
-                {
-                  validator: (rule, value, callback) => {
-                    subEqValue(scope, rule, value, callback);
-                  },
-                  trigger: 'blur'
-                }
-              ]"
+              v-if="scope.row.subType == 6"
             >
-              <el-input
-                type="textarea"
-                rows="1"
-                placeholder="请输入正则表达式"
-                @focus="setScrollRight"
-                v-model.trim="scope.row.subEqValue"
-              ></el-input>
-            </el-form-item>
+              <el-form-item
+                class="type_content_item"
+                label="正则表达式:"
+                label-width="120px"
+                style="width: 100%"
+                :prop="`klRuleByIdSub[${scope.$index}].subEqValue1`"
+                :rules="[
+                  {
+                    required: true,
+                    message: '请输入' + textName(scope.$index),
+                    trigger: 'blur'
+                  },
+                  {
+                    validator: (rule, value, callback) => {
+                      subEqValue(scope, rule, value, callback);
+                    },
+                    trigger: 'blur'
+                  }
+                ]"
+              >
+                <el-input
+                  type="textarea"
+                  rows="1"
+                  placeholder="请输入正则表达式"
+                  @focus="setScrollRight"
+                  v-model.trim="scope.row.subEqValue"
+                ></el-input>
+              </el-form-item>
+            </div>
           </div>
         </template>
       </el-table-column>
@@ -697,32 +708,13 @@ export default {
     // 规则术语类型
     subCodeChange(val, index) {
       //基础规则术语类型修改
-      if ((this.numTypes + ",").indexOf(val + ",") > -1) {
-        this.klRuleByIdSub[index].dataType = "1";
-      } else {
-        this.klRuleByIdSub[index].dataType = "";
-      }
-      this.clearConcept(index);
-      this.clearNumText(index);
+      this.$emit("childSubCodeChange", val, index, this.numTypes);
     },
     clearConcept(index) {
-      this.klRuleByIdSub[index].subConceptId = "";
-      this.klRuleByIdSub[index].conceptList = [];
+      this.$emit("childClearConcept", index);
     },
     clearNumText(index) {
-      let obj = JSON.parse(JSON.stringify(this.klRuleByIdSub));
-
-      obj[index].subMaxOperator = "";
-      obj[index].subMaxValue = "";
-      obj[index].subMaxUnit = "";
-      obj[index].subMinOperator = "";
-      obj[index].subMinValue = "";
-      obj[index].subMinUnit = "";
-      obj[index].subEqValue = "";
-      // this.$set(obj[index], "subEqValue", "");
-      obj[index].subEqOperator = "";
-      // this.klRuleByIdSub = obj;
-      this.$emit("editKlRuleByIdSub", obj);
+      this.$emit("childClearNumText", index);
     },
     //医学标准术语change
     subConceptIdfocus(index) {
@@ -752,11 +744,7 @@ export default {
         });
     },
     dataTypeChange(val, index) {
-      this.klRuleByIdSub[index].subEqOperator = val === "2" ? "=" : "";
-      this.clearNumText(index);
-      // TODO 新增的内容追踪不到
-      //delete this.klRuleByIdSub[index].dataType; //触发更新
-      this.$set(this.klRuleByIdSub[index], "dataType", val);
+      this.$emit("ChildDataTypeChange", val, index);
     },
     // 处理要合并相同行的列
     getSpanArr(data) {
@@ -807,17 +795,17 @@ export default {
     },
     textName(index) {
       return this.klRuleByIdSub[index].subType !== 6 &&
-        this.klRuleByIdSub[index].dataType === "2"
+        this.klRuleByIdSub[index].dataType == "2"
         ? "医学内容"
         : "正则表达式";
     },
     blurRef() {
-      console.log('11111');
+      console.log("11111");
       this.$nextTick(() => {
         console.log("???", this.$refs[this.theRef]);
         this.$refs[this.theRef].handleClose();
       });
-    },
+    }
   },
   components: {},
   mounted() {

+ 1 - 1
vue.config.js

@@ -1,7 +1,7 @@
 const path = require('path');
 // const proxy_path = 'http://192.168.2.236:80';
 // const proxy_path = 'http://192.168.2.241:88';
-const proxy_path = 'http://192.168.2.236:5050';
+const proxy_path = 'http://192.168.2.236:88';
 // const proxy_path = 'http://192.168.3.101:5050';
 // const proxy_path = 'http://192.168.3.117:5050';//周铁刚
 // const proxy_path = 'http://192.168.3.113:5050'; //王峰