let grid = {
  labelCol: { span: 8 },
  wrapperCol: { span: 16 },
  span: 12,
  // 高度
  itemHeight: '50px',
}
let grid1 = {
  labelCol: { span: 8 },
  wrapperCol: { span: 16 },
  span: 24,
  className: 'input-md',
  size: 'large',
  disabled: true,
  // 高度
  itemHeight: '50px',
}
let grid2 = {
  labelCol: { span: 4 },
  wrapperCol: { span: 16 },
  span: 12,
  // 高度
  itemHeight: '50px',
}
let grid2lager = {
  labelCol: { span: 6 },
  wrapperCol: { span: 16 },
  span: 12,
  // 高度
  itemHeight: '50px',
}
let grid3 = {
  labelCol: { span: 2 },
  wrapperCol: { span: 6 },
  span: 18,
  // 高度
  itemHeight: '50px',
}
let newgrid = {
  labelCol: { span: 8 },
  wrapperCol: { span: 16 },
  className: 'input-md',
  size: 'large',
  span: 16,
  // 高度
  itemHeight: '50px',
}
let grid4 = {
  labelCol: { span: 4 },
  wrapperCol: { span: 8 },
  className: 'input-md',
  size: 'large',
  span: 24,
  // 高度
  itemHeight: '50px',
}
let grid4larger = {
  labelCol: { span: 15 },
  wrapperCol: { span: 9 },
  span: 8,
  // 高度
  itemHeight: '50px',
}

// taskInfoItems

export function taskInfoItems(self) {
  let _this = self
  return [
    { type: 'input', name: 'itemCode', label: '商品编码', ...grid1, value: '' },
    { type: 'input', name: 'itemName', label: '商品名称', ...grid1, value: '' },
    { type: 'input', name: 'lotNo', label: '批号', ...grid1, value: '' },
    { type: 'input', name: 'planOfferQty', label: '计划数量', ...grid1, value: '' },
    { type: 'input', name: 'planQty', label: '复核数量', ...grid1, value: '' },
  ]
}

export function formItems(self) {
  let _this = self
  return [
    { type: 'input', hidden: true, name: 'checkTaskNo', label: '任务号', ...grid, value: '' },
    { type: 'input', hidden: true, name: 'outboundDetailId', label: 'outboundDetailId', ...grid, value: '' },
    { type: 'input', hidden: true, name: 'autoOffer', label: '自动复核', ...grid, value: '' },
    { type: 'input', hidden: true, name: 'outboundId', label: 'outboundId', ...grid, value: '' },
    { type: 'input', name: 'id', label: 'id', ...grid, value: '', hidden: true },
    { type: 'input', name: 'goodsId', label: 'goodsId', ...grid, value: '', hidden: true },
    { type: 'input', name: 'pickTaskId', label: 'pickTaskId', ...grid, value: '', hidden: true },

    {
      type: 'input',
      name: 'stationNo',
      label: '供包口',
      ...newgrid,
      span: 12,
      value: '',
      on: {
        pressEnter(KeyboardEvent) {
          let stationNo = KeyboardEvent.target.value.replace(/[^0-9]/g, '')
          self.checkAllotment(stationNo)
        },
      },
    },
    { type: 'input', name: 'username', label: '当前账户', disabled: true, ...newgrid, span: 12, value: '' },
    { type: 'input', name: 'nickname', label: '账户名称', ...newgrid, span: 12, value: '', disabled: true },
    { type: 'input', name: 'waveNo', label: '波次号', ...newgrid, span: 12, value: '', disabled: true },

    {
      type: 'buttonGroup',
      style: { textAlign: 'left' },
      itemHeight: '50px',
      // ...grid,
      span: 8,
      options: [
        {
          value: '查看当前品种任务',
          style: 'margin-right:100px;fontSize:15px;height:40px;lineHeight:40px;borderRadius:5px',
          on: {
            click: () => {
              if (!Object.keys(self.item).length > 0) {
                return self.$message.error('请选择需要确认的订单')
              }
              //   self.ViewitemModel = true
              if (Object.keys(self.item).length) {
                self.remoteParams = {
                  code: self.item.code || '',
                }
                self.ViewitemModel = true
              }
            },
            keyup(val) {},
          },
        },
      ],
    },

    {
      type: 'buttonGroup',
      style: { textAlign: 'left' },
      span: 16,
      options: [
        // {
        //   value: '清空索取人',
        //   icon: 'search',
        //   btnType: 'primary',
        //   style: 'margin-right:10px',
        //   on: {
        //     click: () => {
        //       self.taskDetail()
        //     },
        //     keyup(val) {
        //       console.log('视觉复核2222')
        //     },
        //   },
        // },
        // {
        //   value: '复核解锁',
        //   icon: '',
        //   btnType: 'primary',
        //   style: 'margin-right:10px',
        //   on: {
        //     click: () => {
        //       self.isSupervised()
        //     },
        //   },
        // },
        {
          value: '复核确认',
          btnType: 'primary',
          disabled: false,
          icon: '',
          style: 'margin-left:50px;fontSize:15px;height:40px;width:100px;lineHeight:40px;borderRadius:5px',
          on: {
            click: () => {
              self.checkConfirm()
            },
          },
        },
        {
          value: '复核拍照',
          btnType: 'primary',
          disabled: false,
          icon: '',
          style: 'margin-left:50px;fontSize:15px;height:40px;width:100px;lineHeight:40px;borderRadius:5px',
          on: {
            click: () => {
              self.taskDetail()
            },
          },
        },
      ],
    },

    {
      type: 'input',
      name: 'code',
      label: '条形码',
      ...newgrid,
      span: 24,
      value: '',
      on: {
        pressEnter(KeyboardEvent) {
          if (self.checkAllotmentState) {
            let code = KeyboardEvent.target.value
            // let code = KeyboardEvent.target.value.replace(/[^0-9]/g, '')
            self.allotmentOrder({ code })
          } else {
            self.$message.error('请先校验')
          }
        },
      },
    },

    {
      type: 'buttonGroup',
      style: { textAlign: 'left' },
      // ...grid,
      span: 24,
      options: [
        {
          value: '票据供包',
          style: 'margin-right:100px;fontSize:15px;height:40px;width:100px;lineHeight:40px;borderRadius:5px',
          on: {
            click: () => {
              self.noteConfirm()
            },
            keyup(val) {},
          },
        },
      ],
    },

    // { type: 'input', name: 'cuslocname', label: '客户名称', ...grid2, value: '' },
    // { type: 'input', name: 'manufacturerId', label: '生产厂家', ...grid2, value: '' },

    // { type: 'input', name: 'source', label: '来源货位', ...grid4, value: '' },

    { type: 'input', name: 'manufacturerName', label: '生产厂家', ...grid4, value: '' },
    {
      type: 'input',
      name: 'itemCode',
      label: '商品编码',
      ...grid4,
      labelCol: { span: 8 },
      wrapperCol: { span: 16 },
      span: 12,
      value: '',
    },
    {
      type: 'input',
      size: 'large',
      name: 'planOfferQty',
      label: '计划数量',
      placeholder: '',
      ...grid4larger,
      span: 12,
      className: 'input-lg-red',
      value: '',
    },

    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'itemName',
      label: '商品名称',
      ...grid4,
      value: '',
    },
    {
      type: 'input',
      name: 'pieceUom',
      label: '单位',
      ...grid4,

      value: '',
    },
    // { span: 12 },
    // { span: 12, type: 'txt' },

    {
      type: 'input',
      className: 'input-md',
      size: 'large',
      name: 'lotNo',
      label: '批号',
      ...newgrid,

      span: 12,
      value: '',
    },
    {
      type: 'input',
      className: 'input-lg-red',
      size: 'large',
      name: 'planQty',
      ...grid4larger,
      placeholder: '',
      span: 12,
      label: '复核数量',

      value: '',
      on: {
        pressEnter(KeyboardEvent, vonde) {
          //   self.checkApi('checkNum', KeyboardEvent, vonde)
        },
      },
    },

    { type: 'input', name: 'specification', label: '规格', ...grid4, value: '' },

    { type: 'input', name: 'produceDate', label: '生产日期', ...grid4, value: '' },
    { type: 'input', name: 'expireDate', label: '有效期', ...grid4, value: '' },
    {
      type: 'select',
      name: 'itemHealthSuperviseflag',
      disabled: true,
      label: '监管码管理',
      options: [
        { label: '是', value: 1 },

        { label: '否', value: 0 },
      ],
      ...grid4,
      value: '',
    },
    { type: 'input', name: 'countryOrigin', label: '产地', ...grid4, hidden: true, value: '' },
    { type: 'input', name: 'itemHealthApprovalNbr', label: '批准文号', ...grid4, hidden: true, value: '' },
    { type: 'input', name: 'cargoOwnerName', label: '业主', ...grid4, hidden: true, value: '' },
    { type: 'input', name: 'itemHealthListedLicensor', label: '委托方', ...grid4, hidden: true, value: '' },
    { type: 'input', name: 'wavoNo', label: '波次号', ...grid4, value: '', hidden: true },
    { type: 'input', name: 'itemId', label: 'itemId', ...grid4, value: '', hidden: true },
  ]
}
export function queryItems(self) {
  let _this = self
  return [
    { type: 'input', name: 'id', label: 'id', ...grid, value: '', hidden: true },
    // { type: 'input', hidden: true,name: 'checkTaskNo', label: '任务号', ...grid, value: '',  },
    // { type: 'input', name: 'goodsId', label: 'goodsId', ...grid, value: '',hidden: true },
    // { type: 'input', name: 'ownerId', label: 'ownerId', ...grid, value: '',hidden: true },
    {
      type: 'input',
      name: 'stationNo',
      label: '工作站',
      ...{ labelCol: { span: 6 }, wrapperCol: { span: 16 }, span: 8 },
      value: '',
    },
    {
      type: 'input',
      name: 'goods',
      label: '商品',
      ...{ labelCol: { span: 6 }, wrapperCol: { span: 16 }, span: 8 },
      value: '',
    },
    {
      type: 'input',
      name: 'orderNo',
      label: '单据编码',
      ...{ labelCol: { span: 6 }, wrapperCol: { span: 16 }, span: 8 },
      value: '',
    },
  ]
}
export const rightitems = function (that) {
  return [
    {
      type: 'input',
      name: 'gridNo',
      disabled: true,
      label: '格口号',
      //   ...grid4,
      className: 'input-lgnew',
      size: 'large',
      // 高度
      itemHeight: '50px',
      span: 24,
      value: '',
    },
    // {
    //   type: 'select',
    //   name: 'itemHealthSuperviseflag',
    //   label: '是否监管码管理',
    //   disabled: true,
    //   className: 'input-md',
    //   size: 'large',
    //   // 高度
    //   itemHeight: '50px',
    //   options: [
    //     { label: '是', value: 1 },
    //     { label: '否', value: 0 },
    //   ],
    //   //   ...grid4,
    //   span: 24,
    //   value: '',
    // },
  ]
}

export const Modelcolumns = [
  { title: '波次号', key: 'waveNo', ellipsis: true, dataIndex: 'waveNo', align: 'center' },
  { title: '订单号', key: 'billNo', ellipsis: true, dataIndex: 'billNo', align: 'center' },
  { title: '客户名称', key: 'companyName', ellipsis: true, dataIndex: 'companyName', align: 'center' },
  { title: '商品名称', key: 'itemName', ellipsis: true, dataIndex: 'itemName', align: 'center' },
  { title: '商品编码', key: 'itemCode', ellipsis: true, dataIndex: 'itemCode', align: 'center' },
  { title: '批号信息', key: 'lotNo', ellipsis: true, dataIndex: 'lotNo', align: 'center' },
  { title: '供包数量', key: 'planQty', ellipsis: true, dataIndex: 'planQty', align: 'center' },
]
export const Modelcolumns2 = [
  { title: 'id', key: 'outboundDetailId', ellipsis: true, dataIndex: 'outboundDetailId', align: 'center' },
  { title: '商品编码', key: 'itemCode', ellipsis: true, dataIndex: 'itemCode', align: 'center' },
  { title: '商品批号', key: 'lotNo', ellipsis: true, dataIndex: 'lotNo', align: 'center' },
  { title: '客户名称', key: 'companyName', ellipsis: true, dataIndex: 'companyName', align: 'center' },
  { title: '单据号码', key: 'billNo', ellipsis: true, dataIndex: 'billNo', align: 'center' },
  { title: '计划数量', key: 'planQty', ellipsis: true, dataIndex: 'planQty', align: 'center' },
  { title: '复核数量', key: 'offerQty', ellipsis: true, dataIndex: 'offerQty', align: 'center' },
  {
    title: '任务状态',
    key: 'taskType',
    ellipsis: true,
    dataIndex: 'taskType',
    align: 'center',
    customRender(text, record) {
      record.planQty == 0 && (text = '已复核')
      record.planQty > 0 && (text = '复核中')
      return text
    },
  },
  { title: '波次号', key: 'waveNo', ellipsis: true, dataIndex: 'waveNo', align: 'center' },
]
export const prinTableColumns = [
  { hidden: true, title: 'id', dataIndex: 'id' },
  { title: '商品条码', dataIndex: 'barcode' },
  { title: '商品名称', dataIndex: 'goodsName' },
  { title: '商品编码', dataIndex: 'goodsCode' },
  { title: '单据编号', dataIndex: 'orderNo' },
  { title: '数量', dataIndex: 'qty' },
  { title: '拣选时间', dataIndex: 'pickTime' },
  { title: '规格', dataIndex: 'goodsType' },
  { title: '批号', dataIndex: 'lotNo' },
  { title: '货主', dataIndex: 'goodsOwnerName' },
]

export const tableColumns = [
  { hidden: true, title: 'id', dataIndex: 'id' },
  { title: '单据编号', dataIndex: 'orderNo' },
  { title: '数量', dataIndex: 'plantyQty' },
]

export const items = function (that) {
  return [
    {
      type: 'input',
      name: 'scanCode',
      label: '监管码',
      value: '',
      span: 18,
      className: 'input-md',
      itemHeight: '60px',
      on: {
        pressEnter(KeyboardEvent) {
          window.event.preventDefault()
          let code = KeyboardEvent.target.value
          // let code = KeyboardEvent.target.value.replace(/[^0-9]/g, '')
          console.log(code, '===')

          if (!Object.keys(that.item).length > 0) {
            return that.$message.error('请选择需要确认的订单')
          }
          that.scanCode(code)
        },
      },
    },

    {
      type: 'buttonGroup',
      style: { textAlign: 'left' },
      span: 6,
      options: [
        {
          value: '显示',
          btnType: 'primary',
          disabled: false,
          icon: '',
          style: 'margin-left:50px;fontSize:15px;height:40px;width:100px;lineHeight:40px;borderRadius:5px',
          on: {
            click: () => {
              that.show = !that.show
              console.log(that.items)
              that.items[1].options[0].value = that.show ? '隐藏' : '显示'
              that.items = [...that.items]
            },
          },
        },
      ],
    },
  ]
}

export const showitems = function (that) {
  return [
    {
      type: 'buttonGroup',
      style: { textAlign: 'right' },
      //   span: 24,
      options: [
        {
          value: '显示',
          btnType: 'primary',
          disabled: false,
          icon: '',
          style: 'margin-left:50px;fontSize:15px;height:40px;width:100px;lineHeight:40px;borderRadius:5px',
          on: {
            click: () => {
              that.show1 = !that.show1
              that.showitems[0].options[0].value = that.show1 ? '隐藏' : '显示'
              that.showitems = [...that.showitems]
            },
          },
        },
      ],
    },
  ]
}

export const noteConfirmItem = function (that) {
  return [
    {
      type: 'input',
      name: 'billNo',
      label: '票据订单号',
      value: '',
      required: true,
      //   disabled: true,
      span: 24,
      className: 'input-md',
      itemHeight: '60px',
    },
    {
      type: 'select',
      name: 'noteType',
      label: '票据类型',
      value: '',
      span: 24,
      required: true,
      className: 'input-md',
      itemHeight: '60px',
      options: [
        // 1.首营/质检报告单  2.发票/出库清单
        {
          label: '首营/质检报告单',
          value: '1',
        },
        {
          label: '发票/出库清单',
          value: '2',
        },
      ],
      on: {
        change(value) {
          //   that.websocketsend('cmd-check')
        },
      },
    },
  ]
  //   billNo 订单号
  // noteType 票据类型
  // stationNo 供包口号
}
