修改新增刷新

dev
lilu 2 years ago
parent a70776ac82
commit aeb520224e

@ -237,7 +237,7 @@ export default {
isCopy: this.$route.query.isCopy || false,
inPageLoading: false,
// bookingDetails: {},
bookingDetails: initDetail,
bookingDetails: JSON.parse(JSON.stringify(initDetail)),
tabBarStyle: {
background: '#fff',
padding: '0 20px'
@ -314,6 +314,18 @@ export default {
id: this.id
}
this.$set(this.historyData, `copy-${this.id}`, hisData)
} else if (this.$route.query.addNum) {
const hisData = {
bookingDetails: this.bookingDetails,
excuteRules: this.excuteRules,
excuteRulesType: this.excuteRulesType,
isAdd: this.isAdd,
tabActiveKey: this.tabActiveKey,
type: this.type,
isCopy: this.isCopy
// id: this.id
}
this.$set(this.historyData, `add-${this.$route.query.addNum}`, hisData)
} else {
const hisData = {
bookingDetails: this.bookingDetails,
@ -359,6 +371,18 @@ export default {
id: this.id
}
this.$set(this.historyData, `copy-${this.id}`, hisData)
} else if (this.$route.query.addNum) {
const hisData = {
bookingDetails: this.bookingDetails,
excuteRules: this.excuteRules,
excuteRulesType: this.excuteRulesType,
isAdd: this.isAdd,
tabActiveKey: this.tabActiveKey,
type: this.type,
isCopy: this.isCopy
// id: this.id
}
this.$set(this.historyData, `add-${this.$route.query.addNum}`, hisData)
} else {
const hisData = {
bookingDetails: this.bookingDetails,
@ -410,6 +434,27 @@ export default {
}, 1500)
// console.log('== ==', $data.isCopy, this.$route.query.isCopy, this.isCopy)
this.$forceUpdate()
} else if (Object.keys(this.historyData).includes(`add-${this.$route.query.addNum}`) && this.$route.query.addNum) {
const $data = JSON.parse(JSON.stringify(this.historyData[`add-${this.$route.query.addNum}`]))
this.bookingDetails = $data.bookingDetails
this.excuteRules = $data.excuteRules
this.excuteRulesType = $data.excuteRulesType
this.isAdd = $data.isAdd
this.tabActiveKey = $data.tabActiveKey
this.isCopy = this.$route.query.isCopy
this.inPageLoading = false
// console.log('== ==', $data.isCopy, this.$route.query.isCopy, this.isCopy)
if (this.isCopy && !$data.isCopy) {
// console.log('== , ==')
this.bookingDetails.mblno = ''
}
setTimeout(() => {
this.inChildLoading = false
if (!Object.keys(this.needSavePages).includes(this.$route.fullPath)) {
this.checkSaveFun({ type: 'details', hasChange: false })
}
}, 1500)
this.$forceUpdate()
} else if (Object.keys(this.historyData).includes(newId)) {
this.id = this.$route.query.id
const $data = JSON.parse(JSON.stringify(this.historyData[newId]))
@ -442,7 +487,7 @@ export default {
}
},
init() {
this.bookingDetails = initDetail
this.bookingDetails = JSON.parse(JSON.stringify(initDetail))
this.excuteRules = []
this.excuteRulesType = ''
this.Showtabs = false
@ -615,6 +660,7 @@ export default {
this.isAdd = false
this.id = res.data
this.$message.success('保存成功')
this.bookingDetails = JSON.parse(JSON.stringify(initDetail))
this.$router.replace({
name: 'BookingDetail',
query: {

@ -147,7 +147,7 @@ export default {
<a-select
value={row['ctnall']}
allow-clear={true}
style="width: 120px"
style="width: 90px"
on-change={val => {
const data = this.ctnList[val]
this.tableData[rowIndex].ctnall = data.name
@ -168,6 +168,7 @@ export default {
key: 'ctnnum ',
title: '箱量',
align: 'left',
width: 60,
edit: true
},
{
@ -175,6 +176,7 @@ export default {
key: 'cntrno',
title: '箱号',
align: 'left',
width: 180,
edit: true
},
{
@ -305,7 +307,8 @@ export default {
field: 'cntrno',
key: 'cntrno',
title: '箱号',
align: 'left'
align: 'left',
width: 240
},
{
field: 'sealno',
@ -853,7 +856,7 @@ export default {
kgs: '',
cbm: '',
tareweight: '',
weightype: '',
weightype: '累加',
weighkgs: '',
rowKey: this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0
}
@ -1047,23 +1050,50 @@ export default {
if (res.success) {
const data = JSON.parse(res.data)
const addTable = []
const cntrnoArr = []
this.tableData.map((item, index) => {
if (!item.cntrno) {
// delete this.tableData[index]
this.tableData.splice(index, 1)
} else {
cntrnoArr.push(item.cntrno)
}
})
const lastNum = this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0
data.map((item, index) => {
const _data = {
rowKey: lastNum + index,
ctnall: '',
ctnnum: '1',
cntrno: '',
sealno: '',
pkgs: '',
kindpkgs: '',
kgs: '',
cbm: '',
tareweight: item.TAREWEIGHT,
weightype: '',
weighkgs: ''
if (cntrnoArr.includes(item.CNTRNO)) {
const setWeighkgs = this.calc(Number(this.tableData[cntrnoArr.indexOf(item.CNTRNO)].kgs), Number(item.TAREWEIGHT), '+')
this.tableData[cntrnoArr.indexOf(item.CNTRNO)] = {
rowKey: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].rowKey,
ctnall: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].ctnall,
ctnnum: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].ctnnum,
cntrno: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].cntrno,
sealno: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].sealno,
pkgs: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].pkgs,
kindpkgs: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].kindpkgs,
kgs: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].kgs,
cbm: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].cbm,
tareweight: item.TAREWEIGHT,
weightype: this.tableData[cntrnoArr.indexOf(item.CNTRNO)].weightype,
weighkgs: setWeighkgs
}
} else {
const _data = {
rowKey: lastNum + index,
ctnall: '',
ctnnum: '1',
cntrno: '',
sealno: '',
pkgs: '',
kindpkgs: '',
kgs: '',
cbm: '',
tareweight: item.TAREWEIGHT,
weightype: '',
weighkgs: ''
}
addTable.push(_data)
}
addTable.push(_data)
})
this.tableData = [...this.tableData, ...addTable]
this.$forceUpdate()

@ -1214,10 +1214,14 @@ export default {
},
kindpkgsSelect(value) {
this.details.kindpkgs = value
const enCapitalRes = this.SetTOTALNO(this.details.pkgs)
this.$emit('pkgsEnCapital', enCapitalRes)
},
kindpkgsChange(value) {
if (!value) {
this.details.kindpkgs = this.details.kindpkgs ? this.details.kindpkgs : ''
const enCapitalRes = this.SetTOTALNO(this.details.pkgs)
this.$emit('pkgsEnCapital', enCapitalRes)
}
this.getPackage(value)
},
@ -1473,7 +1477,7 @@ export default {
},
changePkgs () {
console.log(this.details.pkgs)
let enCapitalRes = this.SetTOTALNO(this.details.pkgs)
const enCapitalRes = this.SetTOTALNO(this.details.pkgs)
this.$emit('pkgsEnCapital', enCapitalRes)
},
SetTOTALNO (SS) {
@ -1502,7 +1506,6 @@ export default {
' ONLY.'
}
} else {
// const strNum = Number(SS);
const strNum = this.GetStringNum(SS);
console.log(strNum)
strKind = SS.substring(strNum.length);

@ -62,10 +62,10 @@
</div>
<div
class="btn-list single-view-1"
v-if="!details.hbList || details.hbList.length === 0"
:style="{ width: '110px' }"
:style="{ width: '150px' }"
>
<button @click="addChild()"><span class="iconfont icon-zhizhishu"></span>添加分单</button>
<button @click="addChild()" v-if="!details.hbList || details.hbList.length === 0"><span class="iconfont icon-zhizhishu"></span></button>
<!-- <button><span class="iconfont icon-electronic-signature"></span>自定义必填项</button> -->
</div>
</a-card>

@ -347,7 +347,8 @@ export default {
{ label: '起运港', value: '1' },
{ label: '目的港', value: '2' }
],
traceValue: []
traceValue: [],
addNum: 0
}
},
created() {
@ -720,7 +721,8 @@ export default {
},
addSubmit() {
this.addVisible = false
this.$router.push({ name: 'BookingDetail', query: { type: this.carrierRadio } })
this.addNum = Math.round(Math.random() * 1000)
this.$router.push({ name: 'BookingDetail', query: { type: this.carrierRadio, addNum: this.addNum } })
},
addCancel() {
this.addVisible = false

Loading…
Cancel
Save