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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { HrmSalaryCalculationApi } from '#/api/hrm/salary/calculation';
|
| import { DICT_TYPE } from '#/packages/constants/src';
| import { getDictOptions } from '#/packages/effects/hooks/src';
|
| import { getDeptList } from '#/api/system/dept';
| import { getEmployeeSimpleList } from '#/api/hrm/employee';
| import { handleTree } from '#/packages/utils/src';
|
| /** 列表的搜索表单 */
| export function useGridFormSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'period',
| label: '核算周期',
| component: 'DatePicker',
| componentProps: {
| picker: 'month',
| allowClear: true,
| format: 'YYYY-MM',
| valueFormat: 'YYYY-MM',
| style: { width: '100%' },
| placeholder: '请选择核算周期',
| },
| },
| {
| fieldName: 'userId',
| label: '员工',
| component: 'ApiSelect',
| componentProps: {
| api: getEmployeeSimpleList,
| labelField: 'name',
| valueField: 'id',
| allowClear: true,
| placeholder: '请选择员工',
| },
| },
| {
| fieldName: 'deptId',
| label: '部门',
| component: 'ApiTreeSelect',
| componentProps: {
| api: async () => {
| const data = await getDeptList();
| return handleTree(data);
| },
| labelField: 'name',
| valueField: 'id',
| childrenField: 'children',
| allowClear: true,
| placeholder: '请选择部门',
| treeDefaultExpandAll: true,
| },
| },
| {
| fieldName: 'status',
| label: '状态',
| component: 'Select',
| componentProps: {
| allowClear: true,
| options: getDictOptions(DICT_TYPE.HRM_SALARY_STATUS, 'number'),
| placeholder: '请选择状态',
| },
| },
| ];
| }
|
| /** 列表的字段 */
| export function useGridColumns(): VxeTableGridOptions<HrmSalaryCalculationApi.SalaryCalculation>['columns'] {
| return [
| { type: 'checkbox', width: 50 },
| { field: 'no', title: '核算单号', minWidth: 140 },
| { field: 'period', title: '核算周期', width: 100 },
| { field: 'userName', title: '员工姓名', minWidth: 100 },
| { field: 'deptName', title: '部门', minWidth: 120 },
| { field: 'baseSalary', title: '基本工资', width: 100, formatter: 'formatAmount2' },
| { field: 'performanceSalary', title: '绩效工资', width: 100, formatter: 'formatAmount2' },
| { field: 'overtimePay', title: '加班费', width: 100, formatter: 'formatAmount2' },
| { field: 'mealAllowance', title: '餐补', width: 80, formatter: 'formatAmount2' },
| { field: 'transportAllowance', title: '交通补贴', width: 80, formatter: 'formatAmount2' },
| { field: 'otherAllowance', title: '其他补贴', width: 80, formatter: 'formatAmount2' },
| { field: 'socialSecurityDeduction', title: '社保扣款', width: 100, formatter: 'formatAmount2' },
| { field: 'housingFundDeduction', title: '公积金扣款', width: 100, formatter: 'formatAmount2' },
| { field: 'taxDeduction', title: '个税扣款', width: 100, formatter: 'formatAmount2' },
| { field: 'otherDeduction', title: '其他扣款', width: 80, formatter: 'formatAmount2' },
| { field: 'leaveDeduction', title: '请假扣款', width: 100, formatter: 'formatAmount2' },
| { field: 'actualSalary', title: '实发工资', width: 100, formatter: 'formatAmount2' },
| { field: 'workDays', title: '出勤天数', width: 80 },
| { field: 'overtimeHours', title: '加班时长(h)', width: 100 },
| {
| field: 'status',
| title: '状态',
| width: 100,
| fixed: 'right',
| slots: {
| default: 'status',
| },
| },
| {
| title: '操作',
| width: 120,
| fixed: 'right',
| slots: {
| default: 'actions',
| },
| },
| ];
| }
|
| /** 预览表格的列定义(用于Ant Design Table) */
| export function usePreviewColumns() {
| return [
| { title: '员工姓名', dataIndex: 'userName', width: 100, fixed: 'left' },
| { title: '部门', dataIndex: 'deptName', width: 120 },
| { title: '基本工资', dataIndex: 'baseSalary', width: 110 },
| { title: '绩效工资', dataIndex: 'performanceSalary', width: 110 },
| { title: '加班费', dataIndex: 'overtimePay', width: 110 },
| { title: '餐补', dataIndex: 'mealAllowance', width: 100 },
| { title: '交通补贴', dataIndex: 'transportAllowance', width: 100 },
| { title: '其他补贴', dataIndex: 'otherAllowance', width: 100 },
| { title: '社保扣款', dataIndex: 'socialSecurityDeduction', width: 110 },
| { title: '公积金扣款', dataIndex: 'housingFundDeduction', width: 110 },
| { title: '个税扣款', dataIndex: 'taxDeduction', width: 110 },
| { title: '其他扣款', dataIndex: 'otherDeduction', width: 100 },
| { title: '请假扣款', dataIndex: 'leaveDeduction', width: 110 },
| { title: '出勤天数', dataIndex: 'workDays', width: 90 },
| { title: '加班时长', dataIndex: 'overtimeHours', width: 100 },
| { title: '实发工资', dataIndex: 'actualSalary', width: 100, fixed: 'right' },
| ];
| }
|
|