import { genWarehouseAuthSearchModal, genBldgSearchModal } from '@/views/kzyWMS/SearchModal'
import store from '@/store'

let grid = {
  span: 8,
  labelCol: { span: 8 }
}

export function item(self) {
  let warehouseId = store.state.user.warehouse.warehouseId

  return [
    ...genWarehouseAuthSearchModal(1, true, false, null, 
      function(rowData, form) {
      form.setFieldsValue({ bldgName: '', bldgId: '' })
      if (!rowData) {
        self.warehouseId = ''
      } else {
        self.warehouseId = rowData[0].companyId
      }
    }, grid, null),
    ...genBldgSearchModal(1, false, false, null, null, grid, null),
    {
      name: 'warehouseRoomName',
      label: '库房名称',
      type: 'input'
    }, 
    {
      name: 'warehouseRoomCode',
      label: '库房编码',
      type: 'input'
    },
    {
      name: 'isEnable',
      label: '是否启用',
      type: 'select',
      options: [
        {
          label: '是',
          value: '1'
        },
        {
          label: '否',
          value: '0'
        }
      ]
    },
  ]
}
