mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 03:03:41 +00:00
perf: 可以通过ID搜索任务
This commit is contained in:
parent
16edfe18bc
commit
67780a1fdc
@ -843,7 +843,7 @@ class ProjectController extends AbstractController
|
|||||||
* @apiName task__lists
|
* @apiName task__lists
|
||||||
*
|
*
|
||||||
* @apiParam {Object} [keys] 搜索条件
|
* @apiParam {Object} [keys] 搜索条件
|
||||||
* - keys.name: 任务名称
|
* - keys.name: ID、任务名称
|
||||||
*
|
*
|
||||||
* @apiParam {Number} [project_id] 项目ID
|
* @apiParam {Number} [project_id] 项目ID
|
||||||
* @apiParam {Number} [parent_id] 主任务ID(project_id && parent_id ≤ 0 时 仅查询自己参与的任务)
|
* @apiParam {Number} [parent_id] 主任务ID(project_id && parent_id ≤ 0 时 仅查询自己参与的任务)
|
||||||
@ -897,7 +897,11 @@ class ProjectController extends AbstractController
|
|||||||
$sorts = is_array($sorts) ? $sorts : [];
|
$sorts = is_array($sorts) ? $sorts : [];
|
||||||
//
|
//
|
||||||
if ($keys['name']) {
|
if ($keys['name']) {
|
||||||
$builder->where("project_tasks.name", "like", "%{$keys['name']}%");
|
if (Base::isNumber($keys['name'])) {
|
||||||
|
$builder->where("project_tasks.id", intval($keys['name']));
|
||||||
|
} else {
|
||||||
|
$builder->where("project_tasks.name", "like", "%{$keys['name']}%");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
$scopeAll = false;
|
$scopeAll = false;
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
<Tooltip :always="searchText!=''" @on-popper-show="searchFocus" theme="light" :rawIndex="10">
|
<Tooltip :always="searchText!=''" @on-popper-show="searchFocus" theme="light" :rawIndex="10">
|
||||||
<Icon class="menu-icon" type="ios-search" @click="searchFocus" />
|
<Icon class="menu-icon" type="ios-search" @click="searchFocus" />
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
<Input v-model="searchText" ref="searchInput" :placeholder="$L('名称、描述...')" class="search-input" clearable/>
|
<Input v-model="searchText" ref="searchInput" :placeholder="$L('ID、名称、描述...')" class="search-input" clearable/>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</li>
|
</li>
|
||||||
@ -443,7 +443,7 @@
|
|||||||
<DrawerOverlay
|
<DrawerOverlay
|
||||||
v-model="archivedTaskShow"
|
v-model="archivedTaskShow"
|
||||||
placement="right"
|
placement="right"
|
||||||
:size="900">
|
:size="1000">
|
||||||
<TaskArchived v-if="archivedTaskShow" :project-id="projectId"/>
|
<TaskArchived v-if="archivedTaskShow" :project-id="projectId"/>
|
||||||
</DrawerOverlay>
|
</DrawerOverlay>
|
||||||
|
|
||||||
@ -451,7 +451,7 @@
|
|||||||
<DrawerOverlay
|
<DrawerOverlay
|
||||||
v-model="deletedTaskShow"
|
v-model="deletedTaskShow"
|
||||||
placement="right"
|
placement="right"
|
||||||
:size="900">
|
:size="1000">
|
||||||
<TaskDeleted v-if="deletedTaskShow" :project-id="projectId"/>
|
<TaskDeleted v-if="deletedTaskShow" :project-id="projectId"/>
|
||||||
</DrawerOverlay>
|
</DrawerOverlay>
|
||||||
</div>
|
</div>
|
||||||
@ -609,7 +609,9 @@ export default {
|
|||||||
list = list.filter(({flow_item_id}) => flow_item_id === flowInfo.value);
|
list = list.filter(({flow_item_id}) => flow_item_id === flowInfo.value);
|
||||||
}
|
}
|
||||||
if (searchText) {
|
if (searchText) {
|
||||||
list = list.filter(({name, desc}) => $A.strExists(`${name} ${desc}`, searchText));
|
list = list.filter(({id, name, desc}) => {
|
||||||
|
return id == searchText || $A.strExists(`${name} ${desc}`, searchText)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -727,7 +729,7 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (searchText) {
|
if (searchText) {
|
||||||
if (!$A.strExists(task.name, searchText) && !$A.strExists(task.desc, searchText)) {
|
if (task.id != searchText && !$A.strExists(task.name, searchText) && !$A.strExists(task.desc, searchText)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -758,7 +760,7 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (searchText) {
|
if (searchText) {
|
||||||
if (!$A.strExists(task.name, searchText) && !$A.strExists(task.desc, searchText)) {
|
if (task.id != searchText && !$A.strExists(task.name, searchText) && !$A.strExists(task.desc, searchText)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1298,7 +1300,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
taskIsHidden(task) {
|
taskIsHidden(task) {
|
||||||
const {name, desc, complete_at} = task;
|
const {id, name, desc, complete_at} = task;
|
||||||
const {searchText} = this;
|
const {searchText} = this;
|
||||||
if (!this.projectData.cacheParameter.completedTask) {
|
if (!this.projectData.cacheParameter.completedTask) {
|
||||||
if (complete_at) {
|
if (complete_at) {
|
||||||
@ -1309,7 +1311,7 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (searchText) {
|
if (searchText) {
|
||||||
if (!$A.strExists(`${name} ${desc}`, searchText)) {
|
if (id != searchText && !$A.strExists(`${name} ${desc}`, searchText)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1405,7 +1407,7 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.searchText) {
|
if (this.searchText) {
|
||||||
if (!$A.strExists(task.name, this.searchText) && !$A.strExists(task.desc, this.searchText)) {
|
if (task.id != this.searchText && !$A.strExists(task.name, this.searchText) && !$A.strExists(task.desc, this.searchText)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1425,7 +1427,7 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.searchText) {
|
if (this.searchText) {
|
||||||
if (!$A.strExists(task.name, this.searchText) && !$A.strExists(task.desc, this.searchText)) {
|
if (task.id != this.searchText && !$A.strExists(task.name, this.searchText) && !$A.strExists(task.desc, this.searchText)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,10 +10,10 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<div class="search-label">
|
<div class="search-label">
|
||||||
{{$L("任务名")}}
|
{{$L("关键词")}}
|
||||||
</div>
|
</div>
|
||||||
<div class="search-content">
|
<div class="search-content">
|
||||||
<Input v-model="keys.name" clearable/>
|
<Input v-model="keys.name" :placeholder="$L('ID、任务名...')" clearable/>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="search-button">
|
<li class="search-button">
|
||||||
|
|||||||
@ -10,10 +10,10 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<div class="search-label">
|
<div class="search-label">
|
||||||
{{$L("任务名")}}
|
{{$L("关键词")}}
|
||||||
</div>
|
</div>
|
||||||
<div class="search-content">
|
<div class="search-content">
|
||||||
<Input v-model="keys.name" clearable/>
|
<Input v-model="keys.name" :placeholder="$L('ID、任务名...')" clearable/>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="search-button">
|
<li class="search-button">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user