车间能级提升-智能设备管理系统
baoshiwei
2025-07-02 2f0009c750de4d47a18cce4a5a403fa83ba0c209
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { VxeGridProps } from '#/adapter/vxe-table';
import { ref } from 'vue';
import dayjs from 'dayjs';
import { type FormSchemaGetter } from '#/adapter/form';
 
export const querySchema: FormSchemaGetter = () => [
  {
    component: 'DatePicker',
    componentProps: {
      picker: 'year',
      format: 'YYYY',
      valueFormat: 'YYYY',
      placeholder: '请选择年份',
      allowClear: true,
      defaultValue: dayjs().format('YYYY'),
      getPopupContainer: (triggerNode: HTMLElement) => triggerNode.parentNode as HTMLElement
    },
    fieldName: 'selectYear',
    defaultValue: dayjs().format('YYYY'),
    label: '年份选择'
  }
];
 
export function getEfficiencyColumns() {
  const months = Array.from({ length: 12 }, (_, i) => `${i + 1}月`);
  const columns: VxeGridProps['columns'] = [
    { title: '项目', field: 'item', width: 160, fixed: 'left' },
    ...months.map(month => ({ title: month, field: month, align: 'center' as const })),
    { title: '全年合计', field: 'total', align: 'center' as const }
  ];
  return columns;
}
 
export const columns = ref<VxeGridProps['columns']>(getEfficiencyColumns());