|
|
@ -69,7 +69,7 @@ |
|
|
|
<el-table-column label="托行号" width="100" prop="tPoNumber" align="center" /> |
|
|
|
<el-table-column label="箱个数" width="100" prop="xNumber" align="center"> |
|
|
|
<template #default="scope1"> |
|
|
|
<el-input v-model="scope1.row.xNumber" @blur="blurOne(scope.row, scope1.row)" /> |
|
|
|
<el-input v-model="scope1.row.xNumber" @blur="blurOne(scope.row, scope1.row)" onkeyup="value=value.replace(/\D/g,'')" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="数量" width="100" prop="qtyOne" align="center" /> |
|
|
@ -205,12 +205,22 @@ const intData =async () => { |
|
|
|
const expandChange = (row: any, expandedRows: any[]) => { |
|
|
|
// 判断托信息是否存在 |
|
|
|
if (row.secondPackUnit && row.secondPackQty) { |
|
|
|
// 数量除以托数量获取余数 |
|
|
|
row.lastNumber = parseFloat(row.qty) % parseFloat(row.secondPackQty) |
|
|
|
// // 托数量/箱数量 一托可以放几箱 |
|
|
|
// row.otherNumber =Math.floor(parseFloat(row.secondPackQty) / parseFloat(row.packQty)) |
|
|
|
// // 数量除以托数量获取余数 |
|
|
|
// row.lastNumber = parseFloat(row.qty) % parseFloat(row.secondPackQty) |
|
|
|
// // 数量%托数量 获取总共几托 |
|
|
|
// row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty)) |
|
|
|
|
|
|
|
// 总共需要多少箱 |
|
|
|
row.allXiangQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty)) |
|
|
|
// 托数量/箱数量 一托可以放几箱 |
|
|
|
row.otherNumber = parseFloat(row.secondPackQty) / parseFloat(row.packQty) |
|
|
|
// 数量%托数量 获取总共几托 |
|
|
|
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty)) |
|
|
|
row.otherNumber =Math.floor(parseFloat(row.secondPackQty) / parseFloat(row.packQty)) |
|
|
|
// 数量%托数量 获取总共几托 |
|
|
|
row.allTuoQty = Math.ceil(parseFloat(row.allXiangQty) / parseFloat(row.otherNumber)) |
|
|
|
// 数量除以托数量获取余数 |
|
|
|
row.lastNumber = parseFloat(row.allXiangQty) % parseFloat(row.otherNumber) |
|
|
|
|
|
|
|
row.packageList = [] |
|
|
|
// 循环托 |
|
|
|
for (let i = 0; i < row.allTuoQty; i++) { |
|
|
@ -232,12 +242,12 @@ const expandChange = (row: any, expandedRows: any[]) => { |
|
|
|
} else { |
|
|
|
// 其他数据展示一托的全部箱数和全部数量 |
|
|
|
row.packageList[i].xNumber = row.otherNumber |
|
|
|
row.packageList[i].qtyOne = row.secondPackQty |
|
|
|
row.packageList[i].qtyOne = parseFloat(row.otherNumber) * parseFloat(row.packQty) |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 如果沒有余数,直接展示一托的全部箱数和全部数量 |
|
|
|
row.packageList[i].xNumber = row.otherNumber |
|
|
|
row.packageList[i].qtyOne = row.secondPackQty |
|
|
|
row.packageList[i].qtyOne = parseFloat(row.otherNumber) * parseFloat(row.packQty) |
|
|
|
} |
|
|
|
} |
|
|
|
// 判断箱信息是否存在 |
|
|
@ -418,23 +428,23 @@ const blurOne = (oneRow, twoRow) => { |
|
|
|
if (!twoRow.xNumber) { |
|
|
|
twoRow.qtyOne = '' |
|
|
|
} |
|
|
|
if (parseFloat(twoRow.xNumber) > parseFloat(oneRow.otherNumber)) { |
|
|
|
message.warning('每托箱个数最多' + oneRow.otherNumber + '箱') |
|
|
|
twoRow.xNumber = oneRow.otherNumber |
|
|
|
twoRow.children = [] |
|
|
|
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty) |
|
|
|
} |
|
|
|
// if (parseFloat(twoRow.xNumber) > parseFloat(oneRow.otherNumber)) { |
|
|
|
// message.warning('每托箱个数最多' + oneRow.otherNumber + '箱') |
|
|
|
// twoRow.xNumber = oneRow.otherNumber |
|
|
|
// twoRow.children = [] |
|
|
|
// twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty) |
|
|
|
// } |
|
|
|
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty) |
|
|
|
let num = 0 |
|
|
|
oneRow.packageList.forEach((item) => { |
|
|
|
num += parseFloat(item.xNumber) || 0 |
|
|
|
}) |
|
|
|
if (num > oneRow.allPackQty) { |
|
|
|
message.warning('总箱数不可以大于' + oneRow.allPackQty) |
|
|
|
twoRow.xNumber = '' |
|
|
|
twoRow.qtyOne = '' |
|
|
|
return |
|
|
|
} |
|
|
|
// let num = 0 |
|
|
|
// oneRow.packageList.forEach((item) => { |
|
|
|
// num += parseFloat(item.xNumber) || 0 |
|
|
|
// }) |
|
|
|
// if (num > oneRow.allPackQty) { |
|
|
|
// message.warning('总箱数不可以大于' + oneRow.allPackQty) |
|
|
|
// twoRow.xNumber = '' |
|
|
|
// twoRow.qtyOne = '' |
|
|
|
// return |
|
|
|
// } |
|
|
|
// 托信息修改的時候箱数据自动排列 |
|
|
|
// 判断箱信息是否存在 |
|
|
|
if (oneRow.packUnit && oneRow.packQty) { |
|
|
|