SalaryApprovedPanel.vue
11.8 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<template>
<div>
<BasicTable @register="registerTable" className="p-0">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<a-tag :color="record.status === 10 ? 'green' : 'red'">
{{ record.status === 10 ? '通过' : '拒绝' }}
</a-tag>
</template>
<template v-else-if="column.key === 'action'">
<TableAction
:actions="[
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
<!-- 详情抽屉 -->
<BasicDrawer
width="600"
:showFooter="false"
@register="registerDrawer"
title="薪资字段申请详情"
>
<div class="detail-content">
<div class="field-info">
<h3 style="color: #52c41a;">申请编辑的字段:</h3>
<div class="field-list">
<a-tag
v-for="field in appliedFields"
:key="field"
color="green"
class="field-tag"
>
{{ field }}
</a-tag>
</div>
</div>
<a-divider />
<a-descriptions title="薪资信息" :column="2" bordered>
<a-descriptions-item label="社保配置">
{{ currentRecord.userOldSalaryVO?.wages || '-' }}
</a-descriptions-item>
<a-descriptions-item label="基本工资">
{{ currentRecord.userOldSalaryVO?.basicWages || '-' }}
</a-descriptions-item>
<a-descriptions-item label="岗位津贴">
{{ currentRecord.userOldSalaryVO?.postAllowance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="管理岗位津贴">
{{ currentRecord.userOldSalaryVO?.managementAllowance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="话费补贴">
{{ currentRecord.userOldSalaryVO?.phoneAllowance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="餐补">
{{ currentRecord.userOldSalaryVO?.mealAllowance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="交通补贴">
{{ currentRecord.userOldSalaryVO?.transportationAllowance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="全勤奖">
{{ currentRecord.userOldSalaryVO?.attendanceAllowance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="绩效部分">
{{ currentRecord.userOldSalaryVO?.performanceAllowance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="提成">
{{ currentRecord.userOldSalaryVO?.commissionPrice || '-' }}
</a-descriptions-item>
<a-descriptions-item label="奖金">
{{ currentRecord.userOldSalaryVO?.bonusPrice || '-' }}
</a-descriptions-item>
<a-descriptions-item label="应扣工资">
{{ currentRecord.userOldSalaryVO?.deductibleSalaryPrice || '-' }}
</a-descriptions-item>
<a-descriptions-item label="其他扣款">
{{ currentRecord.userOldSalaryVO?.otherDeductionsPrice || '-' }}
</a-descriptions-item>
<a-descriptions-item label="个人所得税">
{{ currentRecord.userOldSalaryVO?.tax || '-' }}
</a-descriptions-item>
<a-descriptions-item label="个人养老保险">
{{ currentRecord.userOldSalaryVO?.personalPensionInsurance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="个人医疗保险">
{{ currentRecord.userOldSalaryVO?.personalMedicalInsurance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="个人失业保险">
{{ currentRecord.userOldSalaryVO?.personalUnemploymentInsurance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="个人大额医疗">
{{ currentRecord.userOldSalaryVO?.personalLargeMedical || '-' }}
</a-descriptions-item>
<a-descriptions-item label="个人公积金">
{{ currentRecord.userOldSalaryVO?.personalProvidentFund || '-' }}
</a-descriptions-item>
<a-descriptions-item label="公司养老保险">
{{ currentRecord.userOldSalaryVO?.companyPensionInsurance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="公司医疗保险">
{{ currentRecord.userOldSalaryVO?.companyMedicalInsurance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="公司失业保险">
{{ currentRecord.userOldSalaryVO?.companyUnemploymentInsurance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="公司工伤保险">
{{ currentRecord.userOldSalaryVO?.companyWorkInjuryInsurance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="公司生育保险">
{{ currentRecord.userOldSalaryVO?.companyMaternityInsurance || '-' }}
</a-descriptions-item>
<a-descriptions-item label="公司大额医疗">
{{ currentRecord.userOldSalaryVO?.companyLargeMedical || '-' }}
</a-descriptions-item>
<a-descriptions-item label="公司公积金">
{{ currentRecord.userOldSalaryVO?.companyProvidentFund || '-' }}
</a-descriptions-item>
</a-descriptions>
<a-divider />
<a-descriptions title="审核信息" :column="2" bordered>
<a-descriptions-item label="审核状态">
<a-tag :color="currentRecord.status === 10 ? 'green' : 'red'">
{{ currentRecord.status === 10 ? '通过' : '拒绝' }}
</a-tag>
</a-descriptions-item>
<a-descriptions-item label="拒绝原因" v-if="currentRecord.status === 20">
{{ currentRecord.refuseRemark || '-' }}
</a-descriptions-item>
</a-descriptions>
</div>
</BasicDrawer>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { BasicDrawer, useDrawer } from '/@/components/Drawer';
import { message } from 'ant-design-vue';
import { defHttp } from '/@/utils/http/axios';
import dayjs from 'dayjs';
export default defineComponent({
name: 'SalaryApprovedPanel',
components: {
BasicTable,
BasicDrawer,
TableAction,
},
props: {
selectedDate: {
type: Object,
default: null,
},
},
setup(props) {
const currentRecord = ref<any>({});
const appliedFields = ref<string[]>([]);
const [registerDrawer, { openDrawer, closeDrawer }] = useDrawer();
// 字段映射表
const fieldMapping: Record<string, string> = {
'basicWages': '基本工资',
'postAllowance': '岗位津贴',
'managementAllowance': '管理岗位津贴',
'phoneAllowance': '话费补贴',
'mealAllowance': '餐补',
'transportationAllowance': '交通补贴',
'attendanceAllowance': '全勤奖',
'performanceAllowance': '绩效部分',
'wages': '社保配置',
'commissionPrice': '提成',
'bonusPrice': '奖金',
'deductibleSalaryPrice': '应扣工资',
'otherDeductionsPrice': '其他扣款',
'tax': '个人所得税',
};
// 表格列定义
const columns = [
{
title: '序号',
dataIndex: 'index',
width: 80,
customRender: ({ index }: { index: number }) => index + 1,
},
{
title: '申请人',
dataIndex: 'createBy',
width: 120,
},
{
title: '审核字段类型',
dataIndex: 'type',
width: 150,
customRender: () => {
return '薪资字段';
},
},
{
title: '日期',
dataIndex: 'dateTime',
width: 120,
},
{
title: '姓名',
dataIndex: 'chineseName',
width: 100,
},
{
title: '昵称',
dataIndex: 'nickName',
width: 100,
},
{
title: '状态',
dataIndex: 'status',
width: 100,
key: 'status',
},
{
title: '拒绝原因',
dataIndex: 'refuseRemark',
width: 200,
ellipsis: true,
customRender: ({ record }: { record: any }) => {
return record.refuseRemark || '-';
},
},
];
// 注册表格
const [registerTable, { reload }] = useTable({
api: loadSalaryApprovedList,
columns,
useSearchForm: false,
rowKey: 'id',
actionColumn: {
width: 100,
title: '操作',
dataIndex: 'action',
},
});
// 加载薪资字段已审核列表
async function loadSalaryApprovedList(params: any) {
try {
const requestData: any = {
...params,
status: [10, 20], // 查询已审核的申请(通过和拒绝)
};
// 如果选择了日期,添加dateTime参数
if (props.selectedDate) {
requestData.dateTime = dayjs(props.selectedDate).format('YYYY-MM');
}
const response = await defHttp.post({
url: '/order/erp/users/oldWages/applyEditFields_list_by_page',
data: requestData,
});
return {
items: response.records || [],
total: response.total || 0,
};
} catch (error) {
console.error('加载薪资字段已审核列表失败:', error);
message.error('加载数据失败');
return {
items: [],
total: 0,
};
}
}
// 处理详情查看
function handleDetail(record: any) {
currentRecord.value = record;
// 解析申请的字段 - 使用 userOldSalaryFieldVO
const fields: string[] = [];
if (record.userOldSalaryFieldVO) {
Object.entries(record.userOldSalaryFieldVO).forEach(([key, value]) => {
if (value === 'UN_LOCKED' && fieldMapping[key]) {
fields.push(fieldMapping[key]);
}
});
}
appliedFields.value = fields;
openDrawer(true);
}
return {
registerTable,
registerDrawer,
currentRecord,
appliedFields,
handleDetail,
reload,
};
},
});
</script>
<style lang="less" scoped>
.detail-content {
padding: 16px;
.field-info {
margin-top: 16px;
h3 {
margin-bottom: 12px;
color: #52c41a;
}
.field-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
.field-tag {
margin-bottom: 8px;
padding: 4px 12px;
font-size: 14px;
}
}
}
}
</style>