Merge pull request 'feat: 高级筛选逻辑修复,任务审批模块高级筛选type错误修复' (#54) from al into test

Reviewed-on: #54
pull/57/head
刘释隆 1 year ago
commit 37685cdbcc

@ -149,6 +149,10 @@ function editFilter(filter: any) {
watch(asideValue, (newVal) => { watch(asideValue, (newVal) => {
finalStore.setAsideValue(newVal) finalStore.setAsideValue(newVal)
}) })
const inputChange = (keyword)=>{
}
</script> </script>
<template> <template>
@ -161,7 +165,7 @@ watch(asideValue, (newVal) => {
<n-scrollbar trigger="none"> <n-scrollbar trigger="none">
<div class="aside-header"> <div class="aside-header">
<!-- 搜索跳转模块 --> <!-- 搜索跳转模块 -->
<Search v-show="showSearch" @select="scrollHandler" @close="setShowSearch(false)" /> <Search v-show="showSearch" @select="scrollHandler" @close="setShowSearch(false)" @inputChange="inputChange" />
<!-- 高级筛选 --> <!-- 高级筛选 -->
<AdvanceFilter <AdvanceFilter
v-show="!showSearch" :type="1" @select="filterHandler" @update:search="setShowSearch(true)" v-show="!showSearch" :type="1" @select="filterHandler" @update:search="setShowSearch(true)"

@ -303,6 +303,8 @@ function closeModal() {
defineExpose({ defineExpose({
showModal, showModal,
query,
pagination
}); });
const inputHandler = debounce((word) => { const inputHandler = debounce((word) => {

@ -1,90 +1,97 @@
<script lang="ts" setup> <script lang="ts" setup>
import { debounce } from 'lodash-es' import { debounce } from "lodash-es";
import { computed, inject, onBeforeMount, onMounted, ref, shallowRef, unref, watch } from 'vue'
import CustomFieldModal from '../modal/CustomFieldModal.vue'
import AdvanceFilter from '../../home/aside/comp/AdvanceFilter.vue'
import { import {
FilterModalVue, computed,
} from '../../home/aside/comp/modals' inject,
import NewFilterModalVue from '../modal/NewFilterModal.vue' onBeforeMount,
import TaskList from './TaskList.vue' onMounted,
import type { AsideEntity } from '@/config/aside' ref,
import { useUser } from '@/store/modules/user' shallowRef,
import { getAllfieldList, getfieldList } from '@/api/home/filter' unref,
import { useTaskStore } from '@/store/modules/task' watch,
import emitter from '@/utils/mitt' } from "vue";
import { useConfig } from '@/store/modules/asideConfig' import CustomFieldModal from "../modal/CustomFieldModal.vue";
import AdvanceFilter from "../../home/aside/comp/AdvanceFilter.vue";
import { FilterModalVue } from "../../home/aside/comp/modals";
import NewFilterModalVue from "../modal/NewFilterModal.vue";
import TaskList from "./TaskList.vue";
import type { AsideEntity } from "@/config/aside";
import { useUser } from "@/store/modules/user";
import { getAllfieldList, getfieldList } from "@/api/home/filter";
import { useTaskStore } from "@/store/modules/task";
import emitter from "@/utils/mitt";
import { useConfig } from "@/store/modules/asideConfig";
const CustomFieldModalRef = ref(null) const CustomFieldModalRef = ref(null);
const collapse = ref(false) const collapse = ref(false);
const taskStore = useTaskStore() const taskStore = useTaskStore();
const taskListRef: any = ref(null) const taskListRef: any = ref(null);
// //
const showFieldList = ref<any[]>([]) const showFieldList = ref<any[]>([]);
const search = ref('') const search = ref("");
function collapseHandler() { function collapseHandler() {
collapse.value = !collapse.value collapse.value = !collapse.value;
} }
const mousetrap = inject('mousetrap') as any const mousetrap = inject("mousetrap") as any;
mousetrap.bind('[', collapseHandler) mousetrap.bind("[", collapseHandler);
const asideWidth = computed(() => { const asideWidth = computed(() => {
return collapse.value ? 0 : 308 return collapse.value ? 0 : 308;
}) });
const asideStyle = computed(() => { const asideStyle = computed(() => {
return { return {
width: `${asideWidth.value}px`, width: `${asideWidth.value}px`,
} };
}) });
const collapseIcon = computed(() => { const collapseIcon = computed(() => {
return collapse.value ? 'expand-cir' : 'collapse-cir' return collapse.value ? "expand-cir" : "collapse-cir";
}) });
const asideEnter = ref(false) const asideEnter = ref(false);
const showCollapse = computed(() => { const showCollapse = computed(() => {
return collapse.value ? true : asideEnter.value return collapse.value ? true : asideEnter.value;
}) });
watch( watch(
() => taskStore.immersion, () => taskStore.immersion,
() => { () => {
collapse.value = true collapse.value = true;
}, }
) );
function showFilter() { function showFilter() {
const modal = unref(CustomFieldModalRef)! as any const modal = unref(CustomFieldModalRef)! as any;
modal.showModal() modal.showModal();
} }
const showSearch = ref(false) const showSearch = ref(false);
function setShowSearch(value: boolean) { function setShowSearch(value: boolean) {
if (!value) { if (!value) {
console.log('setShowSearch', value) console.log("setShowSearch", value);
search.value = '' search.value = "";
taskListRef.value.search('') taskListRef.value.search("");
return return;
} }
showSearch.value = value showSearch.value = value;
} }
const inputHandler = debounce((word) => { const inputHandler = debounce((word) => {
(taskListRef.value as any).search(word) (taskListRef.value as any).search(word);
}, 500) }, 500);
const reviewType = 2 const reviewType = 2;
async function getshowFieldList() { async function getshowFieldList() {
showFieldList.value = [] showFieldList.value = [];
const userStore = useUser() const userStore = useUser();
const userInfo = userStore.getUserInfo const userInfo = userStore.getUserInfo;
let res let res;
res = await getAllfieldList(reviewType) // res = await getAllfieldList(reviewType); //
const allList = res.data const allList = res.data;
res = await getfieldList(reviewType, userInfo.id) // res = await getfieldList(reviewType, userInfo.id); //
const useList = res.data const useList = res.data;
/** /**
* name 标题 * name 标题
* id 键值 * id 键值
@ -92,20 +99,19 @@ async function getshowFieldList() {
* checked 是否选中 * checked 是否选中
*/ */
if (useList?.userFieldFixed) { if (useList?.userFieldFixed) {
useList?.userFieldFixed?.split(',').map((v) => { useList?.userFieldFixed?.split(",").map((v) => {
let item = allList.find(v2 => v2.name == v) let item = allList.find((v2) => v2.name == v);
if (item) { if (item) {
item = { item = {
name: item.fieldDesc, name: item.fieldDesc,
id: item.name, id: item.name,
fix: item.isrequired == 2, fix: item.isrequired == 2,
checked: true, checked: true,
};
showFieldList.value.push(item);
} }
showFieldList.value.push(item) });
} } else {
})
}
else {
// //
allList?.map((v) => { allList?.map((v) => {
if (v.isrequired == 2) { if (v.isrequired == 2) {
@ -114,52 +120,58 @@ async function getshowFieldList() {
id: v.name, id: v.name,
fix: v.isrequired == 2, fix: v.isrequired == 2,
checked: true, checked: true,
};
showFieldList.value.push(item);
} }
showFieldList.value.push(item) });
}
})
} }
} }
onMounted(() => { onMounted(() => {
getshowFieldList() getshowFieldList();
}) });
// key // key
function scrollHandler(key: string) { function scrollHandler(key: string) {
const element = document.querySelector(`#${key}`) const element = document.querySelector(`#${key}`);
element?.scrollIntoView(true) element?.scrollIntoView(true);
} }
// //
function filterHandler(searchId: string) { function filterHandler(searchId: string) {
emitter.emit('filter', searchId) emitter.emit("filter", searchId);
} }
function showModal(modalRef: any) { function showModal(modalRef: any) {
const modal = unref(modalRef)! as any const modal = unref(modalRef)! as any;
modal.showModal() modal.showModal();
} }
// //
const showItems = shallowRef<{ key: string, config: AsideEntity }[]>([]) const showItems = shallowRef<{ key: string; config: AsideEntity }[]>([]);
const filterModalRef = ref(null) const filterModalRef: any = ref(null);
const newFilterModalRef = ref(null) const newFilterModalRef = ref(null);
const customModalRef = ref(null) const customModalRef = ref(null);
function editFilter(filter: any) { function editFilter(filter: any) {
const modal = unref(newFilterModalRef)! as any const modal = unref(newFilterModalRef)! as any;
modal.showModal() modal.showModal();
modal.edit(filter) modal.edit(filter);
} }
const configStore = useConfig() const configStore = useConfig();
const newFilterOk = () => {
filterModalRef.value.query(
filterModalRef.value.pagination.page,
filterModalRef.value.pagination.pageSize
);
};
onBeforeMount(async () => { onBeforeMount(async () => {
configStore.fetchConfig() configStore.fetchConfig();
configStore.fetchCustomConfig() configStore.fetchCustomConfig();
}) });
function setAsideItemName(text) { function setAsideItemName(text) {
taskListRef.value.setStatusName(text) taskListRef.value.setStatusName(text);
} }
defineExpose({ defineExpose({
setAsideItemName, setAsideItemName,
}) });
</script> </script>
<template> <template>
@ -243,7 +255,7 @@ defineExpose({
@show-new-filter="showModal(newFilterModalRef)" @show-new-filter="showModal(newFilterModalRef)"
/> />
<!-- 新增过滤 --> <!-- 新增过滤 -->
<NewFilterModalVue ref="newFilterModalRef" /> <NewFilterModalVue ref="newFilterModalRef" @onOk="newFilterOk" />
</div> </div>
</template> </template>

@ -15,6 +15,7 @@ const configStore = useConfig()
const dicStore = useDictionary() const dicStore = useDictionary()
const currentStatus = ref<Status>('new') const currentStatus = ref<Status>('new')
let currentEditId: string | null = null let currentEditId: string | null = null
const emit = defineEmits(['onOk'])
const modalTitle = computed(() => { const modalTitle = computed(() => {
return currentStatus.value === 'new' ? '新建过滤条件' : '编辑过滤条件' return currentStatus.value === 'new' ? '新建过滤条件' : '编辑过滤条件'
@ -112,7 +113,7 @@ function handleSumbit(e: MouseEvent) {
const param: FilterCondition = { const param: FilterCondition = {
searchname: formValue.name!, searchname: formValue.name!,
type: 1, type: 2,
ocrUsersearchchildList: list, ocrUsersearchchildList: list,
} }
@ -121,6 +122,7 @@ function handleSumbit(e: MouseEvent) {
else else
updateCondition({ id: currentEditId!, ...param }) updateCondition({ id: currentEditId!, ...param })
closeModal() closeModal()
emit('onOk')
}) })
} }

Loading…
Cancel
Save