import API from '../../api/default'
import { genCargoownerAuthSearchModal } from "../../../SearchModal";

const items = [
  {
    type: 'select',
    name: 'platStatus',
    label: '盘点方式',
    allowClear: false,
    value: '明盘',
    options: [
      { label: '明盘', value: '明盘' },
      { label: '盲盘', value: '盲盘' }
    ]
  },
  {
    type: 'select',
    name: 'platStatus',
    label: '盘点类型',
    value: '货位',
    options: [
      { label: '货位', value: '货位' },
      { label: '动销', value: '动销' },
      { label: '混批号', value: '混批号' },
      { label: '空货位', value: '空货位' }
    ]
  },
  {
    type: 'row',
    label: '日期',
    list: [
      {
        type: 'date',
        name: 'startTime',
        placeholder: '请输入开始日期',
        value: '',
        format: 'YYYY-MM-DD',
        style: 'padding-right:5px;'
      },
      {
        type: 'date',
        name: 'endTime',
        placeholder: '请输入结束日期',
        format: 'YYYY-MM-DD',
        value: ''
      }
    ]
  },
  ...genCargoownerAuthSearchModal(1,true,false,null,null,{span: 6}),
  {
    type: 'select',
    name: 'platStatus',
    label: '库别',
    value: '零货库',
    options: [
      { label: '零货库', value: '零货库' },
      { label: '整件库', value: '整件库' },
      { label: '退货库', value: '退货库' },
      { label: '不合格库', value: '不合格库' }
    ]
  },
  {
    type: 'select',
    name: 'platStatus1',
    label: '区域编号',
    value: '01',
    options: [
      { label: '01', value: '01' },
      { label: '02', value: '02' },
      { label: '03', value: '03' },
      { label: '04', value: '04' }
    ]
  },
  {
    type: 'row',
    label: '货位区间',
    list: [
      {
        type: 'input',
        name: 'start',
        placeholder: '请输入货位',
        value: '',
        style: 'padding-right:5px;'
      },
      {
        type: 'input',
        name: 'end',
        placeholder: '请输入货位',
        value: ''
      }
    ]
  },
  {
    type: 'input',
    name: 'warehouseName1',
    label: '产品编号'
  }
]
const columns = function(self) {
  return [
    { dataIndex: 'itemId', title: '货主名称', key: 'itemId' },
    { dataIndex: 'itemCode1', title: '显示货位', key: 'itemCode1' },
    { dataIndex: 'itemName', title: '区域编号', key: 'itemName' },
    { dataIndex: 'code4', title: '库存数量', key: 'code4' },
    { dataIndex: 'code2', title: '库存件数', key: 'code2' },
    { dataIndex: 'code18', title: '入库已分配', key: 'code18' },
    { dataIndex: 'code19', title: '出库已分配', key: 'code19' },
    { dataIndex: 'code20', title: '批号', key: 'code20' },
    { dataIndex: 'code21', title: '商品编号', key: 'code21' },
    { dataIndex: 'code22', title: '商品名称', key: 'code22' },
    { dataIndex: 'specification', title: '商品规格', key: 'specification' },
    { dataIndex: 'code24', title: '包装单位', key: 'code24' },
    { dataIndex: 'code25', title: '包装数量', key: 'code25' },
    { dataIndex: 'code26', title: '生产厂家', key: 'code26' },
    { dataIndex: 'code27', title: '生产日期', key: 'code27' },
    { dataIndex: 'code28', title: '有效期', key: 'code28' }
  ]
}

const operateFormItems = [
  {
    type: 'input',
    name: 'itemHealthType',
    label: '制单人',
    value: '',
    labelCol: { span: 8 },
    span: 6
  },
  {
    type: 'input',
    name: 'itemHealthUsage',
    label: '修改人',
    value: '',
    labelCol: { span: 8 },
    span: 6
  },
  {
    type: 'input',
    name: 'itemHealthApprovalNbr',
    label: '制单日期',
    value: '',
    labelCol: { span: 8 },
    span: 6
  },
  {
    type: 'input',
    name: 'itemHealthIndustry',
    label: '修改时期',
    value: '',
    labelCol: { span: 8 },
    span: 6
  },
  {
    type: 'input',
    name: 'itemHealthCommonName',
    label: '单据状态',
    value: '',
    labelCol: { span: 8 },
    span: 6
  },
  {
    type: 'input',
    name: 'itemHealthBuyer',
    label: '上传状态',
    value: '',
    labelCol: { span: 8 },
    span: 6
  },
  {
    type: 'input',
    name: 'itemHealthRegisterNbr',
    label: '作业状态',
    value: '',
    labelCol: { span: 8 },
    span: 6
  }
]

export function detailConfig(self) {
  return [
    {
      key: 'one',
      checkedKey: 'main',
      btns: [
        { label: '查询', click() {} },
        { label: '重置', click() {} },
        {
          label: '生成计划',
          click() {}
        },
        {
          label: '打印设置',
          click() {}
        }
      ],
      list: [
        {
          key: 'main',
          tab: '主要信息',
          btns: [
            // { label: '辅助功能1', click() { } },
          ],
          item: { type: 'p-grid-form', config: items }
        }
      ]
    },
    {
      key: 'two',
      checkedKey: 'baseMtlItemUomConversionsList',
      list: [
        {
          key: 'baseMtlItemUomConversionsList',
          tab: '盘点计划',
          btns: [],
          item: {
            type: 'p-table-edit',
            config: columns(self),
            rowKey: '_row_count',
            rowSelectType: 2,
            colChange({ record, name, value }) {}
          }
        }
      ]
    }
  ]
}
