feat: 高级筛选逻辑修复,任务审批模块高级筛选type错误修复

pull/54/head
刘释隆 1 year ago
parent 6085997eb5
commit 03163892ac

@ -149,6 +149,10 @@ function editFilter(filter: any) {
watch(asideValue, (newVal) => {
finalStore.setAsideValue(newVal)
})
const inputChange = (keyword)=>{
}
</script>
<template>
@ -161,7 +165,7 @@ watch(asideValue, (newVal) => {
<n-scrollbar trigger="none">
<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
v-show="!showSearch" :type="1" @select="filterHandler" @update:search="setShowSearch(true)"

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

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

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

Loading…
Cancel
Save