// genCargoownerAuthSearchModal
import { SERVICE_DATA_API_BASE } from '@/config/serviceSettings'
const baseUrl = '/api/upcloud-base-wh-dev-mysql-eistest'
import { genWarehouseAuthSearchModal, genCargoownerAuthSearchModal } from '@/views/kzyWMS/SearchModal'
import moment from 'moment'
import { changecargoOwnerfun } from '@/views/kzyWMS/utils/setCargoOwner'

// const baseUrl = '/wrb1'
import { remote } from '@/views/EIS/remote/index.js'
let grid = {
  span: 8,
  labelCol: { span: 6 },
  wrapperCol: { span: 14 }
}

const config = function(that) {
  return {
    DocumentInfo: {
      remoteUrl: { url: SERVICE_DATA_API_BASE + '/search/page', method: 'post' },
      items: [
        ...genWarehouseAuthSearchModal(1, true, false, null, changecargoOwnerfun, grid, null),
        ...genCargoownerAuthSearchModal(1, true, false, null, null, grid, null),
        {
          type: 'row',
          label: '日期',
          span: 8,
          labelCol: { span: 6 },
          wrapperCol: { span: 14 },
          list: [
            {
              type: 'date',
              name: 'startTime',
              placeholder: '请输入开始日期',
              value: moment()
                .subtract(1, 'months')
                .format('YYYY-MM-DD'),
              format: 'YYYY-MM-DD',
              style: 'padding-right:5px;'
            },
            {
              type: 'date',
              name: 'endTime',
              placeholder: '请输入结束日期',
              format: 'YYYY-MM-DD',
              value: moment().format('YYYY-MM-DD')
            }
          ]
        },

        {
          type: 'input',
          label: '单据编号',
          span: 8,
          labelCol: { span: 6 },
          wrapperCol: { span: 14 },
          name: 'code',
          value: ''
        },

        {
          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) => {
                  form.resetFields()
                  let startTime = moment()
                    .subtract(1, 'months')
                    .format('YYYY-MM-DD')
                  let endTime = moment().format('YYYY-MM-DD')
                  let warehouse = that.$store.state.user.warehouse
                  that.getAuthBycargoOwner()
                  form.setFieldsValue({ ...warehouse, startTime, endTime })
                  //   console.log(form)
                }
              }
            }
          ]
        }
      ],
      columns: [
        { dataIndex: 'cargoOwnerName', title: '货主' },
        { dataIndex: 'itemCode', title: '商品编码' },
        { dataIndex: 'itemName', title: '商品名称' },
        { dataIndex: 'scanName', title: '操作人' },
        // { dataIndex: 'departmentName', title: '部门名称',  },
        { dataIndex: 'supplierOrShipperCode', title: '单位编码' },
        { dataIndex: 'supplierOrShipperName', title: '单位名称' },
        { dataIndex: 'scanDate', title: '操作时间' },
        { dataIndex: 'supervisionType', title: '监管类型' },
        { dataIndex: 'supervisionCode', title: '监管码' },
        { dataIndex: 'refBillId', title: '单据编号' }
      ]
    },
    TasksExported: {
      remoteUrl: { url: SERVICE_DATA_API_BASE + '/search/page', method: 'post' },

      columns: [
        { dataIndex: 'cargoOwnerName', title: '货主' },
        { dataIndex: 'itemCode', title: '商品编码' },
        { dataIndex: 'itemName', title: '商品名称' },
        { dataIndex: 'scanName', title: '操作人' },
        // { dataIndex: 'departmentName', title: '部门名称',  },
        { dataIndex: 'supplierOrShipperCode', title: '单位编码' },
        { dataIndex: 'supplierOrShipperName', title: '单位名称' },
        { dataIndex: 'scanDate', title: '操作时间' },
        { dataIndex: 'supervisionType', title: '监管类型' },
        { dataIndex: 'supervisionCode', title: '监管码' },
        { dataIndex: 'refBillId', title: '单据编号' }
      ]
    }
  }
}

export default config
