diff --git a/src/views/organization/trainingManage/editTraining.vue b/src/views/organization/trainingManage/editTraining.vue index 32f5d09d9..18360f47b 100644 --- a/src/views/organization/trainingManage/editTraining.vue +++ b/src/views/organization/trainingManage/editTraining.vue @@ -25,6 +25,8 @@ v-for="tag in tagForm.dynamicTags" :key="tag" closable + :class="dataLabel.includes(tag) ? 'tagDisable' : ''" + :type="dataLabel.includes(tag) ? 'info' : ''" :disable-transitions="false" @close="handleClose(tag)" > @@ -69,6 +71,7 @@ export default { }, inputVisible: false, inputValue: '', + dataLabel: [], // 原始标签,不能修改删除,只可添加 tagForm: { client: '', dynamicTags: [] @@ -113,6 +116,7 @@ export default { }, methods: { handleClose(tag) { + if (this.dataLabel.includes(tag)) { return; } this.tagForm.dynamicTags.splice(this.tagForm.dynamicTags.indexOf(tag), 1); }, showInput() { @@ -123,7 +127,7 @@ export default { }, handleInputConfirm() { const inputValue = this.inputValue; - if (inputValue) { + if (inputValue && !this.tagForm.dynamicTags.includes(inputValue)) { this.tagForm.dynamicTags.push(inputValue); } this.inputVisible = false; @@ -152,6 +156,7 @@ export default { Object.keys(this.formModel).forEach(key => { this.formModel[key] = data[key]; }); + this.dataLabel = data.labelJson ? JSON.parse(data.labelJson) : []; this.tagForm.dynamicTags = data.labelJson ? JSON.parse(data.labelJson) : []; this.tagForm.client = data.client; } @@ -179,11 +184,19 @@ export default { doClose() { this.$refs.dataform && this.$refs.dataform.resetForm(); this.$refs.form && this.$refs.form.resetFields(); + this.dataLabel = []; this.dialogVisible = false; } } }; +