pull/1/head
张同海 2 years ago
parent df7b027e6f
commit da8f31f093

@ -1144,7 +1144,7 @@ export default {
WText = `件数`
}
}
if (parseFloat(kgs) != parseFloat(this.bookingDetails.kgs)) {
if (parseFloat(kgs).toFixed(2) != parseFloat(this.bookingDetails.kgs).toFixed(2)) {
console.log(parseFloat(kgs), parseFloat(this.bookingDetails.kgs))
if (WText) {
WText = `${WText},重量`
@ -1152,7 +1152,7 @@ export default {
WText = `重量`
}
}
if (parseFloat(cbm) != parseFloat(this.bookingDetails.cbm)) {
if (parseFloat(cbm).toFixed(2) != parseFloat(this.bookingDetails.cbm).toFixed(2)) {
console.log(parseFloat(cbm), parseFloat(this.bookingDetails.cbm))
if (WText) {
WText = `${WText},尺码`
@ -1335,7 +1335,7 @@ export default {
WText = `件数`
}
}
if (parseFloat(kgs) != parseFloat(this.bookingDetails.kgs)) {
if (parseFloat(kgs).toFixed(2) != parseFloat(this.bookingDetails.kgs).toFixed(2)) {
console.log(parseFloat(kgs), parseFloat(this.bookingDetails.kgs))
if (WText) {
WText = `${WText},重量`
@ -1343,7 +1343,7 @@ export default {
WText = `重量`
}
}
if (parseFloat(cbm) != parseFloat(this.bookingDetails.cbm)) {
if (parseFloat(cbm).toFixed(2) != parseFloat(this.bookingDetails.cbm).toFixed(2)) {
console.log(parseFloat(cbm), parseFloat(this.bookingDetails.cbm))
if (WText) {
WText = `${WText},尺码`

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

@ -26,6 +26,11 @@
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="助记码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input placeholder="请输入助记码" v-decorator="['showCode']" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input placeholder="请输入备注" v-decorator="['remark']" />

@ -27,6 +27,11 @@
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="助记码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input placeholder="请输入助记码" v-decorator="['showCode']" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input placeholder="请输入备注" v-decorator="['remark']" />

@ -98,6 +98,12 @@ export default {
width: '100',
dataIndex: 'name'
},
{
title: '助记码',
align: 'center',
width: '80',
dataIndex: 'showCode'
},
{
title: '描述',
align: 'center',

Loading…
Cancel
Save