lilu 2 years ago
commit b4138f12d8

@ -975,8 +975,8 @@ export default {
}
return true
},
bookingOrderUpdate() {
console.log(this.bookingDetails)
// if (!this.bookingDetails.mblno) {
// this.$message.error('')
// return false
@ -1051,59 +1051,111 @@ export default {
return false
}
}
// - end
const _data = JSON.parse(JSON.stringify(this.bookingDetails))
delete _data.hbList
BookingOrderAddOrUpdate(_data)
.then(res => {
if (res.success) {
this.$message.success('保存成功')
if (this.isAdd) {
this.isCopy = false
this.isAdd = false
this.$router.replace({
name: 'BookingDetail',
query: {
id: res.data,
type: this.bookingDetails.carrierid,
noOpenTab: true,
mblno: this.bookingDetails.mblno
let pkgs = 0
let kgs = 0
let cbm = 0
this.bookingDetails.ctnInputs.forEach(item => {
if (parseFloat(item.pkgs)) {
pkgs = pkgs + parseFloat(item.pkgs)
}
if (parseFloat(item.kgs)) {
kgs = kgs + parseFloat(item.kgs)
}
if (parseFloat(item.cbm)) {
cbm = cbm + parseFloat(item.cbm)
}
})
let that = this
let confirm = text => {
this.$confirm({
title: `${text}不一致,是否继续?`,
okText: '是',
okType: 'danger',
cancelText: '否',
onOk() {
const _data = JSON.parse(JSON.stringify(that.bookingDetails))
delete _data.hbList
BookingOrderAddOrUpdate(_data)
.then(res => {
if (res.success) {
that.$message.success('保存成功')
if (that.isAdd) {
that.isCopy = false
that.isAdd = false
that.$router.replace({
name: 'BookingDetail',
query: {
id: res.data,
type: that.bookingDetails.carrierid,
noOpenTab: true,
mblno: that.bookingDetails.mblno
}
})
} else if (that.$route.query.mblno === that.bookingDetails.mblno) {
that.isCopy = false
that.isAdd = false
console.log('1.1 == 保存成功 - 不切换路由 ==', that.id)
// that.init()
that.checkSaveFun({ type: 'hbList', hasChange: false })
that.checkSaveFun({ type: 'details', hasChange: false })
} else {
that.isCopy = false
that.isAdd = false
// console.log('1.2 == - ==', that.id)
that.$router.replace({
name: 'BookingDetail',
query: {
id: that.id,
type: that.bookingDetails.carrierid,
noOpenTab: true,
mblno: that.bookingDetails.mblno
}
})
}
// that.init()
that.$forceUpdate()
} else {
if (typeof res.message === 'string') {
that.$message.error(res.message)
} else {
that.$message.error('保存失败')
}
}
})
} else if (this.$route.query.mblno === this.bookingDetails.mblno) {
this.isCopy = false
this.isAdd = false
console.log('1.1 == 保存成功 - 不切换路由 ==', this.id)
// this.init()
this.checkSaveFun({ type: 'hbList', hasChange: false })
this.checkSaveFun({ type: 'details', hasChange: false })
} else {
this.isCopy = false
this.isAdd = false
// console.log('1.2 == - ==', this.id)
this.$router.replace({
name: 'BookingDetail',
query: {
id: this.id,
type: this.bookingDetails.carrierid,
noOpenTab: true,
mblno: this.bookingDetails.mblno
}
.catch(err => {
console.log(err)
})
}
// this.init()
this.$forceUpdate()
} else {
if (typeof res.message === 'string') {
this.$message.error(res.message)
} else {
this.$message.error('保存失败')
}
}
})
.catch(err => {
console.log(err)
},
onCancel() {
return false
},
class: 'test'
})
}
let WText = ''
if (parseFloat(pkgs) != parseFloat(this.bookingDetails.pkgs)) {
if (WText) {
WText = `${WText},件数`
} else {
WText = `件数`
}
}
if (parseFloat(kgs) != parseFloat(this.bookingDetails.kgs)) {
if (WText) {
WText = `${WText},重量`
} else {
WText = `重量`
}
}
if (parseFloat(cbm) != parseFloat(this.bookingDetails.cbm)) {
if (WText) {
WText = `${WText},尺码`
} else {
WText = `尺码`
}
}
confirm(WText)
// - end
},
bookingOrderAdd() {
@ -1180,37 +1232,110 @@ export default {
return false
}
}
// - end
const _data = JSON.parse(JSON.stringify(this.bookingDetails))
delete _data.hbList
BookingOrderAddOrUpdate(_data)
.then(res => {
if (res.success) {
this.isAdd = false
this.id = res.data
this.$message.success('保存成功')
// this.bookingDetails = JSON.parse(JSON.stringify(initDetail))
this.$router.replace({
name: 'BookingDetail',
query: {
id: res.data,
type: this.bookingDetails.carrierid,
noOpenTab: true,
mblno: this.bookingDetails.mblno
}
})
this.$forceUpdate()
} else {
if (typeof res.message === 'string') {
this.$message.error(res.message)
} else {
this.$message.error('保存失败')
}
}
})
.catch(err => {
console.log(err)
let pkgs = 0
let kgs = 0
let cbm = 0
this.bookingDetails.ctnInputs.forEach(item => {
if (parseFloat(item.pkgs)) {
pkgs = pkgs + parseFloat(item.pkgs)
}
if (parseFloat(item.kgs)) {
kgs = kgs + parseFloat(item.kgs)
}
if (parseFloat(item.cbm)) {
cbm = cbm + parseFloat(item.cbm)
}
})
let that = this
let confirm = text => {
this.$confirm({
title: `${text}不一致,是否继续?`,
okText: '是',
okType: 'danger',
cancelText: '否',
onOk() {
const _data = JSON.parse(JSON.stringify(that.bookingDetails))
delete _data.hbList
BookingOrderAddOrUpdate(_data)
.then(res => {
if (res.success) {
that.$message.success('保存成功')
if (that.isAdd) {
that.isCopy = false
that.isAdd = false
that.$router.replace({
name: 'BookingDetail',
query: {
id: res.data,
type: that.bookingDetails.carrierid,
noOpenTab: true,
mblno: that.bookingDetails.mblno
}
})
} else if (that.$route.query.mblno === that.bookingDetails.mblno) {
that.isCopy = false
that.isAdd = false
console.log('1.1 == 保存成功 - 不切换路由 ==', that.id)
// that.init()
that.checkSaveFun({ type: 'hbList', hasChange: false })
that.checkSaveFun({ type: 'details', hasChange: false })
} else {
that.isCopy = false
that.isAdd = false
// console.log('1.2 == - ==', that.id)
that.$router.replace({
name: 'BookingDetail',
query: {
id: that.id,
type: that.bookingDetails.carrierid,
noOpenTab: true,
mblno: that.bookingDetails.mblno
}
})
}
// that.init()
that.$forceUpdate()
} else {
if (typeof res.message === 'string') {
that.$message.error(res.message)
} else {
that.$message.error('保存失败')
}
}
})
.catch(err => {
console.log(err)
})
},
onCancel() {
return false
},
class: 'test'
})
}
let WText = ''
if (parseFloat(pkgs) != parseFloat(this.bookingDetails.pkgs)) {
if (WText) {
WText = `${WText},件数`
} else {
WText = `件数`
}
}
if (parseFloat(kgs) != parseFloat(this.bookingDetails.kgs)) {
if (WText) {
WText = `${WText},重量`
} else {
WText = `重量`
}
}
if (parseFloat(cbm) != parseFloat(this.bookingDetails.cbm)) {
if (WText) {
WText = `${WText},尺码`
} else {
WText = `尺码`
}
}
confirm(WText)
},
spliceMorefun(str) {
@ -1460,7 +1585,7 @@ export default {
pkgsEnCapitalFun(data) {
this.bookingDetails.totalno = data
},
changeParentTabs (type) {
changeParentTabs(type) {
this.mainOrderActiveKey = type
}
}
@ -1603,27 +1728,33 @@ export default {
right: 16px !important;
}
/deep/ form .has-feedback > .ant-select .ant-select-arrow, form .has-feedback > .ant-select .ant-select-selection__clear, form .has-feedback :not(.ant-input-group-addon) > .ant-select .ant-select-arrow, form .has-feedback :not(.ant-input-group-addon) > .ant-select .ant-select-selection__clear{
/deep/ form .has-feedback > .ant-select .ant-select-arrow,
form .has-feedback > .ant-select .ant-select-selection__clear,
form .has-feedback :not(.ant-input-group-addon) > .ant-select .ant-select-arrow,
form .has-feedback :not(.ant-input-group-addon) > .ant-select .ant-select-selection__clear {
right: 9px !important;
}
/deep/ form .has-feedback .ant-input-affix-wrapper .ant-input-suffix{
/deep/ form .has-feedback .ant-input-affix-wrapper .ant-input-suffix {
right: 0px !important;
}
/deep/ form .has-feedback .ant-calendar-picker-icon, form .has-feedback .ant-time-picker-icon, form .has-feedback .ant-calendar-picker-clear, form .has-feedback .ant-time-picker-clear{
/deep/ form .has-feedback .ant-calendar-picker-icon,
form .has-feedback .ant-time-picker-icon,
form .has-feedback .ant-calendar-picker-clear,
form .has-feedback .ant-time-picker-clear {
right: 0px !important;
}
// === 0217 ===
.booking-detail{
.booking-detail {
margin-top: -16px;
margin-left: -16px;
margin-right: -16px;
/deep/ .ant-card-body{
/deep/ .ant-card-body {
margin-bottom: 2px !important;
}
/deep/ .ant-collapse-header{
/deep/ .ant-collapse-header {
padding: 4px 10px !important;
}
// /deep/ .ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
@ -1633,20 +1764,21 @@ export default {
// }
}
.parent-tabs-box{
.parent-tabs-box {
width: 100%;
// float: none;
list-style: none;
position: relative;
text-align: left;
padding: 29px 0 0 0;
.parents-tabs-top{
position:absolute;
top: 0;left: 0;
.parents-tabs-top {
position: absolute;
top: 0;
left: 0;
li {
float: left;
}
input[type="radio"] {
input[type='radio'] {
position: absolute;
top: -9999px;
left: -9999px;
@ -1670,14 +1802,14 @@ export default {
// transition: all 0.2s ease-in-out;
margin-right: 4px;
}
[id^="tab"]:checked + label {
[id^='tab']:checked + label {
top: 0;
background: #fff;
color: @primary-color;
font-size: 14px;
}
}
.parents-tabs-content{
.parents-tabs-content {
width: 100%;
overflow: hidden;
white-space: nowrap;
@ -1685,7 +1817,7 @@ export default {
.tab-content {
display: inline-block;
vertical-align: top;
transition: .5s all;
transition: 0.5s all;
overflow: hidden;
width: 100%;
padding: 10px 0;
@ -1695,5 +1827,4 @@ export default {
// display: block;
// }
}
</style>

@ -1,6 +1,6 @@
<template>
<div class="goods-table">
<a-card :bordered="false" :bodyStyle="{padding: '10px 20px'}">
<a-card :bordered="false" :bodyStyle="{ padding: '10px 20px' }">
<div class="from-line">
<div class="left">
<a-button class="btn btn-add" type="primary" @click="addboxLine"></a-button>
@ -145,7 +145,7 @@ export default {
renderBodyCell: ({ row, column, rowIndex }, h) => {
return (
<a-select
size='small'
size="small"
value={row['ctnall']}
showSearch
ref="ctnallView"
@ -275,7 +275,7 @@ export default {
renderBodyCell: ({ row, column, rowIndex }, h) => {
return (
<a-select
size='small'
size="small"
allow-clear={true}
showSearch
defaultValue={row['kindpkgs']}
@ -400,7 +400,7 @@ export default {
renderBodyCell: ({ row, column, rowIndex }, h) => {
return (
<a-select
size='small'
size="small"
show-search
value={row['weightype']}
option-filter-prop="children"
@ -1177,7 +1177,7 @@ export default {
})
this.totalPkgs = pkgs
},
developboxLine () {
developboxLine() {
const arr = []
let key = 0
this.tableData.map((item, index) => {
@ -1193,9 +1193,9 @@ export default {
sunData.ctnnum = 1
sunData.rowKey = key
key++
if (!(/(^[1-9]\d*$)/.test(sunData.pkgs / num))) {
if (!/(^[1-9]\d*$)/.test(sunData.pkgs / num)) {
if (i !== num - 1) {
const averagePkgs = (sunData.pkgs / num) + ''
const averagePkgs = sunData.pkgs / num + ''
const cNum = averagePkgs.indexOf('.')
sunData.pkgs = Number(averagePkgs.substr(0, cNum))
surplusPkgs = surplusPkgs - sunData.pkgs
@ -1207,9 +1207,9 @@ export default {
}
//
if (!(/(^[1-9]\d*$)/.test(sunData.kgs * 100000 / num))) {
if (!/(^[1-9]\d*$)/.test((sunData.kgs * 100000) / num)) {
if (i !== num - 1) {
const averagekgs = (sunData.kgs * 100000 / num) + ''
const averagekgs = (sunData.kgs * 100000) / num + ''
const cNum = averagekgs.indexOf('.')
sunData.kgs = Number(averagekgs.substr(0, cNum)) / 100000
surpluskgs = surpluskgs - Number(averagekgs.substr(0, cNum))
@ -1217,13 +1217,13 @@ export default {
sunData.kgs = surpluskgs / 100000
}
} else {
sunData.kgs = ((sunData.kgs * 100000) / num) / 100000
sunData.kgs = (sunData.kgs * 100000) / num / 100000
}
//
if (!(/(^[1-9]\d*$)/.test(sunData.cbm * 100000 / num))) {
if (!/(^[1-9]\d*$)/.test((sunData.cbm * 100000) / num)) {
if (i !== num - 1) {
const averagecbm = (sunData.cbm * 100000 / num) + ''
const averagecbm = (sunData.cbm * 100000) / num + ''
const cNum = averagecbm.indexOf('.')
sunData.cbm = Number(averagecbm.substr(0, cNum)) / 100000
surpluscbm = surpluscbm - Number(averagecbm.substr(0, cNum))
@ -1231,7 +1231,7 @@ export default {
sunData.cbm = surpluscbm / 100000
}
} else {
sunData.cbm = ((sunData.cbm * 100000) / num) / 100000
sunData.cbm = (sunData.cbm * 100000) / num / 100000
}
if (sunData.weightype === '累加') {
sunData['weighkgs'] = this.calc(Number(sunData['kgs']), Number(sunData['tareweight']), '+')
@ -1409,26 +1409,52 @@ export default {
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)
cbm =
parseFloat((item.cbm / item.ctnnum).toFixed(2)) +
parseFloat(item.cbm) -
parseFloat(parseFloat((item.cbm / item.ctnnum).toFixed(2)) * item.ctnnum)
} 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
parseFloat(item.pkgs) ? (totalPkgs = totalPkgs + parseFloat(item.pkgs)) : ''
parseFloat(item.kgs) ? (totalKgs = totalKgs + parseFloat(item.kgs)) : ''
parseFloat(item.cbm) ? (totalCbm = totalCbm + parseFloat(item.cbm)) : ''
data.push({ ...item, ctnnum: 1, rowKey: num })
data.push({
...item,
ctnnum: 1,
rowKey: num,
id: '',
pkgs: pkgs,
kgs: kgs,
cbm: cbm
})
}
} else {
num = num + 1
parseFloat(item.pkgs) ? (totalPkgs = totalPkgs + parseFloat(item.pkgs)) : ''
parseFloat(item.kgs) ? (totalKgs = totalKgs + parseFloat(item.kgs)) : ''
parseFloat(item.cbm) ? (totalCbm = totalCbm + parseFloat(item.cbm)) : ''
data.push({ ...item, rowKey: num })
}
})
console.log(totalPkgs, totalKgs, totalCbm)
this.totalPkgs = totalPkgs
this.totalKgs = totalKgs
this.totalCbm = totalCbm
this.totalKgs = totalKgs.toFixed(2)
this.totalCbm = totalCbm.toFixed(2)
this.tableData = data
this.$forceUpdate()
} else {
@ -1629,7 +1655,7 @@ export default {
.left {
text-align: left;
width: 660px;
float:left;
float: left;
.btn {
margin-right: 10px;
font-size: 14px;
@ -1714,8 +1740,21 @@ export default {
display: block;
}
.ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-body-tr td.ve-table-body-td, .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-expand-tr td.ve-table-body-td {
padding:0 5px;
.ve-table
.ve-table-container
.ve-table-content-wrapper
table.ve-table-content
tbody.ve-table-body
tr.ve-table-body-tr
td.ve-table-body-td,
.ve-table
.ve-table-container
.ve-table-content-wrapper
table.ve-table-content
tbody.ve-table-body
tr.ve-table-expand-tr
td.ve-table-body-td {
padding: 0 5px;
}
// /deep/ .ve-table-container{

Loading…
Cancel
Save