seal.data.ts 4.54 KB
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { FileOutlined } from '@ant-design/icons-vue';

// 表格列配置
export const columns: BasicColumn[] = [
  {
    title: '用印文件名称',
    dataIndex: 'fileName',
    width: 200,
  },
  {
    title: '文件分类',
    dataIndex: 'fileType',
    width: 120,
  },
  {
    title: '签署方式',
    dataIndex: 'signType',
    width: 100,
  },
  {
    title: '文件份数',
    dataIndex: 'count',
    width: 100,
  },
  {
    title: '印章类型',
    dataIndex: 'sealTypes',
    width: 150,
    customRender: ({ record }) => {
      // 如果是数组,用逗号连接显示
      if (Array.isArray(record.sealTypes)) {
        return record.sealTypes.join(', ');
      }
      return record.sealTypes || '';
    },
  },
  {
    title: '印章所属主体',
    dataIndex: 'company',
    width: 150,
  },
  {
    title: '用印部门',
    dataIndex: 'dept',
    width: 120,
  },
  {
    title: '申请人',
    dataIndex: 'createBy',
    width: 120,
  },
  {
    title: '用印文件',
    dataIndex: 'file',
    width: 100,
    customRender: () => {
      // 始终显示文件图标
      return h(FileOutlined, { style: 'font-size: 20px; color: #1890ff;' });
    },
  },
  {
    title: '备注',
    dataIndex: 'note',
    width: 200,
  },
  {
    title: '财务审核',
    dataIndex: 'financeStatus',
    width: 120,
    customRender: ({ record }) => {
      const status = record.financeStatus;
      let text = '';
      let color = '';
      
      if (status === 0) {
        text = '待审核';
        color = '#faad14';
      } else if (status === 10) {
        text = '已通过';
        color = '#52c41a';
      } else if (status === 20) {
        text = '已驳回';
        color = '#ff4d4f';
      }
      
      return h('span', { style: { color } }, text);
    },
  },
  {
    title: '经理审核',
    dataIndex: 'mangerStatus',
    width: 110,
    customRender: ({ record }) => {
      const status = record.mangerStatus;
      let text = '';
      let color = '';
      
      if (status === 0) {
        text = '待审核';
        color = '#faad14';
      } else if (status === 10) {
        text = '已通过';
        color = '#52c41a';
      } else if (status === 20) {
        text = '已驳回';
        color = '#ff4d4f';
      }
      
      return h('span', { style: { color } }, text);
    },
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 140,
  },
];

// 搜索表单配置
export const searchFormSchema: FormSchema[] = [
  {
    field: 'fileName',
    label: '文件名称',
    component: 'Input',
    componentProps: {
      placeholder: '请输入文件名称',
    },
    colProps: { span: 6 },
  },
  {
    field: 'fileType',
    label: '文件分类',
    component: 'Select',
    componentProps: {
      placeholder: '请选择文件分类',
      options: [], // 将在组件中动态设置
    },
    colProps: { span: 6 },
  },
  {
    field: 'signType',
    label: '签署方式',
    component: 'Select',
    componentProps: {
      placeholder: '请选择签署方式',
      options: [
        { label: '电子', value: '电子' },
        { label: '纸质', value: '纸质' },
      ],
    },
    colProps: { span: 6 },
  },
  {
    field: 'company',
    label: '印章所属主体',
    component: 'Select',
    componentProps: {
      placeholder: '请选择印章所属主体',
      options: [], // 将在组件中动态设置
    },
    colProps: { span: 6 },
  },
  {
    field: 'createBy',
    label: '申请人',
    component: 'Input',
    componentProps: {
      placeholder: '请输入申请人',
    },
    colProps: { span: 6 },
  },
  {
    field: 'status',
    label: '状态',
    component: 'Select',
    componentProps: {
      placeholder: '请选择状态',
      options: [
        { label: '待审核', value: 0 },
        { label: '已通过', value: 10 },
        { label: '已驳回', value: 20 },
      ],
    },
    colProps: { span: 6 },
  },
  {
    field: 'startTime',
    label: '开始时间',
    component: 'DatePicker',
    componentProps: {
      placeholder: '请选择开始时间',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      showTime: false,
    },
    colProps: { span: 6 },
  },
  {
    field: 'endTime',
    label: '结束时间',
    component: 'DatePicker',
    componentProps: {
      placeholder: '请选择结束时间',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
      showTime: false,
    },
    colProps: { span: 6 },
  },
];