columns.tsx 1.53 KB
// REQ-USR-003: 用户列表列定义(序号按当前页 BR1;作废只读 0/1→否/是 BR6)
import type { ColumnsType } from 'antd/es/table';
import type { UserVO } from '../../../api/types';

export interface BuildColumnsOpts {
  pageNum: number;
  pageSize: number;
}

/** 列顺序固定:序号 / 用户名 / 员工名 / 用户号 / 部门 / 用户类型 / 语言 / 作废 / 登录日期 / 制单人 / 制单日期 */
export function buildUserColumns(opts: BuildColumnsOpts): ColumnsType<UserVO> {
  const { pageNum, pageSize } = opts;
  return [
    {
      title: '序号',
      key: 'serial',
      width: 64,
      render: (_value, _record, index) => (pageNum - 1) * pageSize + index + 1, // BR1
    },
    { title: '用户名', dataIndex: 'sUserName', key: 'sUserName' },
    { title: '员工名', dataIndex: 'employeeName', key: 'employeeName' },
    { title: '用户号', dataIndex: 'sUserNo', key: 'sUserNo' },
    { title: '部门', dataIndex: 'departmentName', key: 'departmentName' },
    { title: '用户类型', dataIndex: 'sUserType', key: 'sUserType' },
    { title: '语言', dataIndex: 'sLanguage', key: 'sLanguage' },
    {
      title: '作废',
      dataIndex: 'iIsVoid',
      key: 'iIsVoid',
      width: 72,
      render: (v: number) => (v === 1 ? '是' : '否'), // 只读展示,BR6
    },
    { title: '登录日期', dataIndex: 'tLastLoginDate', key: 'tLastLoginDate' },
    { title: '制单人', dataIndex: 'sCreator', key: 'sCreator' },
    { title: '制单日期', dataIndex: 'tCreateDate', key: 'tCreateDate' },
  ];
}