From fa2b672a2e20483792d30d2949c95c4d3fafd83e Mon Sep 17 00:00:00 2001 From: bianyaqi Date: Tue, 21 Mar 2023 18:05:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E8=97=8F=E6=82=A3=E8=80=85=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=8A=9F=E8=83=BD=E5=BE=85=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/360View/collection.vue | 72 +++++++++++++++++++-------- 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/src/components/360View/collection.vue b/src/components/360View/collection.vue index ee4eb26..9abd269 100644 --- a/src/components/360View/collection.vue +++ b/src/components/360View/collection.vue @@ -82,7 +82,7 @@ export default { return { dialogFormVisible: false, remark: '', - curId: '', + curNode: '', editName: '', editMessage: '', disabled: false, // 用防止多次添加或多次重命名 @@ -123,7 +123,6 @@ export default { // 初始化获取或者相关信息 initPatient() { this.findTree() - this.queryPatientRemarks() }, // 获取当前或者最新备注 async queryPatientRemarks() { @@ -134,7 +133,21 @@ export default { platform: this.platform } }) - console.log('备注', data) + // this.tableData = + this.collectData = this.handlePatientList(data.data) + }, + handlePatientList(arr) { + arr.forEach(item => { + if (!item.childs) { + item.childs = [] + } + if (item.hisManagePatientEntity) { + this.$set(item.hisManagePatientEntity, 'name', item.hisManagePatientEntity.remark) + item.childs.push(item.hisManagePatientEntity) + this.handlePatientList(item.childs) + } + }) + return arr }, // 查询树结构 async findTree() { @@ -145,6 +158,7 @@ export default { } }) this.collectData = data.data + await this.queryPatientRemarks() }, // 或者详情目录结构包含或者备注信息 // async patientTrees() { @@ -158,7 +172,7 @@ export default { // console.log('详情目录', data) // }, levelClick(data) { - this.curId = data.id + this.curNode = data }, searchRemark(data) { // this.treeId = data.id @@ -171,7 +185,7 @@ export default { patientId: this.patientId, platform: this.platform, remark: this.remark, - treeId: this.curId + treeId: this.curNode.id } this.$http.post('/tree/addPatientTree', params).then(() => { this.editMessage = '收藏成功!' @@ -180,7 +194,6 @@ export default { type: 'success' }) this.findTree() - this.queryPatientRemarks() }) }, // 新增节点 @@ -221,7 +234,12 @@ export default { ...this.addParam } this.disabled = true - await this.$http.post('/tree/addTree', params) + if (this.curNode.patientId) { + this.curNode.name = this.editName + await this.$http.post('/tree/addPatientTree', { ...this.curNode }) + } else { + await this.$http.post('/tree/addTree', params) + } this.dialogFormVisible = false await this.findTree() }, @@ -236,20 +254,34 @@ export default { }, // 删除树节点 deleteNode(node, data) { - const params = { - doctorId: this.doctorId, - flag: '1', - name: data.label, - platform: this.platform, - id: data.id - } - this.$http.post('/tree/deleteTree', params).then(() => { - this.$message({ - message: '删除成功!', - type: 'success' + if (this.curNode.patientId) { + this.$confirmFun('你确定要删除吗?').then(() => { + this.$http.post('/tree/deletePatientTree', { ...this.curNode }).then(() => { + this.$message({ + message: '删除成功!', + type: 'success' + }) + this.findTree() + }) }) - }) - this.findTree() + } else { + const params = { + doctorId: this.doctorId, + flag: '1', + name: data.label, + platform: this.platform, + id: data.id + } + this.$confirmFun('你确定要删除吗?').then(() => { + this.$http.post('/tree/deleteTree', params).then(() => { + this.$message({ + message: '删除成功!', + type: 'success' + }) + this.findTree() + }) + }) + } }, // 重命名 editNode(node, data) {