浏览代码

Merge branch 'uiUpdate0507' into test

wyq 4 年之前
父节点
当前提交
7407a57e6d

+ 24 - 41
src/components/knowledgeExtra/AddDiagBase.vue

@@ -114,6 +114,7 @@
                 <span class="name">组</span>
               </template>
               <template slot-scope="scope">
+                {{scope.row.depart_id}}
                 <el-form-item>
                   <img
                     src="../../images/icon-add.png"
@@ -128,7 +129,7 @@
                     width="18"
                     class="icon"
                     @click="delGroup(scope.row.depart_id,scope.$index)"
-                    v-show="groupL[scope.row.depart_id].id>1"
+                    v-show="groupL[scope.row.depart_id]&&groupL[scope.row.depart_id].id>1"
                   />
                 </el-form-item>
               </template>
@@ -226,6 +227,7 @@
                       index +
                       '.klDiagnoseDetail.'+i+'.basLibType'"
                       v-if="!items.basNameType && v.title == '基础依据术语类型'"
+                      :rules="[{required: true,message: '请选择基础依据术语类型',trigger: ['change']}]"
                     >
                       <el-select
                         v-model="items.basLibType"
@@ -474,7 +476,7 @@ export default {
                     basDescription: '',
                     basLename: '',
                     basLibName: '',
-                    basLibType: '',
+                    basLibType: null,
                     basType: '',
                     eqOperator: '',
                     eqUnit: '',
@@ -540,7 +542,6 @@ export default {
         { name: '>=', key: '>=' }
       ],
       basType: '',
-      basLibType: '',
       dataType: '',
       spanArr: [],
       list: [], //提交数据数组,
@@ -711,7 +712,6 @@ export default {
       return dest;
     },
     groupL() {
-      console.log(this.form);
       let map = {},
         dest = [];
       let arr = [];
@@ -736,6 +736,7 @@ export default {
         }
       }
       dest.forEach((item, index) => {
+        item.depart_id = index;
         let arr1 = { id: item.groupVO.length };
         arr.push(arr1);
       });
@@ -817,7 +818,7 @@ export default {
                 basDescription: '',
                 basLename: '',
                 basLibName: '',
-                basLibType: '',
+                basLibType: null,
                 basType: '',
                 eqOperator: '',
                 eqUnit: '',
@@ -883,34 +884,15 @@ export default {
       this.setRules();
     },
     //删除依据
-    delDiag(id, i) {
-      const formData = JSON.parse(JSON.stringify(this.form));
-      let map = {},
-        dest = [];
-      for (let i = 0; i < formData.klDiagnoseTypeVO.length; i++) {
-        let ai = formData.klDiagnoseTypeVO[i];
-        if (!map[ai.depart_id]) {
-          dest.push({
-            depart_id: ai.depart_id,
-            conditionType: ai.conditionType,
-            groupVO: ai.groupVO
-          });
-          map[ai.depart_id] = ai;
-        } else {
-          for (let j = 0; j < dest.length; j++) {
-            var dj = dest[j];
-            if (dj.depart_id == ai.depart_id) {
-              dj.groupVO = dj.groupVO.concat(ai.groupVO);
-              break;
-            }
-          }
+    delDiag(id, inx) {
+      this.form.klDiagnoseTypeVO = this.form.klDiagnoseTypeVO.filter(
+        item => item.depart_id !== id
+      );
+      this.form.klDiagnoseTypeVO.forEach((item, index) => {
+        if (item.depart_id > id) {
+          item.depart_id = item.depart_id - 1;
         }
-      }
-      var index = dest.findIndex(item => {
-        return item.depart_id == id;
       });
-      dest.splice(index, 1);
-      this.form.klDiagnoseTypeVO = dest;
       this.setRules();
     },
     //新增组
@@ -930,7 +912,7 @@ export default {
             basDescription: '',
             basLename: '',
             basLibName: '',
-            basLibType: '',
+            basLibType: null,
             basType: '',
             eqOperator: '',
             eqUnit: '',
@@ -983,7 +965,7 @@ export default {
         basDescription: '',
         basLename: '',
         basLibName: '',
-        basLibType: '',
+        basLibType: null,
         basType: '',
         eqOperator: '',
         eqUnit: '',
@@ -1024,7 +1006,6 @@ export default {
     },
     //基础依据类型修改
     baseTermTypeChange(val, inx, index, i) {
-      console.log(val);
       if (!val) {
         return;
       }
@@ -1057,6 +1038,15 @@ export default {
         this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
           i
         ].basNameType = true;
+        this.$refs['form'].clearValidate([
+          'klDiagnoseTypeVO.' +
+            inx +
+            '.groupVO.' +
+            index +
+            '.klDiagnoseDetail.' +
+            i +
+            '.basLibType'
+        ]);
       } else {
         this.form.klDiagnoseTypeVO[inx].groupVO[index].klDiagnoseDetail[
           i
@@ -1254,13 +1244,6 @@ export default {
                     trigger: ['change']
                   }
                 ];
-                that.rules[keyTxt + '.basLibType'] = [
-                  {
-                    required: true,
-                    message: '请选择基础依据术语类型',
-                    trigger: ['change']
-                  }
-                ];
                 that.rules[keyTxt + '.dataType'] = [
                   {
                     required: true,

+ 67 - 15
src/components/knowledgeExtra/AddNewRule.vue

@@ -42,12 +42,35 @@
   .el-form-item.is-success .el-textarea__inner {
     border-color: #c9c9c9 !important;
   }
-  /deep/ .el-form-item.is-success .el-textarea__inner{
+  /deep/ .el-form-item.is-success .el-textarea__inner {
     border-color: #c9c9c9 !important;
   }
-  /deep/ .el-form-item.is-success .el-textarea__inner{
+  /deep/ .el-form-item.is-success .el-textarea__inner {
     border-color: #c9c9c9 !important;
   }
+  .my_error {
+    position: absolute;
+    top: 0;
+    left: -16px;
+    img {
+      width: 12px;
+      height: 12px;
+      cursor: pointer;
+    }
+  }
+}
+</style>
+<style lang="less">
+
+.popper_class {
+  // background: #fff !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;
 }
 </style>
 <template>
@@ -96,6 +119,19 @@
                 >
                 </el-option>
               </el-select>
+              <template slot="error" slot-scope="scope">
+                <div class="my_error">
+                  <el-tooltip
+                    class="item"
+                    effect="light"
+                    :content="scope.error"
+                    placement="top-start"
+                    popper-class="popper_class"
+                  >
+                    <img src="../../images/exclamationpoint.png" alt="" />
+                  </el-tooltip>
+                </div>
+              </template>
               <div class="tip_text">
                 注:更改规则类型,将会清空已填写的规则内容~
               </div>
@@ -109,6 +145,19 @@
               :rules="rules.parLenCode"
               prop="parLenCode"
             >
+              <template slot="error" slot-scope="scope">
+                <div class="my_error">
+                  <el-tooltip
+                    class="item"
+                    effect="light"
+                    :content="scope.error"
+                    placement="top-start"
+                    popper-class="popper_class"
+                  >
+                    <img src="../../images/exclamationpoint.png" alt="" />
+                  </el-tooltip>
+                </div>
+              </template>
               <el-select
                 v-model="form.parLenCode"
                 placeholder="请选择"
@@ -192,6 +241,7 @@
         </div>
         <!-- 表格 -->
         <AddNewRuleTable
+          ref="tableView"
           v-if="form.parHasSub && tableShow"
           :klRuleByIdSub="form.klRuleByIdSub"
           :maxNum="subRuleMaxNum"
@@ -267,8 +317,8 @@ export default {
     }
   },
   methods: {
-    clearValidate(data){
-      this.$refs.ruleForm.clearValidate(data)
+    clearValidate(data) {
+      this.$refs.ruleForm.clearValidate(data);
     },
     // 编辑初始化
     async initEdidData() {
@@ -570,6 +620,9 @@ export default {
         });
         this.form.klRuleByIdSub.splice(i + 1, 0, obj);
       }
+      this.$nextTick(() => {
+        this.$refs.tableView.scrollFun();
+      });
     },
     // 删除分组
     delGroup(groupId) {
@@ -655,17 +708,17 @@ 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);
-      // }
     }
+    // "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 () {
@@ -679,7 +732,6 @@ export default {
       return str;
     },
     showMsg: function () {
-      console.log(this.ruleTermCodeStr, "???", this.msgDict);
       return (
         this.ruleTermCodeStr.length > 2 &&
         this.msgDict.indexOf(this.ruleTermCodeStr) > -1

+ 59 - 50
src/components/knowledgeExtra/AddNewRuleTable.vue

@@ -116,7 +116,7 @@
       :data="klRuleByIdSub"
       size="mini"
       style="min-height: 200px"
-      height="calc(100vh - 383px)"
+      height="calc(100vh - 393px)"
       :header-row-style="{ background: '#E3EAF4' }"
       :cell-style="cellStyle"
       :span-method="ObjectSpanMethod"
@@ -350,7 +350,7 @@
                   >
                     <el-input
                       type="text"
-                      @input="maxChange($event, scope.$index, 'i')"
+                      @focus="maxChange($event, scope.$index, 'i')"
                       :ref="`klRuleByIdSub[${scope.$index}].subMaxValue`"
                       v-model="scope.row.subMaxValue"
                       placeholder="填写数值"
@@ -364,6 +364,7 @@
                   >
                     <el-input
                       type="text"
+                      @focus="setScrollRight"
                       v-model.trim="scope.row.subMaxUnit"
                       placeholder="填写单位"
                     />
@@ -423,7 +424,7 @@
                     <el-input
                       type="text"
                       :ref="`klRuleByIdSub[${scope.$index}].subMinValue`"
-                      @input="minChange($event, scope.$index, 'i')"
+                      @focus="minChange($event, scope.$index, 'i')"
                       v-model="scope.row.subMinValue"
                       placeholder="填写数值"
                     />
@@ -436,6 +437,7 @@
                   >
                     <el-input
                       type="text"
+                      @focus="setScrollRight"
                       v-model.trim="scope.row.subMinUnit"
                       placeholder="填写单位"
                     />
@@ -447,7 +449,7 @@
             <el-form-item
               class="type_content_item"
               style="flex: 2"
-              v-show="scope.row.subType !== 6 && scope.row.dataType === '2'"
+              v-if="scope.row.subType !== 6 && scope.row.dataType === '2'"
               label="医学内容:"
               label-width="100px"
               :prop="`klRuleByIdSub[${scope.$index}].subEqValue`"
@@ -469,6 +471,7 @@
                 type="textarea"
                 rows="1"
                 placeholder="请输入医学内容"
+                @focus="setScrollRight"
                 v-model.trim="scope.row.subEqValue"
               ></el-input>
             </el-form-item>
@@ -478,7 +481,7 @@
               label="正则表达式:"
               label-width="120px"
               style="flex: 2"
-              v-show="scope.row.subType === 6"
+              v-if="scope.row.subType === 6"
               :prop="`klRuleByIdSub[${scope.$index}].subEqValue1`"
               :rules="[
                 {
@@ -498,6 +501,7 @@
                 type="textarea"
                 rows="1"
                 placeholder="请输入正则表达式"
+                @focus="setScrollRight"
                 v-model.trim="scope.row.subEqValue"
               ></el-input>
             </el-form-item>
@@ -529,9 +533,12 @@ export default {
     };
   },
   methods: {
+    setScrollRight() {
+      this.$nextTick(() => {
+        this.$refs.table.bodyWrapper.scrollLeft = this.$refs.table.bodyWrapper.scrollWidth;
+      });
+    },
     maxChange(e, val, type) {
-      console.log(e);
-      // this.$refs[`klRuleByIdSub[0].subMinValue`].clearValidate()
       if (
         type === "i" &&
         this.klRuleByIdSub[val].subMaxOperator &&
@@ -551,10 +558,9 @@ export default {
           `klRuleByIdSub[${val}].subMinOperator`
         ]);
       }
+      this.setScrollRight();
     },
     minChange(e, val, type) {
-      console.log(e);
-      // this.$refs[`klRuleByIdSub[0].subMinValue`].clearValidate()
       if (
         type === "i" &&
         this.klRuleByIdSub[val].subMinOperator &&
@@ -574,6 +580,7 @@ export default {
           `klRuleByIdSub[${val}].subMaxValue`
         ]);
       }
+      this.setScrollRight();
     },
     addGroup(scope) {
       this.$emit("addGroup", null, { groupId: scope.row.groupId });
@@ -583,6 +590,10 @@ export default {
       this.$emit("addGroup", scope.row.groupId, { index: scope.$index });
       this.$refs.table.bodyWrapper.scrollLeft = 0;
     },
+    scrollFun() {
+      this.$refs.table.bodyWrapper.scrollTop =
+        this.$refs.table.bodyWrapper.scrollTop + 60;
+    },
     // table 隔行换色
     // rowStyle({ row }) {
     //   if (row.rowIndex % 2 == 0) {
@@ -726,7 +737,6 @@ export default {
         });
     },
     dataTypeChange(val, index) {
-      console.log(val, index);
       this.klRuleByIdSub[index].subEqOperator = val === "2" ? "=" : "";
       this.clearNumText(index);
       // TODO 新增的内容追踪不到
@@ -795,47 +805,46 @@ export default {
   beforeUpdate() {
     this.getSpanArr(this.klRuleByIdSub);
   },
-  mounted() {},
-  // beforeUpdate() {
-  //   this.getSpanArr(this.klRuleByIdSub);
-  //   console.log("boxxxxxxx", this.box);
-  //   // if (this.box) {
-  //   //   this.box.removeEventListener("scroll");
-  //   // }
-  //   // console.log(box);
-  //   // if (!this.box) {
-  //     this.box = document.querySelector(".el-table__body-wrapper");
-  //   // }
 
-  //   let that = this;
-  //   this.box.addEventListener("scroll", function (e) {
-  //     console.log(that.klRuleByIdSub.length);
-  //     console.log('subType',that.$refs[`klRuleByIdSub[1].subType`]);
-  //     that.klRuleByIdSub.forEach((ite, index) => {
-  //       // console.log(
-  //       //   that.$refs[`klRuleByIdSub[${index}].subType`],
-  //       //   that.$refs[`klRuleByIdSub[${index}].subLenCode`],
-  //       //   that.$refs[`klRuleByIdSub[${index}].subConceptId`],
-  //       //   that.$refs[`klRuleByIdSub[${index}].subMaxOperator`],
-  //       //   that.$refs[`klRuleByIdSub[${index}].subMinOperator`],
-  //       //   that.$refs[`klRuleByIdSub[${index}].subMinOperator`]
-  //       // );
-  //       that.$refs[`klRuleByIdSub[${index}].subType`] &&
-  //         that.$refs[`klRuleByIdSub[${index}].subType`].blur();
-  //       that.$refs[`klRuleByIdSub[${index}].subLenCode`] &&
-  //         that.$refs[`klRuleByIdSub[${index}].subLenCode`].blur();
-  //       that.$refs[`klRuleByIdSub[${index}].subConceptId`] &&
-  //         that.$refs[`klRuleByIdSub[${index}].subConceptId`].blur();
-  //       that.$refs[`klRuleByIdSub[${index}].dataType`] &&
-  //         that.$refs[`klRuleByIdSub[${index}].dataType`].blur();
-  //       that.$refs[`klRuleByIdSub[${index}].subMaxOperator`] &&
-  //         that.$refs[`klRuleByIdSub[${index}].subMaxOperator`].blur();
-  //       that.$refs[`klRuleByIdSub[${index}].subMinOperator`] &&
-  //         that.$refs[`klRuleByIdSub[${index}].subMinOperator`].blur();
-  //       that.$refs[`klRuleByIdSub[${index}]subMinOperator`] &&
-  //         that.$refs[`klRuleByIdSub[${index}]subMinOperator`].blur();
-  //     });
-  //   });
+  // watch: {
+  //   klRuleByIdSub: {
+  //     handler() {
+  //       let that = this;
+  //       // let box = document.querySelector(".el-table__body-wrapper");
+  //       this.$refs.table.bodyWrapper.addEventListener("scroll", function (e) {
+  //         // console.log(that.klRuleByIdSub.length);
+  //         // console.log('subType',that.$refs[`klRuleByIdSub[1].subType`]);
+  //         that.$nextTick(() => {
+  //           that.klRuleByIdSub.forEach((ite, index) => {
+  //             console.log(index);
+  //             console.log(
+  //               that.$refs[`klRuleByIdSub[${index}].subType`],
+  //               that.$refs[`klRuleByIdSub[${index}].subLenCode`],
+  //               that.$refs[`klRuleByIdSub[${index}].subConceptId`],
+  //               that.$refs[`klRuleByIdSub[${index}].subMaxOperator`],
+  //               that.$refs[`klRuleByIdSub[${index}].subMinOperator`],
+  //               that.$refs[`klRuleByIdSub[${index}].subMinOperator`]
+  //             );
+  //             that.$refs[`klRuleByIdSub[${index}].subType`] &&
+  //               that.$refs[`klRuleByIdSub[${index}].subType`].blur();
+  //             that.$refs[`klRuleByIdSub[${index}].subLenCode`] &&
+  //               that.$refs[`klRuleByIdSub[${index}].subLenCode`].blur();
+  //             that.$refs[`klRuleByIdSub[${index}].subConceptId`] &&
+  //               that.$refs[`klRuleByIdSub[${index}].subConceptId`].blur();
+  //             that.$refs[`klRuleByIdSub[${index}].dataType`] &&
+  //               that.$refs[`klRuleByIdSub[${index}].dataType`].blur();
+  //             that.$refs[`klRuleByIdSub[${index}].subMaxOperator`] &&
+  //               that.$refs[`klRuleByIdSub[${index}].subMaxOperator`].blur();
+  //             that.$refs[`klRuleByIdSub[${index}].subMinOperator`] &&
+  //               that.$refs[`klRuleByIdSub[${index}].subMinOperator`].blur();
+  //             that.$refs[`klRuleByIdSub[${index}]subMinOperator`] &&
+  //               that.$refs[`klRuleByIdSub[${index}]subMinOperator`].blur();
+  //           });
+  //         });
+  //       });
+  //     },
+  //     deep: true
+  //   }
   // },
   updated() {},
   props: {

二进制
src/images/exclamationpoint.png