/*
 * @Date: 2022-07-26 16:51:45
 * @LastEditors: 陈禹琨 cyk910622@163.com
 * @LastEditTime: 2022-08-04 10:39:58
 * @FilePath: \upcloud-wms-hnsy-web\src\views\kzyWMS\inBound\receive\rcvEditor\config\exception\index.js
 * @Description: cyk
 */
import items from "../model/girdform";
import { columns } from "../model/columns";
import { mainCols } from "../model/mainCols";
import { SERVICE_DATA_API_BASE } from "@/config/serviceSettings";

const exceptionConfig = function (_this) {
  return {
    title: "订单信息",
    //搜索框配置 girdform
    girdform: items,
    //订单列表数据
    mainlist: {
      remoteBefore(vn, params) {
        let p = { ...params };
        let pp = { rcvTypes: ["1"] };
        pp.errorRcv = "1";
        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;
          },
        },
        {
          label: "清理过期",
          click(item) {
            _this.handleAsnClear([item]);
          },
          show(item) {
            let e = new Date(item.expirationdate);
            e.setHours(0, 0, 0);
            let n = new Date();
            return item.rcvType == "1" && e < n;
            // return false;
          },
        },
      ],
      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, record) {
        return {
          num: "578681744203583488",
          params: {
            billid: data[0],
            errorRcv: "1",
          },
        };
      },
    },
  };
};
export default exceptionConfig;
