gaoluyang
2 天以前 787ccc59ba89bacc075562a161ecf02bc76ebadc
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
<script lang="ts" setup>
import type { HrmEmployeeSocialSecurityApi } from '#/api/hrm/salary/employee-social-security';
 
import { ref } from 'vue';
 
import { useVbenModal } from '#/packages/effects/common-ui/src';
 
import { Table, Tag } from 'ant-design-vue';
 
import { getEmployeeSocialSecurityListByUser } from '#/api/hrm/salary/employee-social-security';
 
const historyList = ref<HrmEmployeeSocialSecurityApi.EmployeeSocialSecurity[]>([]);
const userName = ref<string>('');
 
const columns = [
  { title: '社保方案', dataIndex: 'schemeName', width: 180 },
  { title: '社保基数', dataIndex: 'socialSecurityBase', width: 100 },
  { title: '公积金基数', dataIndex: 'housingFundBase', width: 100 },
  { title: '生效日期', dataIndex: 'effectiveDate', width: 110 },
  {
    title: '状态',
    dataIndex: 'status',
    width: 80,
    key: 'status',
  },
];
 
const [Modal, modalApi] = useVbenModal({
  async onOpenChange(isOpen: boolean) {
    if (!isOpen) {
      historyList.value = [];
      return;
    }
    const data = modalApi.getData<{ userId: number; userName: string }>();
    userName.value = data.userName;
    modalApi.lock();
    try {
      historyList.value = await getEmployeeSocialSecurityListByUser(data.userId);
    } finally {
      modalApi.unlock();
    }
  },
});
</script>
 
<template>
  <Modal :title="`${userName} - 社保公积金历史记录`" class="w-[600px]" :footer="null">
    <Table
      :columns="columns"
      :data-source="historyList"
      :pagination="false"
      size="small"
      row-key="id"
    >
      <template #bodyCell="{ column, record }">
        <template v-if="column.key === 'status'">
          <Tag :color="record.status === 0 ? 'success' : 'default'">
            {{ record.status === 0 ? '启用' : '禁用' }}
          </Tag>
        </template>
      </template>
    </Table>
  </Modal>
</template>