import { SERVICE_DATA_API_BASE, upcloud_base_wh_inbound } from '@/config/serviceSettings'
import { genSupplierSearchModal } from '@/views/kzyWMS/SearchModal'
// import {upcloud_base_wh_inbound,upcloud_base_common} from "@/config/serviceSettings";
const config = function(that) {
  return {
    remoteUrl: {
      url: SERVICE_DATA_API_BASE + '/search/page',
      method: 'post'
    },
    items: [
      {
        label: '收货日期开始时间',
        span: 8,
        type: 'date',
        name: 'startTime',
        placeholder: '请输入开始日期',
        value: '',
        format: 'YYYY-MM-DD',
        showTime: true
      },
      {
        label: '收货日期结束时间',
        span: 8,
        type: 'date',
        name: 'endTime',
        placeholder: '请输入结束日期',
        format: 'YYYY-MM-DD',
        value: '',
        showTime: true
      },
      {
        span: 8,
        type: 'input',
        name: 'autoBillNum',
        label: '采购单号',
        value: ''
      },
      {
        span: 8,
        type: 'input',
        name: 'itemCode',
        label: '商品编号',
        value: ''
      },
      ...genSupplierSearchModal(1, false, false, null, null, {
        span: 8,
        labelCol: { span: 8 }
      }),
      {
        span: 24,
        type: 'buttonGroup',
        style: { textAlign: 'right' },
        options: [
          {
            value: '查询',
            icon: 'search',
            btnType: 'primary',
            style: 'margin-right:10px',
            htmlType: 'submit'
          },
          {
            value: '重置',
            icon: 'redo',
            style: 'margin-right:50px',
            on: {
              click: (event, form) => {
                console.log(form)
                form.resetFields()
              }
            }
          }
        ]
      }
    ],
    columns: [
      {
        dataIndex: 'gmtcreate',
        key: 'gmtcreate',
        align: 'center',
        title: '收货日期'
      },
      {
        title: '货主名称',
        dataIndex: 'mtlOwnerName',
        align: 'center',
        key: 'mtlOwnerName'
      },
      {
        title: '开票单号',
        dataIndex: 'asnAutoBillNum',
        ellipsis: true,
        align: 'center',
        key: 'asnAutoBillNum'
      },
      {
        title: '供应商编号',
        key: 'vendorcode',
        ellipsis: true,
        dataIndex: 'vendorcode',
        align: 'center'
      },
      {
        title: '供应商名称',
        dataIndex: 'vendorname',
        align: 'center',
        ellipsis: true,
        key: 'vendorname'
        // customRender(text) {
        //   text == 0 && (text = '不索取')
        //   text == 1 && (text = '索取')
        //   return text
        // }
      },
      {
        title: '采购单号',
        key: 'autoBillNum',
        ellipsis: true,
        dataIndex: 'autoBillNum',
        align: 'center'
      },
      {
        title: '图片数量',
        key: 'count',
        ellipsis: true,
        dataIndex: 'count',
        align: 'center'
      }
    ],
    detail: {
      remoteUrl: {
        url: upcloud_base_wh_inbound + '/rcvLines/v1.0/qualifiedPage',
        method: 'get'
      },
      items: [
        {
          span: 8,
          type: 'input',
          name: 'autoBillNum',
          disabled: true,
          label: '收货单号',
          value: ''
        },
        {
          span: 8,
          type: 'input',
          disabled: true,
          name: 'mtlOwnerName',
          label: '货主名称',
          value: ''
        },
        {
          span: 8,
          type: 'input',
          name: 'accompanyOrder',
          required: true,
          label: '随货联单号',
          value: ''
        }
      ],
      columns: [
        {
          dataIndex: 'itemNum',
          key: 'itemNum',
          align: 'center',
          title: '商品编号'
        },
        {
          title: '商品名称',
          dataIndex: 'itemName',
          align: 'center',
          key: 'itemName'
        },
        {
          title: '单位',
          dataIndex: 'uom',
          ellipsis: true,
          align: 'center',
          key: 'uom'
        },
        {
          title: '包装数',
          key: 'pieceConversionRate',
          ellipsis: true,
          dataIndex: 'pieceConversionRate',
          align: 'center'
        },
        {
          title: '产地',
          dataIndex: 'productionPlace',
          align: 'center',
          ellipsis: true,
          key: 'productionPlace'
          // customRender(text) {
          //   text == 0 && (text = '不索取')
          //   text == 1 && (text = '索取')
          //   return text
          // }
        },
        {
          title: '生产厂家',
          key: 'manufacturerName',
          ellipsis: true,
          dataIndex: 'manufacturerName',
          align: 'center'
        },
        {
          title: '批号',
          key: 'manufacturerLotNum',
          ellipsis: true,
          dataIndex: 'manufacturerLotNum',
          align: 'center'
        },
        {
          title: '生产日期',
          key: 'showProductionDate',
          ellipsis: true,
          dataIndex: 'showProductionDate',
          align: 'center'
        },
        {
          title: '有效期至',
          key: 'showExpiredDate',
          ellipsis: true,
          dataIndex: 'showExpiredDate',
          align: 'center'
        },
        {
          title: '数量',
          key: 'qty',
          ellipsis: true,
          dataIndex: 'qty',
          align: 'center'
        },
        {
          title: '件数',
          key: 'oddCaseQty',
          ellipsis: true,
          dataIndex: 'oddCaseQty',
          align: 'center'
        },
        {
          title: '零散数',
          key: 'oddPieceQty',
          ellipsis: true,
          dataIndex: 'oddPieceQty',
          align: 'center'
        },
        {
          title: '操作',
          key: 'operation',
          scopedSlots: { customRender: 'operation' },
          fixed: 'right',
          width: 150,
          align: 'center'
        }
      ]
    }
  }
}

export default config
