Selaa lähdekoodia

Merge remote-tracking branch 'origin/test' into test

zhouna 5 vuotta sitten
vanhempi
commit
e61021d2ce
1 muutettua tiedostoa jossa 22 lisäystä ja 7 poistoa
  1. 22 7
      src/components/icss/AddMedicalMultRelation.vue

+ 22 - 7
src/components/icss/AddMedicalMultRelation.vue

@@ -30,12 +30,14 @@
             :data="list"
             :props="defaultProps"
             node-key="conceptId"
-            default-expand-all
             draggable
             :allow-drag="allowDrag"
             :allow-drop="allowDrop"
-            :expand-on-click-node="false">
-            <span class="custom-tree-node" slot-scope="{ node, data }">
+            :expand-on-click-node="true"
+            :default-expanded-keys="defaultExpandedArr"
+            @node-click = "handleNodeClick"
+          >
+            <span class="custom-tree-node" slot-scope="{ node, data }" >
                 <span class="custom-tree-node-name ellipsis" :class="{colorGray: data.isDeletedConcept == 'Y'}" :title="node.label">{{ node.label }}</span>
                 <span class="btn-box">
                   <el-button
@@ -130,7 +132,8 @@ import api from '@api/icss.js';
         isEdit: false,  //是否为修改
         relationConceptId: '', //关联父类ID
         level: 0, //层级(修改时只能显示三级)
-        saveDisable: false  //保存按钮禁止点击
+        saveDisable: false,  //保存按钮禁止点击
+        defaultExpandedArr: []
       }
     },
     created(){
@@ -141,6 +144,7 @@ import api from '@api/icss.js';
           this.minTitle = '分诊人体图数据维护-修改'
           const item = JSON.parse(JSON.stringify(data))
           item.level = 0
+          item.isExpanded = false
           item.nodeList = this.IteraNodeList(item.nodeList, [], 1)
           this.list[0] = item
       }
@@ -166,6 +170,17 @@ import api from '@api/icss.js';
       allowDrag(draggingNode) {
         return draggingNode.data.level != 0;//一级不可拖动
       },
+      handleNodeClick(data) {
+          if(data.nodeList.length > 0) {
+            if(!data.isExpanded) {
+              this.defaultExpandedArr.push(data.conceptId)
+            } else {
+              this.defaultExpandedArr = this.defaultExpandedArr.filter(item => item !== data.conceptId)
+            }
+            this.$set(data, 'isExpanded', !data.isExpanded);
+          }
+      
+      },
       addConcept(e) {
         this.addLevel = 0;
         this.openSearch(e);
@@ -187,7 +202,7 @@ import api from '@api/icss.js';
         api.addMultRelation(param).then((res) => {
           const { data } = res
           if(data.code == '0') {
-            this.message(res.data.msg||'术语建立成功','success');
+            this.message(res.data.msg||'术语关系建立成功','success');
             setTimeout(() => {
               //返回带搜索条件的首页
               this.$router.push({name:'MedicalMultRelation',params:Object.assign({},this.$route.params,{currentPage:1})});
@@ -203,10 +218,10 @@ import api from '@api/icss.js';
         for(let i = 0; i <nodeList.length; i++) {
           let newChild;
           if(type == '0') { //添加的时候保存所有的id列表
-            newChild = {conceptId: nodeList[i].conceptId, relationId: 17,nodeList:[],sonRelationId: 17}
+            newChild = {conceptId: nodeList[i].conceptId, relationId: 17,nodeList:[],sonRelationId: 17, isExpanded:false}
           } else if(type == '1') {  //修改的时候添加层级
             const item = JSON.parse(JSON.stringify(nodeList[i]))
-            newChild = Object.assign(item, {level:  level, nodeList: [],sonRelationId: 17})
+            newChild = Object.assign(item, {level:  level, nodeList: [],sonRelationId: 17, isExpanded:false})
           } else if(type == '2') { //移除节点的时候同时移除节点(搜索时排除的id列表)
             newChild = nodeList[i].conceptId
           }