diff --git a/src/components/360View/collection.vue b/src/components/360View/collection.vue index 0613807..938ee1f 100644 --- a/src/components/360View/collection.vue +++ b/src/components/360View/collection.vue @@ -106,7 +106,6 @@ export default { } }, collectData(val) { - console.log(val) if (!val.length) { this.disabled = false this.addParam.id = '' @@ -209,22 +208,41 @@ export default { }, // 收藏患者 handleAddPatient() { - const params = { - createDate: this.$moment().format('YYYY-MM-DD HH:mm:ss'), - patientId: this.patientId, - platform: this.platform, - remark: this.remark, - treeId: this.curNode.id - } - console.log(this.curNode) - this.$http.post('/tree/addPatientTree', params).then(() => { - this.editMessage = '收藏成功!' - this.$message({ - message: this.editMessage, - type: 'success' + // 添加患者 + if (!this.curNode.patientId) { + const params = { + createDate: this.$moment().format('YYYY-MM-DD HH:mm:ss'), + patientId: this.patientId, + platform: this.platform, + remark: this.remark, + treeId: this.curNode.id + } + this.$http.post('/tree/addPatientTree', params).then(() => { + this.editMessage = '收藏成功!' + this.$message({ + message: this.editMessage, + type: 'success' + }) + this.findTree() }) - this.findTree() - }) + } else { + // 修改患者 + const params = { + patientId: this.curNode.patientId, + platform: this.platform, + remark: this.remark, + treeId: this.curNode.treeId, + id: this.curNode.id + } + this.$http.post('/tree/addPatientTree', params).then(() => { + this.editMessage = '修改成功!' + this.$message({ + message: this.editMessage, + type: 'success' + }) + this.findTree() + }) + } }, // 新增节点 addNode(command, node, data) {