src/views/hrm/salary/payment/data.ts
@@ -2,12 +2,8 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { HrmSalaryPaymentApi } from '#/api/hrm/salary/payment';
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';
import { DICT_TYPE } from '#/packages/constants/src';
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
@@ -26,44 +22,14 @@
      },
    },
    {
      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: [
          { label: '待发放', value: 10 },
          { label: '已发放', value: 20 },
          { label: '已撤销', value: 30 },
          { label: '待发放', value: 0 },
          { label: '已发放', value: 10 },
        ],
        placeholder: '请选择发放状态',
      },
@@ -74,12 +40,10 @@
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<HrmSalaryPaymentApi.SalaryPayment>['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: 'actualSalary', title: '实发工资', width: 100, formatter: 'formatAmount2' },
    { field: 'totalAmount', title: '发放总金额', width: 120, formatter: 'formatAmount2' },
    { field: 'totalCount', title: '发放人数', width: 100 },
    {
      field: 'paymentMethod',
      title: '发放方式',
@@ -90,15 +54,12 @@
      },
    },
    { field: 'paymentTime', title: '发放时间', width: 160 },
    { field: 'paymentNo', title: '发放流水号', minWidth: 140 },
    {
      field: 'status',
      title: '发放状态',
      title: '状态',
      width: 100,
      cellRender: {
        name: 'CellDict',
        props: { type: DICT_TYPE.HRM_SALARY_STATUS },
      },
      fixed: 'right',
      slots: { default: 'status' },
    },
    {
      field: 'createTime',
@@ -108,11 +69,9 @@
    },
    {
      title: '操作',
      width: 150,
      width: 180,
      fixed: 'right',
      slots: {
        default: 'actions',
      },
      slots: { default: 'actions' },
    },
  ];
}