Browse Source

Merge remote-tracking branch 'origin/departShow' into dev5.3.4+

zhouna 5 năm trước cách đây
mục cha
commit
4e667254e7
1 tập tin đã thay đổi với 30 bổ sung1 xóa
  1. 30 1
      src/components/icss/AddMedicalName.vue

+ 30 - 1
src/components/icss/AddMedicalName.vue

@@ -206,7 +206,17 @@
             </el-form-item>
             <el-form-item label="科室:" v-if="dioType" class="marT">
                 <el-select v-model="dept">
-                    <el-option v-for="(it,i) in deptList" :label="it.name" :value="it.name"></el-option>
+                    <!-- <el-option v-for="(it,i) in deptList" :label="it.name" :value="it.name"></el-option> -->
+                    <el-option-group
+                    v-for="group in deptListArr"
+                    :key="group.label">
+                    <el-option
+                      v-for="item in group.deptList"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.name">
+                    </el-option>
+                  </el-option-group>
                 </el-select>
             </el-form-item>
             <el-form-item label="归属类型:" v-if="dioType" class="marT">
@@ -281,6 +291,7 @@ import SimilarListDrag from './SimilarListDrag'
         dioTypeList:[],//更多信息-类型
         dioType:'', //默认展示一类
         deptList:[], //更多信息-科室
+        deptListArr:[], //科室信息分组
         dept:'',  //默认展示全科
         similarList: [], //相似词列表
         searchIndex: -1, //展示哪个的同义词
@@ -338,6 +349,7 @@ import SimilarListDrag from './SimilarListDrag'
           if(data.code==0){
             this.deptList = data.data;
             if(!conptId){
+              console.log('this.deptListArr')
               this.dept = "全科"; //默认展示全科
             }else{
               // 科室id转成name显示
@@ -347,6 +359,23 @@ import SimilarListDrag from './SimilarListDrag'
                 }
               })
             }
+            const total = this.deptList.length;
+              const average = parseInt(total/3);
+              const mod = total%3; //余数
+              const firstGroup = this.deptList.slice(0,average);
+              let secGroup = [];
+              let thirdGroup = [];
+              let tempArr = []
+              if(mod == 2){
+                secGroup = this.deptList.slice(average,average*2+1);
+                thirdGroup = this.deptList.slice(average*2+1,total);
+              }else{
+                secGroup = this.deptList.slice(average,average*2);
+                thirdGroup = this.deptList.slice(average*2,total);
+              }
+              tempArr.push({label:1,deptList:firstGroup},{label:2,deptList:secGroup},{label:3,deptList:thirdGroup});
+              this.deptListArr = tempArr
+            
           }
         })
       },