Pārlūkot izejas kodu

修改套餐细项判断

wyq 4 gadi atpakaļ
vecāks
revīzija
a4e9437781
1 mainītis faili ar 30 papildinājumiem un 5 dzēšanām
  1. 30 5
      src/components/base/LtModal.vue

+ 30 - 5
src/components/base/LtModal.vue

@@ -37,7 +37,7 @@
                     <el-input v-model.trim="form.hisCode" clearable style="minWidth: 240px"></el-input>
                   </el-form-item>
                 </el-col>
-                <el-col :span="16" v-if="type == 1">
+                <el-col :span="16" v-if="type == 1 || type == 2">
                   <el-form-item :label="detail+':'" prop="hisDetailName">
                     <el-input
                       v-model.trim="form.hisDetailName"
@@ -201,12 +201,14 @@ export default {
       drugList: [],
       tableData: [],
       mapList: [],
-      getIndex: 6
+      getIndex: 6,
+      ty:this.type,
+      searchType:''
     };
   },
   created() {
     //修改
-    if (this.data != {}) {
+    if (JSON.stringify(this.data) != '{}') {
       this.isEdit = true;
       this.editId = this.data.id;
       this.form.hisName = this.data.hisName;
@@ -255,9 +257,17 @@ export default {
         this.uniqueNameList = [];
         return;
       }
+      if (this.type == 1) {
+        const { hisName, hisDetailName } = this.form;
+        this.ty = 2; // 1-化验大项、2-化验小项
+        if (hisName !== '' && hisDetailName === '') {
+          this.ty = 1;
+        }
+        this.searchType = this.ty;
+      }
       this.showDrop = true;
       let params = {
-        type: this.type,
+        type: this.ty ? this.ty : this.type,
         inputStr: query,
         sex: 3,
         age: 0
@@ -328,7 +338,7 @@ export default {
     },
     getTermMatching() {
       let params = {
-        type: this.ty ? this.ty : this.type,
+        type: this.type,
         inputStr: this.form.hisName
       };
       api.getTermMatching(params).then(res => {
@@ -354,6 +364,21 @@ export default {
             source
           } = this.form;
           // 当标准术语是套餐时,细项必须为空
+          if (this.searchType === 1 && hisDetailName !== '') {
+            this.warning('医院术语与标准术语类型不匹配,请修改');
+            return;
+          }
+
+          // 当标准术语是细项时,医院术语套餐和细项均不能为空
+          if (this.searchType === 2) {
+            if (hisName === '') {
+              this.warning('医院术语与标准术语类型不匹配,请修改');
+              return;
+            } else if (hisDetailName === '') {
+              this.warning('医院术语与标准术语类型不匹配,请修改');
+              return;
+            }
+          }
           let params = {
             hisName: hisName,
             uniqueName: searchText,