import { FormConfig } from '@/types/basic-form';

export const REGULATION_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'name',
    label: '名称：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入管理规定的标题',
      maxlength: 200,
      showWordLimit: true,
    },
  },
  {
    prop: 'attachment',
    label: '规定文件：',
    slot: 'attachment',
  },
  {
    prop: 'isPush',
    label: '是否推送：',
    slot: 'isPush',
  },
  {
    label: '备注：',
    prop: 'remark',
    component: 'ElInput',
    componentProps: {
      type: 'textarea',
      autosize: { minRows: 3 },
      showWordLimit: true,
    },
  },
  {
    label: '创建人：',
    prop: 'realname',
    component: 'ElInput',
    componentProps: {
      disabled: true,
    },
  },
];

export const REGULATION_FORM_DATA = {
  name: '',
  attachment: [],
  isPush: null,
  remark: '',
  realname: '',
};

export const REGULATION_FORM_RULES = {
  name: [{ required: true, message: '请输入管理规定的标题', trigger: 'blur' }],
  attachment: [{ required: true, message: '请上传规定文件', trigger: 'change' }],
  isPush: [{ required: true, message: '请选择是否推送', trigger: 'change' }],
};

export const NOTICE_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'name',
    label: '通知标题：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入通知标题',
      maxlength: 200,
      showWordLimit: true,
    },
  },
  {
    label: '通知内容：',
    prop: 'content',
    component: 'ElInput',
    componentProps: {
      type: 'textarea',
      autosize: { minRows: 3 },
      maxlength: 1000,
      showWordLimit: true,
    },
  },
  {
    prop: 'attachment',
    label: '通知文件：',
    slot: 'attachment',
  },
  {
    prop: 'isPush',
    label: '是否推送：',
    slot: 'isPush',
  },
  {
    label: '备注：',
    prop: 'remark',
    component: 'ElInput',
    componentProps: {
      type: 'textarea',
      autosize: { minRows: 3 },
      showWordLimit: true,
    },
  },
  {
    label: '创建人：',
    prop: 'realname',
    component: 'ElInput',
    componentProps: {
      disabled: true,
    },
  },
];

export const NOTICE_FORM_DATA = {
  name: '',
  content: '',
  attachment: [],
  isPush: null,
  remark: '',
  realname: '',
};

export const NOTICE_FORM_RULES = {
  name: [{ required: true, message: '请输入通知标题', trigger: 'blur' }],
  content: [{ required: true, message: '请输入通知内容', trigger: 'blur' }],
  isPush: [{ required: true, message: '请选择是否推送', trigger: 'change' }],
};
