import regValue from "@/utils/regValue";
import {
  unitSelect,
  serialNumberRuleSelect,
  processLineSelect,
  bmTableSelect,
} from "@/services/craft";
import { doFetch } from "@/utils/doFetch";

export default {
  materieCode: {
    value: null,
    type: "input",
    title: "物料编号",
    name: ["materieCode"],
    required: true,
  },
  materieName: {
    value: null,
    type: "input",
    title: "物料名称",
    name: ["materieName"],
    required: true,
  },
  materieTypeId: {
    value: null,
    type: "treeselect",
    title: "物料类别",
    name: ["materieTypeId"],
    required: true,
    options: {
      database: (params) => doFetch({ url: "/ngic-workmanship/pmMaterieType/queryTreeList", params }),
      params: {}
    },
  },
  materieControl: {
    value: null,
    type: "select",
    title: "管控方式",
    name: ["materieControl"],
    required: true,
    options: {
      database: (params) => doFetch({ url: "/ngic-base-business/sysDic/queryMaterieControlSelect", params }),
      params: {}
    },
  },
  inventoryMin: {
    value: null,
    type: "inputnumber",
    title: "库存最小值",
    name: ["inventoryMin"],
    required: false,
  },
  inventoryMax: {
    value: null,
    type: "inputnumber",
    title: "库存最大值",
    name: ["inventoryMax"],
    required: false,
  },
  productionUnit: {
    value: null,
    type: "select",
    title: "库存单位",
    name: ["productionUnit"],
    required: false,
    options: {
      database: (params) => doFetch({ url: "/ngic-base-business/sysDic/queryMaterieUnitSelect", params }),
      params: {}
    },
  },
  qualityGuaranteePeriod: {
    value: null,
    type: "inputnumber",
    title: "保质期",
    name: ["qualityGuaranteePeriod"],
    required: false,
  },
  qualityGuaranteePeriodUnit: {
    value: null,
    type: "radio",
    title: "保质期单位",
    name: ["qualityGuaranteePeriodUnit"],
    required: false,
    options: [
      {
        label: "天",
        value: 1,
      },
      {
        label: "月",
        value: 2,
      },
      {
        label: "年",
        value: 3,
      }
    ],
  },
  issueType: {
    value: 1,
    type: "radio",
    title: "发料类型",
    name: ["issueType"],
    required: true,
    options: [
      {
        label: "散发",
        value: 1,
      },
      {
        label: "整发",
        value: 2,
      }
    ],
  },
  materieProductUnitList: {
    value: [],
    title: "转换单位",
    type: "table",
    col: { span: 24 },
    name: ["materieProductUnitList"],
    required: true,
    columns: [
      {
        title: "辅助单位",
        dataIndex: "productionUnit",
        key: "productionUnit",
        search: false,
        valueType: "select",
        request: async () => {
          let res = await doFetch({url:"/ngic-base-business/sysDic/queryMaterieUnitSelect",params:{}})
          return res?.data?.dataList
        },
      },
      {
        title: "转换比",
        dataIndex: "conversionRate",
        key: "conversionRate",
        search: false,
        valueType: "digit",
        width:200
      },
      {
        title: "操作",
        valueType: "option",
        width: 70,
        render: (text, record, _, action) => [
          <a key="delete" onClick={() => { }}>
            删除
          </a>,
        ],
      },
    ],
    rowKey: "id",
  },
 
};
