|
|
@ -112,6 +112,7 @@ |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import { addDay } from '@/utils/formatTime' |
|
|
|
import download from '@/utils/download' |
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
|
import { |
|
|
@ -131,7 +132,7 @@ import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' |
|
|
|
import { PurchaseDetail } from '../../supplierdeliver/purchaseMain/purchaseMain.data' |
|
|
|
import * as ItembasicApi from '@/api/wms/itembasic' |
|
|
|
|
|
|
|
// 采购收货申请 |
|
|
|
// 备件收货申请 |
|
|
|
defineOptions({ name: 'PurchasereceiptRequestMain' }) |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
@ -154,7 +155,7 @@ const updataTableColumns = (val) => { |
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
//console.log("formRef",formRef) |
|
|
|
//console.log("supplierCode",formRef.value.formRef.formModel.supplierCode) |
|
|
|
console.log("searchTableSuccess",formField, searchField, val, formRef, type, row) |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
@ -162,7 +163,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
if(formField == 'itemCode') { |
|
|
|
row['itemCode'] = val[0]['code'] |
|
|
|
} else if(formField == 'poNumber') { |
|
|
|
row['poNumber'] = val[0]['number'] |
|
|
|
updateTableData(val) |
|
|
|
} else if(formField == 'poLine'){ |
|
|
|
//添加费用明细--点击确定 |
|
|
|
val.forEach(item=>{ |
|
|
@ -213,6 +214,25 @@ const onEnter = async (field,value)=>{ |
|
|
|
console.log(field,value) |
|
|
|
getSearchTableData(value,true) |
|
|
|
} |
|
|
|
const updateTableData = (tableList)=>{ |
|
|
|
tableList.forEach(row=>{ |
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row})) |
|
|
|
newRow['poLine'] = row['lineNumber'] |
|
|
|
newRow['itemCode'] = row['itemCode'] |
|
|
|
newRow['uom'] = row['uom'] |
|
|
|
newRow['poNumber'] =row['number'] |
|
|
|
newRow['supplierCode'] =row['supplierCode'] |
|
|
|
//生产日期 到货日期 默认当天 |
|
|
|
newRow['produceDate'] = dayjs().valueOf() |
|
|
|
newRow['arriveDate'] = dayjs().valueOf() |
|
|
|
//批次 |
|
|
|
newRow['batch'] = formatDate(newRow['produceDate'],'YYYYMMDD'); |
|
|
|
newRow['defaultToLocationCode'] =row['defaultLocation'] |
|
|
|
if(!tableData.value.find((item:object)=>item.poNumber == newRow.poNumber&&item.itemCode == newRow.itemCode&&item.poLine == newRow.poLine&&item.batch == newRow.batch)){ |
|
|
|
tableData.value.push(newRow) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const getSearchTableData = async (number,isEnter=false)=>{ |
|
|
|
const {tableObject ,tableMethods} = useTable({ |
|
|
|
defaultParams:{number}, |
|
|
@ -226,22 +246,10 @@ const getSearchTableData = async (number,isEnter=false)=>{ |
|
|
|
item.width = item.table?.width || 150 |
|
|
|
}) |
|
|
|
tableData.value = [] |
|
|
|
updateTableData(tableObject.tableList) |
|
|
|
const itemCodes = [] |
|
|
|
tableObject.tableList.forEach(row=>{ |
|
|
|
itemCodes.push(row['itemCode']) |
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row})) |
|
|
|
newRow['poLine'] = row['lineNumber'] |
|
|
|
newRow['itemCode'] = row['itemCode'] |
|
|
|
newRow['uom'] = row['uom'] |
|
|
|
newRow['poNumber'] =row['number'] |
|
|
|
newRow['supplierCode'] =row['supplierCode'] |
|
|
|
//生产日期 到货日期 默认当天 |
|
|
|
newRow['produceDate'] = dayjs().valueOf() |
|
|
|
newRow['arriveDate'] = dayjs().valueOf() |
|
|
|
//批次 |
|
|
|
newRow['batch'] = formatDate(newRow['produceDate'],'YYYYMMDD'); |
|
|
|
newRow['defaultToLocationCode'] =row['defaultLocation'] |
|
|
|
tableData.value.push(newRow) |
|
|
|
if(isEnter){ |
|
|
|
//回车--供应商代码 |
|
|
|
const setV = {} |
|
|
|