import { BasicColumn, FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  { title: '单位编码', align: 'center', dataIndex: 'unitCode' },
  { title: '单位名称', align: 'center', dataIndex: 'unitName' },
  { title: '单位类型', align: 'center', dataIndex: 'unitType' },
  { title: '精度', align: 'center', dataIndex: 'precisionScale' },
  { title: '状态', align: 'center', dataIndex: 'enableFlag' },
];

export const searchFormSchema: FormSchema[] = [
  { label: '单位编码', field: 'unitCode', component: 'Input', colProps: { span: 6 } },
  { label: '单位名称', field: 'unitName', component: 'Input', colProps: { span: 6 } },
];

export const formSchema: FormSchema[] = [
  { label: '', field: 'id', component: 'Input', show: false },
  { label: '单位编码', field: 'unitCode', component: 'Input', required: true },
  { label: '单位名称', field: 'unitName', component: 'Input', required: true },
  { label: '单位类型', field: 'unitType', component: 'Input', defaultValue: 'BASE' },
  { label: '精度', field: 'precisionScale', component: 'InputNumber', defaultValue: 3 },
  {
    label: '状态',
    field: 'enableFlag',
    component: 'Select',
    defaultValue: 1,
    componentProps: { options: [{ label: '启用', value: 1 }, { label: '停用', value: 0 }] },
  },
  { label: '备注', field: 'remark', component: 'InputTextArea' },
];
