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, pageSize: page.pageSize,
currPage: page.pageNo, currPage: page.pageNo,
keyword: page.keyword, keyword: page.keyword,
userSearchId:page.userSearchId userSearchId: page.userSearchId,
}, },
}) })
@ -94,26 +94,36 @@ export async function getSimilarityList(params: any) {
params, params,
}) })
const { data: { records, pages, total } } = res const { data } = res
// 精简一下数据 if (data) {
const list = records.map((item) => { 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 { return {
id: item.id, pageCount: pages,
taskId: item.taskId, data: records,
taskname: item.fromtaskname, total,
assignee: item.assignee, }
pictureid: item.pictureid, }
imgurl: item.imgUrl, else {
thumburl: item.imgUrl, return {
iztrueorfalse: item.iztrueorfalse, pageCount: 0,
states: item.states, data: [],
total: 0,
} }
})
return {
pageCount: pages,
data: records,
total,
} }
} }

@ -74,7 +74,9 @@ function goPath(item, id) {
const desiredObject = item.data.find((item) => { const desiredObject = item.data.find((item) => {
return item.id === id 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 } }) router.push({ name: item.path, query: { id, searchContent: desiredObject.name } })
emit('close') emit('close')
} }

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

Loading…
Cancel
Save