feat: 终审列表数据筛选。图审弹窗bug修复

pull/57/head
刘释隆 1 year ago
parent 37685cdbcc
commit 747b1f10c0

@ -11,7 +11,9 @@ export const useWorkOrderStore = defineStore({
activeId: '', activeId: '',
packageList: [], packageList: [],
immersion: false, immersion: false,
name: '' name: '',
dataId: '',
approvalList: [],
}), }),
getters: { getters: {
getActiveId: (state: OrderState) => state.activeId, getActiveId: (state: OrderState) => state.activeId,
@ -22,10 +24,11 @@ export const useWorkOrderStore = defineStore({
setOrderList(list: PackageListItem[]) { setOrderList(list: PackageListItem[]) {
this.packageList = list this.packageList = list
}, },
setActive(index: number, orderId?: string) { setActive(index: number, orderId?: string, dataId?: string) {
this.currentIndex = index this.currentIndex = index
const order = this.packageList[index] const order = this.packageList[index]
this.activeId = orderId || order?.checkDuplicateId this.activeId = orderId || order?.checkDuplicateId
this.dataId = dataId || order.id;
}, },
forward() { forward() {
const len = this.packageList.length const len = this.packageList.length
@ -46,7 +49,7 @@ export const useWorkOrderStore = defineStore({
}, },
async fetchOrderList(pagination, keyword) { async fetchOrderList(pagination, keyword) {
const res = await getPackageList(pagination, keyword) const res = await getPackageList(pagination, keyword)
if (res.data&&res.data.length > 0) { if (res.data && res.data.length > 0) {
this.packageList.push(...res.data) this.packageList.push(...res.data)
if (!this.activeId) if (!this.activeId)
this.setActive(0) this.setActive(0)

@ -1,162 +1,178 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, nextTick, onBeforeMount, onMounted, reactive, ref, shallowRef, unref, watch } from 'vue' import {
import { CustomFilterModalVue, FilterModal, NewFilterModal } from '@/views/final/comp' computed,
import Search from '@/views/home/aside/comp/Search.vue' inject,
import AdvanceFilter from '@/views/home/aside/comp/AdvanceFilter.vue' nextTick,
import { getViewportOffset } from '@/utils/domUtils' onBeforeMount,
import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn' onMounted,
import { useFinal } from '@/store/modules/final' reactive,
import type { Filter } from '/#/home' ref,
import type { AsideEntity } from '@/config/aside' shallowRef,
import { asideMap } from '@/config/final' unref,
import type { AsideConfig } from '/#/api' watch,
import emitter from '@/utils/mitt' } from "vue";
import { CustomFilterModalVue, FilterModal, NewFilterModal } from "@/views/final/comp";
const finalStore = useFinal() import Search from "@/views/home/aside/comp/Search.vue";
import AdvanceFilter from "@/views/home/aside/comp/AdvanceFilter.vue";
import { getViewportOffset } from "@/utils/domUtils";
import { useWindowSizeFn } from "@/hooks/event/useWindowSizeFn";
import { useFinal } from "@/store/modules/final";
import type { Filter } from "/#/home";
import type { AsideEntity } from "@/config/aside";
import { asideMap } from "@/config/final";
import type { AsideConfig } from "/#/api";
import emitter from "@/utils/mitt";
const emit = defineEmits(["inputChange"]);
const finalStore = useFinal();
// //
const asideValue: Record<keyof typeof asideMap, any> = reactive({}) const asideValue: Record<keyof typeof asideMap, any> = reactive({});
// : // :
const asideVisible: Partial<Record<keyof AsideConfig, boolean>> = reactive({}) const asideVisible: Partial<Record<keyof AsideConfig, boolean>> = reactive({});
// //
const showItems = shallowRef<{ key: string, config: AsideEntity }[]>([]) const showItems = shallowRef<{ key: string; config: AsideEntity }[]>([]);
Object.keys(asideMap).forEach((key) => { Object.keys(asideMap).forEach((key) => {
const { defaultValue, inFilterList } = asideMap[key] const { defaultValue, inFilterList } = asideMap[key];
if (inFilterList !== false) if (inFilterList !== false) asideValue[key] = defaultValue;
asideValue[key] = defaultValue });
})
const filterModalRef = ref(null) const filterModalRef = ref(null);
const newFilterModalRef = ref(null) const newFilterModalRef = ref(null);
const customModalRef = ref(null) const customModalRef = ref(null);
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 mousetrap = inject('mousetrap') as any const mousetrap = inject("mousetrap") as any;
mousetrap.bind('[', collapseHandler) mousetrap.bind("[", collapseHandler);
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
computeSlideHeight() computeSlideHeight();
}) });
}) });
const collapse = ref(false) const collapse = ref(false);
function collapseHandler() { function collapseHandler() {
collapse.value = !collapse.value collapse.value = !collapse.value;
} }
const asideWidth = computed(() => { const asideWidth = computed(() => {
return collapse.value ? 0 : 308 return collapse.value ? 0 : 308;
}) });
const asideHeight = ref(500) const asideHeight = ref(500);
const asideStyle = computed(() => { const asideStyle = computed(() => {
return { return {
width: `${asideWidth.value}px`, width: `${asideWidth.value}px`,
height: `${asideHeight.value}px`, height: `${asideHeight.value}px`,
} };
}) });
const collapseIcon = computed(() => { const collapseIcon = computed(() => {
return collapse.value ? 'expand-cir' : 'collapse-cir' return collapse.value ? "expand-cir" : "collapse-cir";
}) });
function computeSlideHeight() { function computeSlideHeight() {
const headEl = document.querySelector('.aside-header')! const headEl = document.querySelector(".aside-header")!;
const { bottomIncludeBody } = getViewportOffset(headEl) const { bottomIncludeBody } = getViewportOffset(headEl);
const height = bottomIncludeBody const height = bottomIncludeBody;
asideHeight.value = height - 24 asideHeight.value = height - 24;
} }
useWindowSizeFn(computeSlideHeight, 280) useWindowSizeFn(computeSlideHeight, 280);
onBeforeMount(async () => { onBeforeMount(async () => {
finalStore.fetchCustomConfig() finalStore.fetchCustomConfig();
}) });
finalStore.$subscribe(() => { finalStore.$subscribe(() => {
const customConfig = finalStore.getCustomConfig const customConfig = finalStore.getCustomConfig;
if (customConfig === null) if (customConfig === null) return;
return
const showKeys: string[] = [...customConfig] const showKeys: string[] = [...customConfig];
const defaultKeys = Object.keys(asideMap).filter(key => asideMap[key].isDefaultFilter) const defaultKeys = Object.keys(asideMap).filter(
showKeys.unshift(...defaultKeys) (key) => asideMap[key].isDefaultFilter
);
showKeys.unshift(...defaultKeys);
Object.keys(asideMap).forEach((key) => { Object.keys(asideMap).forEach((key) => {
// //
if (key.startsWith('iz')) if (key.startsWith("iz"))
asideVisible[key] = asideMap[key] && (showKeys.includes(key) || asideMap[key].isDefaultFilter) asideVisible[key] =
}) asideMap[key] && (showKeys.includes(key) || asideMap[key].isDefaultFilter);
});
const items = showKeys.reduce((acc, key) => { const items = showKeys.reduce((acc, key) => {
if (asideMap[key]) { if (asideMap[key]) {
const config = { const config = {
key, key,
config: asideMap[key], config: asideMap[key],
} };
return [...acc, config] return [...acc, config];
} } else {
else { return acc;
return acc
} }
}, []) }, []);
showItems.value = items showItems.value = items;
}) });
watch(asideVisible, (newVal) => { watch(asideVisible, (newVal) => {
Object.keys(asideValue).forEach((key) => { Object.keys(asideValue).forEach((key) => {
if (newVal[key] === false) if (newVal[key] === false) asideValue[key] = asideMap[key].defaultValue;
asideValue[key] = asideMap[key].defaultValue });
}) });
})
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;
}) });
const showSearch = ref(false) const showSearch = ref(false);
function setShowSearch(value: boolean) { function setShowSearch(value: boolean) {
showSearch.value = value showSearch.value = value;
} }
// 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-final', searchId) emitter.emit("filter-final", searchId);
} }
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);
} }
watch(asideValue, (newVal) => { watch(asideValue, (newVal) => {
finalStore.setAsideValue(newVal) finalStore.setAsideValue(newVal);
}) });
const inputChange = (keyword)=>{ const inputChange = (keyword) => {
console.log("Search Component", keyword);
} emit("inputChange", keyword);
};
</script> </script>
<template> <template>
<div class="aside" :style="asideStyle" @mouseenter="asideEnter = true" @mouseleave="asideEnter = false"> <div
class="aside"
:style="asideStyle"
@mouseenter="asideEnter = true"
@mouseleave="asideEnter = false"
>
<div v-show="showCollapse" class="aside-collapse"> <div v-show="showCollapse" class="aside-collapse">
<div class="aside-collapse-btn" @click="collapseHandler"> <div class="aside-collapse-btn" @click="collapseHandler">
<SvgIcon :name="collapseIcon" size="40" /> <SvgIcon :name="collapseIcon" size="40" />
@ -165,23 +181,40 @@ const inputChange = (keyword)=>{
<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)" @inputChange="inputChange" /> <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"
@show-custom="showModal(customModalRef)" @show-filter="showModal(filterModalRef)" :type="1"
@select="filterHandler"
@update:search="setShowSearch(true)"
@show-custom="showModal(customModalRef)"
@show-filter="showModal(filterModalRef)"
/> />
</div> </div>
<component <component
:is="item.config.component" v-for="(item, index) in showItems" :id="item.key" :key="index" :is="item.config.component"
v-model:value="asideValue[item.key]" :label="item.config.label" v-for="(item, index) in showItems"
:id="item.key"
:key="index"
v-model:value="asideValue[item.key]"
:label="item.config.label"
/> />
<!-- 筛选 --> <!-- 筛选 -->
<CustomFilterModalVue ref="customModalRef" /> <CustomFilterModalVue ref="customModalRef" />
<!-- 过滤列表 --> <!-- 过滤列表 -->
<FilterModal ref="filterModalRef" @edit-filter="editFilter" @show-new-filter="showModal(newFilterModalRef)" /> <FilterModal
ref="filterModalRef"
@edit-filter="editFilter"
@show-new-filter="showModal(newFilterModalRef)"
/>
<!-- 新增过滤 --> <!-- 新增过滤 -->
<NewFilterModal ref="newFilterModalRef" /> <NewFilterModal ref="newFilterModalRef" />
</n-scrollbar> </n-scrollbar>
@ -193,7 +226,7 @@ const inputChange = (keyword)=>{
display: flex; display: flex;
position: relative; position: relative;
flex-direction: column; flex-direction: column;
background: #FFF; background: #fff;
border: 1px solid #efeff5; border: 1px solid #efeff5;
border-radius: 3px; border-radius: 3px;
box-sizing: border-box; box-sizing: border-box;
@ -230,11 +263,17 @@ const inputChange = (keyword)=>{
right: -20px; right: -20px;
} }
::v-deep(.n-collapse .n-collapse-item.n-collapse-item--right-arrow-placement .n-collapse-item__header .n-collapse-item-arrow) { ::v-deep(.n-collapse
.n-collapse-item.n-collapse-item--right-arrow-placement
.n-collapse-item__header
.n-collapse-item-arrow) {
margin-left: 8px; margin-left: 8px;
} }
::v-deep(.n-collapse .n-collapse-item .n-collapse-item__header .n-collapse-item__header-main) { ::v-deep(.n-collapse
.n-collapse-item
.n-collapse-item__header
.n-collapse-item__header-main) {
font-weight: bold; font-weight: bold;
justify-content: space-between; justify-content: space-between;
} }
@ -247,11 +286,18 @@ const inputChange = (keyword)=>{
border-top: 0px; border-top: 0px;
} }
::v-deep(.n-collapse .n-collapse-item .n-collapse-item__content-wrapper .n-collapse-item__content-inner) { ::v-deep(.n-collapse
.n-collapse-item
.n-collapse-item__content-wrapper
.n-collapse-item__content-inner) {
padding-top: 10px; padding-top: 10px;
} }
::v-deep(.n-scrollbar > .n-scrollbar-rail.n-scrollbar-rail--vertical > .n-scrollbar-rail__scrollbar, .n-scrollbar + .n-scrollbar-rail.n-scrollbar-rail--vertical > .n-scrollbar-rail__scrollbar) { ::v-deep(.n-scrollbar
> .n-scrollbar-rail.n-scrollbar-rail--vertical
> .n-scrollbar-rail__scrollbar, .n-scrollbar
+ .n-scrollbar-rail.n-scrollbar-rail--vertical
> .n-scrollbar-rail__scrollbar) {
width: 0px; width: 0px;
} }
} }

File diff suppressed because it is too large Load Diff

@ -7,7 +7,7 @@ import ListContent from './content/ListContent.vue'
const showList = ref(false); const showList = ref(false);
const contentRef = ref(null); const contentRef = ref(null);
const inputChange = (keyword)=>{ const inputChange = (keyword)=>{
contentRef.value.filterTableData(keyword)
} }
</script> </script>

@ -1,14 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import { deletePackage } from '@/api/home/main' import { deletePackage } from "@/api/home/main";
import NotPassed from '@/components/NotPassed.vue' import NotPassed from "@/components/NotPassed.vue";
import { useWorkOrder } from '@/store/modules/workOrder' import { useWorkOrder } from "@/store/modules/workOrder";
import { isEmpty } from '@/utils' import { isEmpty } from "@/utils";
import { useInfiniteScroll } from '@vueuse/core' import { useInfiniteScroll } from "@vueuse/core";
import { useMessage } from 'naive-ui' import { useMessage } from "naive-ui";
import { reactive, ref, watch } from 'vue' import { reactive, ref, watch } from "vue";
import ApprovalModal from '../modal/ApprovalModal.vue' import ApprovalModal from "../modal/ApprovalModal.vue";
import ListItem from './ListItem.vue' import ListItem from "./ListItem.vue";
import type { PackageListItem } from '/#/workorder' import type { PackageListItem } from "/#/workorder";
defineProps({ defineProps({
showFieldList: { showFieldList: {
@ -19,132 +19,126 @@ defineProps({
type: Array, type: Array,
default: () => [], default: () => [],
}, },
}) });
const workStore = useWorkOrder() const workStore = useWorkOrder();
const data = ref<PackageListItem[]>([]) const data = ref<PackageListItem[]>([]);
const activeId = ref('') const activeId = ref("");
const el = ref<HTMLDivElement | null>(null) const el = ref<HTMLDivElement | null>(null);
const keyword = ref('') const keyword = ref("");
const canloadMore = ref(true) const canloadMore = ref(true);
const isLoading = ref(false) const isLoading = ref(false);
const pagination = reactive({ const pagination = reactive({
pageNo: 0, pageNo: 0,
pageSize: 10, pageSize: 10,
}) });
const approvalModalRef: any = ref(null) const approvalModalRef: any = ref(null);
const notPassedRef: any = ref(null) const notPassedRef: any = ref(null);
const overTask = ref<any>(null); const overTask = ref<any>(null);
function selectHandler(id: string, index: number) { function selectHandler(id: string, index: number) {
workStore.setActive(index) // console.log('selectHandler',id)
workStore.setActive(index);
// showModal(approvalModalRef, id) // showModal(approvalModalRef, id)
} }
useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
loadMore() loadMore();
}, },
{ {
distance: 10, distance: 10,
interval: 1500, interval: 1500,
canLoadMore: () => canloadMore.value, canLoadMore: () => canloadMore.value,
}, }
) );
async function loadMore() { async function loadMore() {
if (isLoading.value || el.value == null) if (isLoading.value || el.value == null) return;
return isLoading.value = true;
isLoading.value = true
try { try {
const more = await fetchList() const more = await fetchList();
more.forEach(ele=>{ more.forEach((ele) => {
ele.search = JSON.parse(ele.search) ele.search = JSON.parse(ele.search);
// ele.search.createTime = ele.search.submit_date_timestamp // ele.search.createTime = ele.search.submit_date_timestamp
}) });
data.value.push(...more) data.value.push(...more);
} } finally {
finally { isLoading.value = false;
isLoading.value = false
} }
} }
async function fetchList() { async function fetchList() {
try { try {
pagination.pageNo += 1 pagination.pageNo += 1;
const result = await workStore.fetchOrderList(pagination, keyword.value) const result = await workStore.fetchOrderList(pagination, keyword.value);
const { data, pageCount } = result const { data, pageCount } = result;
if (pageCount !== 0) if (pageCount !== 0) canloadMore.value = pageCount >= pagination.pageNo;
canloadMore.value = pageCount >= pagination.pageNo else canloadMore.value = false;
else
canloadMore.value = false return data || [];
} catch (error) {
return data || [] canloadMore.value = false;
} return [];
catch (error) {
canloadMore.value = false
return []
} }
} }
watch( watch(
() => workStore.activeId, () => workStore.activeId,
(newVal) => { (newVal) => {
if (isEmpty(newVal)) if (isEmpty(newVal)) return;
return
activeId.value = newVal; activeId.value = newVal;
approvalModalRef.value.showModal(activeId.value) approvalModalRef.value.showModal(workStore.dataId);
}
}, );
)
function reset() { function reset() {
pagination.pageNo = 0 pagination.pageNo = 0;
pagination.pageSize = 10 pagination.pageSize = 10;
canloadMore.value = true canloadMore.value = true;
data.value.length = 0 data.value.length = 0;
workStore.reset() workStore.reset();
} }
function notPass(value) { function notPass(value) {
notPassedRef.value.showModal(value) notPassedRef.value.showModal(value);
} }
async function search(word: string) { async function search(word: string) {
keyword.value = word keyword.value = word;
reset() reset();
useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
loadMore() loadMore();
}, },
{ distance: 10, canLoadMore: () => canloadMore.value }, { distance: 10, canLoadMore: () => canloadMore.value }
) );
} }
function overTaskHandelr(item: any) { function overTaskHandelr(item: any) {
overTask.value = item overTask.value = item;
} }
function leaveTaskHandler(event) { function leaveTaskHandler(event) {
if(event?.relatedTarget?.id !=="taskPopconfirmRef"){ if (event?.relatedTarget?.id !== "taskPopconfirmRef") {
overTask.value = null; overTask.value = null;
} }
} }
const message = useMessage() const message = useMessage();
function dismisClick(packageId:string) { function dismisClick(packageId: string) {
deletePackage({packageId: packageId}).then((res) => { deletePackage({ packageId: packageId }).then((res) => {
if(res.code==="OK"){ if (res.code === "OK") {
message.success("解散任务包成功") message.success("解散任务包成功");
reset() reset();
loadMore() loadMore();
} }
}) });
} }
defineExpose({ defineExpose({
search, search,
}) });
</script> </script>
<template> <template>
@ -161,7 +155,7 @@ defineExpose({
:dicts="dicts" :dicts="dicts"
:mouse-over-task="overTask" :mouse-over-task="overTask"
@click="selectHandler(item.id, index)" @click="selectHandler(item.id, index)"
@mouseover="overTaskHandelr(item)" @mouseover="overTaskHandelr(item)"
@mouseleave="leaveTaskHandler" @mouseleave="leaveTaskHandler"
@dismisClick="dismisClick" @dismisClick="dismisClick"
/> />

@ -3,6 +3,7 @@ import { nextTick, onDeactivated, onMounted, reactive, ref, toRefs } from "vue";
import { format } from "date-fns"; import { format } from "date-fns";
import { NButton, NDataTable, useDialog, useMessage } from "naive-ui"; import { NButton, NDataTable, useDialog, useMessage } from "naive-ui";
import { aiApprovaltools, aiApprovaltoolsClearmark, setTF } from "@/api/work/work"; import { aiApprovaltools, aiApprovaltoolsClearmark, setTF } from "@/api/work/work";
import { audit } from "@/api/task/task";
import { getToolsCount } from "@/api/home/main"; import { getToolsCount } from "@/api/home/main";
import { storage } from "@/utils/Storage"; import { storage } from "@/utils/Storage";
import { CURRENT_USER } from "@/store/mutation-types"; import { CURRENT_USER } from "@/store/mutation-types";
@ -32,6 +33,7 @@ function showModal(id) {
} }
async function getDetail(id) { async function getDetail(id) {
console.log('getDetail',id)
// const userInfo = storage.get(CURRENT_USER); // const userInfo = storage.get(CURRENT_USER);
// const nodeType = userInfo.nodeType; // const nodeType = userInfo.nodeType;
// id = "264626184091111068"; // id = "264626184091111068";
@ -43,12 +45,13 @@ async function getDetail(id) {
} }
const handleReject = async () => { const handleReject = async () => {
const res = await setTF({ const res = await audit()
taskchildpictureids: state.detail.taskIdList.join(","), // const res = await setTF({
packageid: state.packageid, // taskchildpictureids: state.detail.taskIdList.join(","),
iztrueorfalse: 0, // packageid: state.packageid,
}); // iztrueorfalse: 0,
console.log(res, "handleReject"); // });
// console.log(res, "handleReject");
}; };
async function clearMark() { async function clearMark() {
@ -86,13 +89,6 @@ async function viewRepeat(e: MouseEvent) {
closeModal(); closeModal();
} }
async function getShowStatus() {
const res = await getToolsCount();
if (res.code == "OK") {
show.value = true;
}
}
const initRem = () => { const initRem = () => {
const designWidth = 1440; const designWidth = 1440;
const rempPx = 16; const rempPx = 16;
@ -100,7 +96,6 @@ const initRem = () => {
document.documentElement.style.fontSize = scale * rempPx + "px"; document.documentElement.style.fontSize = scale * rempPx + "px";
}; };
onMounted(() => { onMounted(() => {
getShowStatus();
nextTick(() => { nextTick(() => {
initRem(); initRem();
}); });
@ -126,7 +121,7 @@ defineExpose({
<div class="wrapper-hearder"> <div class="wrapper-hearder">
<div class="wrapper-title">智能AI审批工具</div> <div class="wrapper-title">智能AI审批工具</div>
<div class="wrapper-mark"> <div class="wrapper-mark">
{{ detail.tenantUserName || '部门信息' }} {{ detail.tenantUserName || "部门信息" }}
</div> </div>
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">

@ -17,7 +17,8 @@ export interface OrderState {
currentIndex: number currentIndex: number
packageList: PackageListItem[] packageList: PackageListItem[]
approvalList: any[] approvalList: any[]
immersion: boolean immersion: boolean,
dataId: string
} }
// 任务实体 // 任务实体

Loading…
Cancel
Save