perf: 优化标签选择

This commit is contained in:
kuaifan 2025-07-08 10:57:09 +08:00
parent b01a54437a
commit 5e4a08538b
3 changed files with 11 additions and 7 deletions

View File

@ -98,10 +98,7 @@ export default {
},
methods: {
onOpen(tag = null) {
if (tag === null) {
tag = this.getEmptyTag()
}
this.editingTag = { ...tag }
this.editingTag = { ...this.getEmptyTag(), ...(tag || {}) }
this.showEditModal = true
},

View File

@ -35,7 +35,7 @@
<!-- Add Button -->
<div class="footer-box">
<div class="add-button" @click="$emit('add')">
<div class="add-button" @click="$emit('add', searchQuery)">
<i class="el-icon-plus"></i>
<span>{{ $L('添加标签') }}</span>
</div>
@ -99,6 +99,9 @@ export default {
isSelected(tag) {
return this.value.some(item => item.name === tag.name);
},
clearSearch() {
this.searchQuery = '';
},
toggleTag(tag) {
const isSelected = this.isSelected(tag);
let newValue;
@ -176,6 +179,8 @@ export default {
flex: 1;
overflow-y: auto;
max-height: 300px;
margin: 0 -12px;
padding: 0 12px;
.tag-item {
display: flex;

View File

@ -155,6 +155,7 @@
<div class="item-content tags">
<EPopover v-model="tagShow" class="tags-select" placement="bottom">
<TaskTagSelect
ref="tagSelect"
v-model="tagValue"
:data-sources="tagData"
:loading="tagLoad > 0"
@ -2063,13 +2064,13 @@ export default {
this.$set(this.delayTaskForm, 'type', type)
},
onTagAdd() {
onTagAdd(tagName) {
//
this.tagValue = this.getTag;
this.tagBakValue = $A.cloneJSON(this.tagValue);
//
this.tagShow = false
this.$refs.addTag.onOpen(null)
this.$refs.addTag.onOpen(tagName ? {name: tagName} : null)
},
onTagAddSave(result) {
@ -2082,6 +2083,7 @@ export default {
];
//
this.updateData('tag', mergedTags);
this.$refs.tagSelect?.clearSearch();
},
getTypeLabel(type) {