From f9bd200593268acb17301615faf90f221f3cc9ef Mon Sep 17 00:00:00 2001 From: liushilong <2224574157@qq.com> Date: Wed, 17 Apr 2024 15:55:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20api=E8=AF=B7=E6=B1=82=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=8F=8Abug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/task/task.ts | 48 +++++++++++++++++++------------- src/components/Search/Search.vue | 4 ++- src/layout/index.vue | 15 +++++----- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/api/task/task.ts b/src/api/task/task.ts index 501a26f..5087c50 100644 --- a/src/api/task/task.ts +++ b/src/api/task/task.ts @@ -15,7 +15,7 @@ export async function getApprovalList(page: any) { pageSize: page.pageSize, currPage: page.pageNo, keyword: page.keyword, - userSearchId:page.userSearchId + userSearchId: page.userSearchId, }, }) @@ -94,26 +94,36 @@ export async function getSimilarityList(params: any) { params, }) - const { data: { records, pages, total } } = res - // 精简一下数据 - const list = records.map((item) => { + const { data } = res + if (data) { + const { records, pages, total } = data + // 精简一下数据 + const list = records.map((item) => { + return { + id: item.id, + taskId: item.taskId, + taskname: item.fromtaskname, + assignee: item.assignee, + pictureid: item.pictureid, + imgurl: item.imgUrl, + thumburl: item.imgUrl, + iztrueorfalse: item.iztrueorfalse, + states: item.states, + } + }) + return { - id: item.id, - taskId: item.taskId, - taskname: item.fromtaskname, - assignee: item.assignee, - pictureid: item.pictureid, - imgurl: item.imgUrl, - thumburl: item.imgUrl, - iztrueorfalse: item.iztrueorfalse, - states: item.states, + pageCount: pages, + data: records, + total, + } + } + else { + return { + pageCount: 0, + data: [], + total: 0, } - }) - - return { - pageCount: pages, - data: records, - total, } } diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 5a9539a..2d31538 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -74,7 +74,9 @@ function goPath(item, id) { const desiredObject = item.data.find((item) => { return item.id === id }) - storage.set('isSearch', true) + if (!storage.get('isSearch')) + storage.set('isSearch', true, Date.now() + 30 * 60 * 1000) + router.push({ name: item.path, query: { id, searchContent: desiredObject.name } }) emit('close') } diff --git a/src/layout/index.vue b/src/layout/index.vue index 6e39d10..b1d0c0b 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,5 +1,5 @@