Browse Source

添加慢病和指标值维护搜索展示修改(不直接操作dom)

zhangxc 5 years ago
parent
commit
d249340a42
1 changed files with 15 additions and 16 deletions
  1. 15 16
      src/components/icss/AddChronicAndIndexRelation.vue

+ 15 - 16
src/components/icss/AddChronicAndIndexRelation.vue

@@ -15,7 +15,7 @@
             <el-form-item  class="addDepartFormItem"  v-if="!isEdit" label="选择慢病标准术语(概念ID):" prop="department">
             <el-form-item  class="addDepartFormItem"  v-if="!isEdit" label="选择慢病标准术语(概念ID):" prop="department">
                 <input class="searchInput"  @focus="focuInput" type="text" v-model = "searchDiagVal"> 
                 <input class="searchInput"  @focus="focuInput" type="text" v-model = "searchDiagVal"> 
                 <span class="searchName" @click="searchDiag">搜索</span>
                 <span class="searchName" @click="searchDiag">搜索</span>
-                <ul class="itemList diagList" ref="diagList">
+                <ul v-if="showDiagList&&diagList.length > 0" class="itemList diagList" ref="diagList">
                     <li 
                     <li 
                     v-for="item in diagList" 
                     v-for="item in diagList" 
                     class="diagItem ellipsis"
                     class="diagItem ellipsis"
@@ -35,7 +35,7 @@
                     <label class="screenIndexLabel">选择化验指标公表项内容(概念ID):</label>
                     <label class="screenIndexLabel">选择化验指标公表项内容(概念ID):</label>
                     <input class="searchInput"  @focus="focuInput" type="text" v-model = "searchIndexVal"> 
                     <input class="searchInput"  @focus="focuInput" type="text" v-model = "searchIndexVal"> 
                     <span class="searchName" @click="searchIndex">搜索</span>
                     <span class="searchName" @click="searchIndex">搜索</span>
-                    <ul class="itemList indexList" ref="indexList">
+                    <ul v-if="showIndexList&&indexList.length > 0" class="itemList indexList" ref="indexList">
                         <li 
                         <li 
                         v-for="item in indexList" 
                         v-for="item in indexList" 
                         class="diagItem ellipsis"
                         class="diagItem ellipsis"
@@ -90,7 +90,9 @@
             searchDiagVal: '',
             searchDiagVal: '',
             searchIndexVal: '',
             searchIndexVal: '',
             isEdit: false,
             isEdit: false,
-            saveDisable: false 
+            saveDisable: false,
+            showDiagList: false,
+            showIndexList: false
         }
         }
     },
     },
     created(){
     created(){
@@ -123,38 +125,38 @@
         close() {
         close() {
             this.diagList = [];
             this.diagList = [];
             this.indexList = [];
             this.indexList = [];
-            if(this.diagList.length>0){this.$refs['diagList'].style.display = 'none';}
-            if(this.indexList.length>0){this.$refs['indexList'].style.display = 'none';}
         },
         },
         back(){
         back(){
             this.$router.go(-1);
             this.$router.go(-1);
         },
         },
         searchDiag() {
         searchDiag() {
+            if(!this.searchDiagVal.trim()) {
+                return
+            }
             const param = {
             const param = {
                 "diseaseName": this.searchDiagVal,
                 "diseaseName": this.searchDiagVal,
             }
             }
             api.queryIndexConfigDiseaseNames(param).then((res)=>{
             api.queryIndexConfigDiseaseNames(param).then((res)=>{
                if(res.data.code === '0') {
                if(res.data.code === '0') {
                    this.diagList = res.data.data
                    this.diagList = res.data.data
-                   if(this.diagList.length>0) {this.$refs['diagList'].style.display = 'block'}
-                   if(this.indexList.length>0) {this.$refs['indexList'].style.display = 'none'}
+                   this.showDiagList = true
                 }
                 }
             })
             })
         },
         },
         selectDiag(item) {
         selectDiag(item) {
             this.form.diseaseId = item.diseaseId
             this.form.diseaseId = item.diseaseId
             this.form.diseaseName = item.diseaseName
             this.form.diseaseName = item.diseaseName
-            this.$refs['diagList'].style.display='none'
             this.searchDiagVal = ''
             this.searchDiagVal = ''
             this.diagList=[]
             this.diagList=[]
         },
         },
         focuInput() {
         focuInput() {
-          if(this.$refs){
-            this.$refs['diagList'].style.display='none';
-            this.$refs['indexList'].style.display='none';
-          }
+            this.showDiagList = false
+            this.showIndexList = false
         },
         },
         searchIndex() {
         searchIndex() {
+             if(!this.searchIndexVal.trim()) {
+                return
+            }
              const param = {
              const param = {
                 conceptName: this.searchIndexVal,
                 conceptName: this.searchIndexVal,
                 excludedConceptNames:  this.selectedIndexMap
                 excludedConceptNames:  this.selectedIndexMap
@@ -170,8 +172,7 @@
                     //     {conceptName : '糖化血红蛋白'},
                     //     {conceptName : '糖化血红蛋白'},
                     //     {conceptName : '血常规'},
                     //     {conceptName : '血常规'},
                     // ]
                     // ]
-                   if(this.indexList.length > 0){this.$refs['indexList'].style.display='block'}
-                   if(this.diagList.length>0) {this.$refs['diagList'].style.display = 'none'}
+                    this.showIndexList = true
                 }
                 }
             })
             })
         },
         },
@@ -179,7 +180,6 @@
             this.selectedIndexList.push({indexUnique: item.conceptName, conceptId: item.conceptId, indexDesc:''})
             this.selectedIndexList.push({indexUnique: item.conceptName, conceptId: item.conceptId, indexDesc:''})
             this.selectedIndexMap.push(item.conceptName)
             this.selectedIndexMap.push(item.conceptName)
             this.indexList = []
             this.indexList = []
-            this.$refs['indexList'].style.display='none'
         },
         },
         delSelectedIndex(selectedItem, index) {
         delSelectedIndex(selectedItem, index) {
             this.selectedIndexMap = this.selectedIndexMap.filter((item) => {return item != selectedItem.indexUnique})
             this.selectedIndexMap = this.selectedIndexMap.filter((item) => {return item != selectedItem.indexUnique})
@@ -295,7 +295,6 @@
         }
         }
         .itemList {
         .itemList {
             position: absolute;
             position: absolute;
-            display: none;
             background: #fff;
             background: #fff;
             width: 162px;
             width: 162px;
             max-height: 150px;
             max-height: 150px;