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

export const POINT_DEDUCTION_FORM_CONFIG: FormConfig[] = [
  {
    // 扣分原因改为文本输入（原为下拉 hiddenDangerId + slot）
    prop: 'deductionReason',
    label: '扣分原因：',
    slot: 'deductionReason',
  },
  {
    prop: 'deductionDate',
    label: '扣分日期：',
    component: 'ElDatePicker',
    componentProps: {
      type: 'date',
      placeholder: '请选择扣分日期',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    prop: 'deductionValue',
    label: '扣分值：',
    component: 'ElInputNumber',
    componentProps: {
      min: 1,
      max: 99999,
      precision: 0, // 不允许小数点，只能输入整数
      placeholder: '请输入扣分值',
    },
  },
  {
    prop: 'departmentName',
    label: '部门：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入部门名称',
    },
  },
  {
    prop: 'status',
    label: '状态：',
    slot: 'status',
  },
];

export const POINT_DEDUCTION_FORM_DATA = {
  deductionDate: '',
  deductionValue: 1, // 最小值为1
  departmentName: '',
  hiddenDangerId: undefined as number | undefined,
  deductionReason: '',
  status: 'ENABLE',
};

export const POINT_DEDUCTION_FORM_RULES = {
  deductionDate: [{ required: true, message: '请选择扣分日期', trigger: 'change' }],
  deductionValue: [
    { required: true, message: '请输入扣分值', trigger: 'blur' },
    { type: 'number', min: 1, message: '扣分值不能小于1', trigger: 'blur' },
    { type: 'number', max: 99999, message: '扣分值不能大于99999', trigger: 'blur' },
  ],
  departmentName: [{ required: true, message: '请输入部门名称', trigger: 'blur' }],
  // hiddenDangerId: [{ required: true, message: '请选择扣分原因', trigger: 'change' }],
  deductionReason: [{ required: true, message: '请输入扣分原因', trigger: 'blur' }],
  status: [{ required: true, message: '请选择状态', trigger: 'change' }],
};
