import { selectboxMaterie } from "@/services/craft";
import regValue from "@/utils/regValue";
const addFields = {
  materieId: {
    value: null,
    type: "select",
    title: "产出物料编号-名称-单位",
    name: ["materieId"],
    required: true,
    options: {
      database: selectboxMaterie,
      params: { materieType: 0 },
    },
  },
  orderNum: {
    value: null,
    type: "inputnumber",
    title: "订单数量",
    name: ["orderNum"],
    required: true,
    ...regValue(null, 6, 3),
  },
  planStartDate: {
    value: null,
    type: "datepicker",
    title: "计划开工时间",
    name: ["planStartDate"],
    required: true,
    format: "YYYY-MM-DD",
    showTime: false,
    disabledDate: null,
    disabledDateTime: null,
  },
  planEndDate: {
    value: null,
    type: "datepicker",
    title: "计划完工时间",
    name: ["planEndDate"],
    required: true,
    format: "YYYY-MM-DD",
    showTime: false,
    disabledDate: null,
    disabledDateTime: null,
  },
  description: {
    value: null,
    type: "textarea",
    title: "描述",
    name: ["description"],
    required: false,
    col: {
      span: 24,
    },
  },
  saleOrderNo: {
    value: null,
    type: "input",
    title: "销售订单号",
    name: ["saleOrderNo"],
    required: false,
  },
  lineNo: {
    value: null,
    type: "input",
    title: "行号",
    name: ["lineNo"],
    required: false,
  },
  customerName: {
    value: null,
    type: "input",
    title: "客户名称",
    name: ["customerName"],
    required: false,
  },
  specs: {
    value: null,
    type: "input",
    title: "规格",
    name: ["specs"],
    required: false,
  },
  color: {
    value: null,
    type: "input",
    title: "颜色",
    name: ["color"],
    required: false,
  },
};
const issueFields = {
  list: {
    value: [],
    title: "工艺路线",
    type: "table",
    col: { span: 24 },
    name: ["list"],
    required: false,
    columns: [
      {
        title: "序号",
        dataIndex: "sortNo",
        key: "sortNo",
        search: false,
        editable: false,
        render: (text, row, index, action) => {
          return <span>{index + 1}</span>;
        },
      },
      {
        title: "工厂",
        dataIndex: "factoryName",
        key: "factoryName",
        search: false,
        editable: false,
      },
      {
        title: "车间",
        dataIndex: "shopName",
        key: "shopName",
        search: false,
        editable: false,
      },
      {
        title: "工艺路线编号",
        dataIndex: "processLineCode",
        key: "processLineCode",
        search: false,
        editable: false,
      },
      {
        title: "工艺路线名称",
        dataIndex: "processLineName",
        key: "processLineName",
        search: false,
        editable: false,
      },
      {
        title: "物料编号",
        dataIndex: "materieCode",
        key: "materieCode",
        search: false,
        editable: false,
      },
      {
        title: "物料名称",
        dataIndex: "materieName",
        key: "materieName",
        search: false,
        editable: false,
      },
      {
        title: "生产单位",
        dataIndex: "productionUnitName",
        key: "productionUnitName",
        search: false,
        editable: false,
      },
      {
        title: "计划数量",
        dataIndex: "planNum",
        key: "planNum",
        search: false,
        editable: false,
      },
      {
        title: "计划开始时间",
        dataIndex: "planStartDate",
        key: "planStartDate",
        search: false,
        valueType: "date",
        width: 160,
        editable: true,
      },
      {
        title: "计划完成时间",
        dataIndex: "planEndDate",
        key: "planEndDate",
        search: false,
        valueType: "date",
        width: 160,
        editable: true,
      },
    ],
    rowKey: "id",
    pagination: "false",
    recordCreatorProps: "false",
  },
};

export { addFields, issueFields };
