Browse Source

HL-5932发料申请新增(多选、批量添加)时,给包装规格赋默认值

hella_online_20240913
yufei_wang 2 months ago
parent
commit
e192caaf21
  1. 5
      src/api/wms/issueRequestMain/index.ts
  2. 26
      src/views/wms/issueManage/issue/issueRequestMain/index.vue

5
src/api/wms/issueRequestMain/index.ts

@ -61,7 +61,10 @@ export const updateIssueRequestMain = async (data: IssueRequestMainVO) => {
export const deleteIssueRequestMain = async (id: number) => { export const deleteIssueRequestMain = async (id: number) => {
return await request.delete({ url: `/wms/issue-request-main/delete?id=` + id }) return await request.delete({ url: `/wms/issue-request-main/delete?id=` + id })
} }
// 获取默认包装规格
export const getPackUnit = async (data) => {
return await request.post({ url: `/wms/issue-request-main/getPackUnit`, data })
}
// 导出发料申请主 Excel // 导出发料申请主 Excel
export const exportIssueRequestMain = async (params) => { export const exportIssueRequestMain = async (params) => {
if (params.isSearch) { if (params.isSearch) {

26
src/views/wms/issueManage/issue/issueRequestMain/index.vue

@ -169,12 +169,31 @@ const onEnter = async (field,value) => {
}]) }])
} }
} }
//
const getDefaultPackUnit = async (packUnitList)=>{
console.log('获取默认包装规格',packUnitList)
let res = await IssueRequestMainApi.getPackUnit({
list:packUnitList
})
console.log('res',res)
if(res&&res.list.length>0){
tableData.value.forEach(item=>{
if(!item['packUnit']){
let findItem = res.list.find(item1=>item1.itemCode == item.itemCode)
if(findItem){
item['packUnit'] = findItem['packUnit']
}
}
})
}
}
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(async() => { nextTick(async() => {
if (type == 'tableForm') { if (type == 'tableForm') {
// //
if (formField == 'itemCode') { if (formField == 'itemCode') {
let packUnitList = []
val.forEach(item=>{ val.forEach(item=>{
let tableForm = JSON.parse(JSON.stringify(tableFormKeys)) let tableForm = JSON.parse(JSON.stringify(tableFormKeys))
if (tableData.value.length > 0) { if (tableData.value.length > 0) {
@ -185,8 +204,15 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
const newRow = JSON.parse(JSON.stringify({...tableForm,...item})) const newRow = JSON.parse(JSON.stringify({...tableForm,...item}))
newRow['itemCode'] = item['code'] newRow['itemCode'] = item['code']
newRow['uom'] = item['uom'] newRow['uom'] = item['uom']
packUnitList.push({
itemCode:item['code'],
workshopCode:formRef.formModel['workshopCode'],//
productionLineCode:formRef.formModel['productionLineCode'],//线
workStationCode:formRef.formModel['workStationCode'],//
})
tableData.value.push(newRow) tableData.value.push(newRow)
}) })
getDefaultPackUnit(packUnitList)
}else if(formField == 'packUnit'){ }else if(formField == 'packUnit'){
row['packQty'] = val[0]['packQty'] row['packQty'] = val[0]['packQty']
row[formField] = val[0][searchField] row[formField] = val[0][searchField]

Loading…
Cancel
Save