import items from './girdform'
import { mainCols } from "./mainCols";
import columns from './columns'
import { SERVICE_DATA_API_BASE } from "@/config/serviceSettings";

const modelConfig = function (_this) {
  return {
    title: '订单信息',
    //搜索框配置 girdform
    girdform: items,
    //订单列表数据
    mainlist: {
      remoteBefore(vn, params) {
        let p = { ...params }
        let pp = { "rcvTypeCodes": ["1","3","4","5","6","7","8","9","10","11","12","13","14"] };
        if (params.data.warehouseCode) pp.warehouseCode = params.data.warehouseCode;
        if (params.data.cargoOwnerCode) pp.mtlOwnerNum = params.data.cargoOwnerCode;
        if (params.data.asnAutoBillNum) pp.asnAutoBillNum = params.data.asnAutoBillNum;
        if (params.data.itemZjm) pp.itemZjm = params.data.itemZjm;
        if (params.data.shipperZjm) pp.shipperZjm = params.data.shipperZjm;
        if (params.data.startTime) pp.startTime = params.data.startTime;
        if (params.data.endTime) pp.endTime = params.data.endTime;
        if (params.data.rcvType) pp.rcvType = params.data.rcvType;
        p.data = {
          num: '588464518951211008',
          pageNum: params.data.pageNum, pageSize: params.data.pageSize,
          params: pp
        };
        return p;
      },
      columns: mainCols,
      operators: [
        {
          label: '单位查看',
          click(item) {
            _this.viewSupplierItem = item;
            _this.showViewSupplier = true;
          }
        }
      ],
      rowKey: 'billid',
      remoteParams: {},
      remoteUrl: {
        url: SERVICE_DATA_API_BASE+'/search/page',
        method: 'post'
      }
    },
    //商品列表配置
    sublist: {
      rowKey: 'asnLineId',
      columns: columns,
      operators: [
        {
          label: '查看商品图片',
          click(item) {

            _this.viewCommodity = item;
            _this.showCommodity = true;
          }
        }
      ],
      GoodsremoteUrl: {
        url: SERVICE_DATA_API_BASE+'/search',
        method: 'post'
      },
      remoteBefore(data) {
        return {
          num: '578681744203583488',
          params: {
            billid: data[0]
          },
        };
      },
      done(list) {
        _this.handleQueryItems(list, _this.$refs.detailModel)
      }
    }
  }
}
export default modelConfig
