import { genWarehouseAuthSearchModal, genCargoownerAuthSearchModal } from "@/views/kzyWMS/SearchModal";
import qs from "qs";
import store from "@/store";
import request from "@/utils/request";
import { sorter } from "@/views/kzyWMS/utils/sort";
import { changecargoOwnerfun } from "@/views/kzyWMS/utils/setCargoOwner";
import {
  SERVICE_DATA_API_BASE,
  upcloud_base_strategy,
  upcloud_base_gsp,
  upcloud_base_inventory,
} from "@/config/serviceSettings";
let warehouseId = store.getters.warehouse.warehouseId; //仓库id;
let srcWarehouseCategory = null; // 源库别编码
let quantityMode = null;
let warehouseAreaCategory = null;
let rows = 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" },
];
let b = [
  { label: "待审核", value: "10" },
  { label: "通过", value: "20" },
];
const tablecolumns = function (that) {
  return {
    gridform: {
      ref: "form",
      items: [
        //genWarehouseAuthSearchModal 仓库

        ...genWarehouseAuthSearchModal(1, true, false, null, changecargoOwnerfun, {
          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" },
          ],
          on: {
            change(event, form) {
              let columns = that.tablecolumns.MainTable.columns;
              if (event.target.value == "10") {
                that.chektype = true;
                columns.forEach((item) => {
                  if (item.key == "auditDate") {
                    item.hidden = true;
                  }
                  if (item.key == "auditText") {
                    item.scopedSlots = { customRender: "auditText1" };
                  }
                });
                that.$refs.maintable.clearMainTabledata();
              } else {
                columns.forEach((item) => {
                  if (item.key == "auditText" || item.key == "auditDate") {
                    item.hidden = false;
                    delete item.scopedSlots;
                    console.log(item);
                  }
                });
                that.chektype = false;
                that.$refs.maintable.clearMainTabledata();
              }
            },
          },
        },
        {
          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",
              icon: "redo",
              on: {
                click(event, form) {
                  form.resetFields();
                },
              },
            },
          ],
        },
      ],
    },

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

        {
          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",
          hidden: true,
          dataIndex: "opinion",
        },

        {
          title: "审核时间",
          hidden: true,
          key: "auditDate",
          dataIndex: "auditDate",
        },
        {
          title: "审核意见",
          key: "auditText",
          dataIndex: "auditText",
          width: 100,
          scopedSlots: { customRender: "auditText1" },
        },

        //   {
        //     title: '操作',
        //     key: 'operation',
        //     scopedSlots: { customRender: 'operation' },
        //     align: 'center'
        //   }
      ]),
    },
    //   详情表
    SubTable: {
      title: "明细列表",
      remoteUrl: {
        url: upcloud_base_gsp + "/gspUnqualifiedLoss/findDetailByMstId	",
        headers: {
          "Content-Type": "application/JSON",
        },
        method: "get",
      },
      ref: "rule",
      rowkey: "id",
      columns: sorter([
        {
          title: "商品编码",
          key: "itemCode",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemCode",
        },
        {
          title: "商品名称",
          key: "itemName",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemName",
        },
        {
          title: "商品大类",
          key: "itemHealthCategory",
          type: "txt",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthCategory",
        },
        {
          title: "商品规格",
          key: "specification",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "specification",
        },
        {
          title: "生产厂家",
          key: "manufacturerName",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "manufacturerName",
        },
        {
          title: "产地",
          key: "countryOriginName",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "countryOriginName",
        },
        {
          title: "包装数量",
          key: "caseConversionRate",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "caseConversionRate",
        },
        {
          title: "包装单位",
          key: "caseUom",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "caseUom",
        },
        {
          title: "是否追溯",
          key: "itemHealthSuperviseflag",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemHealthSuperviseflag",
          customRender(text, record, index) {
            text ? (text = "是") : (text = "否");
            return text;
          },
        },

        {
          title: "库别",
          key: "warehouseAreaCategoryName",
          width: 150,
          ellipsis: true,
          dataIndex: "warehouseAreaCategoryName",
        },
        {
          title: "库区",
          key: "warehouseAreaName",
          width: 150,
          ellipsis: true,
          dataIndex: "warehouseAreaName",
        },
        {
          title: "货位",
          key: "locatorCode",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "locatorCode",
        },
        {
          title: "货位ID",
          key: "locatorId",
          type: "txt",
          ellipsis: true,
          hidden: true,
          dataIndex: "locatorId",
        },
        {
          title: "报损数量",
          key: "lossQty",
          type: "txt",
          dataIndex: "lossQty",
          width: 100,
          scopedSlots: { customRender: "number" },
        },
        {
          title: "部门意见",
          width: 150,
          key: "opinion",
          type: "txt",
          ellipsis: true,
          dataIndex: "opinion",
        },
        {
          title: "批准文号",
          key: "itemHealthApprovalNbr",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthApprovalNbr",
        },
        {
          title: "上市许可持有人",
          key: "itemHealthListedLicensor",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthListedLicensor",
        },
        {
          title: "注册证号",
          key: "itemHealthRegisterNbr",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthRegisterNbr",
        },
        {
          title: "日期",
          dataIndex: "refBillDate",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "refBillDate",
        },
        {
          title: "原单据编号",
          dataIndex: "refBillId",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "refBillId",
        },
        {
          title: "不合格品来源",
          dataIndex: "refBillType",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "refBillType",
          width: 100,
          customRender(text, record, index) {
            text == 1 ? ((text = "入库") ? text == 2 : (text = "移库")) : (text = "暂无");
            return text;
          },
        },
        {
          title: "不合格原因",
          dataIndex: "unqualifiedReason",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "unqualifiedReason",
        },
        {
          title: "不合格数量",
          dataIndex: "unqualifiedQty",
          type: "txt",
          key: "unqualifiedQty",
          hidden: true,
        },

        {
          title: "助记码",
          key: "itemAssistantCode",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemAssistantCode",
        },

        {
          title: "批号",
          key: "lotNum",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "lotNum",
        },

        //   {
        //     title: '操作',
        //     key: 'operation',
        //     align: 'center',
        //     scopedSlots: { customRender: 'operation' }
        //   }
      ]),
      WMScolumns: sorter([
        {
          title: "商品编码",
          key: "itemCode",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemCode",
        },
        {
          title: "商品名称",
          key: "itemName",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemName",
        },
        {
          title: "商品大类",
          key: "itemHealthCategory",
          type: "txt",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthCategory",
        },
        {
          title: "商品规格",
          key: "specification",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "specification",
        },
        {
          title: "生产厂家",
          key: "manufacturerName",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "manufacturerName",
        },
        {
          title: "产地",
          key: "countryOriginName",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "countryOriginName",
        },
        {
          title: "包装数量",
          key: "caseConversionRate",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "caseConversionRate",
        },
        {
          title: "包装单位",
          key: "caseUom",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "caseUom",
        },
        {
          title: "是否追溯",
          key: "itemHealthSuperviseflag",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemHealthSuperviseflag",
          customRender(text, record, index) {
            text ? (text = "是") : (text = "否");
            return text;
          },
        },
        {
          title: "货位",
          key: "locatorCode",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "locatorCode",
        },
        {
          title: "库别",
          key: "warehouseAreaCategoryName",
          width: 150,
          type: "txt",
          ellipsis: true,
          dataIndex: "warehouseAreaCategoryName",
        },
        {
          title: "库区",
          key: "warehouseAreaName",
          width: 150,
          type: "txt",
          ellipsis: true,
          dataIndex: "warehouseAreaName",
        },
        {
          title: "货位ID",
          key: "locatorId",
          type: "txt",
          ellipsis: true,
          hidden: true,
          dataIndex: "locatorId",
        },
        {
          title: "报损数量",
          key: "lossQty",
          type: "txt",
          dataIndex: "lossQty",
          width: 100,
          scopedSlots: { customRender: "number" },
        },
        {
          title: "部门意见",
          width: 150,
          key: "opinion",
          type: "txt",
          ellipsis: true,
          dataIndex: "opinion",
        },
        {
          title: "批准文号",
          key: "itemHealthApprovalNbr",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthApprovalNbr",
        },
        {
          title: "上市许可持有人",
          key: "itemHealthListedLicensor",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthListedLicensor",
        },
        {
          title: "注册证号",
          key: "itemHealthRegisterNbr",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthRegisterNbr",
        },
        {
          title: "日期",
          dataIndex: "refBillDate",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "refBillDate",
        },
        {
          title: "原单据编号",
          dataIndex: "refBillId",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "refBillId",
        },
        {
          title: "不合格品来源",
          dataIndex: "refBillType",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "refBillType",
          width: 100,
          customRender(text, record, index) {
            text == 1 ? ((text = "入库") ? text == 2 : (text = "移库")) : (text = "暂无");
            return text;
          },
        },
        {
          title: "不合格原因",
          dataIndex: "unqualifiedReason",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "unqualifiedReason",
        },
        {
          title: "不合格数量",
          dataIndex: "unqualifiedQty",
          type: "txt",
          key: "unqualifiedQty",
          hidden: true,
        },

        {
          title: "助记码",
          key: "itemAssistantCode",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemAssistantCode",
        },

        {
          title: "批号",
          key: "lotNum",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "lotNum",
        },

        //   {
        //     title: '操作',
        //     key: 'operation',
        //     align: 'center',
        //     scopedSlots: { customRender: 'operation' }
        //   }
      ]),
      OMScolumns: sorter([
        {
          title: "商品编码",
          key: "itemCode",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemCode",
        },
        {
          title: "商品名称",
          key: "itemName",
          width: 150,
          type: "txt",
          ellipsis: true,
          dataIndex: "itemName",
        },
        // {
        //   title: '货位',
        //   key: 'locatorCode',
        //   width: 150,
        //   ellipsis: true,
        //   dataIndex: 'locatorCode'
        // },
        {
          title: "货位",
          type: "searchModal",
          width: 150,
          required: true,
          dataIndex: "locatorCode",
          targetClick: true,
          destroyOnClose: true,
          targetValueKey: "locatorCode",
          remoteUrl: { url: upcloud_base_inventory + "/stock/v1/qty/avl", method: "get" },
          toolBar: {
            items: [
              { type: "input", name: "locatorName", label: "货位名称", value: "" },
              { type: "input", name: "locatorCode", label: "货位编码", value: "" },
            ],
          },
          //   modalOpenChange: open => {
          //     let bool = false
          //     that.$refs.search.form.validateFields((err, values) => {
          //       if (err) {
          //         that.$message.warn('请选择货主！')
          //         bool = false
          //       } else {
          //         bool = true
          //       }
          //     })
          //     return bool
          //   },
          tableConfig: {
            rowKey: "id",
            // remoteParams:remoteParams,
            remoteBefore: (vn, p) => {
              console.log("当前行数据：", rows);
              p.params.warehouseId = rows.warehouseId;
              p.params.cargoOwnerId = rows.cargoOwnerId;
              p.params.itemId = rows.itemId;
              p.params.outStockStatus = 2;
              p.params.manufacturerLotNum = rows.manufacturerLotNum; //生产商批号
              return p;
            },
            columns: [
              { dataIndex: "locatorName", title: "货位名称" },
              { dataIndex: "locatorCode", title: "货位编码" },
              { dataIndex: "quantity", title: "数量" },
              { dataIndex: "availableQuantity", title: "可用数量" },
              { dataIndex: "batchNum", title: "批号", ellipsis: true },
              { dataIndex: "warehouseAreaName", title: "库区名称", ellipsis: true },
              { dataIndex: "warehouseAreaCategoryName", title: "库别名称", ellipsis: true },
              { dataIndex: "warehouseAreaCategory", title: "库别" },
            ],
          },
          on: {
            search: (val1, val2, val3, val4, val5, val6, val7, val8, val9) => {
              console.log(arguments, val1, val2, val3, val4, val5, val6, val7, val8, val9);
              rows = val5; //当前行数据
            },
            change: ({ event, name, value, modalRowData, record, index }) => {
              console.log("货位行数据", event, name, value, modalRowData, record, index);
              record.locatorId = modalRowData[0].locatorId;
              //   console.log(record.locatorId)
              //   record.warehouseAreaCategoryName = modalRowData[0].warehouseAreaCategoryName
              //   // record.batchNum = modalRowData[0].batchNum ;  //批号
              //   // record.availableQuantity = modalRowData[0].availableQuantity ;  //可用库存数量
              //   // record.quantity = modalRowData[0].quantity ;  //数量
              //   record.batchProductionDate = modalRowData[0].batchProductionDate //生产日期
              //   record.batchExpiredDate = modalRowData[0].batchExpiredDate //有效期至
              //   record.batchProductionDateShow = modalRowData[0].batchProductionDateShow //显示生产日期
              //   record.batchExpiredDateShow = modalRowData[0].batchExpiredDateShow //显示有效期至
              //   // warehouseAreaId =modalRowData[0].warehouseAreaId;	//源库区id
              //   // locatorId = modalRowData[0].locatorId;		//货位ID
              //   srcWarehouseCategory = modalRowData[0].warehouseAreaCategory //源库别编码

              //   //最新保存接口需字段
              //   record.batchId = modalRowData[0].batchId //批次ID
              //   record.outContainerCode = modalRowData[0].containerCode //移出容器ID
              //   record.outGoodsCaseCode = modalRowData[0].locatorCode //移出货格
              //   record.outLocatorId = modalRowData[0].locatorId //移出货格
              //   record.warehouseWorkerId = store.getters.userInfo.userId //当前操作员

              //   // 清除后面重选
              //   // record.destWarehouseAreaName="";	// 4、目的库区
              //   // record.warehouseLocatorName="";	// 5、目的货位
              //   // 			toWhLocatorId = ""; //5、目的货位
            },
          },
        },
        {
          title: "货位ID",
          key: "locatorId",
          type: "txt",
          ellipsis: true,
          hidden: true,
          dataIndex: "locatorId",
        },
        {
          title: "报损数量",
          key: "lossQty",
          dataIndex: "lossQty",
          width: 100,
          type: "number",
        },
        {
          title: "商品大类",
          key: "itemHealthCategory",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthCategory",
        },
        {
          title: "库别",
          key: "warehouseAreaCategoryName",
          width: 150,
          type: "txt",
          ellipsis: true,
          dataIndex: "warehouseAreaCategoryName",
        },
        {
          title: "库区",
          key: "warehouseAreaName",
          width: 150,
          type: "txt",
          ellipsis: true,
          dataIndex: "warehouseAreaName",
        },
        {
          title: "商品规格",
          key: "specification",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "specification",
        },
        {
          title: "生产厂家",
          key: "manufacturerName",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "manufacturerName",
        },
        {
          title: "产地",
          key: "countryOriginName",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "countryOriginName",
        },
        {
          title: "包装数量",
          key: "caseConversionRate",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "caseConversionRate",
        },
        {
          title: "包装单位",
          key: "caseUom",
          width: 150,
          type: "txt",
          ellipsis: true,
          dataIndex: "caseUom",
        },
        {
          title: "是否追溯",
          key: "itemHealthSuperviseflag",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemHealthSuperviseflag",
          customRender(text, record, index) {
            text ? (text = "是") : (text = "否");
            return text;
          },
        },

        {
          title: "部门意见",
          width: 150,
          type: "txt",
          key: "opinion",
          ellipsis: true,
          dataIndex: "opinion",
        },
        {
          title: "批准文号",
          key: "itemHealthApprovalNbr",
          ellipsis: true,
          type: "txt",
          width: 150,
          dataIndex: "itemHealthApprovalNbr",
        },
        {
          title: "上市许可持有人",
          key: "itemHealthListedLicensor",
          type: "txt",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthListedLicensor",
        },
        {
          title: "注册证号",
          key: "itemHealthRegisterNbr",
          ellipsis: true,
          type: "txt",
          width: 150,
          dataIndex: "itemHealthRegisterNbr",
        },
        {
          title: "日期",
          dataIndex: "refBillDate",
          hidden: true,
          ellipsis: true,
          type: "txt",
          key: "refBillDate",
        },
        {
          title: "原单据编号",
          dataIndex: "refBillId",
          type: "txt",
          hidden: true,
          ellipsis: true,
          key: "refBillId",
        },
        {
          title: "不合格品来源",
          dataIndex: "refBillType",
          hidden: true,
          type: "txt",
          ellipsis: true,
          key: "refBillType",
          width: 100,
          customRender(text, record, index) {
            text == 1 ? ((text = "入库") ? text == 2 : (text = "移库")) : (text = "暂无");
            return text;
          },
        },
        {
          title: "不合格原因",
          dataIndex: "unqualifiedReason",
          hidden: true,
          ellipsis: true,
          type: "txt",
          key: "unqualifiedReason",
        },
        {
          title: "不合格数量",
          type: "txt",
          dataIndex: "unqualifiedQty",
          key: "unqualifiedQty",
          hidden: true,
        },
        {
          title: "助记码",
          key: "itemAssistantCode",
          type: "txt",
          width: 150,
          ellipsis: true,
          dataIndex: "itemAssistantCode",
        },
        {
          title: "批号",
          key: "lotNum",
          width: 150,
          type: "txt",
          ellipsis: true,
          dataIndex: "lotNum",
        },
        {
          title: "操作",
          width: 150,
          fixed: "right",
          key: "operation",
          align: "center",
          scopedSlots: { customRender: "operation" },
        },
      ]),
    },
    modalItems: {
      rowkey: "locatorId",
      remoteUrl: {
        url: SERVICE_DATA_API_BASE + "/search/page",
        method: "post",
      },
      remoteBefore(vn, params) {
        let p = { ...params };
        p.data = {
          num: "589130005049643008",
          pageNum: params.data.pageNum,
          pageSize: params.data.pageSize,
          params: params.data,
        };
        return p;
      },
      title: "提取商品",
      gridformref: "form",
      ref: "modelFormType",
      items: [
        //genWarehouseAuthSearchModal 仓库

        ...genWarehouseAuthSearchModal(1, true, false, null, changecargoOwnerfun, {
          span: 6,
          labelCol: { span: 6 },
          wrapperCol: { span: 14 },
        }),
        ...genCargoownerAuthSearchModal(1, true, false, null, null, {
          span: 6,
          labelCol: { span: 6 },
          wrapperCol: { span: 14 },
        }),

        {
          type: "select",
          span: 6,
          name: "refBillType",
          label: "不合格品来源",
          value: "", //初始化值
          options: [
            { label: "所有", value: "" },
            { label: "入库", value: "1" },
            { label: "移库", value: "2" },
          ],
        },
        {
          type: "input",
          span: 6,
          name: "itemId",
          label: "商品",
          placeholder: "请输入产品名称或助记码或产品编",
          value: "", //初始化值
        },
        {
          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",
              icon: "redo",
              on: {
                click(event, form) {
                  form.resetFields();
                },
              },
            },
          ],
        },
      ],
      columns: [
        {
          title: "日期",
          dataIndex: "refBillDate",
          ellipsis: true,
          key: "refBillDate",
        },
        {
          title: "原单据编号",
          dataIndex: "refBillId",
          ellipsis: true,
          key: "refBillId",
        },
        {
          title: "不合格品来源",
          dataIndex: "refBillType",
          ellipsis: true,
          key: "refBillType",
          width: 100,
          customRender(text, record, index) {
            text == 1 ? ((text = "入库") ? text == 2 : (text = "移库")) : (text = "暂无");
            return text;
          },
        },
        {
          title: "不合格原因",
          dataIndex: "unqualifiedReason",
          ellipsis: true,
          key: "unqualifiedReason",
        },
        {
          title: "不合格数量",
          dataIndex: "unqualifiedQty",
          key: "unqualifiedQty",
          hidden: true,
        },

        {
          title: "数量",
          key: "lossQty",
          dataIndex: "lossQty",
          width: 100,
          scopedSlots: { customRender: "number" },
        },
        {
          title: "所在部门意见",
          key: "opinion",
          ellipsis: true,
          dataIndex: "opinion",
        },
        {
          title: "商品编码",
          key: "itemCode",
          ellipsis: true,
          dataIndex: "itemCode",
        },
        {
          title: "商品名称",
          key: "itemName",
          ellipsis: true,
          dataIndex: "itemName",
        },
        {
          title: "助记码",
          key: "itemAssistantCode",
          ellipsis: true,
          dataIndex: "itemAssistantCode",
        },
        {
          title: "生产厂家",
          key: "manufacturerName",
          ellipsis: true,
          dataIndex: "manufacturerName",
        },
        {
          title: "货位",
          key: "locatorCode",
          ellipsis: true,
          dataIndex: "locatorCode",
        },
        {
          title: "货位ID",
          key: "locatorId",
          ellipsis: true,
          hidden: true,
          dataIndex: "locatorId",
        },
        {
          title: "库别",
          key: "warehouseAreaCategoryName",
          width: 150,
          ellipsis: true,
          dataIndex: "warehouseAreaCategoryName",
        },
        {
          title: "库区",
          key: "warehouseAreaName",
          width: 150,
          ellipsis: true,
          dataIndex: "warehouseAreaName",
        },
        {
          title: "批号",
          key: "lotNum",
          ellipsis: true,
          dataIndex: "lotNum",
        },
        {
          title: "是否追溯",
          key: "itemHealthSuperviseflag",
          ellipsis: true,
          dataIndex: "itemHealthSuperviseflag",
          customRender(text, record, index) {
            text ? (text = "是") : (text = "否");
            return text;
          },
        },
        {
          title: "商品规格",
          key: "specification",
          ellipsis: true,
          dataIndex: "specification",
        },
        {
          title: "产地",
          key: "countryOriginName",
          ellipsis: true,
          dataIndex: "countryOriginName",
        },

        {
          title: "上市许可持有人",
          key: "itemHealthListedLicensor",
          ellipsis: true,
          width: 150,
          dataIndex: "itemHealthListedLicensor",
        },
        {
          title: "包装数量",
          key: "caseConversionRate",
          ellipsis: true,
          dataIndex: "caseConversionRate",
        },
        {
          title: "包装单位",
          key: "caseUom",
          ellipsis: true,
          dataIndex: "caseUom",
        },
      ],
      ModalItemsOpinion: {
        ref: "Opinion",
        items: [
          {
            type: "input",
            span: 12,
            name: "opinion",
            label: "意见",
            value: "", //初始化值
          },
        ],
      },
    },
  };
};

export default tablecolumns;
