import { remote } from './remote'
import { upcloud_base_wh ,upcloud_base_chain} from "@/config/serviceSettings";

const items = [
  {
    type: 'date',
    name: 'billDateStart',
    label: '开始时间',
    format: 'YYYY-MM-DD HH:mm:ss'
  },
  {
    type: 'date',
    name: 'billDateEnd',
    label: '结束时间',
    format: 'YYYY-MM-DD HH:mm:ss'
  },
  {
    type: 'input',
    name: 'billDateEnd',
    label: '波次号',
    format: 'YYYY-MM-DD HH:mm:ss'
  },
  {
    type: 'select',
    name: 'status',
    label: '状态',
    format: 'YYYY-MM-DD HH:mm:ss'
  },
  {
    span: 24,
    type: 'buttonGroup',
    style: { textAlign: 'right' },
    options: [
      {
        value: '查询',
        icon: 'search',
        btnType: 'primary',
        style: 'margin-right:10px',
        htmlType: 'submit'
      },
      {
        value: '重置',
        name: 'ccz',
        icon: 'redo',
        on: {
          click(event, form) {
            form.resetFields()
          }
        }
      }
    ]
  }
]

const modalItems = [
  {
    type: 'input',
    name: 'dcId',
    label: '仓配中心id',
    hidden: true
  },
  {
    name: 'dcName',
    label: '仓配中心名称',
    type: 'searchModal',
    remoteUrl: { url: upcloud_base_wh +'/wmsdc/page', method: 'get' },
    rowKey: 'dcId',
    targetValueKey: 'dcName',
    required: true,
    toolBar: {
      items: [
        {
          type: 'input',
          name: 'dcCode',
          label: '仓配中心编码',
          value: ''
        },
        {
          type: 'input',
          name: 'dcName',
          label: '仓配中心名称',
          value: ''
        }
      ]
    },
    tableConfig: {
      columns: [
        {
          dataIndex: 'dcCode',
          title: '仓配中心编码'
        },
        {
          dataIndex: 'dcName',
          title: '仓配中心名称'
        }
      ]
    },
    on: {
      ok(event, value, rowData, form) {
        form.setFieldsValue({
          dcId: `${rowData[0].dcId}`
        })
      }
    }
  },
  {
    type: 'input',
    name: 'warehouseId',
    label: '仓库id',
    required: true,
    hidden: true
  },
  {
    type: 'searchModal',
    name: 'warehouseName',
    label: '仓库名称',
    required: true,
    remoteUrl: { url: upcloud_base_wh +'/warehouse/page', method: 'get' },
    rowKey: 'warehouseId',
    targetValueKey: 'warehouseName',
    required: true,
    toolBar: {
      items: [
        {
          type: 'input',
          name: 'warehouseCode',
          label: '仓库编码',
          value: ''
        },
        {
          type: 'input',
          name: 'warehouseName',
          label: '仓库名称',
          value: ''
        }
      ]
    },
    tableConfig: {
      columns: [
        {
          dataIndex: 'warehouseCode',
          title: '仓库编码'
        },
        {
          dataIndex: 'warehouseName',
          title: '仓库名称'
        }
      ]
    },
    on: {
      ok(event, value, rowData, form) {
        form.setFieldsValue({
          warehouseId: `${rowData[0].warehouseId}`
        })
      }
    }
  },
  {
    type: 'input',
    name: 'warehouseRoomId',
    label: '库房id',
    required: true,
    hidden: true
  },
  {
    type: 'searchModal',
    name: 'warehouseRoomName',
    label: '库房名称',
    required: true,
    remoteUrl: { url: upcloud_base_wh +'/baseWmsWarehouseRoomMst/page', method: 'post' },
    rowKey: 'warehouseRoomId',
    targetValueKey: 'warehouseRoomName',
    toolBar: {
      items: [
        {
          type: 'input',
          name: 'warehouseRoomCode',
          label: '库房编码',
          value: ''
        },
        {
          type: 'input',
          name: 'warehouseRoomName',
          label: '库房名称',
          value: ''
        }
      ]
    },
    tableConfig: {
      columns: [
        {
          dataIndex: 'warehouseRoomCode',
          title: '库房编码'
        },
        {
          dataIndex: 'warehouseRoomName',
          title: '库房名称'
        }
      ]
    },
    on: {
      ok(event, value, rowData, form) {
        form.setFieldsValue({
          warehouseRoomId: `${rowData[0].warehouseRoomId}`
        })
      }
    }
  },
  {
    type: 'input',
    name: 'warehouseAreaId',
    label: '库区id',
    required: true,
    hidden: true
  },
  {
    type: 'searchModal',
    name: 'warehouseAreaName',
    label: '库区名称',
    required: true,
    remoteUrl: { url: upcloud_base_wh +'/baseWmsWarehouseArea/page', method: 'post' },
    rowKey: 'warehouseAreaId',
    targetValueKey: 'warehouseAreaName',
    toolBar: {
      items: [
        {
          type: 'input',
          name: 'warehouseAreaCode',
          label: '库区编码',
          value: ''
        },
        {
          type: 'input',
          name: 'warehouseAreaName',
          label: '库区名称',
          value: ''
        }
      ]
    },
    tableConfig: {
      columns: [
        {
          dataIndex: 'warehouseAreaCode',
          title: '库区编码'
        },
        {
          dataIndex: 'warehouseAreaName',
          title: '库区名称'
        }
      ]
    },
    on: {
      ok(event, value, rowData, form) {
        form.setFieldsValue({
          warehouseAreaId: `${rowData[0].warehouseAreaId}`
        })
      }
    }
  },
  {
    type: 'input',
    name: 'stageCode',
    label: '集货区编码',
    required: true
  },
  {
    type: 'select',
    name: 'stageType',
    label: '集货区类型',
    required: true,
    ...remote('pub_workstage_stagetype')
  },
  {
    type: 'select',
    name: 'shiplineId',
    label: '配送方向',
    ...remote('common_shiplineid')
  },
  {
    type: 'select',
    name: 'deliveryType',
    label: '提货方式',
    ...remote('pub_workstage_delivertype')
  },
  {
    type: 'input',
    name: 'customerId',
    label: '客户id',
    hidden: true
  },
  {
    type: 'searchModal',
    name: 'customerName',
    label: '客户名称',
    required: true,
    remoteUrl: { url: upcloud_base_chain+'/baseCustomerMst/v1.0/page', method: 'post' },
    rowKey: 'customerId',
    targetValueKey: 'customerName',
    toolBar: {
      items: [
        {
          type: 'input',
          name: 'customerCode',
          label: '客户编码'
        },
        {
          type: 'input',
          name: 'customerName',
          label: '客户名称'
        }
      ]
    },
    tableConfig: {
      columns: [
        {
          dataIndex: 'customerCode',
          title: '客户编码'
        },
        {
          dataIndex: 'customerName',
          title: '客户名称'
        }
      ]
    },
    on: {
      ok(event, value, rowData, form) {
        form.setFieldsValue({
          customerId: `${rowData[0].customerId}`
        })
      }
    }
  },
  {
    type: 'input',
    name: 'numlimit',
    label: '订单数限制'
  },
  {
    type: 'input',
    name: 'tunnelno',
    label: '巷道'
  },
  {
    type: 'select',
    name: 'isEnable',
    label: '状态',
    options: [
      {
        label: '启用',
        value: 1
      },
      {
        label: '禁用',
        value: 0
      }
    ]
  }
]

const columns = [
  {
    title: '序号',
    dataIndex: 'index',
    key: 'index',
    scopedSlots: { customRender: 'index' }
  },
  {
    title: '打印',
    dataIndex: 'tag',
    key: 'tag'
  },
  {
    title: '是否取消订单',
    dataIndex: 'box_no',
    key: 'box_no'
  },
  {
    title: '单据编码',
    key: 'name',
    dataIndex: 'name'
  },
  {
    title: '货主名称',
    key: 'code',
    dataIndex: 'code'
  },
  {
    title: '单位编号',
    key: 'type',
    dataIndex: 'type'
  },
  {
    title: '单位名称',
    key: 'some',
    dataIndex: 'some'
  },
  {
    title: '开票员',
    key: 'created_at',
    dataIndex: 'created_at'
  },
  {
    title: '复核员',
    key: 'time_end',
    dataIndex: 'time_end'
  },
  {
    title: '配送方向',
    key: 'plan_num',
    dataIndex: 'plan_num'
  },
  {
    title: '提货方式',
    key: 'realy_num',
    dataIndex: 'realy_num'
  },
  {
    title: '日期',
    key: 'scan_num',
    dataIndex: 'scan_num'
  },
  {
    title: '客户备注',
    key: 'handle',
    dataIndex: 'handle'
  },
  {
    title: '备注',
    key: 'reason',
    dataIndex: 'reason'
  }
]

const singleColumns = [
  {
    title: '序号',
    dataIndex: 'index',
    key: 'index',
    scopedSlots: { customRender: 'index' }
  },
  {
    dataIndex: 'approvalNumber',
    title: '拼箱号'
  },
  {
    dataIndex: 'amt',
    title: '冷藏箱号'
  },
  {
    dataIndex: 'batchNo',
    title: '起始暂存区'
  },
  {
    dataIndex: 'billno',
    title: '终止暂存区'
  },
  {
    dataIndex: 'closedReason',
    title: '建筑物'
  },
  {
    dataIndex: 'colorCode',
    title: '标签条码'
  },
  {
    dataIndex: 'consignorname',
    title: '产品编码'
  },
  {
    dataIndex: 'freeQty',
    title: '产品名称'
  },
  {
    dataIndex: 'itemOdd',
    title: '单位'
  },
  {
    dataIndex: 'itemPcs',
    title: '规格'
  },
  {
    dataIndex: 'itemQty',
    title: '包装数'
  },
  {
    dataIndex: 'itemSpecs',
    title: '生产厂家'
  },
  {
    dataIndex: 'itemVolume',
    title: '批号'
  },
  {
    dataIndex: 'lotNo',
    title: '实际件数'
  },
  {
    dataIndex: 'machType',
    title: '实际零散数'
  },
  {
    dataIndex: 'manufacturer',
    title: '实际数量'
  },
  {
    dataIndex: 'packTypeNum',
    title: '拣货错误'
  },
  {
    dataIndex: 'packUnits',
    title: '计划件数'
  },
  {
    dataIndex: 'pdateFrom',
    title: '实际零散数'
  },
  {
    dataIndex: 'price',
    title: '实际数量'
  },
  {
    dataIndex: 'productionPlace',
    title: '拣货错误处理方式'
  },
  {
    dataIndex: 'sizeCode',
    title: '计划件数'
  },
  {
    dataIndex: 'status',
    title: '计划零散数'
  },
  {
    dataIndex: 'tniAmt',
    title: '计划数量'
  },
  {
    dataIndex: 'tniPrice',
    title: '显示货位'
  },
  {
    dataIndex: 'typeCode',
    title: '拣货员'
  },
  {
    dataIndex: 'typeName',
    title: '外复核员'
  },
  {
    dataIndex: 'validUntil',
    title: '生产日期'
  },
  {
    dataIndex: 'validUntil1',
    title: '有效期至'
  },
  {
    dataIndex: 'validUntil2',
    title: '注册证号'
  },
  {
    dataIndex: 'validUntil3',
    title: '外复核索取'
  },
  {
    dataIndex: 'validUntil4',
    title: '单据编号'
  },
  {
    dataIndex: 'validUntil5',
    title: '行号'
  },
  {
    dataIndex: 'validUntil6',
    title: '库房编号'
  }
]

export { items, modalItems, columns, singleColumns }
