config.data.ts 2.91 KB
import { BasicColumn, FormSchema } from '/@/components/Table';
import { dingRule, emailRule, phoneRule } from '/@/utils/rules';
import { useComponentRegister } from '/@/components/Form';
import { OrgTreeSelect } from '../../common/OrgTreeSelect';
useComponentRegister('OrgTreeSelect', OrgTreeSelect);
// 表格列数据
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: 'dingtalk',
    width: 160,
  },
  {
    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: 30,
    },
  },
  {
    field: 'organizationId',
    label: '所属组织',
    required: true,
    component: 'OrgTreeSelect',
  },
  {
    field: 'phone',
    label: '手机号码',
    component: 'Input',
    componentProps: {
      placeholder: '请输入手机号码',
      maxLength: 11,
    },
    rules: phoneRule,
  },
  {
    field: 'email',
    label: '电子邮箱',
    component: 'Input',
    componentProps: {
      placeholder: '请输入电子邮箱',
    },
    rules: emailRule,
  },
  {
    field: 'wechat',
    label: '微信',
    component: 'Input',
    componentProps: {
      placeholder: '请输入微信号',
      maxLength: 255,
    },
  },
  {
    field: 'wechatMessage',
    label: ' ',
    slot: 'wechatMessage',
    component: 'Input',
    ifShow: ({ model }) => model.wechat,
  },
  {
    field: 'dingtalk',
    label: '钉钉',
    component: 'Input',
    helpMessage: '请输入与钉钉相关联的手机号',
    rules: dingRule,
    componentProps: {
      placeholder: '不填默认为手机号码',
      maxLength: 11,
    },
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入备注',
      maxLength: 255,
    },
  },
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
    componentProps: {
      maxLength: 36,
      placeholder: 'id',
    },
  },
];