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