/**
 * 应急预案表单配置
 */
import type { FormConfig } from '@/types/basic-form';
const BASIC_FORM_CONFIG = {
  APPENDIX: {
    label: '预案文件：',
    prop: 'uploadFile',
    slot: 'uploadFile',
  },
};
// 盘点任务表单信息
export const PLAN_MANAGEMENT_FORM_CONFIG: FormConfig[] = [
  {
    label: '预案名称：',
    prop: 'planName',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入预案名称',
    },
  },
  {
    label: '预案类型：',
    prop: 'planType',
    slot: 'planType',
  },
  {
    label: '事件类型：',
    prop: 'eventType',
    slot: 'eventType',
  },
  {
    label: '制定部门：',
    prop: 'deptId',
    slot: 'deptId',
  },
  {
    label: '试验专业场所：',
    prop: 'professionalTestSite',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入试验专业场所',
    },
  },
  {
    label: '审批流程：',
    prop: 'approvalTemplateId',
    slot: 'approvalTemplateId',
  },
  BASIC_FORM_CONFIG.APPENDIX,
];

export const PLAN_MANAGEMENT_FORM_CONFIG_EDIT: FormConfig[] = [
  {
    label: '预案名称：',
    prop: 'planName',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入预案名称',
      disabled: true,
    },
  },
  {
    label: '预案类型：',
    prop: 'planTypeName',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入预案类型',
      disabled: true,
    },
  },
  {
    label: '事件类型：',
    prop: 'eventTypeName',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入事件类型',
      disabled: true,
    },
  },
  {
    label: '制定部门：',
    prop: 'deptName',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入制定部门',
      disabled: true,
    },
  },
  {
    label: '试验专业场所：',
    prop: 'professionalTestSite',
    component: 'ElInput',
    componentProps: {
      disabled: true,
    },
  },
  {
    label: '审批流程：',
    prop: 'approvalTemplateName',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入审批流程',
      disabled: true,
    },
  },
  BASIC_FORM_CONFIG.APPENDIX,
];

// 盘点任务表单数据
const BASE_FORM_DATA = {
  planName: '',
  planType: '',
  eventType: '',
  deptId: null,
  deptName: '',
  professionalTestSite: null,
  approvalTemplateId: null,
  appendix: '',
  uploadFile: [],
};

export const PLAN_MANAGEMENT_FORM_DATA = { ...BASE_FORM_DATA };

export const PLAN_MANAGEMENT_FORM_DATA_EDIT = {
  ...BASE_FORM_DATA,
  planTypeName: '',
  eventTypeName: '',
  approvalTemplateName: '',
};

const BASIC_FORM_RULES = {
  uploadFile: [{ required: true, message: '请上传预案文件', trigger: 'change' }],
};

// 盘点任务表单规则
export const PLAN_MANAGEMENT_FORM_RULES = {
  planName: [{ required: true, message: '请输入预案名称', trigger: 'blur' }],
  planType: [{ required: true, message: '请选择预案类型', trigger: 'change' }],
  eventType: [{ required: true, message: '请选择事件类型', trigger: 'change' }],
  deptId: [{ required: true, message: '请选择制定部门', trigger: 'change' }],
  approvalTemplateId: [{ required: true, message: '请选择审批流程', trigger: 'change' }],
  ...BASIC_FORM_RULES,
};

export const PLAN_MANAGEMENT_FORM_RULES_EDIT = {
  ...BASIC_FORM_RULES,
};
