From 59f34f6cc50945e51f70a6d6044b9c162cb730b9 Mon Sep 17 00:00:00 2001 From: bianyaqi Date: Thu, 30 Mar 2023 15:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E9=83=A8=E5=88=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/360View/collection.vue | 80 +++++++++---------- .../360View/commonForm/optometryForm.vue | 9 --- .../medicalRecord/outPatientRecord/index.vue | 3 +- 3 files changed, 40 insertions(+), 52 deletions(-) diff --git a/src/components/360View/collection.vue b/src/components/360View/collection.vue index 865dabb..7882aa1 100644 --- a/src/components/360View/collection.vue +++ b/src/components/360View/collection.vue @@ -8,14 +8,13 @@ :data="collectData" node-key="id" :props="defaultProps" - :expand-on-click-node="false" > {{ node.label }} - + @@ -27,7 +26,8 @@ ··· - 重命名 + 重命名 + 编辑 删除 @@ -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' diff --git a/src/components/360View/commonForm/optometryForm.vue b/src/components/360View/commonForm/optometryForm.vue index f0d1af9..a53b30c 100644 --- a/src/components/360View/commonForm/optometryForm.vue +++ b/src/components/360View/commonForm/optometryForm.vue @@ -313,7 +313,6 @@