import items from './girdform'
import mainColumns from "./mainColumns";
import columns from './columns'

import { baseUrl } from "../../../../config/baseUrl";

const modelConfig = function (_this) {
  return {
    title: '订单信息',
    //搜索框配置 girdform
    girdform: items(_this),
    //订单列表数据
    mainlist: {
      remoteBefore(vn, params) {
        let p = { ...params }
        // if (params.params.cargoOwnerId) p.params.mtlOwnerId = params.params.cargoOwnerId;
        return p;
      },
      columns: mainColumns,
      operators: [
        {
          label: '单位查看',
          click(item) {
            _this.viewSupplierItem = item;
            _this.showViewSupplier = true;
          }
        }
      ],
      rowKey: 'rcvHeaderId',
      remoteParams: {},
      remoteUrl: {
        url: baseUrl + '/rqcHeaders/extractRcvH',
      }
    },
    //商品列表配置
    sublist: {
      rowKey: 'taskRqcId',
      columns: columns,
      operators: [
        {
        label: '查看商品图片',
        fixed: 'right',
        click(item) {
          _this.viewCommodity = item;
          _this.showCommodity = true;
        }
      },
      {
      label: '上传图片查看',
      click(item) {
        _this.viewUpdate = item;
        _this.showUpdate = true;
      },
      show(record){
        return record.storeTemperature ? record.storeTemperature.indexOf('冷') >= 0 : false;
      }
    },
    ],
      GoodsremoteUrl: {
        url: baseUrl + '/rqcHeaders/extractRqcTask',
      },
      remoteBefore(data) {
        return { rcvHeaderId: data[0] }
      },
    }
  }
}

export default modelConfig
