Browse Source

托规格默认

hella_online_20240829
zhang_li 4 months ago
parent
commit
d10c3215a0
  1. 98
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue

98
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue

@ -154,7 +154,6 @@
:footButttondata="footButttondata"
@footButtonClick="footButtonClick"
@formSelectChange="formSelectChangeLabel"
@visibleChange='visibleChange'
/>
<!-- 上传质量报告 -->
<BasicForm
@ -607,7 +606,7 @@ const buttonTableClick = async (val, row) => {
}
genLabelId.value = row.masterId
// await getDetailList()
await getGenerateLabelList(row)
await getGenerateLabelList(row)
formLabelRef.value.open('create', row, null, 'createLabel') // createLabel
}
})
@ -628,27 +627,33 @@ const footButttondata = ref([
defaultButtons.formCloseBtn(null) // BOM
])
//
const getGenerateLabelList=async(row)=>{
const getGenerateLabelList = async (row) => {
const params1 = {
masterId: row.masterId,
pageSize: '500',
pageNo: '1',
sort: '',
by: 'ASC'
}
await SupplierdeliverRequestDetailApi.getGenerateLabelList(params1).then((res) => {
detatableData1.value = res
detatableData1.value.forEach((item) => {
item.packUnitInitOptions = item.boxPackaging
let obj = item?.boxPackaging[0]
if (obj) {
item.packUnit= obj.packUnit
item.packQty = obj.packQty
}
item.secondPackUnit= ''
item.secondPackQty = ''
})
masterId: row.masterId,
pageSize: '500',
pageNo: '1',
sort: '',
by: 'ASC'
}
await SupplierdeliverRequestDetailApi.getGenerateLabelList(params1).then((res) => {
detatableData1.value = res
detatableData1.value.forEach((item) => {
item.packUnitInitOptions = item.boxPackaging
item.secondPackUnitInitOptions = item.palletPackaging || []
let obj = item?.boxPackaging[0]
if (obj) {
item.packUnit = obj.packUnit
item.packQty = obj.packQty
}
//
item.secondPackUnit = obj.parentPackUnit
? obj.parentPackUnit
: item?.secondPackUnitInitOptions[0]?.packUnit
item.secondPackQty = obj.parentPackUnit
? obj.parentPackQty
: item?.secondPackUnitInitOptions[0]?.packQty
})
})
}
//
const labelFormRef = ref()
@ -658,12 +663,12 @@ const footButtonClick = async (val) => {
if (!validateForm) {
return
}
let isNext = detatableData1.value.some((item)=>{
return !item.packUnit || !item.packQty
let isNext = detatableData1.value.some((item) => {
return !item.packUnit || !item.packQty
})
if(isNext){
if (isNext) {
message.warning('有数据没有选择箱规格')
return;
return
}
const data = JSON.parse(JSON.stringify(detatableData1.value))
labelFormRef.value.openLabel(data)
@ -677,12 +682,25 @@ const formSelectChangeLabel = (field, val, row) => {
let obj = row.boxPackaging.find((item) => item.packUnit == val)
if (obj) {
row.packQty = obj.packQty
//
const params1 = {
itemCode: row.itemCode,
packUnit: row.packUnit
}
SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => {
if (res?.length > 0) {
row.secondPackUnit = res[0].packUnit
row.secondPackQty = res[0].packQty
} else {
row.secondPackUnit = row?.secondPackUnitInitOptions[0]?.packUnit
row.secondPackQty = row?.secondPackUnitInitOptions[0]?.packQty
}
})
} else {
row.packQty = ''
row.secondPackUnit = ''
row.secondPackQty = ''
}
row.secondPackUnit = ''
row.secondPackQty = ''
}
//
if (field == 'secondPackUnit') {
@ -694,23 +712,7 @@ const formSelectChangeLabel = (field, val, row) => {
}
}
}
// tableForm
const visibleChange=(field, val, row, index)=>{
row.secondPackUnitInitOptions=[]
if(field=='secondPackUnit'){
if(val){
//
const params1 = {
itemCode: row.itemCode,
packUnit: row.packUnit
}
SupplierdeliverRequestDetailApi.getGenerateLabelParentList(params1).then((res) => {
row.secondPackUnitInitOptions = res
})
}
}
}
//
const { wsCache } = useCache()
@ -1000,10 +1002,9 @@ const { getList: getDetailList } = detatableMethods
//
const submitFormLabel = async (list) => {
try {
let data = {
subList:list
}
let data = {
subList: list
}
await message.confirm(t('ts.是否为此数据生成标签?'))
labelFormRef.value.isLoading = true
await SupplierdeliverRequestMainApi.genLabel(data)
@ -1016,7 +1017,6 @@ const submitFormLabel = async (list) => {
labelFormRef.value.formLoading = false
labelFormRef.value.dialogTableVisible = false
labelFormRef.value.isLoading = false
}
}
const clearInput = async (field, row, index) => {

Loading…
Cancel
Save