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

export const columns: BasicColumn[] = [
  { title: '物料编码', align: 'center', dataIndex: 'materialCode' },
  { title: '物料名称', align: 'center', dataIndex: 'materialName' },
  { title: '分类', align: 'center', dataIndex: 'categoryId_dictText' },
  { title: '基础单位', align: 'center', dataIndex: 'baseUnitId_dictText' },
  { title: '状态', align: 'center', dataIndex: 'enableFlag' },
  { title: '创建时间', align: 'center', dataIndex: 'createTime' },
];

export const searchFormSchema: FormSchema[] = [
  { label: '物料编码', field: 'materialCode', component: 'Input', colProps: { span: 6 } },
  { label: '物料名称', field: 'materialName', component: 'Input', colProps: { span: 6 } },
  {
    label: '分类',
    field: 'categoryId',
    component: 'JDictSelectTag',
    componentProps: { dictCode: 'mes_material_category,category_name,id' },
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  { label: '', field: 'id', component: 'Input', show: false },
  { label: '物料编码', field: 'materialCode', component: 'Input', required: true },
  { label: '物料名称', field: 'materialName', component: 'Input', required: true },
  { label: '别名', field: 'aliasName', component: 'Input' },
  { label: '简称', field: 'shortName', component: 'Input' },
  {
    label: '分类',
    field: 'categoryId',
    component: 'JDictSelectTag',
    required: true,
    componentProps: { dictCode: 'mes_material_category,category_name,id' },
  },
  {
    label: '基础单位',
    field: 'baseUnitId',
    component: 'JDictSelectTag',
    required: true,
    componentProps: { dictCode: 'mes_unit,unit_name,id' },
  },
  {
    label: '统计单位',
    field: 'statUnitId',
    component: 'JDictSelectTag',
    componentProps: { dictCode: 'mes_unit,unit_name,id' },
  },
  { label: '计划价格', field: 'planPrice', component: 'InputNumber' },
  { label: '最小库存', field: 'minStock', component: 'InputNumber' },
  { label: '最大库存', field: 'maxStock', component: 'InputNumber' },
  { label: '换算系数', field: 'unitConvertRate', component: 'InputNumber', defaultValue: 1 },
  {
    label: '状态',
    field: 'enableFlag',
    component: 'Select',
    defaultValue: 1,
    componentProps: {
      options: [
        { label: '启用', value: 1 },
        { label: '停用', value: 0 },
      ],
    },
  },
  { label: '备注', field: 'remark', component: 'InputTextArea' },
];
