|
@ -155,12 +155,12 @@ const openLabel = (tableList) => { |
|
|
tableData.value = tableList |
|
|
tableData.value = tableList |
|
|
intData() |
|
|
intData() |
|
|
} |
|
|
} |
|
|
const oneId = ref(0)//每托的id |
|
|
const oneId = ref(0) //每托的id |
|
|
const twoId = ref(0)//每箱的id |
|
|
const twoId = ref(0) //每箱的id |
|
|
const intData = () => { |
|
|
const intData = () => { |
|
|
// 目前托信息等于包装规格1 |
|
|
// 目前托信息等于包装规格1 |
|
|
tableData.value.forEach((item) => { |
|
|
tableData.value.forEach((item) => { |
|
|
item.packQty1 = 3 |
|
|
item.packQty1 = 11 |
|
|
|
|
|
|
|
|
// 判断托信息是否存在 |
|
|
// 判断托信息是否存在 |
|
|
if (item.packUnit && item.packQty) { |
|
|
if (item.packUnit && item.packQty) { |
|
@ -170,70 +170,67 @@ const intData = () => { |
|
|
item.otherNumber = parseFloat(item.packQty) / parseFloat(item.secondPackQty) |
|
|
item.otherNumber = parseFloat(item.packQty) / parseFloat(item.secondPackQty) |
|
|
// 数量%每箱数量 获取总共几箱 |
|
|
// 数量%每箱数量 获取总共几箱 |
|
|
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty)) |
|
|
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty)) |
|
|
|
|
|
// 数量%托数量 获取总共几托 |
|
|
|
|
|
item.allTuoQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.packQty)) |
|
|
item.children = [] |
|
|
item.children = [] |
|
|
|
|
|
// 循环托 |
|
|
for (let i = 0; i < item.packQty1; i++) { |
|
|
for (let i = 0; i < item.packQty1; i++) { |
|
|
oneId.value++ |
|
|
oneId.value++ |
|
|
// 如果有余数 |
|
|
// 先给所有托一个默认对象值 |
|
|
if (item.lastNumber) { |
|
|
item.children[i] = { |
|
|
// 最后一条信息直接展示余数的信息 |
|
|
id: oneId.value, |
|
|
if (i == item.packQty1 - 1) { |
|
|
tPoNumber: i + 1, |
|
|
item.children.push({ |
|
|
xNumber: '', |
|
|
id: oneId.value, |
|
|
qtyOne: '' |
|
|
tPoNumber: i + 1, |
|
|
} |
|
|
xNumber: Math.ceil(item.lastNumber / parseFloat(item.secondPackQty)), |
|
|
// 循环当前数量所需要的托数量 |
|
|
qtyOne: item.lastNumber |
|
|
for (let j = 0; j < item.allTuoQty; j++) { |
|
|
}) |
|
|
if (i == j) { |
|
|
} else { |
|
|
// 如果有余数 |
|
|
// 其他数据展示一托的全部箱数和全部数量 |
|
|
if (item.lastNumber) { |
|
|
item.children.push({ |
|
|
// 最后一条信息直接展示余数的信息 |
|
|
id: oneId.value, |
|
|
if (j == item.allTuoQty - 1) { |
|
|
tPoNumber: i + 1, |
|
|
item.children[j].xNumber = Math.ceil(item.lastNumber / parseFloat(item.secondPackQty)) |
|
|
xNumber: item.otherNumber, |
|
|
item.children[j].qtyOne = item.lastNumber |
|
|
qtyOne: item.packQty |
|
|
}else{ |
|
|
}) |
|
|
// 其他数据展示一托的全部箱数和全部数量 |
|
|
|
|
|
item.children[j].xNumber = item.otherNumber |
|
|
|
|
|
item.children[j].qtyOne = item.packQty |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
// 如果沒有余数,直接展示一托的全部箱数和全部数量 |
|
|
|
|
|
item.children[j].xNumber = item.otherNumber |
|
|
|
|
|
item.children[j].qtyOne = item.packQty |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
// 如果沒有余数,直接展示一托的全部箱数和全部数量 |
|
|
|
|
|
item.children.push({ |
|
|
|
|
|
id: oneId.value, |
|
|
|
|
|
tPoNumber: i + 1, |
|
|
|
|
|
xNumber: item.otherNumber, |
|
|
|
|
|
qtyOne: item.packQty |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 判断箱信息是否存在 |
|
|
// 判断箱信息是否存在 |
|
|
if (item.secondPackUnit && item.secondPackQty) { |
|
|
if (item.secondPackUnit && item.secondPackQty) { |
|
|
item.children.forEach((cur, key) => { |
|
|
item.children.forEach((cur, key) => { |
|
|
cur.children = [] |
|
|
cur.children = [] |
|
|
// 数量除以托数量获取余数 |
|
|
// 数量除以箱数量获取余数 |
|
|
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(item.secondPackQty) |
|
|
cur.xLastNumber = parseFloat(cur.qtyOne) % parseFloat(item.secondPackQty) |
|
|
for (let j = 0; j < cur.xNumber; j++) { |
|
|
// cur.xiangNumber = Math.ceil(parseFloat(cur.qtyOne) / parseFloat(item.secondPackQty)) |
|
|
|
|
|
for (let i = 0; i < cur.xNumber; i++) { |
|
|
twoId.value++ |
|
|
twoId.value++ |
|
|
|
|
|
cur.children[i]={ |
|
|
|
|
|
id: twoId.value, |
|
|
|
|
|
xPoNumber: i + 1, |
|
|
|
|
|
} |
|
|
// 如果有余数 |
|
|
// 如果有余数 |
|
|
if (cur.xLastNumber) { |
|
|
if (cur.xLastNumber) { |
|
|
// 最后一条信息直接展示余数的信息 |
|
|
// 最后一条信息直接展示余数的信息 |
|
|
if (j == cur.xNumbery - 1) { |
|
|
if (i == cur.xNumber - 1) { |
|
|
cur.children.push({ |
|
|
cur.children[i].qtyTwo = cur.xLastNumber |
|
|
id: twoId.value, |
|
|
|
|
|
xPoNumber: j + 1, |
|
|
|
|
|
qtyTwo: cur.xLastNumber |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
// 其他数据展示一托的全部箱数和全部数量 |
|
|
// 其他数据展示一托的全部箱数和全部数量 |
|
|
cur.children.push({ |
|
|
cur.children[i].qtyTwo = item.secondPackQty |
|
|
id: twoId.value, |
|
|
|
|
|
xPoNumber: j + 1, |
|
|
|
|
|
qtyTwo: item.secondPackQty |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
// 如果沒有余数,直接展示一托的全部箱数和全部数量 |
|
|
// 如果沒有余数,直接展示一托的全部箱数和全部数量 |
|
|
cur.children.push({ |
|
|
cur.children[i].qtyTwo = item.secondPackQty |
|
|
id: twoId.value, |
|
|
|
|
|
xPoNumber: j + 1, |
|
|
|
|
|
qtyTwo: item.secondPackQty |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
@ -241,38 +238,44 @@ const intData = () => { |
|
|
} else { |
|
|
} else { |
|
|
// 数量除以箱数量获取余数 |
|
|
// 数量除以箱数量获取余数 |
|
|
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.secondPackQty) |
|
|
item.lastNumber = parseFloat(item.orderQty) % parseFloat(item.secondPackQty) |
|
|
|
|
|
// 数量%每箱数量 获取总共几箱 |
|
|
|
|
|
item.allPackQty = Math.ceil(parseFloat(item.orderQty) / parseFloat(item.secondPackQty)) |
|
|
item.children = [] |
|
|
item.children = [] |
|
|
console.log(item.packQty1) |
|
|
console.log(333,item.lastNumber) |
|
|
|
|
|
// 循环箱 |
|
|
for (let i = 0; i < item.packQty1; i++) { |
|
|
for (let i = 0; i < item.packQty1; i++) { |
|
|
oneId.value++ |
|
|
oneId.value++ |
|
|
if (item.lastNumber) { |
|
|
// 先给所有托一个默认对象值 |
|
|
// 最后一条信息直接展示余数的信息 |
|
|
item.children[i] = { |
|
|
if (i == item.packQty - 1) { |
|
|
id: oneId.value, |
|
|
item.children.push({ |
|
|
xPoNumber: i + 1, |
|
|
id: oneId.value, |
|
|
qtyOne: '' |
|
|
xPoNumber: i + 1, |
|
|
} |
|
|
qtyOne: item.lastNumber |
|
|
console.log(444,item.allPackQty) |
|
|
}) |
|
|
// 循环当前数量所需要的箱数量 |
|
|
} else { |
|
|
for (let j = 0; j < item.allPackQty; j++) { |
|
|
// 其他数据展示一托的全部箱数和全部数量 |
|
|
if (i == j) { |
|
|
item.children.push({ |
|
|
// 如果有余数 |
|
|
id: oneId.value, |
|
|
if (item.lastNumber) { |
|
|
xPoNumber: i + 1, |
|
|
// 最后一条信息直接展示余数的信息 |
|
|
qtyOne: item.secondPackQty |
|
|
if (j == item.allPackQty - 1) { |
|
|
}) |
|
|
item.children[j].qtyOne = item.lastNumber |
|
|
|
|
|
}else{ |
|
|
|
|
|
// 其他数据展示一托的全部箱数和全部数量 |
|
|
|
|
|
item.children[j].qtyOne = item.secondPackQty |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
// 如果沒有余数,直接展示一托的全部箱数和全部数量 |
|
|
|
|
|
item.children[j].qtyOne = item.secondPackQty |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
item.children.push({ |
|
|
|
|
|
id: oneId.value, |
|
|
|
|
|
xPoNumber: i + 1, |
|
|
|
|
|
qtyOne: item.secondPackQty |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
console.log(item.children) |
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
console.log(tableData.value) |
|
|
console.log(111, tableData.value) |
|
|
} |
|
|
} |
|
|
/** 弹窗按钮 */ |
|
|
/** 弹窗按钮 */ |
|
|
let Butttondata: any = [] |
|
|
let Butttondata: any = [] |
|
@ -297,9 +300,9 @@ const submitForm = () => { |
|
|
let arr = tableData.value.map((item) => { |
|
|
let arr = tableData.value.map((item) => { |
|
|
item.allNumber = 0 |
|
|
item.allNumber = 0 |
|
|
// 判断托信息是否存在 |
|
|
// 判断托信息是否存在 |
|
|
item.children.forEach((cur) => { |
|
|
item.children.forEach((cur) => { |
|
|
item.allNumber += parseFloat(cur.qtyOne) || 0 |
|
|
item.allNumber += parseFloat(cur.qtyOne) || 0 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
if (item.allNumber == parseFloat(item.orderQty)) { |
|
|
if (item.allNumber == parseFloat(item.orderQty)) { |
|
|
return true |
|
|
return true |
|
@ -383,6 +386,7 @@ const blurOne = (oneRow, twoRow) => { |
|
|
twoRow.xNumber = oneRow.otherNumber |
|
|
twoRow.xNumber = oneRow.otherNumber |
|
|
twoRow.children = [] |
|
|
twoRow.children = [] |
|
|
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty) |
|
|
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty) |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty) |
|
|
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.secondPackQty) |
|
|
let num = 0 |
|
|
let num = 0 |
|
@ -392,6 +396,7 @@ const blurOne = (oneRow, twoRow) => { |
|
|
if (num > oneRow.allPackQty) { |
|
|
if (num > oneRow.allPackQty) { |
|
|
message.warning('总箱数不可以大于' + oneRow.allPackQty) |
|
|
message.warning('总箱数不可以大于' + oneRow.allPackQty) |
|
|
twoRow.xNumber = '' |
|
|
twoRow.xNumber = '' |
|
|
|
|
|
twoRow.qtyOne = '' |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
// 托信息修改的時候箱数据自动排列 |
|
|
// 托信息修改的時候箱数据自动排列 |
|
@ -437,7 +442,7 @@ const blurTwo = (oneRow, twoRow, threeRow) => { |
|
|
console.log(parseFloat(threeRow.qtyTwo)) |
|
|
console.log(parseFloat(threeRow.qtyTwo)) |
|
|
console.log(parseFloat(oneRow.secondPackQty)) |
|
|
console.log(parseFloat(oneRow.secondPackQty)) |
|
|
if (parseFloat(threeRow.qtyTwo) > parseFloat(oneRow.secondPackQty)) { |
|
|
if (parseFloat(threeRow.qtyTwo) > parseFloat(oneRow.secondPackQty)) { |
|
|
message.warning('数量最多为'+oneRow.secondPackQty) |
|
|
message.warning('数量最多为' + oneRow.secondPackQty) |
|
|
threeRow.qtyTwo = oneRow.secondPackQty |
|
|
threeRow.qtyTwo = oneRow.secondPackQty |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|