|
|
@ -14,11 +14,15 @@ |
|
|
|
<el-button v-if="!collectData.length" size="mini" @click="dialogFormVisible = true">新增节点</el-button> |
|
|
|
<el-tree |
|
|
|
v-else |
|
|
|
ref="collectTree" |
|
|
|
:data="collectData" |
|
|
|
node-key="id" |
|
|
|
:props="defaultProps" |
|
|
|
:default-expanded-keys="defaultExpandIds" |
|
|
|
@node-expand="handleNodeExpand" |
|
|
|
@node-collapse="handleNodeCollapse" |
|
|
|
> |
|
|
|
<span slot-scope="{ node, data }" :class="[curNode.id===data.id?'active':'','custom-tree-node']" @click="levelClick(data)"> |
|
|
|
<span slot-scope="{ node, data }" :class="[curNode.id===data.id?'active':'','custom-tree-node']" @click="levelClick(data,node)"> |
|
|
|
<span class="treeDefault"> |
|
|
|
<span>{{ node.label }}</span> |
|
|
|
</span> |
|
|
@ -32,8 +36,7 @@ |
|
|
|
<el-dropdown-item command="child">新增子级节点</el-dropdown-item> |
|
|
|
</el-dropdown-menu> |
|
|
|
</el-dropdown> |
|
|
|
<i v-if="data.patientId" style="color: red" class="el-icon-delete" @click="deleteNode(node, data)" /> |
|
|
|
<el-dropdown v-else trigger="click" style="margin-left: 10px" @command="(command)=>handleNode(command,node,data)"> |
|
|
|
<el-dropdown trigger="click" style="margin-left: 10px" @command="(command)=>handleNode(command,node,data)"> |
|
|
|
<span :class="{'active':curNode.id===data.id}">···</span> |
|
|
|
<el-dropdown-menu slot="dropdown"> |
|
|
|
<el-dropdown-item command="rename">编辑</el-dropdown-item> |
|
|
@ -103,11 +106,13 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
defaultExpandIds: [], |
|
|
|
keyword: '', |
|
|
|
dialogFormVisible: false, |
|
|
|
remarkDialog: false, |
|
|
|
remark: '', |
|
|
|
curNode: '', |
|
|
|
curExpand: '', |
|
|
|
editName: '', |
|
|
|
editRemark: '', |
|
|
|
editMessage: '新增成功', |
|
|
@ -180,7 +185,7 @@ export default { |
|
|
|
searchPatient() { |
|
|
|
this.$http.get('/tree/findCollectPatient', { |
|
|
|
params: { |
|
|
|
doctorld: this.doctorId, |
|
|
|
doctorId: this.doctorId, |
|
|
|
platform: this.platform, |
|
|
|
queryStr: this.keyword |
|
|
|
} |
|
|
@ -236,8 +241,9 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
levelClick(data) { |
|
|
|
levelClick(data, node) { |
|
|
|
this.curNode = data |
|
|
|
this.curExpand = node |
|
|
|
this.remark = data.remark || '' |
|
|
|
this.tableData = data.treePatientVoList |
|
|
|
}, |
|
|
@ -371,6 +377,21 @@ export default { |
|
|
|
this.editMessage = '重命名成功!' |
|
|
|
this.addParam.id = data.id |
|
|
|
this.addParam.parentId = data.parentId |
|
|
|
}, |
|
|
|
// 树节点展开 |
|
|
|
handleNodeExpand() { |
|
|
|
if (this.defaultExpandIds.indexOf(this.curNode.id) === -1) { |
|
|
|
this.defaultExpandIds.push(this.curNode.id) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 树节点关闭 |
|
|
|
handleNodeCollapse() { |
|
|
|
if (!this.defaultExpandIds.indexOf(this.curNode.id)) { |
|
|
|
const index = this.defaultExpandIds.findIndex(item => { |
|
|
|
return item === this.curNode.id |
|
|
|
}) |
|
|
|
this.defaultExpandIds.splice(index, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|