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

export const INDUSTRY_STANDARD_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'fileName',
    label: '文件名称：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入文件名称',
    },
  },
  {
    prop: 'classifyName',
    label: '分类名称：',
    component: 'ElSelect',
    componentProps: {
      placeholder: '请选择分类名称',
    },
    selectOptions: [
      { label: '外部行业标准', value: '外部行业标准' },
      { label: '内部行业标准', value: '内部行业标准' },
    ],
  },
  {
    prop: 'fileCode',
    label: '文件编号：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入文件编号',
    },
  },
  {
    prop: 'fileVersion',
    label: '文件版本号：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入文件版本号，如：V1.0',
    },
  },
  {
    prop: 'fileFormat',
    label: '文件格式：',
    slot: 'fileFormat',
  },
  {
    prop: 'releaseDate',
    label: '发布日期：',
    component: 'ElDatePicker',
    componentProps: {
      type: 'date',
      placeholder: '请选择发布日期',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    prop: 'fileUrl',
    label: '文件上传：',
    slot: 'fileUrl',
  },
  {
    prop: 'content',
    label: '文档内容：',
    slot: 'content',
  },
  {
    prop: 'status',
    label: '状态：',
    slot: 'status',
  },
];

export const INDUSTRY_STANDARD_FORM_DATA = {
  fileName: '',
  classifyName: '',
  fileCode: '',
  fileVersion: '',
  fileFormat: '',
  releaseDate: '',
  fileUrl: '',
  fileUrlList: [] as any[], // 文件列表（FileItem数组）
  content: '',
  status: 1, // 默认启用
};

export const INDUSTRY_STANDARD_FORM_RULES = {
  fileName: [{ required: true, message: '请输入文件名称', trigger: 'blur' }],
  classifyName: [{ required: true, message: '请选择分类名称', trigger: 'change' }],
  fileCode: [{ required: true, message: '请输入文件编号', trigger: 'blur' }],
  fileVersion: [{ required: true, message: '请输入文件版本号', trigger: 'blur' }],
  fileFormat: [{ required: true, message: '请选择文件格式', trigger: 'change' }],
  releaseDate: [{ required: true, message: '请选择发布日期', trigger: 'change' }],
  fileUrl: [{ required: true, message: '请选择文件上传', trigger: 'change' }],
};
