import {
  genWarehouseAuthSearchModal,
  genCargoownerAuthSearchModal,
  genItemSearchModal,
  genItemSearchModalcuring
} from '@/views/kzyWMS/SearchModal'
import qs from 'qs'
import request from '@/utils/request'
import store from '@/store'
import { sorter } from '../../../utils/sort'
import { upcloud_base_strategy, upcloud_base_gsp } from '@/config/serviceSettings'
let dcId = null
let warehouseId = store.state.user.warehouse.warehouseId || null
let bldgId = null
let warehouseRoomId = null
let warehouseAreaId = null
let warehouseLogicId = null
let cargoOwnerId = null
function gettype(parameter) {
  //  批量录入销毁信息 POST
  return request({
    method: 'get',
    url: upcloud_base_strategy + '/registry/by-code',
    params: parameter
  })
}
let a = [
  { label: '待审核', value: '10' },
  { label: '通过', value: '20' },
  { label: '驳回', value: '30' },
  { label: '销毁', value: '40' }
]
let b = [
  { label: '待审核', value: '10' },
  { label: '通过', value: '20' },
  { label: '销毁', value: '40' }
]
const tablecolumns = function(that) {
  return {
    gridform: {
      ref: 'form',
      items: [
        // 仓库
        ...genWarehouseAuthSearchModal(
          1,
          true,
          false,
          null,
          async function(rowData, form) {
            form.setFieldsValue({
              cargoOwnerCode: null,
              cargoOwnerId: null,
              cargoOwnerName: null
            })
            console.log(rowData)
            if (rowData) {
              let items = that.tablecolumns.gridform.items
              let data = {
                regCode: 'WMS_GSP_UNQUALIFIED_CAN_AUDIT_NO',
                warehouseId: rowData[0].companyId
              }
              let res = await gettype(data)
              console.log(res)
              if (res.data) {
                if (res.data.regValue == '1') {
                  items.forEach(item => {
                    if (item.name == 'status') {
                      item.options = a
                    }
                  })
                } else {
                  items.forEach(item => {
                    if (item.name == 'status') {
                      item.options = b
                    }
                  })
                }
              } else {
                items.forEach(item => {
                  if (item.name == 'status') {
                    item.options = b
                  }
                })
              }
            }
          },
          {
            span: 6,
            labelCol: { span: 6 },
            wrapperCol: { span: 14 }
          }
        ),

        ...genCargoownerAuthSearchModal(1, true, false, null, null, {
          span: 6,
          labelCol: { span: 6 },
          wrapperCol: { span: 14 }
        }),
        {
          type: 'radio',
          span: 6,
          name: 'status',
          label: '状态',
          value: '10', //初始化值
          options: [
            { label: '待审核', value: '10' },
            { label: '通过', value: '20' },
            { label: '驳回', value: '30' },
            { label: '销毁', value: '40' }
          ]
        },
        {
          span: 6,
          type: 'buttonGroup',
          style: { textAlign: 'left' },
          options: [
            {
              value: '查询',
              icon: 'search',
              btnType: 'primary',
              style: 'margin-right:10px;margin-left:10px;',
              htmlType: 'submit'
            },
            {
              value: '重置',

              name: 'ccz',
              style: 'margin-right:50px;',
              icon: 'redo',
              on: {
                click(event, form) {
                  form.resetFields()
                }
              }
            }
          ]
        }
      ]
    },

    //主表
    MainTable: {
      edit: false,
      // edit: true,
      title: '明细列表',
      // /strategy/v1/page
      remoteUrl: {
        url: upcloud_base_gsp + '/gspUnqualifiedDestroy/listPage',
        headers: {
          'Content-Type': 'application/JSON'
        },
        method: 'get'
      },
      ref: 'MainTable',
      rowkey: 'id',
      columns: sorter([
        {
          title: '单据编号',
          dataIndex: 'code',
          key: 'code'
        },

        {
          title: '仓库',
          dataIndex: 'warehouseName',
          key: 'warehouseName'
        },
        {
          title: '货主',
          dataIndex: 'cargoOwnerName',
          key: 'cargoOwnerName'
        },
        {
          title: '状态',
          dataIndex: 'status',
          key: 'status',
          scopedSlots: { customRender: 'status' },
          customRender(text) {
            console.log(text, '=====')
            if (text) {
              switch (text) {
                case '10':
                  text = '待审核'
                  break
                case '20':
                  text = '已审批'
                  break
                case '30':
                  text = '已驳回'
                  break
              }
              return text
            } else return
          }
        },
        {
          title: '申请人',
          key: 'creatorName',
          dataIndex: 'creatorName'
        },
        {
          title: '申请时间',
          key: 'gmtCreate',
          dataIndex: 'gmtCreate'
        },
        {
          title: '意见',
          key: 'opinion',
          dataIndex: 'opinion'
        },

        {
          title: '审核时间',
          key: 'auditDate',
          dataIndex: 'auditDate'
        },
        {
          title: '审核意见',
          key: 'auditText',
          dataIndex: 'auditText'
        }

        //   {
        //     title: '操作',
        //     key: 'operation',
        //     scopedSlots: { customRender: 'operation' },
        //     align: 'center'
        //   }
      ])
    },
    //   详情表
    SubTable: {
      title: '销毁品列表',
      remoteUrl: {
        url: upcloud_base_gsp + '/gspUnqualifiedDestroy/findDetailByMstId',
        headers: {
          'Content-Type': 'application/JSON'
        },
        method: 'get'
      },
      ref: 'rule',
      rowkey: 'id',
      columns: sorter([
        {
          title: '商品编码',
          key: 'itemCode',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemCode'
        },
        {
          title: '商品名称',
          key: 'itemName',
          width: 150,
          ellipsis: true,
          dataIndex: 'itemName'
        },
        {
          title: '商品大类',
          key: 'itemHealthCategory',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthCategory'
        },
        {
          title: '商品规格',
          key: 'specification',
          ellipsis: true,
          width: 150,
          dataIndex: 'specification'
        },
        {
          title: '生产厂家',
          key: 'manufacturerName',
          width: 150,
          ellipsis: true,
          dataIndex: 'manufacturerName'
        },
        {
          title: '产地',
          key: 'countryOriginName',
          ellipsis: true,
          width: 150,
          dataIndex: 'countryOriginName'
        },
        {
          title: '包装数量',
          key: 'caseConversionRate',
          width: 150,
          ellipsis: true,
          dataIndex: 'caseConversionRate'
        },
        {
          title: '包装单位',
          key: 'caseUom',
          width: 150,
          ellipsis: true,
          dataIndex: 'caseUom'
        },
        {
          title: '是否追溯',
          key: 'itemHealthSuperviseflag',
          width: 150,
          ellipsis: true,
          dataIndex: 'itemHealthSuperviseflag',
          customRender(text, record, index) {
            text ? (text = '是') : (text = '否')
            return text
          }
        },
        {
          title: '货位',
          key: 'locatorCode',
          width: 150,
          ellipsis: true,
          dataIndex: 'locatorCode'
        },
        {
          title: '报损数量',
          key: 'lossQty',
          width: 100,
          ellipsis: true,
          dataIndex: 'lossQty'
          //   scopedSlots: { customRender: 'number' }
        },
        {
          title: '销毁数量',
          key: 'destroyingQty',
          dataIndex: 'destroyingQty',
          //   scopedSlots: { customRender: 'destroyedQty' },
          width: 100
        },
        {
          title: '数量',
          key: 'destroyQty',
          dataIndex: 'destroyQty',
          scopedSlots: { customRender: 'destroyQty' },
          width: 100
        },
        {
          title: '批号',
          key: 'lotNum',
          ellipsis: true,
          width: 150,
          dataIndex: 'lotNum'
        },
        {
          title: '生产日期',
          key: 'batchProductionDateShow',
          ellipsis: true,
          width: 150,
          dataIndex: 'batchProductionDateShow'
        },
        {
          title: '有效期至',
          key: 'batchExpiredDateShow',
          ellipsis: true,
          width: 150,
          dataIndex: 'batchExpiredDateShow'
        },
        {
          title: '所在部门意见',
          key: 'opinion',
          ellipsis: true,
          width: 150,
          dataIndex: 'opinion',
          scopedSlots: { customRender: 'opinion' }
        },

        {
          title: '批准文号',
          key: 'itemHealthApprovalNbr',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthApprovalNbr'
        },
        {
          title: '上市许可持有人',
          key: 'itemHealthListedLicensor',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthListedLicensor'
        },

        {
          title: '注册证号',
          key: 'itemHealthRegisterNbr',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthRegisterNbr'
        },

        {
          title: '日期',
          dataIndex: 'refBillDate',
          hidden: true,
          ellipsis: true,
          key: 'refBillDate'
        },
        {
          title: '原单据编号',
          dataIndex: 'refBillId',
          hidden: true,
          ellipsis: true,
          key: 'refBillId'
        },
        {
          title: '不合格品来源',
          dataIndex: 'refBillType',
          hidden: true,
          ellipsis: true,
          key: 'refBillType',
          width: 100,
          customRender(text, record, index) {
            text == 1 ? ((text = '入库') ? text == 2 : (text = '移库')) : ''
            return text
          }
        },
        {
          title: '不合格原因',
          dataIndex: 'unqualifiedReason',
          hidden: true,
          ellipsis: true,
          key: 'unqualifiedReason'
        },
        {
          title: '不合格数量',
          dataIndex: 'unqualifiedQty',
          key: 'unqualifiedQty',
          hidden: true
        },
        // {
        //   title: '报损数量',
        //   key: 'lossQty',
        //   dataIndex: 'lossQty',
        //   //   scopedSlots: { customRender: 'lossQty' },
        //   width: 100
        // },

        {
          title: '助记码',
          key: 'itemAssistantCode',
          ellipsis: true,
          dataIndex: 'itemAssistantCode'
        },

        {
          title: '报损单号',
          key: 'lossCode',
          ellipsis: true,
          dataIndex: 'lossCode'
        },
        // 报损单号
        {
          title: '货位ID',
          key: 'locatorId',
          hidden: true,
          ellipsis: true,
          dataIndex: 'locatorId'
        }

        //   {
        //     title: '操作',
        //     key: 'operation',
        //     align: 'center',
        //     scopedSlots: { customRender: 'operation' }
        //   }
      ])
    },
    modalItems: {
      rowkey: 'id',
      remoteUrl: {
        url: upcloud_base_gsp + '/gspUnqualifiedDestroy/listPagePick	',
        method: 'get'
      },
      doneBefore(res) {
        let list = res.data.list
        list.forEach(item => {
          if (item.lossQty) {
            item.lossQty1 = item.lossQty
          }
        })
        console.log(res.data.list)
        return res
      },
      title: '提取商品',
      gridformref: 'form',
      ref: 'modelFormType',
      items: [
        // 仓库

        ...genWarehouseAuthSearchModal(
          1,
          true,
          false,
          null,
          function(rowData, form) {
            form.setFieldsValue({
              cargoOwnerCode: null,
              cargoOwnerId: null,
              cargoOwnerName: null
            })
            console.log(rowData)
            if (rowData == null) {
              warehouseId = null
            } else {
              warehouseId = rowData[0].companyId
            }
          },
          {
            span: 6,
            labelCol: { span: 6 },
            wrapperCol: { span: 14 }
          }
        ),
        ...genCargoownerAuthSearchModal(
          1,
          true,
          false,
          null,
          function(rowData, form) {
            console.log(rowData)
            if (rowData == null) {
              cargoOwnerId = null
            } else {
              cargoOwnerId = rowData[0].companyId
            }
          },
          {
            span: 6,
            labelCol: { span: 6 },
            wrapperCol: { span: 14 }
          }
        ),
        // 上级单据类型
        {
          type: 'radio',
          span: 12,
          required: true,
          name: 'billType',
          label: '上级单据类型',
          value: 0, //初始化值
          options: [
            { label: '不合格品报损单', value: 0 },
            { label: '入库拒收单', value: 1 },
            { label: '采购退出单', value: 2 }
          ]
        }

        // {
        //   type: 'input',
        //   span: 6,
        //   name: 'lossCode',
        //   label: '报损单号',
        //   value: '', //初始化值
        // },

        // ...genItemSearchModalcuring(
        //   1,
        //   false,
        //   false,
        //   function(res, p) {
        //     p.data.cargoOwnerId = cargoOwnerId
        //     p.data.warehouseId = warehouseId
        //     console.log(p, '====')
        //     return p
        //   },
        //   null,
        //   { span: 6, labelCol: { span: 6 }, wrapperCol: { span: 14 } }
        // ),
        // {
        //   span: 24,
        //   type: 'buttonGroup',
        //   style: { textAlign: 'right' },
        //   options: [
        //     {
        //       value: '查询',
        //       icon: 'search',
        //       btnType: 'primary',
        //       style: 'margin-right:10px;margin-left:10px;',
        //       htmlType: 'submit'
        //     },
        //     {
        //       value: '重置',

        //       name: 'ccz',
        //       style: 'margin-right:50px;',
        //       icon: 'redo',
        //       on: {
        //         click(event, form) {
        //           form.resetFields()
        //         }
        //       }
        //     }
        //   ]
        // }
      ],
      columns: sorter([
        {
          title: '仓库',
          key: 'warehouseName',
          ellipsis: true,
          width: 150,
          dataIndex: 'warehouseName'
        },
        {
          title: '货主',
          key: 'cargoOwnerName',
          ellipsis: true,
          width: 150,
          dataIndex: 'cargoOwnerName'
        },
        {
          title: '上级单据编号',
          key: 'refBillType',
          ellipsis: true,
          width: 150,
          dataIndex: 'refBillType',
          customRender(text, record, index) {
            text == 0 && (text = '不合格品报损单')
            text == 1 && (text = '入库拒收单')
            text == 2 && (text = '采购退出单')
            return text
          }
        },
        {
          title: '商品编码',
          key: 'itemCode',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemCode'
        },
        {
          title: '商品名称',
          key: 'itemName',
          width: 150,
          ellipsis: true,
          dataIndex: 'itemName'
        },
        {
          title: '商品大类',
          key: 'itemHealthCategory',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthCategory'
        },
        {
          title: '商品规格',
          key: 'specification',
          ellipsis: true,
          width: 150,
          dataIndex: 'specification'
        },
        {
          title: '生产厂家',
          key: 'manufacturerName',
          width: 150,
          ellipsis: true,
          dataIndex: 'manufacturerName'
        },
        {
          title: '产地',
          key: 'countryOriginName',
          ellipsis: true,
          width: 150,
          dataIndex: 'countryOriginName'
        },
        {
          title: '包装数量',
          key: 'caseConversionRate',
          width: 150,
          ellipsis: true,
          dataIndex: 'caseConversionRate'
        },
        {
          title: '包装单位',
          key: 'caseUom',
          width: 150,
          ellipsis: true,
          dataIndex: 'caseUom'
        },
        {
          title: '是否追溯',
          key: 'itemHealthSuperviseflag',
          width: 150,
          ellipsis: true,
          dataIndex: 'itemHealthSuperviseflag',
          customRender(text, record, index) {
            text ? (text = '是') : (text = '否')
            return text
          }
        },
        {
          title: '货位',
          key: 'locatorCode',
          width: 150,
          ellipsis: true,
          dataIndex: 'locatorCode'
        },
        {
          title: '报损数量',
          key: 'lossQty',
          width: 100,
          ellipsis: true,
          dataIndex: 'lossQty'
          //   scopedSlots: { customRender: 'number' }
        },
        {
          title: '销毁数量',
          key: 'destroyingQty',
          dataIndex: 'destroyingQty',
          //   scopedSlots: { customRender: 'destroyedQty' },
          width: 100
        },
        {
          title: '数量',
          key: 'destroyQty',
          dataIndex: 'destroyQty',
          scopedSlots: { customRender: 'destroyQty' },
          width: 100
        },
        {
          title: '批号',
          key: 'lotNum',
          ellipsis: true,
          width: 150,
          dataIndex: 'lotNum'
        },
        {
          title: '生产日期',
          key: 'batchProductionDateShow',
          ellipsis: true,
          width: 150,
          dataIndex: 'batchProductionDateShow'
        },
        {
          title: '有效期至',
          key: 'batchExpiredDateShow',
          ellipsis: true,
          width: 150,
          dataIndex: 'batchExpiredDateShow'
        },
        {
          title: '所在部门意见',
          key: 'opinion',
          ellipsis: true,
          width: 150,
          dataIndex: 'opinion',
          scopedSlots: { customRender: 'opinion' }
        },

        {
          title: '批准文号',
          key: 'itemHealthApprovalNbr',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthApprovalNbr'
        },
        {
          title: '上市许可持有人',
          key: 'itemHealthListedLicensor',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthListedLicensor'
        },

        {
          title: '注册证号',
          key: 'itemHealthRegisterNbr',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthRegisterNbr'
        },

        {
          title: '日期',
          dataIndex: 'refBillDate',
          hidden: true,
          ellipsis: true,
          key: 'refBillDate'
        },
        {
          title: '原单据编号',
          dataIndex: 'refBillId',
          hidden: true,
          ellipsis: true,
          key: 'refBillId'
        },
        {
          title: '不合格品来源',
          dataIndex: 'refBillType',
          hidden: true,
          ellipsis: true,
          key: 'refBillType',
          width: 100,
          customRender(text, record, index) {
            text == 1 ? ((text = '入库') ? text == 2 : (text = '移库')) : ''
            return text
          }
        },
        {
          title: '不合格原因',
          dataIndex: 'unqualifiedReason',
          hidden: true,
          ellipsis: true,
          key: 'unqualifiedReason'
        },
        {
          title: '不合格数量',
          dataIndex: 'unqualifiedQty',
          key: 'unqualifiedQty',
          hidden: true
        },
        // {
        //   title: '报损数量',
        //   key: 'lossQty',
        //   dataIndex: 'lossQty',
        //   //   scopedSlots: { customRender: 'lossQty' },
        //   width: 100
        // },

        {
          title: '助记码',
          key: 'itemAssistantCode',
          ellipsis: true,
          dataIndex: 'itemAssistantCode'
        },

        {
          title: '报损单号',
          key: 'lossCode',
          ellipsis: true,
          dataIndex: 'lossCode'
        },
        // 报损单号
        {
          title: '货位ID',
          key: 'locatorId',
          hidden: true,
          ellipsis: true,
          dataIndex: 'locatorId'
        }
      ]),
      ModalItemsOpinion: {
        ref: 'Opinion',
        items: [
          {
            type: 'input',
            span: 6,
            name: 'destroyReason',
            label: '销毁原因',
            value: '' //初始化值
          },
          {
            type: 'input',
            span: 6,
            name: 'destroySite',
            label: '销毁地点',
            value: '' //初始化值
          },
          {
            type: 'input',
            span: 6,
            name: 'destroyMode',
            label: '销毁方式',
            value: '' //初始化值
          },
          {
            type: 'input',
            span: 6,
            name: 'transportor',
            label: '运输人员',
            value: '' //初始化值
          }
        ]
      }
    },
    recover: {
      rowkey: 'id',
      remoteUrl: {
        url: upcloud_base_gsp + '/gspUnqualifiedDestroy/listPagePick',
        method: 'get'
      },
      doneBefore(res) {
        let list = res.data.list
        list.forEach(item => {
          if (item.lossQty) {
            item.lossQty1 = item.lossQty
          }
        })
        console.log(res.data.list)
        return res
      },
      title: '提取商品',
      gridformref: 'form',
      ref: 'modelFormType',
      items: [
        // 仓库

        ...genWarehouseAuthSearchModal(
          1,
          true,
          false,
          null,
          function(rowData, form) {
            form.setFieldsValue({
              cargoOwnerCode: null,
              cargoOwnerId: null,
              cargoOwnerName: null
            })
            console.log(rowData)
            if (rowData == null) {
              warehouseId = null
            } else {
              warehouseId = rowData[0].companyId
            }
          },
          {
            span: 6,
            labelCol: { span: 6 },
            wrapperCol: { span: 14 }
          }
        ),
        ...genCargoownerAuthSearchModal(
          1,
          true,
          false,
          null,
          function(rowData, form) {
            console.log(rowData)
            if (rowData == null) {
              cargoOwnerId = null
            } else {
              cargoOwnerId = rowData[0].companyId
            }
          },
          {
            span: 6,
            labelCol: { span: 6 },
            wrapperCol: { span: 14 }
          }
        ),
        // {
        //   type: 'input',
        //   span: 6,
        //   name: 'lossCode',
        //   label: '报损单号',
        //   value: '', //初始化值
        // },
        {
          type: 'radio',
          span: 12,
          required: true,
          name: 'billType',
          label: '上级单据类型',
          value: 0, //初始化值
          options: [
            { label: '不合格品报损单', value: 0 },
            { label: '入库拒收单', value: 1 },
            { label: '采购退出单', value: 2 }
          ]
        },

        {
          type: 'input',
          span: 6,
          labelCol: { span: 6 },
          wrapperCol: { span: 14 },
          name: 'lossCode',
          label: '报损单号',
          value: '' //初始化值
        },

        ...genItemSearchModalcuring(
          1,
          false,
          false,
          function(res, p) {
            p.data.cargoOwnerId = cargoOwnerId
            p.data.warehouseId = warehouseId
            console.log(p, '====')
            return p
          },
          null,
          { span: 6, labelCol: { span: 6 }, wrapperCol: { span: 14 } }
        ),

        {
          span: 6,
          type: 'buttonGroup',
          style: { textAlign: 'right' },
          options: [
            {
              value: '查询',
              icon: 'search',
              btnType: 'primary',
              style: 'margin-right:10px;margin-left:10px;',
              htmlType: 'submit'
            },
            {
              value: '重置',

              name: 'ccz',
              style: 'margin-right:50px;',
              icon: 'redo',
              on: {
                click(event, form) {
                  form.resetFields()
                }
              }
            }
          ]
        }
      ],
      columns: sorter([
        {
          title: '商品编码',
          key: 'itemCode',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemCode'
        },
        {
          title: '商品名称',
          key: 'itemName',
          width: 150,
          ellipsis: true,
          dataIndex: 'itemName'
        },
        {
          title: '商品大类',
          key: 'itemHealthCategory',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthCategory'
        },
        {
          title: '商品规格',
          key: 'specification',
          ellipsis: true,
          width: 150,
          dataIndex: 'specification'
        },
        {
          title: '生产厂家',
          key: 'manufacturerName',
          width: 150,
          ellipsis: true,
          dataIndex: 'manufacturerName'
        },
        {
          title: '产地',
          key: 'countryOriginName',
          ellipsis: true,
          width: 150,
          dataIndex: 'countryOriginName'
        },
        {
          title: '包装数量',
          key: 'caseConversionRate',
          width: 150,
          ellipsis: true,
          dataIndex: 'caseConversionRate'
        },
        {
          title: '包装单位',
          key: 'caseUom',
          width: 150,
          ellipsis: true,
          dataIndex: 'caseUom'
        },
        {
          title: '是否追溯',
          key: 'itemHealthSuperviseflag',
          width: 150,
          ellipsis: true,
          dataIndex: 'itemHealthSuperviseflag',
          customRender(text, record, index) {
            text ? (text = '是') : (text = '否')
            return text
          }
        },
        {
          title: '货位',
          key: 'locatorCode',
          width: 150,
          ellipsis: true,
          dataIndex: 'locatorCode'
        },
        {
          title: '报损数量',
          key: 'lossQty',
          width: 100,
          ellipsis: true,
          dataIndex: 'lossQty'
          //   scopedSlots: { customRender: 'number' }
        },
        {
          title: '销毁数量',
          key: 'destroyingQty',
          dataIndex: 'destroyingQty',
          //   scopedSlots: { customRender: 'destroyedQty' },
          width: 100
        },
        {
          title: '数量',
          key: 'destroyQty',
          dataIndex: 'destroyQty',
          //   scopedSlots: { customRender: 'destroyQty' },
          width: 100
        },
        {
          title: '批号',
          key: 'lotNum',
          ellipsis: true,
          width: 150,
          dataIndex: 'lotNum'
        },
        {
          title: '生产日期',
          key: 'batchProductionDateShow',
          ellipsis: true,
          width: 150,
          dataIndex: 'batchProductionDateShow'
        },
        {
          title: '有效期至',
          key: 'batchExpiredDateShow',
          ellipsis: true,
          width: 150,
          dataIndex: 'batchExpiredDateShow'
        },
        {
          title: '所在部门意见',
          key: 'opinion',
          ellipsis: true,
          width: 150,
          dataIndex: 'opinion',
          scopedSlots: { customRender: 'opinion' }
        },

        {
          title: '批准文号',
          key: 'itemHealthApprovalNbr',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthApprovalNbr'
        },
        {
          title: '上市许可持有人',
          key: 'itemHealthListedLicensor',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthListedLicensor'
        },

        {
          title: '注册证号',
          key: 'itemHealthRegisterNbr',
          ellipsis: true,
          width: 150,
          dataIndex: 'itemHealthRegisterNbr'
        },

        {
          title: '日期',
          dataIndex: 'refBillDate',
          hidden: true,
          ellipsis: true,
          key: 'refBillDate'
        },
        {
          title: '原单据编号',
          dataIndex: 'refBillId',
          hidden: true,
          ellipsis: true,
          key: 'refBillId'
        },
        {
          title: '不合格品来源',
          dataIndex: 'refBillType',
          hidden: true,
          ellipsis: true,
          key: 'refBillType',
          width: 100,
          customRender(text, record, index) {
            text == 1 ? ((text = '入库') ? text == 2 : (text = '移库')) : ''
            return text
          }
        },
        {
          title: '不合格原因',
          dataIndex: 'unqualifiedReason',
          hidden: true,
          ellipsis: true,
          key: 'unqualifiedReason'
        },
        {
          title: '不合格数量',
          dataIndex: 'unqualifiedQty',
          key: 'unqualifiedQty',
          hidden: true
        },
        // {
        //   title: '报损数量',
        //   key: 'lossQty',
        //   dataIndex: 'lossQty',
        //   //   scopedSlots: { customRender: 'lossQty' },
        //   width: 100
        // },

        {
          title: '助记码',
          key: 'itemAssistantCode',
          ellipsis: true,
          dataIndex: 'itemAssistantCode'
        },

        {
          title: '报损单号',
          key: 'lossCode',
          ellipsis: true,
          dataIndex: 'lossCode'
        },
        // 报损单号
        {
          title: '货位ID',
          key: 'locatorId',
          hidden: true,
          ellipsis: true,
          dataIndex: 'locatorId'
        }
      ]),
      ModalItemsOpinion: {
        ref: 'Opinion',
        items: [
          {
            type: 'input',
            span: 6,
            name: 'destroyReason',
            label: '销毁原因',
            value: '' //初始化值
          },
          {
            type: 'input',
            span: 6,
            name: 'destroySite',
            label: '销毁地点',
            value: '' //初始化值
          },
          {
            type: 'input',
            span: 6,
            name: 'destroyMode',
            label: '销毁方式',
            value: '' //初始化值
          },
          {
            type: 'input',
            span: 6,
            name: 'transportor',
            label: '运输人员',
            value: '' //初始化值
          }
        ]
      }
    }
  }
}

export default tablecolumns
