|
|
@ -815,14 +815,18 @@ export default {
|
|
|
|
cellAutofillOption: true,
|
|
|
|
cellAutofillOption: true,
|
|
|
|
checkboxOption: {
|
|
|
|
checkboxOption: {
|
|
|
|
hideSelectAll: false,
|
|
|
|
hideSelectAll: false,
|
|
|
|
|
|
|
|
// 可控属性
|
|
|
|
|
|
|
|
selectedRowKeys: [],
|
|
|
|
// 行选择改变事件
|
|
|
|
// 行选择改变事件
|
|
|
|
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
|
|
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
|
|
this.selectArr = selectedRowKeys
|
|
|
|
this.changeSelectedRowKeys(selectedRowKeys)
|
|
|
|
|
|
|
|
// this.selectArr = selectedRowKeys
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 全选改变事件
|
|
|
|
// 全选改变事件
|
|
|
|
selectedAllChange: ({ isSelected, selectedRowKeys }) => {
|
|
|
|
selectedAllChange: ({ isSelected, selectedRowKeys }) => {
|
|
|
|
if (isSelected) {
|
|
|
|
if (isSelected) {
|
|
|
|
this.selectArr = selectedRowKeys
|
|
|
|
this.changeSelectedRowKeys(selectedRowKeys)
|
|
|
|
|
|
|
|
// this.selectArr = selectedRowKeys
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.selectArr = []
|
|
|
|
this.selectArr = []
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -832,6 +836,7 @@ export default {
|
|
|
|
hideSelectAll: false,
|
|
|
|
hideSelectAll: false,
|
|
|
|
// 行选择改变事件
|
|
|
|
// 行选择改变事件
|
|
|
|
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
|
|
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
|
|
|
|
|
|
|
|
console.log(row, isSelected, selectedRowKeys)
|
|
|
|
this.selectChildArr = selectedRowKeys
|
|
|
|
this.selectChildArr = selectedRowKeys
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 全选改变事件
|
|
|
|
// 全选改变事件
|
|
|
@ -1025,6 +1030,11 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
// 给可控属性重新赋值
|
|
|
|
|
|
|
|
changeSelectedRowKeys(keys) {
|
|
|
|
|
|
|
|
this.selectArr = keys
|
|
|
|
|
|
|
|
this.checkboxOption.selectedRowKeys = keys
|
|
|
|
|
|
|
|
},
|
|
|
|
startEditingCell(rowKey, colKey, defaultValue) {
|
|
|
|
startEditingCell(rowKey, colKey, defaultValue) {
|
|
|
|
this.$refs['tableRef'].startEditingCell({ rowKey, colKey, defaultValue })
|
|
|
|
this.$refs['tableRef'].startEditingCell({ rowKey, colKey, defaultValue })
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1176,6 +1186,8 @@ export default {
|
|
|
|
pkgs += Number(item.pkgs)
|
|
|
|
pkgs += Number(item.pkgs)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.totalPkgs = pkgs
|
|
|
|
this.totalPkgs = pkgs
|
|
|
|
|
|
|
|
this.checkboxOption.selectedRowKeys = []
|
|
|
|
|
|
|
|
this.selectArr = []
|
|
|
|
},
|
|
|
|
},
|
|
|
|
developboxLine() {
|
|
|
|
developboxLine() {
|
|
|
|
const arr = []
|
|
|
|
const arr = []
|
|
|
@ -1402,63 +1414,73 @@ export default {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log(this.tableData, this.selectArr[0])
|
|
|
|
console.log(this.tableData, this.selectArr[0])
|
|
|
|
if (this.tableData[this.selectArr[0]].ctnnum > 1) {
|
|
|
|
if (this.tableData[this.selectArr[0]].ctnnum > 1) {
|
|
|
|
let tableData = this.tableData
|
|
|
|
console.log(
|
|
|
|
let data = []
|
|
|
|
parseFloat(this.tableData[this.selectArr[0]].ctnnum),
|
|
|
|
let num = 0
|
|
|
|
parseFloat(this.tableData[this.selectArr[0]].pkgs)
|
|
|
|
let totalPkgs = 0
|
|
|
|
)
|
|
|
|
let totalKgs = 0
|
|
|
|
if (
|
|
|
|
let totalCbm = 0
|
|
|
|
parseFloat(this.tableData[this.selectArr[0]].ctnnum) <= parseFloat(this.tableData[this.selectArr[0]].pkgs)
|
|
|
|
tableData.forEach((item, index) => {
|
|
|
|
) {
|
|
|
|
parseFloat(item.pkgs) ? (totalPkgs = totalPkgs + parseFloat(item.pkgs)) : ''
|
|
|
|
let tableData = this.tableData
|
|
|
|
parseFloat(item.kgs) ? (totalKgs = totalKgs + parseFloat(item.kgs)) : ''
|
|
|
|
let data = []
|
|
|
|
parseFloat(item.cbm) ? (totalCbm = totalCbm + parseFloat(item.cbm)) : ''
|
|
|
|
let num = 0
|
|
|
|
if (index == this.selectArr[0]) {
|
|
|
|
let totalPkgs = 0
|
|
|
|
for (let index = 0; index < item.ctnnum; index++) {
|
|
|
|
let totalKgs = 0
|
|
|
|
let pkgs = 0
|
|
|
|
let totalCbm = 0
|
|
|
|
let kgs = 0
|
|
|
|
tableData.forEach((item, index) => {
|
|
|
|
let cbm = 0
|
|
|
|
parseFloat(item.pkgs) ? (totalPkgs = totalPkgs + parseFloat(item.pkgs)) : ''
|
|
|
|
if (index == item.ctnnum - 1) {
|
|
|
|
parseFloat(item.kgs) ? (totalKgs = totalKgs + parseFloat(item.kgs)) : ''
|
|
|
|
pkgs =
|
|
|
|
parseFloat(item.cbm) ? (totalCbm = totalCbm + parseFloat(item.cbm)) : ''
|
|
|
|
parseInt(item.pkgs / item.ctnnum) +
|
|
|
|
if (index == this.selectArr[0]) {
|
|
|
|
parseInt(item.pkgs) -
|
|
|
|
for (let index = 0; index < item.ctnnum; index++) {
|
|
|
|
parseInt(parseInt(item.pkgs / item.ctnnum) * item.ctnnum)
|
|
|
|
let pkgs = 0
|
|
|
|
kgs = (
|
|
|
|
let kgs = 0
|
|
|
|
parseFloat((item.kgs / item.ctnnum).toFixed(2)) +
|
|
|
|
let cbm = 0
|
|
|
|
parseFloat(item.kgs) -
|
|
|
|
if (index == item.ctnnum - 1) {
|
|
|
|
parseFloat(parseFloat((item.kgs / item.ctnnum).toFixed(2)) * item.ctnnum)
|
|
|
|
pkgs =
|
|
|
|
).toFixed(2)
|
|
|
|
parseInt(item.pkgs / item.ctnnum) +
|
|
|
|
cbm = (
|
|
|
|
parseInt(item.pkgs) -
|
|
|
|
parseFloat((item.cbm / item.ctnnum).toFixed(2)) +
|
|
|
|
parseInt(parseInt(item.pkgs / item.ctnnum) * item.ctnnum)
|
|
|
|
parseFloat(item.cbm) -
|
|
|
|
kgs = (
|
|
|
|
parseFloat(parseFloat((item.cbm / item.ctnnum).toFixed(2)) * item.ctnnum)
|
|
|
|
parseFloat((item.kgs / item.ctnnum).toFixed(2)) +
|
|
|
|
).toFixed(2)
|
|
|
|
parseFloat(item.kgs) -
|
|
|
|
} else {
|
|
|
|
parseFloat(parseFloat((item.kgs / item.ctnnum).toFixed(2)) * item.ctnnum)
|
|
|
|
pkgs = parseInt(item.pkgs / item.ctnnum)
|
|
|
|
).toFixed(2)
|
|
|
|
kgs = parseFloat((item.kgs / item.ctnnum).toFixed(2))
|
|
|
|
cbm = (
|
|
|
|
cbm = parseFloat((item.cbm / item.ctnnum).toFixed(2))
|
|
|
|
parseFloat((item.cbm / item.ctnnum).toFixed(2)) +
|
|
|
|
|
|
|
|
parseFloat(item.cbm) -
|
|
|
|
|
|
|
|
parseFloat(parseFloat((item.cbm / item.ctnnum).toFixed(2)) * item.ctnnum)
|
|
|
|
|
|
|
|
).toFixed(2)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pkgs = parseInt(item.pkgs / item.ctnnum)
|
|
|
|
|
|
|
|
kgs = parseFloat((item.kgs / item.ctnnum).toFixed(2))
|
|
|
|
|
|
|
|
cbm = parseFloat((item.cbm / item.ctnnum).toFixed(2))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
num = num + 1
|
|
|
|
|
|
|
|
data.push({
|
|
|
|
|
|
|
|
...item,
|
|
|
|
|
|
|
|
ctnnum: 1,
|
|
|
|
|
|
|
|
rowKey: num,
|
|
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
|
|
pkgs: pkgs,
|
|
|
|
|
|
|
|
kgs: kgs,
|
|
|
|
|
|
|
|
cbm: cbm
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
num = num + 1
|
|
|
|
num = num + 1
|
|
|
|
data.push({
|
|
|
|
data.push({ ...item, rowKey: num })
|
|
|
|
...item,
|
|
|
|
|
|
|
|
ctnnum: 1,
|
|
|
|
|
|
|
|
rowKey: num,
|
|
|
|
|
|
|
|
id: '',
|
|
|
|
|
|
|
|
pkgs: pkgs,
|
|
|
|
|
|
|
|
kgs: kgs,
|
|
|
|
|
|
|
|
cbm: cbm
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
})
|
|
|
|
num = num + 1
|
|
|
|
console.log(totalPkgs, totalKgs, totalCbm)
|
|
|
|
data.push({ ...item, rowKey: num })
|
|
|
|
this.totalPkgs = totalPkgs
|
|
|
|
}
|
|
|
|
this.totalKgs = totalKgs.toFixed(2)
|
|
|
|
})
|
|
|
|
this.totalCbm = totalCbm.toFixed(2)
|
|
|
|
console.log(totalPkgs, totalKgs, totalCbm)
|
|
|
|
this.tableData = data
|
|
|
|
this.totalPkgs = totalPkgs
|
|
|
|
this.$forceUpdate()
|
|
|
|
this.totalKgs = totalKgs.toFixed(2)
|
|
|
|
} else {
|
|
|
|
this.totalCbm = totalCbm.toFixed(2)
|
|
|
|
this.$message.error('所选数据的件数应大于等于箱量')
|
|
|
|
this.tableData = data
|
|
|
|
}
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.$message.error('所选数据的箱量应大于1')
|
|
|
|
this.$message.error('所选数据的箱量应大于1')
|
|
|
|
}
|
|
|
|
}
|
|
|
|