|
|
|
@ -45,6 +45,7 @@
|
|
|
|
|
<goodsTable
|
|
|
|
|
ref="goodsTable"
|
|
|
|
|
:details="bookingDetails"
|
|
|
|
|
:rules="tableRules"
|
|
|
|
|
@changeDetail="changeDetailFun"
|
|
|
|
|
@changeTotal="changeTotalFun"
|
|
|
|
|
v-if="!inPageLoading"
|
|
|
|
@ -369,7 +370,21 @@ export default {
|
|
|
|
|
'freightpayer': [ { required: false, message: '请输入付款方', trigger: 'change' } ],
|
|
|
|
|
'bookingEDIExt.weiTuoFang': [ { required: false, message: '请输入委托方', trigger: 'change' } ],
|
|
|
|
|
},
|
|
|
|
|
hasEdiRules: false
|
|
|
|
|
hasEdiRules: false,
|
|
|
|
|
tableRules: {
|
|
|
|
|
ctnall: { required: false, title: '箱型', message: '请选择箱型', trigger: 'change' },
|
|
|
|
|
ctnnum: { required: false, title: '箱量', message: '请选择箱量', trigger: 'change' },
|
|
|
|
|
cntrno: { required: false, title: '箱号', message: '请选择箱号', trigger: 'change' },
|
|
|
|
|
sealno: { required: false, title: '封号', message: '请选择封号', trigger: 'change' },
|
|
|
|
|
pkgs: { required: false, title: '件数', message: '请选择件数', trigger: 'change' },
|
|
|
|
|
kindpkgs: { required: false, title: '包装', message: '请选择包装', trigger: 'change' },
|
|
|
|
|
kgs: { required: false, title: '重量', message: '请选择重量', trigger: 'change' },
|
|
|
|
|
cbm: { required: false, title: '尺码', message: '请选择尺码', trigger: 'change' },
|
|
|
|
|
tareweight: { required: false, title: '箱皮重', message: '请选择箱皮重', trigger: 'change' },
|
|
|
|
|
weightype: { required: false, title: '称重方式', message: '请选择称重方式', trigger: 'change' },
|
|
|
|
|
weighkgs: { required: false, title: '称重重量', message: '请选择称重重量', trigger: 'change' }
|
|
|
|
|
},
|
|
|
|
|
hasTableRules: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
@ -653,12 +668,13 @@ export default {
|
|
|
|
|
type: 'booking_form_col'
|
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
|
|
|
|
// this.checkFrom = ['customername', 'mblno', 'carrierid', 'forwarder', 'shipper', 'consignee', 'notifyparty', 'yard', 'customser', 'marks', 'cargoid', 'hscode', 'issuetype', 'issuedate', 'soremark', 'siremark', 'bookingEDIExt.sendCode', 'bookingEDIExt.receiveCode']
|
|
|
|
|
if (res.data && JSON.parse(res.data.configJson).length) {
|
|
|
|
|
this.checkFrom = JSON.parse(res.data.configJson) || []
|
|
|
|
|
} else {
|
|
|
|
|
this.checkFrom = []
|
|
|
|
|
}
|
|
|
|
|
// 测试数据
|
|
|
|
|
// this.checkFrom = ['customername', 'mblno', 'carrierid', 'forwarder', 'shipper', 'consignee', 'notifyparty', 'yard', 'customser', 'marks', 'cargoid', 'hscode', 'issuetype', 'issuedate', 'soremark', 'siremark', 'bookingEDIExt.sendCode', 'bookingEDIExt.receiveCode', 'ctnall', 'ctnnum']
|
|
|
|
|
Object.keys(this.basicRules).map((item, index) => {
|
|
|
|
|
if (this.checkFrom.includes(item)) {
|
|
|
|
|
this.basicRules[item][0].required = true
|
|
|
|
@ -687,7 +703,12 @@ export default {
|
|
|
|
|
Object.keys(this.ediRules).map((item, index) => {
|
|
|
|
|
if (this.checkFrom.includes(item)) {
|
|
|
|
|
this.ediRules[item][0].required = true
|
|
|
|
|
// this.hasEdiRules = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
Object.keys(this.tableRules).map((item, index) => {
|
|
|
|
|
if (this.checkFrom.includes(item)) {
|
|
|
|
|
this.tableRules[item].required = true
|
|
|
|
|
this.hasTableRules = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
@ -861,6 +882,23 @@ export default {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 箱信息验证
|
|
|
|
|
if (this.hasTableRules) {
|
|
|
|
|
let tableErrTip = ''
|
|
|
|
|
this.bookingDetails.ctnInputs.map((item, index) => {
|
|
|
|
|
Object.keys(item).map((label, lindex) => {
|
|
|
|
|
if (this.tableRules[label] && this.tableRules[label].required && !item[label]) {
|
|
|
|
|
console.log('这里需要必填: ', label, this.tableRules[label].message)
|
|
|
|
|
tableErrTip = `${tableErrTip} 序号${index + 1}中${this.tableRules[label].title}未填写,`
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
if (tableErrTip !== '') {
|
|
|
|
|
this.$message.error(`箱信息错误: ${tableErrTip.substr(0, tableErrTip.length - 1)}`, 3)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 自定义必填项验证 - end
|
|
|
|
|
const _data = JSON.parse(JSON.stringify(this.bookingDetails))
|
|
|
|
|
delete _data.hbList
|
|
|
|
@ -954,6 +992,22 @@ export default {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 箱信息验证
|
|
|
|
|
if (this.hasTableRules) {
|
|
|
|
|
let tableErrTip = ''
|
|
|
|
|
this.bookingDetails.ctnInputs.map((item, index) => {
|
|
|
|
|
Object.keys(item).map((label, lindex) => {
|
|
|
|
|
if (this.tableRules[label] && this.tableRules[label].required && !item[label]) {
|
|
|
|
|
console.log('这里需要必填: ', label, this.tableRules[label].message)
|
|
|
|
|
tableErrTip = `${tableErrTip} 序号${index + 1}中${this.tableRules[label].title}未填写,`
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
if (tableErrTip !== '') {
|
|
|
|
|
this.$message.error(`箱信息错误: ${tableErrTip.substr(0, tableErrTip.length - 1)}`, 3)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 自定义必填项验证 - end
|
|
|
|
|
const _data = JSON.parse(JSON.stringify(this.bookingDetails))
|
|
|
|
|
delete _data.hbList
|
|
|
|
|