import moment from "moment";
import { rcvTypeOptions } from "../../../../config/options";
import { arrivalModeList } from "../../api/index";
import { upcloud_base_wh_inbound, upcloud_base_common } from "@/config/serviceSettings";

export const mainCols = [
  { title: "billid", dataIndex: "billid", key: "billid", hidden: true },
  {
    title: "收货类型",
    dataIndex: "rcvType",
    width: 140,
    // scopedSlots: { customRender: 'rcvReason1' }
    autoLoad: true,
    remoteUrl: { url: upcloud_base_common + "/dict/listbytype?dicttypeCodes=oms_asn_bill_type", method: "post" },
    replaceFields: {
      value: "dictCode",
      // value: 'dictName',
      label: "dictName",
    },
  },
  { title: "货主编号", dataIndex: "mtlOwnerNum", key: "mtlOwnerNum", width: 100 },
  { title: "货主名称", dataIndex: "mtlOwnerName", key: "mtlOwnerName", width: 180 },
  { title: "供应商编号", dataIndex: "vendorCode", key: "vendorCode" },
  { title: "供应商名称", dataIndex: "vendorName", key: "vendorName" },
  { title: "ASN单号", dataIndex: "asnAutoBillNum", key: "asnAutoBillNum" },
  { title: "备注", dataIndex: "asnRemark", key: "asnRemark" },
  {
    title: "订单日期",
    dataIndex: "billDate",
    key: "billDate",
    customRender(text) {
      return text ? moment(text).format("YYYY-MM-DD") : "";
    },
  },
  { title: "订单有效期", dataIndex: "expirationdate", key: "expirationdate" },
  { title: "未收数量", dataIndex: "remainqty", key: "remainqty" },
  { title: "要货部门", dataIndex: "needDept", key: "needDept" },
  { title: "要货业务员", dataIndex: "needUser", key: "needUser" },
  { title: "代理商", dataIndex: "agent", key: "agent" },
  { title: "单位助记码", dataIndex: "shipperZjm", key: "shipperZjm", width: 100 },
  { title: "采购员", dataIndex: "buyerMane", key: "buyerMane" },
  {
    title: "到货方式",
    dataIndex: "arrivalMode",
    key: "arrivalMode",
    customRender(text) {
      let item = arrivalModeList.find((t) => t.dictCode == text);
      if (item) {
        return item.dictName;
      } else return "";
    },
  },
  { title: "仓库", dataIndex: "warehouseName", key: "warehouseName" },
  { title: "仓库编码", dataIndex: "warehouseCode", key: "warehouseCode" },
];
