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

export const DRILL_CREATE_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'drillScope',
    label: '演练规模：',
    slot: 'drillScope',
  },
  {
    prop: 'drillContent',
    label: '演练内容：',
    component: 'el-input',
    componentProps: { placeholder: '请输入演练内容' },
  },
  {
    prop: 'dueCompleteTime',
    label: '计划完成日期：',
    component: 'el-date-picker',
    componentProps: {
      type: 'date',
      placeholder: '请选择计划完成日期',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    prop: 'responsibleDeptIdList',
    label: '责任部门：',
    slot: 'responsibleDeptIdList',
  },
  {
    prop: 'coordinateDeptIdList',
    label: '配合部门：',
    slot: 'coordinateDeptIdList',
  },
  {
    prop: 'emergencyPlanId',
    label: '应急预案：',
    slot: 'emergencyPlanId',
  },
  {
    prop: 'approvalTemplateId',
    label: '审批流程：',
    slot: 'approvalTemplateId',
  },
];

export const DRILL_CREATE_FORM_RULES = {
  drillScope: [
    {
      required: true,
      message: '请选择演练规模',
      trigger: 'change',
    },
  ],
  drillContent: [
    {
      required: true,
      message: '请输入演练内容',
      trigger: 'blur',
    },
  ],
  dueCompleteTime: [
    {
      required: true,
      message: '请选择计划完成时间',
      trigger: 'change',
    },
  ],
  responsibleDeptIdList: [
    {
      required: true,
      message: '请选择责任部门',
      trigger: 'change',
    },
  ],
  approvalTemplateId: [
    {
      required: true,
      message: '请选择审批流程',
      trigger: 'change',
    },
  ],
};

export const DRILL_CREATE_FORM_DATA = {
  drillScope: '',
  drillContent: '',
  dueCompleteTime: '',
  responsibleDeptIdList: undefined,
  coordinateDeptIdList: undefined,
  emergencyPlanId: undefined,
  approvalTemplateId: undefined,
};

export const DRILL_EXECUTE_FORM_CONFIG = [
  {
    prop: 'drillTime',
    label: '演练时间：',
    component: 'el-date-picker',
    componentProps: {
      type: 'datetime',
      placeholder: '请选择演练时间',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    prop: 'drillLocation',
    label: '演练地点：',
    component: 'el-input',
    componentProps: { placeholder: '请输入演练地点' },
  },
  {
    prop: 'personInChargeName',
    label: '负责人：',
    slot: 'personInChargeName',
  },
  {
    prop: 'drillDeptIdList',
    label: '演练部门：',
    slot: 'drillDeptIdList',
  },
  {
    prop: 'drillScript',
    label: '演练脚本：',
    slot: 'drillScript',
  },
];

export const INS_DRILL_EXECUTE_FORM_RULES = {
  drillTime: [{ required: true, message: '请选择演练时间', trigger: 'change' }],
  drillLocation: [{ required: true, message: '请输入演练地点', trigger: 'blur' }],
  personInChargeName: [{ required: true, message: '请选择演练负责人', trigger: 'change' }],
  drillDeptIdList: [{ required: true, message: '请选择演练部门', trigger: 'change' }],
  drillScript: [{ required: true, message: '请上传演练脚本', trigger: 'change' }],
};

export const DEP_DRILL_EXECUTE_FORM_RULES = {
  drillTime: [{ required: true, message: '请选择演练时间', trigger: 'change' }],
  drillLocation: [{ required: true, message: '请输入演练地点', trigger: 'blur' }],
  personInChargeName: [{ required: true, message: '请选择演练负责人', trigger: 'change' }],
};

export const DRILL_EXECUTE_FORM_DATA = {
  drillTime: undefined,
  drillLocation: '',
  personInChargeName: undefined,
  drillDeptIdList: undefined,
  drillScript: undefined,
};

export const DRILL_RECORD_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'participants',
    label: '参与人员：',
    component: 'el-input',
    componentProps: {
      type: 'textarea',
      maxlength: 1000,
      autosize: { minRows: 3 },
      showWordLimit: true,
      placeholder: '请描述演练人员，不超过1000字',
    },
  },
  {
    prop: 'drillDescription',
    label: '演练描述：',
    component: 'el-input',
    componentProps: {
      type: 'textarea',
      maxlength: 2000,
      showWordLimit: true,
      autosize: { minRows: 8 },
      placeholder: '请描述演练过程，不超过2000字',
    },
  },
  {
    prop: 'drillImage',
    label: '演练照片：',
    slot: 'drillImage',
  },
  {
    prop: 'drillEffectAssess',
    label: '演练效果评估：',
    component: 'el-input',
    componentProps: {
      type: 'textarea',
      maxlength: 2000,
      showWordLimit: true,
      autosize: { minRows: 5 },
      placeholder: '请描述演练效果评估，不超过2000字',
    },
  },
  {
    prop: 'drillProblemAnalyse',
    label: '演练问题分析：',
    component: 'el-input',
    componentProps: {
      type: 'textarea',
      maxlength: 2000,
      showWordLimit: true,
      autosize: { minRows: 5 },
      placeholder: '请描述演练问题分析，不超过2000字',
    },
  },
  {
    prop: 'drillImproveMethod',
    label: '演练改进措施：',
    component: 'el-input',
    componentProps: {
      type: 'textarea',
      maxlength: 2000,
      showWordLimit: true,
      autosize: { minRows: 5 },
      placeholder: '请描述演练改进措施，不超过2000字',
    },
  },
];

export const DRILL_RECORD_FORM_RULES = {
  participants: [{ required: true, message: '请填写参与人员', trigger: 'blur' }],
  drillDescription: [{ required: true, message: '请填写演练描述', trigger: 'blur' }],
  drillEffectAssess: [{ required: true, message: '请填写演练效果评估', trigger: 'blur' }],
  drillProblemAnalyse: [{ required: true, message: '请填写演练问题分析', trigger: 'blur' }],
  drillImproveMethod: [{ required: true, message: '请填写演练改进措施', trigger: 'blur' }],
};

export const DRILL_RECORD_FORM_DATA = {
  participants: '',
  drillDescription: '',
  drillImage: '',
  drillEffectAssess: '',
  drillProblemAnalyse: '',
  drillImproveMethod: '',
};
