feat: 新增最后审批查找功能

pull/171/head
贾博轩 2 years ago
parent cc6f0ce4c1
commit 43d15cfdcf

@ -72,7 +72,10 @@ async function getHistory() {
getHistory() getHistory()
function goPath(item, id) { function goPath(item, id) {
router.push({ name: item.path, query: { id, searchContent: item.data[0].name } }) const desiredObject = item.data.find(function (item) {
return item.id === id;
});
router.push({ name: item.path, query: { id, searchContent: desiredObject.name } })
emit('close') emit('close')
} }

@ -236,6 +236,7 @@ const handleOk = (item: any) => {
@select="scrollHandler" @select="scrollHandler"
@close="setShowSearch(false)" @close="setShowSearch(false)"
@inputChange="inputChange" @inputChange="inputChange"
@showSearch="setShowSearch(true)"
/> />
<!-- 高级筛选 --> <!-- 高级筛选 -->
<AdvanceFilter <AdvanceFilter

@ -1,16 +1,21 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { nextTick, onMounted, ref } from 'vue'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import { asideMap } from '@/config/aside' import { asideMap } from '@/config/aside'
import type { SearchEntity } from '/#/home' import type { SearchEntity } from '/#/home'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
import { useRoute } from 'vue-router'
const route = useRoute()
const searchContent = route.query.searchContent as string;
defineOptions({ name: 'Search' }) defineOptions({ name: 'Search' })
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'close'): void (e: 'close'): void
(e: 'select', key: string): void (e: 'select', key: string): void
(e: 'inputChange', value: string): void (e: 'inputChange', value: string): void
(e: 'showSearch'): void
}>() }>()
const data = ref<SearchEntity[]>([]) const data = ref<SearchEntity[]>([])
@ -20,7 +25,7 @@ const searchKeyword = ref('')
const inputHandler = debounce((keyword) => { const inputHandler = debounce((keyword) => {
searchKeyword.value = keyword; searchKeyword.value = keyword;
emit('inputChange',keyword) emit('inputChange', keyword)
}, 300) }, 300)
configStore.$subscribe(() => { configStore.$subscribe(() => {
@ -54,7 +59,7 @@ function selectHandler(item: SearchEntity) {
// //
const searchName = () => { const searchName = () => {
configStore.setSearchValue(searchKeyword.value); configStore.setSearchValue(searchKeyword.value);
emit('inputChange',searchKeyword.value); emit('inputChange', searchKeyword.value);
} }
const close = () => { const close = () => {
@ -63,16 +68,29 @@ const close = () => {
emit('close'); emit('close');
} }
const initSerach = () => {
if (searchContent) {
emit('showSearch')
const id_param = searchContent.match(/-\d+-/);
if (id_param) {
searchKeyword.value = id_param[0].slice(1, -1);
emit('inputChange', searchKeyword.value)
}
}
}
onMounted(() => {
initSerach()
})
</script> </script>
<template> <template>
<div class="wrapper"> <div class="wrapper">
<n-popover <n-popover ref="popover" :style="{ padding: '0px' }" style="width: 248px" :show-arrow="false"
ref="popover" :style="{ padding: '0px' }" style="width: 248px" :show-arrow="false" placement="bottom-start" placement="bottom-start" trigger="focus">
trigger="focus"
>
<template #trigger> <template #trigger>
<n-input v-model:value="searchKeyword" style="width: 260px;height: 32px;" placeholder="请输入你需要搜索的内容" @input="inputHandler"> <n-input v-model:value="searchKeyword" style="width: 260px;height: 32px;" placeholder="请输入你需要搜索的内容"
@input="inputHandler">
<template #suffix> <template #suffix>
<SvgIcon size="14px" name="magnifying-1" @click="searchName" style="cursor: pointer;" /> <SvgIcon size="14px" name="magnifying-1" @click="searchName" style="cursor: pointer;" />
</template> </template>

@ -125,6 +125,8 @@ function getMore() {
state.pageNo += 1; state.pageNo += 1;
getList("more"); getList("more");
} }
console.log(tabList);
</script> </script>
<template> <template>
@ -170,7 +172,7 @@ function getMore() {
{{ item.titile }} {{ item.titile }}
</div> </div>
<div v-if="tab === 1" class="status"> <div v-if="tab === 1" class="status">
<div class="tag tag-blue">审批节点{{ item.tag.nodeName }}</div> <div class="tag tag-blue">审批节点{{ item.tag.sendUserName }}</div>
<div :class="item.tag.states === 3 ? 'tag-red' : 'tag-green'" class="tag"> <div :class="item.tag.states === 3 ? 'tag-red' : 'tag-green'" class="tag">
审批状态{{ getStateText(item.tag.states) }} 审批状态{{ getStateText(item.tag.states) }}
</div> </div>

@ -211,7 +211,6 @@ const initSerach = () => {
setShowSearch(true); setShowSearch(true);
const id_param = searchContent.match(/-\d+-/); const id_param = searchContent.match(/-\d+-/);
if (id_param) { if (id_param) {
console.log("aaaa", id_param);
search.value = id_param[0].slice(1, -1); search.value = id_param[0].slice(1, -1);
inputHandler(id_param[0].slice(1, -1)); inputHandler(id_param[0].slice(1, -1));
} }

Loading…
Cancel
Save