import { upcloud_base_common, upcloud_base_inventory } from "@/config/serviceSettings";

export function items(self) {
  return [
    {
      disabled: true,
      type: "input",
      name: "billid",
      label: "出库单号",
      value: "",
      span: 6,
    },
    {
      disabled: true,
      type: "input",
      name: "lineid",
      label: "订单行号",
      value: "",
      span: 6,
    },
    {
      disabled: true,
      type: "input",
      name: "itemcode",
      label: "商品编码",
      value: "",
      span: 6,
    },
    {
      disabled: true,
      type: "input",
      name: "itemname",
      label: "商品名称",
      value: "",
      span: 6,
    },
    {
      disabled: true,
      type: "input",
      name: "itemId",
      label: "商品ID",
      value: "",
      span: 6,
    },
    {
      disabled: true,
      type: "input",
      name: "lotNo",
      label: "指定批号",
      value: "",
      span: 6,
    },
    {
      type: "input",
      name: "batchNum",
      label: "库存批号",
      value: "",
      span: 6,
    },
    {
      type: "input",
      name: "chukudanhao6",
      label: "货位编码",
      value: "",
      span: 6,
    },
    {
      span: 6,
      name: "kuqu",
      label: "库区",
      remoteUrl: {
        url: upcloud_base_common + "/dict/listbytype?dicttypeCodes=areatype",
        method: "post",
      },
      replaceFields: {
        value: "dictCode",
        // value: 'dictName',
        label: "dictName",
      },
      autoLoad: true,
      type: "select",
    },
    {
      name: "kucunzhuangtai",
      label: "库存状态",
      remoteUrl: {
        url: upcloud_base_common + `/dict/listbytype/?dicttypeCodes=common_stockstatus`,
        method: "post",
      },
      replaceFields: {
        label: "dictName",
        value: "dictCode",
      },
      autoLoad: true,
      type: "select",
      span: 6,
    },

    // {
    //   type: 'input',
    //   name: 'manufacturerLotNum',
    //   label: '批号',
    //   value: '',
    //   span: 6
    // },
    {
      span: 6,
      type: "buttonGroup",
      style: { textAlign: "left" },
      options: [
        {
          value: "查询",
          icon: "search",
          btnType: "primary",
          style: "margin-right:10px",
          htmlType: "submit",
        },
        {
          value: "重置",
          icon: "redo",
          on: {
            click: () => {
              self.$refs.modelForm.form.resetFields();
            },
          },
        },
      ],
    },
  ];
}

export const avlcolumns = [
  {
    title: "整件",
    dataIndex: "completeQty",
    width: 100,
    type: "number",
    required: true,
    rules: {
      type: "number",
      message: "请输入正整数",
      validator: (rule, value, cb) => {
        var reg = /^([1-9]\d*|[0]{1,1})$/;
        if (!reg.test(value)) {
          cb(true);
        }
        cb();
      },
    },
  },
  {
    title: "零散数量",
    dataIndex: "scatteredQty",
    width: 100,
    type: "number",
    required: true,
    rules: {
      type: "number",
      message: "请输入正整数",
      validator: (rule, value, cb) => {
        var reg = /^([1-9]\d*|[0]{1,1})$/;
        if (!reg.test(value)) {
          cb(true);
        }
        cb();
      },
    },
  },
  {
    title: "总数量",
    dataIndex: "qty",
    type: "txt",
  },
  {
    title: "可用库存",
    dataIndex: "availableQuantity",
    type: "txt",
  },
  {
    title: "实际库存",
    dataIndex: "quantity",
    type: "txt",
  },
  {
    title: "商品包装含量",
    dataIndex: "caseConversionRate",
    type: "txt",
  },
  {
    title: "库位类型",
    dataIndex: "locatorTypeName",
    type: "txt",
  },
  {
    title: "库位类型",
    hidden: true,
    dataIndex: "locatorType",
    type: "txt",
  },
  {
    title: "批次号",
    dataIndex: "batchNum",
    type: "txt",
  },
  {
    title: "预入",
    dataIndex: "inPreQuantity",
    type: "txt",
  },
  {
    title: "预出",
    dataIndex: "outPreQuantity",
    type: "txt",
  },
  {
    title: "锁定状态",
    dataIndex: "lockFlag",
    type: "txt",
  },
  {
    title: "仓库库存状态",
    dataIndex: "status",
    type: "txt",
  },
  {
    title: "商品规格",
    dataIndex: "caseUom",
    type: "txt",
  },
  {
    title: "仓库区域库别",
    dataIndex: "warehouseAreaCategoryName",
    type: "txt",
  },
  {
    title: "仓库区域编号",
    dataIndex: "warehouseAreaCode",
    type: "txt",
  },
  {
    title: "仓库区域编码",
    dataIndex: "warehouseAreaId",
    type: "txt",
  },
  {
    title: "仓库区域名称",
    dataIndex: "warehouseAreaName",
    width: 150,
    type: "txt",
  },
  {
    title: "商品大类",
    dataIndex: "itemHealthCategoryName",
    width: 150,
    type: "txt",
  },
  {
    title: "有效期至",
    dataIndex: "batchExpiredDate",
    width: 150,
    type: "txt",
  },
  {
    title: "厂商批号",
    dataIndex: "manufacturerLotNum",
    width: 150,
    type: "txt",
  },
];

export const avlcolumnsQuery = [
  {
    title: "整件",
    dataIndex: "zhengjian",
    width: "100px",
  },
  {
    title: "零散数量",
    dataIndex: "odd",
    width: "100px",
  },
  {
    title: "总数量",
    dataIndex: "qty",
    width: "100px",
  },
  {
    title: "包装数量",
    dataIndex: "packsize",
    width: "100px",
  },
  {
    title: "锁定状态",
    dataIndex: "locktype",
    width: "100px",
  },
  {
    title: "库存状态",
    dataIndex: "kucunzhuangtai",
    width: "100px",
  },
  {
    title: "批号",
    dataIndex: "manufacturerLotNum",
    width: "100px",
  },
  {
    title: "生产日期",
    dataIndex: "shengchanriqi",
    width: "100px",
  },
  {
    title: "有效期至",
    dataIndex: "youxiaoqizhi",
    width: "100px",
  },
  {
    title: "货位编码",
    dataIndex: "huoweibianma",
    width: "100px",
  },
  {
    title: "库区编码",
    dataIndex: "areaCode",
    width: "100px",
  },
  {
    title: "库区名称",
    dataIndex: "areaName",
    width: "100px",
  },
  {
    title: "库别",
    dataIndex: "areaCategory",
    width: "100px",
  },

  //   {
  //     title: '库区类别',
  //     dataIndex: 'areaCategory',
  //     width: '100px',
  //   },
  //   {
  //     title: '库区编码',
  //     dataIndex: 'areaCode',
  //     width: '100px',
  //   },
  //   {
  //     title: '批次号Id',
  //     dataIndex: 'batchId',
  //     width: '100px',
  //     type: 'txt'
  //   },
  //   {
  //     title: '数量',
  //     dataIndex: 'qty',
  //     width: '200px',
  //     type: 'txt'
  //   },
  //   {
  //     title: '订单明细id',
  //     dataIndex: 'billDId',
  //     width: '100px',
  //     type: 'txt'
  //   },
  //   {
  //     title: '包装转换数量',
  //     dataIndex: 'conversionRate',
  //     width: '100px',
  //     type: 'txt'
  //   },
  //   {
  //     title: '商品包装含量',
  //     dataIndex: 'caseConversionRate',
  //     width: '100px',
  //     type: 'txt'
  //   },
  //   {
  //     title: '库位类型',
  //     dataIndex: 'locationType',
  //     width: '100px',
  //     className: 'v_top',
  //     customRender: (text, record) => {
  //       if (text == '0') return '整件位'
  //       if (text == '1') return '散件位'
  //       return '整散合一'
  //     }
  //   },
  //   {
  //     title: '批号',
  //     dataIndex: 'manufacturerLotNum',
  //     width: '100px',
  //     type: 'txt'
  //   }
];
