|
|
@ -139,7 +139,9 @@ |
|
|
|
<el-button |
|
|
|
type="warning" |
|
|
|
link |
|
|
|
@click="removeX(scope.row, scope.$index, item, index,scope1.row, scope1.$index )" |
|
|
|
@click=" |
|
|
|
removeX(scope.row, scope.$index, item, index, scope1.row, scope1.$index) |
|
|
|
" |
|
|
|
>移出</el-button |
|
|
|
> |
|
|
|
</template> |
|
|
@ -177,7 +179,7 @@ |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import * as accuracyFun from "@/utils/calculate" |
|
|
|
import * as accuracyFun from '@/utils/calculate' |
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
@ -220,9 +222,8 @@ const intData = async () => { |
|
|
|
}) |
|
|
|
} |
|
|
|
const expandChange = (row: any, expandedRows: any[]) => { |
|
|
|
|
|
|
|
// 判断托信息和箱信息是否都存在 |
|
|
|
if (row.secondPackUnit && row.secondPackQty&&row.packUnit && row.packQty) { |
|
|
|
if (row.secondPackUnit && row.secondPackQty && row.packUnit && row.packQty) { |
|
|
|
// 总共需要多少箱 |
|
|
|
row.allXiangQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty)) |
|
|
|
// 放满的多少箱 |
|
|
@ -234,16 +235,16 @@ const expandChange = (row: any, expandedRows: any[]) => { |
|
|
|
// 放满的托数量 |
|
|
|
row.manTuoQty = Math.floor(parseFloat(row.manXiangQty) / parseFloat(row.otherNumber)) |
|
|
|
// 放满的托数量*一托的箱数量*一箱的数量 获取放满的托一共多少数量 |
|
|
|
let num1 = accuracyFun.multiply(parseFloat(row.manTuoQty ),parseFloat(row.otherNumber)) |
|
|
|
let num1 = accuracyFun.multiply(parseFloat(row.manTuoQty), parseFloat(row.otherNumber)) |
|
|
|
row.tuoInManNumber = accuracyFun.multiply(num1, parseFloat(row.packQty)) |
|
|
|
console.log(11,row.tuoInManNumber ) |
|
|
|
console.log(11, row.tuoInManNumber) |
|
|
|
// 数量除以托数量获取余数 |
|
|
|
row.lastNumber = |
|
|
|
parseFloat(row.qty) >= parseFloat(row.tuoInManNumber) |
|
|
|
? accuracyFun.subtract( parseFloat(row.qty),parseFloat(row.tuoInManNumber)) |
|
|
|
? accuracyFun.subtract(parseFloat(row.qty), parseFloat(row.tuoInManNumber)) |
|
|
|
: parseFloat(row.qty) |
|
|
|
// 循环托 |
|
|
|
row.packageList =[] |
|
|
|
row.packageList = [] |
|
|
|
for (let i = 0; i < row.allTuoQty; i++) { |
|
|
|
oneId.value++ |
|
|
|
// 先给所有托一个默认对象值 |
|
|
@ -269,7 +270,10 @@ const expandChange = (row: any, expandedRows: any[]) => { |
|
|
|
} else { |
|
|
|
// 如果沒有余数,直接展示一托的全部箱数和全部数量 |
|
|
|
row.packageList[i].xNumber = row.otherNumber |
|
|
|
row.packageList[i].qtyOne = accuracyFun.multiply( parseFloat(row.otherNumber),parseFloat(row.packQty)) |
|
|
|
row.packageList[i].qtyOne = accuracyFun.multiply( |
|
|
|
parseFloat(row.otherNumber), |
|
|
|
parseFloat(row.packQty) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
// 判断箱信息是否存在 |
|
|
@ -282,7 +286,7 @@ const expandChange = (row: any, expandedRows: any[]) => { |
|
|
|
for (let j = 0; j < cur.xNumber; j++) { |
|
|
|
twoId.value++ |
|
|
|
cur.children[j] = { |
|
|
|
id: twoId.value, |
|
|
|
id: twoId.value |
|
|
|
// xPoNumber: j + 1 |
|
|
|
} |
|
|
|
// 如果有余数 |
|
|
@ -303,7 +307,7 @@ const expandChange = (row: any, expandedRows: any[]) => { |
|
|
|
} |
|
|
|
} |
|
|
|
// 只有箱规格 |
|
|
|
if(!row.secondPackUnit && row.packUnit && row.packQty){ |
|
|
|
if (!row.secondPackUnit && row.packUnit && row.packQty) { |
|
|
|
// 数量%每箱数量 获取总共几箱 |
|
|
|
row.allXiangQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty)) |
|
|
|
row.packageList = [] |
|
|
@ -325,7 +329,7 @@ const expandChange = (row: any, expandedRows: any[]) => { |
|
|
|
for (let j = 0; j < row.allXiangQty; j++) { |
|
|
|
twoId.value++ |
|
|
|
cur.children[j] = { |
|
|
|
id: twoId.value, |
|
|
|
id: twoId.value |
|
|
|
// xPoNumber: j + 1 |
|
|
|
} |
|
|
|
// 数量除以箱数量获取余数 |
|
|
@ -377,8 +381,8 @@ const submitForm = () => { |
|
|
|
if (cur.qtyOne == '' || cur.qtyOne == 0) { |
|
|
|
isZ = true |
|
|
|
} |
|
|
|
cur?.children?.forEach((ele,i) => { |
|
|
|
ele.xPoNumber = i+1 |
|
|
|
cur?.children?.forEach((ele, i) => { |
|
|
|
ele.xPoNumber = i + 1 |
|
|
|
if (ele.qtyTwo == '' || ele.qtyTwo == 0) { |
|
|
|
isZ = true |
|
|
|
} |
|
|
@ -392,9 +396,14 @@ const submitForm = () => { |
|
|
|
let obj = tableData.value.find((item) => { |
|
|
|
item.allNumber = 0 |
|
|
|
item.packageList.forEach((cur) => { |
|
|
|
item.allNumber = accuracyFun.add(item.allNumber , parseFloat(cur.qtyOne)?parseFloat(cur.qtyOne):0) |
|
|
|
item.allNumber = accuracyFun.add( |
|
|
|
item.allNumber, |
|
|
|
parseFloat(cur.qtyOne) ? parseFloat(cur.qtyOne) : 0 |
|
|
|
) |
|
|
|
// item.allNumber += parseFloat(cur.qtyOne) || 0 |
|
|
|
}) |
|
|
|
console.log(111, item.allNumber) |
|
|
|
console.log(222, parseFloat(item.qty)) |
|
|
|
return item.allNumber != parseFloat(item.qty) |
|
|
|
}) |
|
|
|
console.log(222, obj) |
|
|
@ -427,7 +436,7 @@ const addT = (oneRow) => { |
|
|
|
} |
|
|
|
// 移出托 |
|
|
|
const removeT = (oneRow, oneIndex, twoRow, twoIndex) => { |
|
|
|
oneRow.packageList= oneRow.packageList.filter(item=>item.id!=twoRow.id) |
|
|
|
oneRow.packageList = oneRow.packageList.filter((item) => item.id != twoRow.id) |
|
|
|
oneRow.allTuoQty = oneRow.packageList.length |
|
|
|
} |
|
|
|
// 添加箱 |
|
|
@ -447,18 +456,22 @@ const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => { |
|
|
|
twoRow.xNumber = twoRow.children.length |
|
|
|
let num = 0 |
|
|
|
twoRow.children.forEach((item) => { |
|
|
|
num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo) || 0) |
|
|
|
num = accuracyFun.add(parseFloat(num), parseFloat(item.qtyTwo) || 0) |
|
|
|
}) |
|
|
|
twoRow.qtyOne = num |
|
|
|
} else { |
|
|
|
// 直接添加箱 |
|
|
|
oneRow.isTuo= 1 //无托 |
|
|
|
oneRow.isTuo = 1 //无托 |
|
|
|
twoRow.children.push({ |
|
|
|
id: twoId.value, |
|
|
|
// xPoNumber: |
|
|
|
// twoRow.children.length > 0 ? twoRow.children[twoRow.children.length - 1].xPoNumber + 1 : 1, |
|
|
|
qtyTwo: oneRow.packQty |
|
|
|
}) |
|
|
|
//无托的时候默认显示一条托用来记录托数量 |
|
|
|
let num = 0 |
|
|
|
twoRow.children.forEach((item) => { |
|
|
|
num = accuracyFun.add(parseFloat(num), parseFloat(item.qtyTwo)) |
|
|
|
}) |
|
|
|
twoRow.qtyOne = num |
|
|
|
} |
|
|
|
} |
|
|
|
// 移除箱 |
|
|
@ -466,15 +479,21 @@ const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex, type) |
|
|
|
// 有父级托的时候 |
|
|
|
if (type == 1) { |
|
|
|
// 在托下移除箱 |
|
|
|
twoRow.children= twoRow.children.filter(item=>item.id!=threeRow.id) |
|
|
|
twoRow.children = twoRow.children.filter((item) => item.id != threeRow.id) |
|
|
|
let num = 0 |
|
|
|
twoRow.children.forEach((item) => { |
|
|
|
num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo) || 0) |
|
|
|
num = accuracyFun.add(parseFloat(num), parseFloat(item.qtyTwo) || 0) |
|
|
|
}) |
|
|
|
twoRow.qtyOne = num |
|
|
|
twoRow.xNumber = twoRow.children.length |
|
|
|
} else { |
|
|
|
twoRow.children= twoRow.children.filter(item=>item.id!=threeRow.id) |
|
|
|
twoRow.children = twoRow.children.filter((item) => item.id != threeRow.id) |
|
|
|
//无托的时候默认显示一条托用来记录托数量 |
|
|
|
let num = 0 |
|
|
|
twoRow.children.forEach((item) => { |
|
|
|
num = accuracyFun.add(parseFloat(num), parseFloat(item.qtyTwo) || 0) |
|
|
|
}) |
|
|
|
twoRow.qtyOne = num |
|
|
|
} |
|
|
|
} |
|
|
|
// 是否显示展开图标 |
|
|
@ -494,8 +513,8 @@ const blurOne = (oneRow, twoRow) => { |
|
|
|
// twoRow.children = [] |
|
|
|
// twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty) |
|
|
|
// } |
|
|
|
twoRow.qtyOne = parseFloat(twoRow.xNumber) ? |
|
|
|
accuracyFun.multiply( parseFloat(twoRow.xNumber),parseFloat(oneRow.packQty)) |
|
|
|
twoRow.qtyOne = parseFloat(twoRow.xNumber) |
|
|
|
? accuracyFun.multiply(parseFloat(twoRow.xNumber), parseFloat(oneRow.packQty)) |
|
|
|
: '' |
|
|
|
// let num = 0 |
|
|
|
// oneRow.packageList.forEach((item) => { |
|
|
@ -554,7 +573,7 @@ const blurTwo = (oneRow, twoRow, threeRow) => { |
|
|
|
// } |
|
|
|
let num = 0 |
|
|
|
twoRow.children.forEach((item) => { |
|
|
|
num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo)) |
|
|
|
num = accuracyFun.add(parseFloat(num), parseFloat(item.qtyTwo)) |
|
|
|
}) |
|
|
|
twoRow.qtyOne = num |
|
|
|
} |
|
|
@ -566,7 +585,7 @@ const blurThree = (oneRow, twoRow, thereeRow) => { |
|
|
|
// } |
|
|
|
let num = 0 |
|
|
|
twoRow.children.forEach((item) => { |
|
|
|
num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo)) |
|
|
|
num = accuracyFun.add(parseFloat(num), parseFloat(item.qtyTwo)) |
|
|
|
}) |
|
|
|
twoRow.qtyOne = num |
|
|
|
} |
|
|
|