perf: 已删除任务支持按标签搜索

This commit is contained in:
kuaifan 2025-02-28 21:07:54 +08:00
parent e52d066fb0
commit 2c3e80bd8f

View File

@ -13,7 +13,22 @@
{{$L("关键词")}}
</div>
<div class="search-content">
<Input v-model="keys.name" :placeholder="$L('ID、任务名...')" clearable/>
<Input v-model="keys.name" :placeholder="$L('ID、名称、描述...')" clearable/>
</div>
</li>
<li v-if="tags.length > 0">
<div class="search-label">
{{$L("任务标签")}}
</div>
<div class="search-content">
<Select v-model="keys.tag" :placeholder="$L('全部')">
<Option value="">{{$L('全部')}}</Option>
<Option v-for="tag in tags" :key="tag.id" :value="tag.name" :label="tag.name">
<div class="tag-dot" :style="{'--bg-color': tag.color}">
{{tag.name}}
</div>
</Option>
</Select>
</div>
</li>
<li class="search-button">
@ -96,6 +111,23 @@ export default {
return h('AutoTip', row.name);
}
},
{
title: this.$L('任务标签'),
key: 'tags',
minWidth: 100,
render: (h, {row}) => {
if (row.task_tag.length == 0) {
return h('div', '-');
}
return h('AutoTip', {
on: {
'on-click': () => {
this.$store.dispatch("openTask", row);
}
}
}, row.task_tag.map(({name}) => name).join('、'));
}
},
{
title: this.$L('创建时间'),
key: 'created_at',
@ -160,6 +192,8 @@ export default {
],
list: [],
tags: [],
page: 1,
pageSize: 20,
total: 0,
@ -167,7 +201,7 @@ export default {
}
},
mounted() {
this.loadTags()
},
computed: {
...mapState(['cacheTasks'])
@ -192,6 +226,23 @@ export default {
this.getLists();
},
async loadTags() {
let tags = [];
const project_id = this.projectId
try {
const {data} = await this.$store.dispatch("call", {
url: 'project/tag/list',
data: {project_id},
})
tags = data || []
} catch (e) {
tags = [];
}
if (project_id === this.projectId) {
this.tags = tags
}
},
getLists() {
if (!this.projectId) {
return;