|
|
@ -8,14 +8,13 @@ |
|
|
|
:data="collectData" |
|
|
|
node-key="id" |
|
|
|
:props="defaultProps" |
|
|
|
:expand-on-click-node="false" |
|
|
|
> |
|
|
|
<span slot-scope="{ node, data }" class="custom-tree-node" @click="levelClick(data)"> |
|
|
|
<span style="display: inline-block;min-width: 100px"> |
|
|
|
<span>{{ node.label }}</span> |
|
|
|
</span> |
|
|
|
<span> |
|
|
|
<el-dropdown v-if="!data.treeId" trigger="click" @command="(command)=>addNode(command,node,data)"> |
|
|
|
<el-dropdown v-if="!data.patientId" trigger="click" @command="(command)=>addNode(command,node,data)"> |
|
|
|
<span> |
|
|
|
<i class="el-icon-plus" /> |
|
|
|
</span> |
|
|
@ -27,7 +26,8 @@ |
|
|
|
<el-dropdown trigger="click" style="margin-left: 10px" @command="(command)=>handleNode(command,node,data)"> |
|
|
|
<span>···</span> |
|
|
|
<el-dropdown-menu slot="dropdown"> |
|
|
|
<el-dropdown-item command="rename">重命名</el-dropdown-item> |
|
|
|
<el-dropdown-item v-if="!data.patientId" command="rename">重命名</el-dropdown-item> |
|
|
|
<el-dropdown-item v-else command="edit">编辑</el-dropdown-item> |
|
|
|
<el-dropdown-item command="delete">删除</el-dropdown-item> |
|
|
|
</el-dropdown-menu> |
|
|
|
</el-dropdown> |
|
|
@ -82,6 +82,7 @@ export default { |
|
|
|
curNode: '', |
|
|
|
editName: '', |
|
|
|
editMessage: '', |
|
|
|
curPatient: {}, // 当前id下的患者 |
|
|
|
disabled: false, // 用防止多次添加或多次重命名 |
|
|
|
addParam: { |
|
|
|
id: '', |
|
|
@ -128,17 +129,23 @@ export default { |
|
|
|
patient: this.patientId, |
|
|
|
platform: this.platform |
|
|
|
}).then(res => { |
|
|
|
console.log(res.data) |
|
|
|
// console.log(res.data) |
|
|
|
}) |
|
|
|
}, |
|
|
|
findTreePatient() { |
|
|
|
this.$http.get('/tree/findPatientTree', { |
|
|
|
this.$http.get('/tree/findPatientTree', { params: { |
|
|
|
limit: 10, |
|
|
|
page: 1, |
|
|
|
platform: this.platform, |
|
|
|
treeId: this.curNode.id |
|
|
|
}).then(res => { |
|
|
|
console.log(res) |
|
|
|
}}).then(res => { |
|
|
|
this.curPatient = res.data.data.list.map(item => { |
|
|
|
return { |
|
|
|
name: item.patientName, |
|
|
|
...item |
|
|
|
} |
|
|
|
}) |
|
|
|
this.handlePatientList(this.collectData) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取当前或者最新备注 |
|
|
@ -150,23 +157,22 @@ export default { |
|
|
|
platform: this.platform |
|
|
|
} |
|
|
|
}) |
|
|
|
this.collectData = this.handlePatientList(data.data) |
|
|
|
this.collectData = data.data |
|
|
|
}, |
|
|
|
// 递归收藏患者 |
|
|
|
handlePatientList(arr) { |
|
|
|
arr.forEach(item => { |
|
|
|
if (!item.childs && item.hisManagePatientEntity) { |
|
|
|
handlePatientList(data) { |
|
|
|
data.forEach(item => { |
|
|
|
if (!item.childs) { |
|
|
|
item.childs = [] |
|
|
|
} |
|
|
|
if (item.hisManagePatientEntity) { |
|
|
|
this.$set(item.hisManagePatientEntity, 'name', item.hisManagePatientEntity.remark) |
|
|
|
item.childs.push(item.hisManagePatientEntity) |
|
|
|
} |
|
|
|
if (item.childs && item.childs.length) { |
|
|
|
if (this.curNode.id === item.id) { |
|
|
|
const arr = _.uniqWith(item.childs.concat(this.curPatient), (item1, item2) => item1.id === item2.id) |
|
|
|
this.$set(item, 'childs', arr) |
|
|
|
} else { |
|
|
|
this.handlePatientList((item.childs)) |
|
|
|
} |
|
|
|
}) |
|
|
|
return arr |
|
|
|
return data |
|
|
|
}, |
|
|
|
// 查询树结构 |
|
|
|
async findTree() { |
|
|
@ -176,7 +182,6 @@ export default { |
|
|
|
platform: this.platform |
|
|
|
} |
|
|
|
}) |
|
|
|
this.collectData = data.data |
|
|
|
await this.queryPatientRemarks() |
|
|
|
}, |
|
|
|
// 或者详情目录结构包含或者备注信息 |
|
|
@ -256,39 +261,32 @@ export default { |
|
|
|
...this.addParam |
|
|
|
} |
|
|
|
this.disabled = true |
|
|
|
if (this.curNode.patientId) { |
|
|
|
this.curNode.name = this.editName |
|
|
|
this.curNode.remark = this.editName |
|
|
|
await this.$http.post('/tree/addPatientTree', { ...this.curNode }) |
|
|
|
this.$message({ |
|
|
|
message: this.editMessage, |
|
|
|
type: 'success' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
await this.$http.post('/tree/addTree', params) |
|
|
|
this.$message({ |
|
|
|
message: this.editMessage, |
|
|
|
type: 'success' |
|
|
|
}) |
|
|
|
} |
|
|
|
await this.$http.post('/tree/addTree', params) |
|
|
|
this.$message({ |
|
|
|
message: this.editMessage, |
|
|
|
type: 'success' |
|
|
|
}) |
|
|
|
this.dialogFormVisible = false |
|
|
|
await this.findTree() |
|
|
|
}, |
|
|
|
// 更多 |
|
|
|
handleNode(command, node, data) { |
|
|
|
if (command === 'delete') { |
|
|
|
this.deleteNode(node, data) |
|
|
|
} else { |
|
|
|
this.disabled = false |
|
|
|
console.log(this.curNode) |
|
|
|
this.editNode(node, data) |
|
|
|
switch (command) { |
|
|
|
case 'rename': |
|
|
|
this.disabled = false |
|
|
|
this.editNode(node, data) |
|
|
|
break |
|
|
|
case 'delete': |
|
|
|
this.deleteNode(node, data) |
|
|
|
break |
|
|
|
case 'edit': |
|
|
|
} |
|
|
|
}, |
|
|
|
// 删除树节点 |
|
|
|
deleteNode(node, data) { |
|
|
|
if (this.curNode.patientId) { |
|
|
|
if (data.patientId) { |
|
|
|
this.$confirmFun('你确定要删除吗?').then(() => { |
|
|
|
this.$http.post('/tree/deletePatientTree', { ...this.curNode }).then(() => { |
|
|
|
this.$http.post('/tree/deletePatientTree', { ...data }).then(() => { |
|
|
|
this.$message({ |
|
|
|
message: '删除成功!', |
|
|
|
type: 'success' |
|
|
|