feat: 报表中心调整

This commit is contained in:
caiyuchao
2025-09-10 17:05:28 +08:00
parent 2f446fac55
commit 63e3792e6d
14 changed files with 391 additions and 337 deletions

View File

@@ -0,0 +1,99 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getProgressByStaffPage } from '#/api/report/progress';
import { useStaffGridColumns, useStaffGridFormSchema } from '../data';
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: useStaffGridFormSchema(),
submitOnEnter: true,
fieldMappingTime: [['updateTime', ['updateTimeStart', 'updateTimeEnd']]],
},
gridOptions: {
columns: useStaffGridColumns(),
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getProgressByStaffPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
pagerConfig: {
enabled: true,
},
exportConfig: {},
toolbarConfig: {
refresh: { code: 'query' },
search: true,
// export: true,
},
height: 'auto',
rowConfig: {
keyField: 'id',
isHover: false,
useKey: true,
},
columnConfig: {
useKey: true,
},
border: true,
virtualXConfig: {
enabled: false,
},
virtualYConfig: {
enabled: false,
},
headerCellStyle: { backgroundColor: '#fafafa' },
spanMethod({ row, rowIndex, column, visibleData }) {
const spanFields = ['projectName', 'customerName', 'author'];
let columnField = column.field as string;
const mergeFields = [
'serialNo',
'status',
'businessStatus',
'businessOwnerName',
'technicalOwnerAName',
'technicalOwnerBName',
'startTime',
];
if (mergeFields.includes(columnField)) {
// 字段与前面的合并方式相同
columnField = 'projectName';
}
const cellValue = (row as Record<string, any>)[columnField];
if (cellValue && spanFields.includes(columnField)) {
const prevRow = visibleData[rowIndex - 1];
let nextRow = visibleData[rowIndex + 1];
if (
prevRow &&
(prevRow as Record<string, any>)[columnField] === cellValue
) {
return { rowspan: 0, colspan: 0 };
} else {
let countRowspan = 1;
while (
nextRow &&
(nextRow as Record<string, any>)[columnField] === cellValue
) {
nextRow = visibleData[++countRowspan + rowIndex];
}
if (countRowspan > 1) {
return { rowspan: countRowspan, colspan: 1 };
}
}
}
},
} as VxeTableGridOptions<any>,
});
</script>
<template>
<Grid table-title="成员进展" />
</template>