mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 20:12:48 +00:00
perf: 已删除任务支持按标签搜索
This commit is contained in:
parent
e52d066fb0
commit
2c3e80bd8f
@ -13,7 +13,22 @@
|
|||||||
{{$L("关键词")}}
|
{{$L("关键词")}}
|
||||||
</div>
|
</div>
|
||||||
<div class="search-content">
|
<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>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="search-button">
|
<li class="search-button">
|
||||||
@ -96,6 +111,23 @@ export default {
|
|||||||
return h('AutoTip', row.name);
|
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('创建时间'),
|
title: this.$L('创建时间'),
|
||||||
key: 'created_at',
|
key: 'created_at',
|
||||||
@ -160,6 +192,8 @@ export default {
|
|||||||
],
|
],
|
||||||
list: [],
|
list: [],
|
||||||
|
|
||||||
|
tags: [],
|
||||||
|
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
total: 0,
|
total: 0,
|
||||||
@ -167,7 +201,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.loadTags()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['cacheTasks'])
|
...mapState(['cacheTasks'])
|
||||||
@ -192,6 +226,23 @@ export default {
|
|||||||
this.getLists();
|
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() {
|
getLists() {
|
||||||
if (!this.projectId) {
|
if (!this.projectId) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user