import { genWarehouseAuthSearchModal, genCargoownerAuthSearchModal, genBldgSearchModal } from "../../../../../SearchModal";
import store  from '@/store';
import { rcvTypeOptions } from "../../../../config/options";
import {upcloud_base_wh_inbound,upcloud_base_common} from "@/config/serviceSettings";
let grid = {
  labelCol: { span: 8 }, span: 6,
};

let ops = [...rcvTypeOptions];
ops.shift();

let warehouseId = store.getters.warehouse.warehouseId ||  null ;

// 提取单号需要增加按照商品助记码、单位助记码和单据编号、货主进行筛选查询
// 入库类型，收货日期，筛选 ，容器号，建筑物筛选
const items = (self)=>[
  ...genWarehouseAuthSearchModal(1, true, false, null, null, grid),
  ...genCargoownerAuthSearchModal(1, true, false, null, null, grid, { mapper: { cargoOwnerId: 'mtlOwnerId' } }),
  { type: 'input', name: 'autoBillNum', label: '自动单号', value: '', ...grid },
  { type: 'input', name: 'customBillNum', label: '手工单号', value: '', ...grid },
  { type: 'input', name: 'itemZjm', label: '商品助记码', value: '', ...grid },
  { type: 'input', name: 'shipperZjm', label: '单位助记码', value: '', ...grid },
  { type: 'input', name: 'asnAutoBillNum', label: '单据编号', value: '', ...grid },
  {
    type: 'select', name: 'rcvType', label: '入库类型', value: '',
    remoteUrl: { url: upcloud_base_common+'/dict/listbytype?dicttypeCodes=oms_asn_bill_type', method: 'post' },
    replaceFields: { value: 'dictCode', label: 'dictName' },
    ...grid
  },
  { type: 'input', name: 'containerCode', label: '容器号', value: '', ...grid },
//   ...genBldgSearchModal(1, false, false, function (vnode, p) {
    
//     let vals = self.$refs.infoModel.$refs.form.form.getFieldsValue();
//     p.params.warehouseId = vals.warehouseId;
//     return p;
//   }, null, grid),
  {
    type: "row",
    label: "收货日期",
    ...grid,
    list: [
      {
        type: "date",
        name: "startTime",
        placeholder: "请输入开始日期",
        value: "",
        format: "YYYY-MM-DD",
        style: "padding-right:5px;",
      },
      {
        type: "date",
        name: "endTime",
        placeholder: "请输入结束日期",
        format: "YYYY-MM-DD",
        value: "",
      },
    ],
  },
  { type: 'input', name: 'rcvUser', label: '收货人', value: '', ...grid },
];

export default items
