config.data.ts 2.51 KB
import { BasicColumn, FormSchema } from '/@/components/Table';
import { getOrganizationList } from '/@/api/system/system';
import { copyTransFun } from '/@/utils/fnUtils';
import { emailRule, phoneRule } from '/@/utils/rules';

// 表格列数据
export const columns: BasicColumn[] = [
  {
    title: '姓名',
    dataIndex: 'username',
    width: 120,
  },
  {
    title: '所属组织',
    dataIndex: 'organizationDTO.name',
    width: 160,
  },
  {
    title: '手机',
    dataIndex: 'phone',
    width: 160,
  },
  {
    title: '邮箱',
    dataIndex: 'email',
    width: 160,
  },
  {
    title: '微信',
    dataIndex: 'wechat',
    width: 180,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 120,
  },

  {
    title: '添加时间',
    dataIndex: 'createTime',
    width: 180,
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    width: 180,
  },
];

// 查询字段
export const searchFormSchema: FormSchema[] = [
  {
    field: 'username',
    label: '联系人姓名',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      maxLength: 36,
      placeholder: '请输入联系人姓名',
    },
  },
];

// 弹框配置项
export const formSchema: FormSchema[] = [
  {
    field: 'username',
    label: '联系人姓名',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入联系人姓名',
      maxLength: 255,
    },
  },
  {
    field: 'organizationId',
    label: '所属组织',
    component: 'ApiTreeSelect',
    componentProps: {
      api: async () => {
        const data = await getOrganizationList();
        copyTransFun(data as any as any[]);
        return data;
      },
    },
  },
  {
    field: 'phone',
    label: '手机号码',
    component: 'Input',
    componentProps: {
      placeholder: '请输入手机号码',
    },
    rules: phoneRule,
  },
  {
    field: 'email',
    label: '电子邮箱',
    component: 'Input',
    componentProps: {
      placeholder: '请输入电子邮箱',
    },
    rules: emailRule,
  },
  {
    field: 'wechat',
    label: '微信',
    component: 'Input',
    componentProps: {
      placeholder: '请输入微信号',
      maxLength: 255,
    },
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入备注',
      maxLength: 255,
    },
  },
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
    componentProps: {
      maxLength: 36,
      placeholder: 'id',
    },
  },
];