feat: api请求数据处理及bug修复 #216

Merged
liushilong merged 1 commits from fix/allseach_bug into test 1 year ago

@ -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,
}
}

@ -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')
}

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, onBeforeMount, unref } from 'vue'
import { computed, onBeforeMount, onMounted, unref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { Logo } from './components/Logo'
import { MainView } from './components/Main'
@ -10,7 +10,7 @@ import { storage } from '@/utils/Storage'
const router = useRouter()
const route = useRoute()
onBeforeMount(() => {
onMounted(() => {
/**
* 如果刷新则去掉筛选条件
* 1. 如果当前页面路由与上一个页面路由相同时则为刷新
@ -20,14 +20,13 @@ onBeforeMount(() => {
* 4. 搜索点击->存storage->跳转页面->onMounted
* ->如果storage为true则不replace 并将storage置false
*/
if (
history.state.back == route.path
&& JSON.stringify(route.query).trim() != '{}'
&& storage.get('isSearch')
) {
storage.set('isSearch', false)
if (storage.get('isSearch')) {
storage.remove('isSearch')
router.replace(route.path)
return
}
if (history.state.back == route.path && JSON.stringify(route.query).trim() != '{}')
router.replace(route.path)
})
const { menuSetting } = useProjectSetting()

Loading…
Cancel
Save