/**
 * 预防检查任务单表单配置
 */
import type { FormConfig } from '@/types/basic-form';
import type { TaskManagementRuleForm } from '../type';
// 任务管理表单信息
export const TASK_MANAGEMENT_FROM_CONFIG: FormConfig[] = [
  {
    label: '任务名称',
    prop: 'taskName',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入任务名称',
      maxlength: 200,
      showWordLimit: true,
    },
  },
  {
    label: '被检查（自查）单位',
    prop: 'selfCheckUnit',
    component: 'ElSelect',
    componentProps: {
      placeholder: '请选择被检查（自查）单位',
      multiple: true,
    },
  },
  {
    label: '检查类型',
    prop: 'taskType',
    slot: 'taskType',
  },
  {
    label: '应完成时间',
    prop: 'shouldCompleteTime',
    component: 'ElDatePicker',
    componentProps: {
      placeholder: '请选择应完成时间',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm',
      dateFormat: 'MMM DD, YYYY',
      timeFormat: 'HH:mm',
    },
  },
  {
    label: '检查要求',
    prop: 'checkRequirement',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入检查要求',
      type: 'textarea',
      rows: 5,
      maxlength: 1000,
      showWordLimit: true,
    },
  },
  {
    label: '检查人员',
    prop: 'checkUser',
    slot: 'checkUser',
  },
  {
    label: '是否推送',
    prop: 'isPush',
    slot: 'isPush',
  },
  {
    label: '创建人',
    prop: 'createUser',
    component: 'ElInput',
    componentProps: {
      disabled: true,
    },
  },
];

// 任务管理表单数据
export const TASK_MANAGEMENT_FROM_DATA: TaskManagementRuleForm = {
  taskName: '',
  selfCheckUnit: [],
  taskType: null,
  taskTemplate: null,
  shouldCompleteTime: '',
  checkRequirement: '',
  checkUser: [],
  isPush: null,
  createUser: '',
};

// 任务管理表单规则
export const TASK_MANAGEMENT_FROM_RULES = {
  taskName: [{ required: true, message: '请输入任务名称', trigger: 'blur' }],
  // selfCheckUnit: [{ required: true, message: '请选择被检查（自查）单位', trigger: 'change' }],
  taskType: [{ required: true, message: '请选择检查类型', trigger: 'change' }],
  shouldCompleteTime: [{ required: true, message: '请选择应完成时间', trigger: 'change' }],
  checkUser: [{ required: true, message: '请选择检查人员', trigger: 'change' }],
  isPush: [{ required: true, message: '请选择是否推送', trigger: 'change' }],
};
