import { factorySelect, shopSelectByFactory } from "@/services/system";
import regValue from "@/utils/regValue";
export default {
  processLineCode: {
    value: null,
    type: "input",
    title: "工艺路线编号",
    name: ["processLineCode"],
    required: true,
  },
  processLineName: {
    value: null,
    type: "input",
    title: "工艺路线名称",
    name: ["processLineName"],
    required: true,
  },
  factoryId: {
    value: null,
    type: "select",
    title: "所属工厂",
    name: ["factoryId"],
    required: true,
    options: {
      database: factorySelect,
      params: {},
    },
    linked: true,
  },
  shopId: {
    value: null,
    type: "select",
    title: "所属车间",
    name: ["shopId"],
    required: true,
    belinked: {
      options: {
        database: shopSelectByFactory,
        params: { factoryId: "linked" },
      },
    },
    linked: true,
  },
  processLineType: {
    value: null,
    type: "select",
    title: "工艺路线类型",
    name: ["processLineType"],
    required: false,
    options: [
      {
        label: "常规",
        value: 1,
      },
      {
        label: "返工",
        value: 2,
      },
    ],
  },
  capacity: {
    value: null,
    type: "inputnumber",
    title: "能力",
    name: ["capacity"],
    required: false,
    ...regValue(null, 6, 3),
  },
  remark: {
    value: null,
    type: "textarea",
    title: "描述",
    name: ["remark"],
    required: false,
    col: { span: 24 },
  },
  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",
  },
};
