|
@@ -1,12 +1,15 @@
|
|
|
<template>
|
|
|
<div class="addMedicalMultRelationWrapper">
|
|
|
- <crumbs :title="minTitle" :param="$route.params" fix="fixed" linkTo="AboutDisease"></crumbs>
|
|
|
+ <crumbs
|
|
|
+ :title="minTitle"
|
|
|
+ :param="$route.params"
|
|
|
+ fix="fixed"
|
|
|
+ linkTo="AboutDisease"
|
|
|
+ ></crumbs>
|
|
|
<div class="contents">
|
|
|
<div class="content">
|
|
|
<div class="addBtn" v-if="list.length == 0">
|
|
|
- <el-button
|
|
|
- @click="addConcept"
|
|
|
- >+ 新 增</el-button>
|
|
|
+ <el-button @click="addConcept">+ 新 增</el-button>
|
|
|
</div>
|
|
|
|
|
|
<div class="tree">
|
|
@@ -21,424 +24,510 @@
|
|
|
:render-after-expand="true"
|
|
|
:highlight-current="true"
|
|
|
:default-expanded-keys="defaultExpandedArr"
|
|
|
- @node-click = "handleNodeClick"
|
|
|
+ @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
|
|
|
- class="btn-add fl"
|
|
|
- v-if="data.level < 2 &&data.level>0"
|
|
|
- type="text"
|
|
|
- size="mini"
|
|
|
- @click="(e) => append(data, e)">
|
|
|
- + 增加
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- class="btn-del fr"
|
|
|
- v-if="data.level > 1"
|
|
|
- type="text"
|
|
|
- size="mini"
|
|
|
- @click.stop="() => remove(node, data)">
|
|
|
- 删除
|
|
|
- </el-button>
|
|
|
- </span>
|
|
|
+ <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 }} <i v-show="data.drugC && node.parent.data.conceptName == '疾病相关药物治疗'">({{ data.drugC }})</i></span
|
|
|
+ >
|
|
|
+ <span class="btn-box">
|
|
|
+ <el-button
|
|
|
+ class="btn-add fl"
|
|
|
+ v-if="data.level < 2 && data.level > 0"
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click="(e) => append(data, e)"
|
|
|
+ >
|
|
|
+ + 增加
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ class="btn-del fr"
|
|
|
+ v-if="data.level > 1"
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click.stop="() => remove(node, data)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ <!-- <el-button @click="showNodeData(node,data)"> 显示</el-button> -->
|
|
|
+ </span>
|
|
|
</span>
|
|
|
</el-tree>
|
|
|
</div>
|
|
|
<div class="btn">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- :disabled = 'saveDisable'
|
|
|
- @click="confirm"
|
|
|
- >确 定</el-button>
|
|
|
+ <el-button type="primary" :disabled="saveDisable" @click="confirm"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="btmFix"></div>
|
|
|
- <SearchList
|
|
|
+ <SearchList
|
|
|
v-if="showSearch"
|
|
|
ref="searchDom"
|
|
|
- :conceptList="conceptList||[]"
|
|
|
+ :conceptList="conceptList || []"
|
|
|
:addLevel="addLevel"
|
|
|
placeTxt="请输入术语"
|
|
|
title="疾病相关术语"
|
|
|
top="120px"
|
|
|
- @closeSearch="closeSearch"
|
|
|
- @selectConcept="selectConcept"
|
|
|
- @searchConcept="searchConcept" />
|
|
|
+ @closeSearch="closeSearch"
|
|
|
+ @selectConcept="selectConcept"
|
|
|
+ @searchConcept="searchConcept"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script type="text/javascript">
|
|
|
-import api from '@api/knowledgeTree.js';
|
|
|
-import SearchList from '../basicKnow/SearchList.vue';
|
|
|
+import api from "@api/knowledgeTree.js";
|
|
|
+import SearchList from "../basicKnow/SearchList.vue";
|
|
|
|
|
|
export default {
|
|
|
- name:'DiseaseTree',
|
|
|
- components:{
|
|
|
- SearchList
|
|
|
- },
|
|
|
- data(){
|
|
|
- return{
|
|
|
- minTitle:'疾病相关维护-添加',
|
|
|
- tab:[
|
|
|
- {name:'ICD10疾病类别',id:'1'},
|
|
|
- {name:'科室疾病类别',id:'2'},
|
|
|
- {name:'药物类别',id:'3'},
|
|
|
- {name:'症状类别',id:'4'},
|
|
|
- {name:'手术和操作类别',id:'5'},
|
|
|
- {name:'实验室检查类别',id:'6'},
|
|
|
- {name:'辅助检查类别',id:'7'},
|
|
|
+ name: "DiseaseTree",
|
|
|
+ components: {
|
|
|
+ SearchList,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ minTitle: "疾病相关维护-添加",
|
|
|
+ tab: [
|
|
|
+ { name: "ICD10疾病类别", id: "1" },
|
|
|
+ { name: "科室疾病类别", id: "2" },
|
|
|
+ { name: "药物类别", id: "3" },
|
|
|
+ { name: "症状类别", id: "4" },
|
|
|
+ { name: "手术和操作类别", id: "5" },
|
|
|
+ { name: "实验室检查类别", id: "6" },
|
|
|
+ { name: "辅助检查类别", id: "7" },
|
|
|
+ ],
|
|
|
+ template: {
|
|
|
+ conceptId: null,
|
|
|
+ conceptName: "",
|
|
|
+ nodeList: [
|
|
|
+ {
|
|
|
+ conceptId: 501,
|
|
|
+ conceptName: "疾病相关主症状",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [103],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 502,
|
|
|
+ conceptName: "疾病相关次症状",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [103],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 503,
|
|
|
+ conceptName: "疾病相关体格检查结果",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [104],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 504,
|
|
|
+ conceptName: "疾病相关实验室检查套餐",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [107],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 505,
|
|
|
+ conceptName: "疾病相关辅助检查项目",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [109, 110],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 506,
|
|
|
+ conceptName: "疾病相关药物治疗",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [101],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 507,
|
|
|
+ conceptName: "疾病相关手术治疗",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [106],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 508,
|
|
|
+ conceptName: "疾病相关鉴别诊断",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [100],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 509,
|
|
|
+ conceptName: "疾病相关量表",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [124],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 510,
|
|
|
+ conceptName: "疾病相关护理",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [123],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ conceptId: 516,
|
|
|
+ conceptName: "经典病例",
|
|
|
+ nodeList: [],
|
|
|
+ libType: [411],
|
|
|
+ level: 1,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
],
|
|
|
- template:{
|
|
|
- "conceptId": null,
|
|
|
- "conceptName": "",
|
|
|
- "nodeList": [{
|
|
|
- "conceptId": 501,
|
|
|
- "conceptName": "疾病相关主症状",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [103],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 502,
|
|
|
- "conceptName": "疾病相关次症状",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [103],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 503,
|
|
|
- "conceptName": "疾病相关体格检查结果",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [104],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 504,
|
|
|
- "conceptName": "疾病相关实验室检查套餐",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [107],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 505,
|
|
|
- "conceptName": "疾病相关辅助检查项目",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [109, 110],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 506,
|
|
|
- "conceptName": "疾病相关药物治疗",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [101],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 507,
|
|
|
- "conceptName": "疾病相关手术治疗",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [106],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 508,
|
|
|
- "conceptName": "疾病相关鉴别诊断",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [100],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 509,
|
|
|
- "conceptName": "疾病相关量表",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [124],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 510,
|
|
|
- "conceptName": "疾病相关护理",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [123],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }, {
|
|
|
- "conceptId": 511,
|
|
|
- "conceptName": "经典病例",
|
|
|
- "nodeList": [],
|
|
|
- "libType": [411],
|
|
|
- "level": 1,
|
|
|
- "sonRelationId": 17,
|
|
|
- "isExpanded": false
|
|
|
- }
|
|
|
- ],
|
|
|
- "level": 0,
|
|
|
- "isExpanded": false
|
|
|
- },
|
|
|
- curId:'1',
|
|
|
- list: [],
|
|
|
- defaultProps: {
|
|
|
- children: 'nodeList',
|
|
|
- label: 'conceptName'
|
|
|
- },
|
|
|
- conceptList: [], //概念列表
|
|
|
- showSearch: false,
|
|
|
- addLevel: 0, //添加级别
|
|
|
- excludedConceptIds:[],
|
|
|
- operaList: [],
|
|
|
- relationConceptId: '', //关联父类ID
|
|
|
- level: 0, //层级(修改时只能显示三级)
|
|
|
- saveDisable: false, //保存按钮禁止点击
|
|
|
- defaultExpandedArr: [],
|
|
|
- relationTypes:[]
|
|
|
- }
|
|
|
+ level: 0,
|
|
|
+ isExpanded: false,
|
|
|
+ },
|
|
|
+ curId: "1",
|
|
|
+ list: [],
|
|
|
+ defaultProps: {
|
|
|
+ children: "nodeList",
|
|
|
+ label: "conceptName",
|
|
|
+ },
|
|
|
+ conceptList: [], //概念列表
|
|
|
+ showSearch: false,
|
|
|
+ addLevel: 0, //添加级别
|
|
|
+ excludedConceptIds: [],
|
|
|
+ operaList: [],
|
|
|
+ relationConceptId: "", //关联父类ID
|
|
|
+ level: 0, //层级(修改时只能显示三级)
|
|
|
+ saveDisable: false, //保存按钮禁止点击
|
|
|
+ defaultExpandedArr: [],
|
|
|
+ relationTypes: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getTreeList(1);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ addConcept(e) {
|
|
|
+ this.addLevel = 0;
|
|
|
+ this.openSearch(e);
|
|
|
},
|
|
|
- created(){
|
|
|
- this.getTreeList(1)
|
|
|
+ getTreeList(id) {
|
|
|
+ const { isEdit, data } = this.$route.params;
|
|
|
+ if (isEdit) {
|
|
|
+ this.isEdit = isEdit;
|
|
|
+ this.minTitle = "疾病相关维护-修改";
|
|
|
+ const paramData = JSON.parse(JSON.stringify(data));
|
|
|
+ let result = paramData.diseaseDetailDTO || {};
|
|
|
+ // this.relationTypes = paramData.types[0]||[]
|
|
|
+ const itemStr = JSON.stringify(result);
|
|
|
+ let tmp = itemStr
|
|
|
+ .replace(/disName/g, "conceptName")
|
|
|
+ .replace(/rname/g, "conceptName")
|
|
|
+ .replace(/datas/g, "nodeList")
|
|
|
+ .replace(/details/g, "nodeList")
|
|
|
+ .replace(/id/g, "conceptId")
|
|
|
+ .replace(/sconceptId/g, "conceptId")
|
|
|
+ .replace(/rconceptId/g, "conceptId")
|
|
|
+ .replace(/libName/g, "conceptName");
|
|
|
+ let item = JSON.parse(tmp);
|
|
|
+ item.level = 0;
|
|
|
+ item.isExpanded = false;
|
|
|
+ console.log("11111", item.nodeList);
|
|
|
+ item.nodeList = this.IteraNodeList(item.nodeList, [], 1);
|
|
|
+ let arr = [];
|
|
|
+ arr[0] = item;
|
|
|
+ this.list = [...arr];
|
|
|
+ }
|
|
|
},
|
|
|
- methods:{
|
|
|
- addConcept(e) {
|
|
|
- this.addLevel = 0;
|
|
|
- this.openSearch(e);
|
|
|
- },
|
|
|
- getTreeList(id){
|
|
|
- const { isEdit, data } = this.$route.params
|
|
|
- if(isEdit) {
|
|
|
- this.isEdit = isEdit
|
|
|
- this.minTitle = '疾病相关维护-修改'
|
|
|
- const paramData = JSON.parse(JSON.stringify(data))
|
|
|
- let result = paramData.diseaseDetailDTO||{}
|
|
|
- // this.relationTypes = paramData.types[0]||[]
|
|
|
- const itemStr = JSON.stringify(result)
|
|
|
- let tmp = itemStr.replace(/disName/g,'conceptName').replace(/rname/g,'conceptName').replace(/datas/g,'nodeList').replace(/details/g,'nodeList').replace(/id/g,'conceptId').replace(/sconceptId/g,'conceptId').replace(/rconceptId/g,'conceptId').replace(/libName/g,'conceptName')
|
|
|
- let item = JSON.parse(tmp)
|
|
|
- item.level = 0
|
|
|
- item.isExpanded = false
|
|
|
- console.log(item.nodeList);
|
|
|
- item.nodeList = this.IteraNodeList(item.nodeList, [], 1)
|
|
|
- let arr = []
|
|
|
- arr[0] = item
|
|
|
- this.list = [...arr]
|
|
|
+ allowDrop(draggingNode, dropNode, type) {
|
|
|
+ if (
|
|
|
+ draggingNode.parent.data.conceptName !==
|
|
|
+ dropNode.parent.data.conceptName
|
|
|
+ ) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return type !== "inner";
|
|
|
}
|
|
|
- },
|
|
|
- allowDrop(draggingNode, dropNode, type) {
|
|
|
- if(draggingNode.parent.data.conceptName !== dropNode.parent.data.conceptName){
|
|
|
- return false
|
|
|
- }else{
|
|
|
- return type !== 'inner'
|
|
|
- }
|
|
|
- },
|
|
|
- allowDrag(draggingNode) {
|
|
|
- return draggingNode.data.level > 1;//一级不可拖动
|
|
|
- },
|
|
|
- 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);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- confirm() {
|
|
|
- if(!this.list[0] || this.list[0].nodeList.length == 0) {
|
|
|
- this.message('请输入数据信息');
|
|
|
- return
|
|
|
+ },
|
|
|
+ allowDrag(draggingNode) {
|
|
|
+ return draggingNode.data.level > 1; //一级不可拖动
|
|
|
+ },
|
|
|
+ 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
|
|
|
+ );
|
|
|
}
|
|
|
- const param = {
|
|
|
- conceptId: this.list[0].conceptId,
|
|
|
- sonRelationId: 17,
|
|
|
- isOrderBy: 1
|
|
|
+ this.$set(data, "isExpanded", !data.isExpanded);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ confirm() {
|
|
|
+ if (!this.list[0] || this.list[0].nodeList.length == 0) {
|
|
|
+ this.message("请输入数据信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const param = {
|
|
|
+ conceptId: this.list[0].conceptId,
|
|
|
+ sonRelationId: 17,
|
|
|
+ isOrderBy: 1,
|
|
|
+ };
|
|
|
+ const nodeListResult = [];
|
|
|
+ this.IteraNodeList(this.list[0].nodeList, nodeListResult, 0);
|
|
|
+ param.nodeList = nodeListResult;
|
|
|
+ const { params, grandson } = this.reparams(param);
|
|
|
+ if (grandson == 0) {
|
|
|
+ this.message("增加子项数据后才能保存~");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
|
|
|
+ api.diseaseBaseSave(params).then((res) => {
|
|
|
+ const { data } = res;
|
|
|
+ if (data.code == "0") {
|
|
|
+ this.message(res.data.msg || "保存成功", "success");
|
|
|
+ this.$router.push({
|
|
|
+ name: "AboutDisease",
|
|
|
+ params: Object.assign({}, this.$route.params, { currentPage: 1 }),
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.message(data.msg);
|
|
|
}
|
|
|
- const nodeListResult = []
|
|
|
- this.IteraNodeList(this.list[0].nodeList, nodeListResult, 0)
|
|
|
- param.nodeList = nodeListResult
|
|
|
- const {params,grandson} = this.reparams(param)
|
|
|
- if(grandson == 0){
|
|
|
- this.message('增加子项数据后才能保存~');
|
|
|
- return
|
|
|
+ this.saveDisable = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ IteraNodeList(nodeList, nodeListResult, type, level = 1) {
|
|
|
+ this.level = level + 1;
|
|
|
+ for (let i = 0; i < nodeList.length; i++) {
|
|
|
+ //console.log(nodeList[i]);
|
|
|
+ let newChild;
|
|
|
+ if (type == "0") {
|
|
|
+ //添加的时候保存所有的id列表
|
|
|
+ newChild = {
|
|
|
+ conceptId: nodeList[i].conceptId,
|
|
|
+ libType: nodeList[i].libType,
|
|
|
+ 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,
|
|
|
+ isExpanded: false,
|
|
|
+ });
|
|
|
+ } else if (type == "2") {
|
|
|
+ //移除节点的时候同时移除节点(搜索时排除的id列表)
|
|
|
+ newChild = nodeList[i].conceptId;
|
|
|
}
|
|
|
- this.saveDisable = true //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
|
|
|
- api.diseaseBaseSave(params).then((res) => {
|
|
|
- const { data } = res
|
|
|
- if(data.code == '0') {
|
|
|
- this.message(res.data.msg||'保存成功','success');
|
|
|
- this.$router.push({
|
|
|
- name: 'AboutDisease',
|
|
|
- params: Object.assign({}, this.$route.params, { currentPage: 1 })
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.message(data.msg);
|
|
|
- }
|
|
|
- this.saveDisable = false;
|
|
|
- })
|
|
|
- },
|
|
|
- IteraNodeList(nodeList, nodeListResult, type, level = 1) {
|
|
|
- this.level= level + 1
|
|
|
- for(let i = 0; i <nodeList.length; i++) {
|
|
|
- //console.log(nodeList[i]);
|
|
|
- let newChild;
|
|
|
- if(type == '0') { //添加的时候保存所有的id列表
|
|
|
- newChild = {conceptId: nodeList[i].conceptId,libType:nodeList[i].libType, 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, isExpanded:false})
|
|
|
- } else if(type == '2') { //移除节点的时候同时移除节点(搜索时排除的id列表)
|
|
|
- newChild = nodeList[i].conceptId
|
|
|
- }
|
|
|
- if(nodeList[i].nodeList &&nodeList[i].nodeList.length > 0&&level < 3) {
|
|
|
- if(type == '0' || type =='1') {
|
|
|
- this.IteraNodeList(nodeList[i].nodeList, newChild.nodeList, type, level+1)
|
|
|
- } else if(type == '2') {
|
|
|
- this.IteraNodeList(nodeList[i].nodeList, nodeListResult, type, level+1)
|
|
|
- }
|
|
|
+ if (
|
|
|
+ nodeList[i].nodeList &&
|
|
|
+ nodeList[i].nodeList.length > 0 &&
|
|
|
+ level < 3
|
|
|
+ ) {
|
|
|
+ if (type == "0" || type == "1") {
|
|
|
+ this.IteraNodeList(
|
|
|
+ nodeList[i].nodeList,
|
|
|
+ newChild.nodeList,
|
|
|
+ type,
|
|
|
+ level + 1
|
|
|
+ );
|
|
|
+ } else if (type == "2") {
|
|
|
+ this.IteraNodeList(
|
|
|
+ nodeList[i].nodeList,
|
|
|
+ nodeListResult,
|
|
|
+ type,
|
|
|
+ level + 1
|
|
|
+ );
|
|
|
}
|
|
|
- newChild&&nodeListResult.push(newChild)
|
|
|
- }
|
|
|
- return nodeListResult
|
|
|
- },
|
|
|
- searchConcept(txt) {
|
|
|
- let excludedConceptIds = [];
|
|
|
- if(!txt){
|
|
|
- this.conceptList = []
|
|
|
- return
|
|
|
}
|
|
|
- if(this.list.length>0) {
|
|
|
- this.excludedConceptIds = this.IteraNodeList(this.list[0].nodeList,excludedConceptIds, 2)
|
|
|
- }
|
|
|
- const {libType} = this.operaList
|
|
|
+ newChild && nodeListResult.push(newChild);
|
|
|
+ }
|
|
|
+ return nodeListResult;
|
|
|
+ },
|
|
|
+ searchConcept(txt) {
|
|
|
+ let excludedConceptIds = [];
|
|
|
+ if (!txt) {
|
|
|
+ this.conceptList = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.list.length > 0) {
|
|
|
+ this.excludedConceptIds = this.IteraNodeList(
|
|
|
+ this.list[0].nodeList,
|
|
|
+ excludedConceptIds,
|
|
|
+ 2
|
|
|
+ );
|
|
|
+ }
|
|
|
+ const { libType } = this.operaList;
|
|
|
|
|
|
- this.list.length>0&&this.excludedConceptIds.push(this.list[0].conceptId)
|
|
|
- const params = {
|
|
|
- "name": txt,
|
|
|
- "diseaseName":txt,
|
|
|
- "excludedConceptIds": this.excludedConceptIds||[],
|
|
|
- "libType": this.addLevel == 0?100:libType&&libType[0]||''
|
|
|
+ this.list.length > 0 &&
|
|
|
+ this.excludedConceptIds.push(this.list[0].conceptId);
|
|
|
+ const params = {
|
|
|
+ name: txt,
|
|
|
+ diseaseName: txt,
|
|
|
+ excludedConceptIds: this.excludedConceptIds || [],
|
|
|
+ libType: this.addLevel == 0 ? 100 : (libType && libType[0]) || "",
|
|
|
+ };
|
|
|
+ let searchUrl = this.addLevel == 0 ? "findDisName" : "searchConcept";
|
|
|
+ api[searchUrl](params).then((res) => {
|
|
|
+ const { data } = res;
|
|
|
+ if (data.code == "0") {
|
|
|
+ this.conceptList = data.data;
|
|
|
+ console.log("conceptList", this.conceptList);
|
|
|
+
|
|
|
}
|
|
|
- let searchUrl = this.addLevel == 0?'findDisName':'searchConcept'
|
|
|
- api[searchUrl](params).then((res) => {
|
|
|
- const { data } = res
|
|
|
- if(data.code == '0') {
|
|
|
- this.conceptList = data.data
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- selectConcept(data) {
|
|
|
- console.log(this.addLevel)
|
|
|
- const {item,txt} = data
|
|
|
- if(this.addLevel == 0) {
|
|
|
- let temp = JSON.parse(JSON.stringify(this.template))
|
|
|
- temp.conceptId = item.conceptId
|
|
|
- temp.conceptName = item.conceptName
|
|
|
- this.list = [temp]
|
|
|
- }else {
|
|
|
- const data = this.operaList
|
|
|
- const newChild = Object.assign({}, item, {nodeList: [],libType:data.libType, level: data.level+1, conceptId: item.conceptId, relationId: 17,sonRelationId: 17});
|
|
|
- // const newChild = { id: id++, label: 'nodeList', level: data.level+1, children: [] };
|
|
|
- if (!data.nodeList) {
|
|
|
- this.$set(data, 'nodeList', []);
|
|
|
- }
|
|
|
- data.nodeList.push(newChild);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ selectConcept(data) {
|
|
|
+ console.log(this.addLevel);
|
|
|
+ const { item, txt } = data;
|
|
|
+ if (this.addLevel == 0) {
|
|
|
+ let temp = JSON.parse(JSON.stringify(this.template));
|
|
|
+ temp.conceptId = item.conceptId;
|
|
|
+ temp.conceptName = item.conceptName;
|
|
|
+ temp.drugC=item.drugC;
|
|
|
+ this.list = [temp];
|
|
|
+ } else {
|
|
|
+ const data = this.operaList;
|
|
|
+ const newChild = Object.assign({}, item, {
|
|
|
+ nodeList: [],
|
|
|
+ libType: data.libType,
|
|
|
+ level: data.level + 1,
|
|
|
+ conceptId: item.conceptId,
|
|
|
+ relationId: 17,
|
|
|
+ sonRelationId: 17,
|
|
|
+ });
|
|
|
+ // const newChild = { id: id++, label: 'nodeList', level: data.level+1, children: [] };
|
|
|
+ if (!data.nodeList) {
|
|
|
+ this.$set(data, "nodeList", []);
|
|
|
}
|
|
|
+ data.nodeList.push(newChild);
|
|
|
+ }
|
|
|
+ this.conceptList = [];
|
|
|
+ if (this.addLevel == 0) {
|
|
|
+ this.closeSearch();
|
|
|
+ } else {
|
|
|
+ this.searchConcept(txt);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ openSearch(e) {
|
|
|
+ this.showSearch = true;
|
|
|
+ },
|
|
|
+ closeSearch() {
|
|
|
+ this.conceptList = [];
|
|
|
+ this.showSearch = false;
|
|
|
+ },
|
|
|
+ append(data, e) {
|
|
|
+ if (this.$refs.searchDom) {
|
|
|
+ console.log(this.$refs.searchDom.$refs.conceptInput);
|
|
|
this.conceptList = [];
|
|
|
- if(this.addLevel == 0){
|
|
|
- this.closeSearch();
|
|
|
- }else{
|
|
|
- this.searchConcept(txt)
|
|
|
- }
|
|
|
- },
|
|
|
- openSearch(e) {
|
|
|
- this.showSearch = true
|
|
|
- },
|
|
|
- closeSearch() {
|
|
|
- this.conceptList = []
|
|
|
- this.showSearch = false
|
|
|
- },
|
|
|
- append(data, e) {
|
|
|
- if(this.$refs.searchDom){console.log(this.$refs.searchDom.$refs.conceptInput)
|
|
|
- this.conceptList = [];
|
|
|
- setTimeout(()=>{
|
|
|
- this.$refs.searchDom.$refs.conceptInput.value="";
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
- this.addLevel = data.level+1;
|
|
|
- this.relationConceptId = data.conceptId
|
|
|
- this.operaList = data;
|
|
|
- this.openSearch(data);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.searchDom.$refs.conceptInput.value = "";
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.addLevel = data.level + 1;
|
|
|
+ this.relationConceptId = data.conceptId;
|
|
|
+ this.operaList = data;
|
|
|
+ this.openSearch(data);
|
|
|
|
|
|
- // const newChild = { id: id++, label: 'testtest', level: data.level+1, nodeList: [] };
|
|
|
- // if (!data.nodeList) {
|
|
|
- // this.$set(data, 'nodeList', []);
|
|
|
- // }
|
|
|
- // data.nodeList.push(newChild);
|
|
|
- },
|
|
|
- showConfirmDialog(msg,resolve){
|
|
|
- this.$confirm(msg, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- showCancelButton:false,
|
|
|
- // cancelButtonText: '取消',
|
|
|
- // cancelButtonClass:'cancel',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
+ // const newChild = { id: id++, label: 'testtest', level: data.level+1, nodeList: [] };
|
|
|
+ // if (!data.nodeList) {
|
|
|
+ // this.$set(data, 'nodeList', []);
|
|
|
+ // }
|
|
|
+ // data.nodeList.push(newChild);
|
|
|
+ },
|
|
|
+ showConfirmDialog(msg, resolve) {
|
|
|
+ this.$confirm(msg, "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ showCancelButton: false,
|
|
|
+ // cancelButtonText: '取消',
|
|
|
+ // cancelButtonClass:'cancel',
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
resolve();
|
|
|
- }).catch(() => {});
|
|
|
- },
|
|
|
- remove(node, data) {
|
|
|
- this.showConfirmDialog('是否删除该关联关系,可能对现有系统会造成影响',()=>{
|
|
|
- const parent = node.parent;
|
|
|
- const nodeList = parent.data.nodeList || parent.data;
|
|
|
- const index = nodeList.findIndex(d => d.conceptId === data.conceptId);
|
|
|
- nodeList.splice(index, 1);
|
|
|
- })
|
|
|
- },
|
|
|
- reparams(param){
|
|
|
- let params = [],grandson = 0;
|
|
|
- const tmplis = param.nodeList||[];
|
|
|
- for(let i = 0;i < tmplis.length;i++){
|
|
|
- let item = tmplis[i],sonIds=[];
|
|
|
- if(item.nodeList&&item.nodeList.length>0){
|
|
|
- for(let j = 0;j < item.nodeList.length;j++){
|
|
|
- sonIds.push(item.nodeList[j].conceptId)
|
|
|
- }
|
|
|
- }
|
|
|
- if(sonIds.length > 0){
|
|
|
- ++grandson
|
|
|
- }
|
|
|
- let obj = {
|
|
|
- "sid": param.conceptId,
|
|
|
- "rid": item.conceptId,
|
|
|
- "eids": sonIds,
|
|
|
- // "eid": item.libType[0],
|
|
|
- // "srid": 0
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ remove(node, data) {
|
|
|
+ this.showConfirmDialog(
|
|
|
+ "是否删除该关联关系,可能对现有系统会造成影响",
|
|
|
+ () => {
|
|
|
+ const parent = node.parent;
|
|
|
+ const nodeList = parent.data.nodeList || parent.data;
|
|
|
+ const index = nodeList.findIndex(
|
|
|
+ (d) => d.conceptId === data.conceptId
|
|
|
+ );
|
|
|
+ nodeList.splice(index, 1);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ reparams(param) {
|
|
|
+ let params = [],
|
|
|
+ grandson = 0;
|
|
|
+ const tmplis = param.nodeList || [];
|
|
|
+ for (let i = 0; i < tmplis.length; i++) {
|
|
|
+ let item = tmplis[i],
|
|
|
+ sonIds = [];
|
|
|
+ if (item.nodeList && item.nodeList.length > 0) {
|
|
|
+ for (let j = 0; j < item.nodeList.length; j++) {
|
|
|
+ sonIds.push(item.nodeList[j].conceptId);
|
|
|
}
|
|
|
- params.push(obj)
|
|
|
}
|
|
|
- return {params,grandson}
|
|
|
- },
|
|
|
- message(msg,type){
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message:msg,
|
|
|
- type:type||'warning'
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- }
|
|
|
-}
|
|
|
+ if (sonIds.length > 0) {
|
|
|
+ ++grandson;
|
|
|
+ }
|
|
|
+ let obj = {
|
|
|
+ sid: param.conceptId,
|
|
|
+ rid: item.conceptId,
|
|
|
+ eids: sonIds,
|
|
|
+ // "eid": item.libType[0],
|
|
|
+ // "srid": 0
|
|
|
+ };
|
|
|
+ params.push(obj);
|
|
|
+ }
|
|
|
+ return { params, grandson };
|
|
|
+ },
|
|
|
+ message(msg, type) {
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: msg,
|
|
|
+ type: type || "warning",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ showNodeData(node, data) {
|
|
|
+ console.log("node:", node);
|
|
|
+ console.log("data:", data);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
@import "../../less/admin.less";
|
|
@@ -466,12 +555,12 @@ export default {
|
|
|
left: 350px;
|
|
|
}
|
|
|
.btn-del {
|
|
|
- color: #8F8F8F;
|
|
|
+ color: #8f8f8f;
|
|
|
padding-left: 28px;
|
|
|
}
|
|
|
.addBtn {
|
|
|
width: 66px;
|
|
|
- order: 1px solid #21CBC7;
|
|
|
+ order: 1px solid #21cbc7;
|
|
|
border-radius: 2px;
|
|
|
}
|
|
|
.conceptSearch {
|
|
@@ -481,7 +570,7 @@ export default {
|
|
|
bottom: 10px;
|
|
|
width: 300px;
|
|
|
background: #fff;
|
|
|
- border: 1px solid #C9C9C9;
|
|
|
+ border: 1px solid #c9c9c9;
|
|
|
text-align: center;
|
|
|
z-index: 2;
|
|
|
padding: 30px;
|
|
@@ -495,14 +584,14 @@ export default {
|
|
|
padding: 0 35px 0 15px;
|
|
|
width: 100%;
|
|
|
height: 34px;
|
|
|
- border: 1px solid #C9C9C9;
|
|
|
+ border: 1px solid #c9c9c9;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.conceptList {
|
|
|
min-height: 200px;
|
|
|
- max-height:300px;
|
|
|
+ max-height: 300px;
|
|
|
margin: -2px auto 0;
|
|
|
- border: 1px solid #E1DFDF;
|
|
|
+ border: 1px solid #e1dfdf;
|
|
|
overflow: hidden;
|
|
|
overflow-y: auto;
|
|
|
}
|
|
@@ -527,18 +616,17 @@ export default {
|
|
|
.search {
|
|
|
position: absolute;
|
|
|
right: 7px;
|
|
|
- top:8px;
|
|
|
+ top: 8px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
.delete {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
-.content{
|
|
|
+.content {
|
|
|
background: #fff;
|
|
|
padding: 20px 20px 30px;
|
|
|
color: #545455;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
.btn {
|
|
@@ -551,5 +639,5 @@ export default {
|
|
|
}
|
|
|
.colorGray {
|
|
|
color: #c1c1c1;
|
|
|
-}
|
|
|
+}
|
|
|
</style>
|