config.d.ts 2.73 KB
import { BasicColumn, FormSchema } from '/@/components/Table';
import { Tinymce } from '/@/components/Tinymce/index';
import { h } from 'vue';

export const columns: BasicColumn[] = [
  {
    title: '类型',
    dataIndex: 'type',
    width: 200,
    format: (text: string, record: Recordable) => {
      return record.type === 'MEETING'
        ? '公告'
        : record.type === 'MEETING1'
        ? '会议'
        : record.type === 'MEETING2'
        ? '其他'
        : '';
    },
  },
  {
    title: '标题',
    dataIndex: 'title',
    width: 200,
  },
  {
    title: '内容',
    dataIndex: 'content',
    width: 120,
  },
  {
    title: '发送者',
    dataIndex: 'senderName',
    width: 200,
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 200,
    format: (text: string, record: Recordable) => {
      return record.status == 0
        ? '草稿'
        : record.type == 1
        ? '已发'
        : record.type == 2
        ? '其他'
        : '其他';
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'type',
    label: '类型',
    colProps: { span: 24 },
    required: true,
    component: 'RadioGroup',
    componentProps: {
      options: [
        {
          label: '公告',
          value: '1',
        },
        {
          label: '会议',
          value: '2',
        },
        {
          label: '其他',
          value: '3',
        },
      ],
    },
  },
  {
    field: 'title',
    label: '标题',
    required: true,
    colProps: { span: 24 },
    component: 'Input',
    componentProps: {
      placeholder: '请输入标题',
    },
  },
  {
    field: 'content',
    component: 'Input',
    colProps: { span: 24 },
    label: '内容',
    defaultValue: '请输入内容',
    rules: [{ required: true }],
    render: ({ model, field }) => {
      return h(Tinymce, {
        value: model[field],
        onChange: (value: string) => {
          model[field] = value;
        },
      });
    },
  },
  {
    field: 'receiverTypeIds',
    label: '接收者',
    colProps: { span: 24 },
    component: 'RadioGroup',
    componentProps: {
      options: [
        {
          label: '全部',
          value: '1',
        },
        {
          label: '部门',
          value: '2',
        },
      ],
    },
  },
  {
    field: '',
    component: 'Input',
    label: '',
    colProps: {
      span: 12,
    },
    slot: 'add',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'orderField',
    label: '',
    colProps: { span: 8 },
    component: 'ApiSelect',
    componentProps: {
      // api: async () => {
      //   const data = await screenLinkOrganizationGetApi();
      //   copyTransFun(data as any as any[]);
      //   return data;
      // },
    },
  },
];