diff --git a/flossom-ui/src/views/system/instrument/index.vue b/flossom-ui/src/views/system/instrument/index.vue index 28da47d..3b1021d 100644 --- a/flossom-ui/src/views/system/instrument/index.vue +++ b/flossom-ui/src/views/system/instrument/index.vue @@ -953,7 +953,7 @@ import { listInstructions, delInstructions, addInstructions, - updateInstructions, listAllMode, + updateInstructions, listAllMode, addInstrumentTag, listInstrumentTag, } from '@/api/system/instrument' import {getToken} from '@/utils/auth' import Treeselect from '@riophae/vue-treeselect' @@ -1055,14 +1055,14 @@ export default { }, /* 小程序可见标签 */ miniProgramTag: { - userId: null, + instrumentId: null, selectTagList: null, visible: false, optionTree: [], }, /* 企微可见标签 */ wecomTag: { - userId: null, + instrumentId: null, selectTagList: null, visible: false, optionTree: [], @@ -1684,6 +1684,9 @@ export default { }, /* 设置小程序可见标签 */ editMiniProgramTags(row) { + /* 小程序可见标签 */ + this.miniProgramTag.instrumentId = null; + this.miniProgramTag.selectTagList = null; // 小程序标签树 getMiniProgramTagTree().then((Response) => { this.miniProgramTag.optionTree = Response.data @@ -1693,11 +1696,21 @@ export default { .split(',') .map(Number) } - this.miniProgramTag.userId = row.id + this.miniProgramTag.instrumentId = row.id + listInstrumentTag({ + instrumentId: row.id, + type: 1 + }).then((res) => { + if (res.code == 200 && res.data != null && res.data.length > 0) { + this.miniProgramTag.selectTagList = res.data.map(obj => obj.tagId); + } + }) }) }, /* 设置企微可见标签 */ editWecomTags(row) { + this.wecomTag.instrumentId = null; + this.wecomTag.selectTagList = null; // 外部标签树 getWecomTagTree().then((response) => { this.wecomTag.optionTree = response.data @@ -1705,25 +1718,45 @@ export default { if (row.wecomTagIds != null && row.wecomTagIds.length > 0) { this.wecomTag.selectTagList = row.wecomTagIds.split(',').map(Number) } - this.wecomTag.userId = row.id + this.wecomTag.instrumentId = row.id + listInstrumentTag({ + instrumentId: row.id, + type: 2 + }).then((res) => { + if (res.code == 200 && res.data != null && res.data.length > 0) { + this.wecomTag.selectTagList = res.data.map(obj => obj.tagId); + } + }) }) }, /* 保存小程序标签 */ submitMiniProgramTagList() { - this.form.id = this.miniProgramTag.userId - this.form.miniTagIds = this.miniProgramTag.selectTagList.join(',') - updateInstrument(this.form).then((response) => { - this.$modal.msgSuccess('修改成功') + if (this.miniProgramTag.selectTagList == null || this.miniProgramTag.selectTagList.length == 0) { + this.$message.warning(`请选择小程序标签`); + return; + } + addInstrumentTag({ + instrumentId: this.miniProgramTag.instrumentId, + tagIdList: this.miniProgramTag.selectTagList, + type: 1 + }).then((response) => { + this.$modal.msgSuccess('操作成功') this.miniProgramTag.visible = false this.getList() }) }, /* 保存外部标签 */ submitWecomTagList() { - this.form.id = this.wecomTag.userId - this.form.wecomTagIds = this.wecomTag.selectTagList.join(',') - updateInstrument(this.form).then((response) => { - this.$modal.msgSuccess('修改成功') + if (this.wecomTag.selectTagList == null || this.wecomTag.selectTagList.length == 0) { + this.$message.warning(`请选择外部标签`); + return; + } + addInstrumentTag({ + instrumentId: this.wecomTag.instrumentId, + tagIdList: this.wecomTag.selectTagList, + type: 2 + }).then((response) => { + this.$modal.msgSuccess('操作成功') this.wecomTag.visible = false this.getList() })