
export default function Columns() {
  const FormColumns = [
    {
      item: { key: "materialClassify", title: "物料分类编码" },
      attr: {
        is: "el-popover-tree-select",
        referName: "MATERIALCLASSIFY_PARAM",
        valueKey: "code",
        clearable: true,
        // 末级
        onlyFinal: true,
        readonly: true,
        defaultProps: {
          label: function (data, node) {
            return data.code + " " + data.name;
          },
          children: "children",
        },
        dataMapping: {
          materialClassifyName: "name",
        }
      },
    },
    {
      item: { key: "materialClassifyName", title: "物料分类名称" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "materialClassifyOne", title: "一级分类编码" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "materialClassifyOneName", title: "一级分类名称" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "materialClassifyTwoName", title: "二级分类名称" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "materialClassifyThreeName", title: "三级分类名称" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "materialClassifyFourName", title: "四级分类名称" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "materialCode", title: "物料编码" },
      attr: {
        is: "el-popover-select-v2",
        valueKey: "code",
        referName: "MATERIAL_PARAM",
        dataMapping: {
          materialName: "name",
        },
        clearable: true,
        readonly: true,
      },
    },
    {
      item: { key: "materialName", title: "物料名称" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "manufacturer", title: "生产厂家" },
      attr: {
        is: "el-input",
        clearable: true,
      },
    },
    {
      item: { key: "orgName", title: "所属组织" },
      attr: {
        is: "el-popover-select-v2",
        referName: "ORG_PARAM",
        valueKey: "name",
        dataMapping: {
          org: "code"
        }
      },
    },
    {
      item: { key: "orderPersonalName", title: "订单员" },
      attr: {
        is: "el-popover-select-v2",
        referName: "CONTACTS_PARAM",
        valueKey: "name",
        dataMapping: {
          orderPersonal: "code",
          orderDeptName: "deptName",
          orderDept: "deptId",
        }
      },
    },
    {
      item: { key: "orderDeptName", title: "订单部门" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "buyerName", title: "采购员" },
      attr: {
        is: "el-popover-select-v2",
        referName: "CONTACTS_PARAM",
        valueKey: "name",
        dataMapping: {
          buyer: 'code',
          puDeptName: "deptName",
          puDept: "deptId",
        },
      },
    },
    {
      item: { key: "puDeptName", title: "采购部门" },
      attr: {
        is: "el-input",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "sendStatus", title: "同步状态" },
      attr: {
        is: "el-select",
        dictName: "synch_state",
        clearable: true,
        disabled: true,
      },
    },
    {
      item: { key: "remark", title: "备注" },
      attr: {
        is: "el-input",
        clearable: true,
      },
    },

  ].map(({ item, attr }) => ({
    attr,
    item: { ...item, hidden: true, span: item.span || 6 },
  }));

  return { FormColumns };
};