feat: 项目进展报表
This commit is contained in:
97
apps/web-antd/src/views/report/progress/modules/project.vue
Normal file
97
apps/web-antd/src/views/report/progress/modules/project.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getProgressByProjectPage } from '#/api/report/progress';
|
||||
|
||||
import { useProjectGridColumns, useProjectGridFormSchema } from '../data';
|
||||
|
||||
const [Grid] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useProjectGridFormSchema(),
|
||||
submitOnEnter: true,
|
||||
fieldMappingTime: [['updateTime', ['updateTimeStart', 'updateTimeEnd']]],
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useProjectGridColumns(),
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getProgressByProjectPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
},
|
||||
exportConfig: {},
|
||||
toolbarConfig: {
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
// export: true,
|
||||
},
|
||||
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'];
|
||||
let columnField = column.field as string;
|
||||
const mergeFields = [
|
||||
'serialNo',
|
||||
'status',
|
||||
'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>
|
||||
Reference in New Issue
Block a user