let grid = {
  labelCol: { span: 6 },
  wrapperCol: { span: 16 },
  span: 12,
  // 高度
  itemHeight: '50px',
}
import { SERVICE_AI_EIS_KZ_MASTER_DEV } from '@/config/serviceSettings.js'
import { pdStationCheck } from '../api'
import { QN_BASEURL } from '../../serviceSettings'
const baseUrl = QN_BASEURL

export function formItems(self) {
  return [
    { hidden: true, type: 'input', name: 'id', label: 'id', value: '' },
    { hidden: true, type: 'input', name: 'taskId', label: 'taskId', value: '' },
    { hidden: true, type: 'input', name: 'conserveNo', label: 'conserveNo', value: '' },
    { hidden: true, type: 'input', name: 'actualAllocation', label: 'actualAllocation', value: '' },
    { hidden: true, type: 'input', name: 'maintainTaskId', label: 'maintainTaskId', value: '' },
    { hidden: true, type: 'input', name: 'planes', label: 'planes', value: '' },
    { hidden: true, type: 'input', name: 'bizPropertyId', label: 'bizPropertyId', value: '' },

    {
      type: 'select',
      className: 'input-md',
      destroyOptions: true,
      size: 'large',
      name: 'stationNo',
      label: '工作站',
      remoteUrl: {
        url: baseUrl + `/api/v1/pc/pdStationList`,
        method: 'get',
      },
      replaceFields: {
        label: 'stationNo',
        value: 'stationNo',
      },
      autoLoad: true,
      ...grid,
      value: '',
      on: {
        change(event, value, rowData, form) {
          console.log(arguments)
          if (value) {
            self.pdStationCheck(value)
          }
        },
        // pressEnter() {
        //   const params = self.$refs.itemForm.form.getFieldsValue().stationNo
        //   checkStation({ stationNo: params }).then((res) => {
        //     if (!res.success) {
        //       self.$message.warning(self.$lang(res.message))
        //       return
        //     }
        //     // self.$refs.itemForm.form.setFieldsValue(res.data[0])
        //     self.$message.success(self.$lang('验证成功'))
        //     self.message = '请领取任务'
        //   })
        // },
      },
    },

    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'barCode',
      label: '商品条码',
      ...grid,
      value: '',
      disabled: true,
    },

    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'itemName',
      label: '商品名称',
      span: 24,
      labelCol: { span: 3 },
      wrapperCol: { span: 20 },
      itemHeight: '50px',
      value: '',
      disabled: true,
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'manufacturerName',
      label: '生产厂家',
      ...grid,
      value: '',
      disabled: true,
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'cargoOwnerName',
      label: '货主',
      ...grid,
      value: '',
      disabled: true,
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'specification',
      label: '规格',
      ...grid,
      value: '',
      disabled: true,
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'containerNo',
      label: '货架编号',
      ...grid,
      value: '',
      disabled: true,
      // on: {
      //   change(value, data) {
      //     setTimeout(() => {
      //       const params = self.$refs.itemForm.form.getFieldsValue()
      //       if (params.goodsShelves) {
      //         clearInterval(t)
      //       }
      //     }, 1000)
      //   }
      // }
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'lotNo',
      label: '批号',
      ...grid,
      value: '',
      disabled: true,
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'containerSubNo',
      label: '货位编码',
      ...grid,
      value: '',
      disabled: true,
      // on: {
      //   change(value, data) {
      //     setTimeout(() => {
      //       const params = self.$refs.itemForm.form.getFieldsValue()
      //       if (params.goodsAllocation) {
      //         clearInterval(t)
      //       }
      //     }, 1000)
      //   }
      // }
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'taskStatus',
      label: '商品状态',
      ...grid,
      value: '',
      size: 'large',
      disabled: true,
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'category',
      label: '商品大类',
      ...grid,
      value: '',
      size: 'large',
      disabled: true,
    },
    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'qty',
      label: '实物数量',
      ...grid,
      value: '',
      size: 'large',
      //   disabled: true,
    },

    // {
    //   type: 'number', name: 'realityQty', label: '上架数量', ...grid, value: '', size: "large", min: 0,
    //   on: {
    //     change(p1, p2) {
    //       const params = self.$refs.itemForm.form.getFieldsValue()
    //       if (p1 > params.qty) {
    //         self.$message.error(self.$lang('上架数量不能大于数量'))
    //       }
    //     }
    //   }
    // },
  ]
}

export const tableColumns = [
  { hidden: true, title: 'id', dataIndex: 'id' },
  { hidden: true, title: '货主', dataIndex: 'nodeType' },
  { title: '货架编号', dataIndex: 'goodsShelveNo' },
  { title: '货架区域', dataIndex: 'sourceArea' },
  { title: '货架点位', dataIndex: 'sourceLocation', className: 'v_top' },
  { title: '位面', dataIndex: 'shelfPlane', className: 'v_top' },
  { title: '可用货位编码', dataIndex: 'shelveLocation', className: 'v_top' },
  { title: '商品大类', dataIndex: 'specification', className: 'v_top' },
]

export const containerColumns = [
  { hidden: true, title: 'taskId', dataIndex: 'taskId' },
  // { hidden: true, title: '货主', dataIndex: 'nodeType', },
  { dataIndex: 'nodeType', title: '货主', key: 'nodeType' },
  { dataIndex: 'pieceBarcode', title: '商品条码', key: 'pieceBarcode' },
  { dataIndex: 'itemName', title: '商品名称', key: 'itemName' },
  { dataIndex: 'specification', title: '规格', key: 'specification' },
  { dataIndex: 'manufacturerLotNum', title: '批号', key: 'manufacturerLotNum' },
  { dataIndex: 'qty', title: '数量', key: 'qty' },
  { dataIndex: 'containerSubNo', title: '容器编号', key: 'containerSubNo' },
  { dataIndex: 'orderNo', title: '单据编号', key: 'orderNo' },
]
