import {
  genWarehouseAuthSearchModal,
  genCargoownerAuthSearchModal,
} from '@/views/kzyWMS/SearchModal'
let grid = {
  labelCol: { span: 6 }, span: 6,
};
export function formItems(self) {
  let _this = self
  return [
    ...genWarehouseAuthSearchModal(1, true, false, null, function (rowData, form) {
			if (!rowData) {
				self.warehouseId = '';
			} else {
				self.warehouseId = rowData[0].companyId;
			}
		}, grid,{label:'仓库名称'}),
    ...genCargoownerAuthSearchModal(1, false, false, null, null, grid,{label:'源货主名称',mapper:{'cargoOwnerId':'srcCargoOwnerId','cargoOwnerName':'srcCargoOwnerName'}}),
    ...genCargoownerAuthSearchModal(1, false, false, null, null, grid, { label: '目标货主名称',mapper:{'cargoOwnerId':'destCargoOwnerId','cargoOwnerName':'destCargoOwnerName'} }),
    { type: 'input', name: 'poBillNo', label: '采购单编号', ...grid, value: '', },
    { type: 'input', name: 'orderBillNo', label: '销售单编号', ...grid, value: '', },
    {
      type: 'select',
      name: 'status',
      label: '状态',
      value: '',
      ...grid, 
      options: [
        { label: '全部', value: '' },
        { label: '待转换', value: '0' },
        { label: '未完成', value: '1' },
        { label: '已完成', value: '2' },
        { label: '错误', value: '3' },
        { label: '取消', value: '4' },
      ]
    },
    {
      type: "date",
      name: "billDate",
      ...grid, 
      label: "单据日期",
      placeholder: "请输入单据日期",
      value: "",
      format: "YYYY-MM-DD",
    },
    {
      type: 'buttonGroup',
      ...grid,
      options: [
        {
          value: '查询',
          icon: 'search',
          btnType: 'primary',
          // style: 'margin-left:10px',
          htmlType: 'submit'
        },
        {
          value: '重置',
          icon: 'redo',
          style: 'margin-left:10px',
          on: {
            click: () => {
              self.$refs.formTarget.form.resetFields()
            }
          }
        }
      ]
    }
  ]
}

export const tableColumns = [
  { title: '单据日期', dataIndex: 'billDate', },
  { title: '转换单号', dataIndex: 'refBillNo', },
  { title: '源货主名称', dataIndex: 'srcCargoOwnerName', },
  { title: '目的货主名称', dataIndex: 'destCargoOwnerName', },
  { title: '状态', dataIndex: 'statusName', },
  { title: '结论',width:140, dataIndex: 'rqcResult',scopedSlots: { customRender: 'rqcResult' } },
  { title: '销售单编号', dataIndex: 'orderBillNo', },
  { title: '采购单编号', dataIndex: 'poBillNo', },
  { title: '仓库名称', dataIndex: 'warehouseName', },
  { title: '仓库编号', dataIndex: 'warehouseCode', },
  { title: '备注', dataIndex: 'remark', },
]


export function detailFormItems(self) {
  let _this = self
  return [

    { type: 'input', name: 'cargoOwnerId', label: '货主ID', ...grid, value: '', hidden: true },
    { type: 'input', name: 'autoBillNum', label: '源货主', ...grid, value: '', },
    { type: 'input', name: 'customBillNum', label: '源商品', ...grid, value: '', },
    { type: 'input', name: 'shipperName', label: '批号', ...grid, value: '', },
    { type: 'input', name: 'shipperCode', label: '目标货主', ...grid, value: '', },
    { type: 'input', name: 'shipperZjm', label: '目标商品', ...grid, value: '', },
    { type: 'input', name: 'status', label: '转换数量', ...grid, value: '', },
    {
      type: 'buttonGroup',
      ...grid,
      options: [
        {
          value: '查询',
          icon: 'search',
          btnType: 'primary',
          // style: 'margin-left:10px',
          htmlType: 'submit'
        },
        {
          value: '重置',
          icon: 'redo',
          style: 'margin-left:10px',
          on: {
            click: () => {
              self.$refs.formTarget.form.resetFields()
            }
          }
        }
      ]
    }
  ]
}


export const detailColumns = [
  { title: '货主转换单日期', dataIndex: 'billDate', },
  { title: '源货主', dataIndex: 'sourceconsignorname', }, 
  { title: '目标货主', dataIndex: 'targetconsignorname', },  
  { title: '货主转换单号', dataIndex: 'billno', },
  { title: '仓库名称', dataIndex: 'branchname', },
  { title: '销售订单号', dataIndex: 'orderBillNo', },
  { title: '采购订单号', dataIndex: 'poBillNo', },
]

export const tableColumnsDetail = [
  { key:'srcItemName',title: '源商品名称', dataIndex: 'srcItemName',type:'txt' },
  { key:'destItemName',title: '目标商品名称', dataIndex: 'destItemName',type:'txt' }, 
  { key:'quantity',title: '数量', dataIndex: 'quantity',type:'txt' },  
    { key:'qcOddCaseQty',dataIndex: 'qcOddCaseQty', title: '抽样整件数',type:'txt'},
  { key:'qcOddPieceQty',dataIndex: 'qcOddPieceQty', title: '抽样零散数', type:'txt'},
  { key:'qcOddCaseActQty',dataIndex: 'qcOddCaseActQty',type:'number',required:true, title: '实际抽检整件数' },
  { key:'qcOddPieceActQty',dataIndex: 'qcOddPieceActQty',type:'number',required:true, title: '实际抽检零散数' },
  {dataIndex: 'qcQty',key:'qcQty',required:true,type: 'number', title: '验收数量', },
  { key:'refBillId',title: '源单号', dataIndex: 'refBillId',type:'txt' },
  { key:'manufacturerLotNum',title: '批号', dataIndex: 'manufacturerLotNum', type:'txt'},
  // { title: '销售订单号', dataIndex: 'orderBillNo', },
  // { title: '采购订单号', dataIndex: 'poBillNo', },
]