diff --git a/src/views/main/BookingLedger/detail/components/sedOrder.vue b/src/views/main/BookingLedger/detail/components/sedOrder.vue
index 86c0cce..3493311 100644
--- a/src/views/main/BookingLedger/detail/components/sedOrder.vue
+++ b/src/views/main/BookingLedger/detail/components/sedOrder.vue
@@ -44,7 +44,7 @@
-
+
@@ -239,7 +239,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
}
},
watch: {
@@ -276,11 +290,13 @@ export default {
immediate: true,
handler(nD, oD) {
this.id = this.$route.query.id
- // this.$refs.basicInfo.$refs.basicFrom.clearValidate()
- // this.$refs.mailingInfo.$refs.mailingFrom.clearValidate()
- // this.$refs.cargoInfo.$refs.cargoFrom.clearValidate()
- // this.$refs.billInfo.$refs.billFrom.clearValidate()
- // this.$refs.remarksInfo.$refs.remarkFrom.clearValidate()
+ if (this.$refs.basicInfo) {
+ this.$refs.basicInfo.$refs.basicFrom.clearValidate()
+ this.$refs.mailingInfo.$refs.mailingFrom.clearValidate()
+ this.$refs.cargoInfo.$refs.cargoFrom.clearValidate()
+ this.$refs.billInfo.$refs.billFrom.clearValidate()
+ this.$refs.remarksInfo.$refs.remarkFrom.clearValidate()
+ }
}
},
checkFrom (nval, oval) {
@@ -341,7 +357,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()
@@ -476,6 +497,22 @@ export default {
return false
}
}
+ // 箱信息验证
+ if (this.hasTableRules) {
+ let tableErrTip = ''
+ this.editDetails.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
let data = JSON.parse(JSON.stringify(this.editDetails))
delete data.isNoSave
@@ -551,6 +588,22 @@ export default {
return false
}
}
+ // 箱信息验证
+ if (this.hasTableRules) {
+ let tableErrTip = ''
+ this.editDetails.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
let data = JSON.parse(JSON.stringify(this.editDetails))
delete data.isNoSave
diff --git a/src/views/main/BookingLedger/detail/index.vue b/src/views/main/BookingLedger/detail/index.vue
index e313ede..ee4a202 100644
--- a/src/views/main/BookingLedger/detail/index.vue
+++ b/src/views/main/BookingLedger/detail/index.vue
@@ -45,6 +45,7 @@
{
- // 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
diff --git a/src/views/main/BookingLedger/detail/modules/goodsTable.vue b/src/views/main/BookingLedger/detail/modules/goodsTable.vue
index 3213720..7a82b7f 100644
--- a/src/views/main/BookingLedger/detail/modules/goodsTable.vue
+++ b/src/views/main/BookingLedger/detail/modules/goodsTable.vue
@@ -86,6 +86,12 @@ export default {
default: () => {
return {}
}
+ },
+ rules: {
+ type: Object,
+ default: () => {
+ return {}
+ }
}
},
data() {
@@ -175,6 +181,15 @@ export default {
// />
//
)
+ },
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.ctnall.required ? * : ''
+ } {column.title}
+
+ );
}
},
{
@@ -183,7 +198,16 @@ export default {
title: '箱量',
align: 'left',
width: 60,
- edit: true
+ edit: true,
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.ctnnum.required ? * : ''
+ } {column.title}
+
+ );
+ }
},
{
field: 'cntrno',
@@ -191,21 +215,48 @@ export default {
title: '箱号',
align: 'left',
width: 130,
- edit: true
+ edit: true,
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.cntrno.required ? * : ''
+ } {column.title}
+
+ );
+ }
},
{
field: 'sealno',
key: 'sealno',
title: '封号',
align: 'left',
- edit: true
+ edit: true,
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.sealno.required ? * : ''
+ } {column.title}
+
+ );
+ }
},
{
field: 'pkgs',
key: 'pkgs',
title: '件数',
align: 'left',
- edit: true
+ edit: true,
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.pkgs.required ? * : ''
+ } {column.title}
+
+ );
+ }
},
{
field: 'kindpkgs',
@@ -265,6 +316,15 @@ export default {
})}
)
+ },
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.kindpkgs.required ? * : ''
+ } {column.title}
+
+ );
}
},
{
@@ -272,21 +332,48 @@ export default {
key: 'kgs',
title: '重量',
align: 'left',
- edit: true
+ edit: true,
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.kgs.required ? * : ''
+ } {column.title}
+
+ );
+ }
},
{
field: 'cbm',
key: 'cbm',
title: '尺码',
align: 'left',
- edit: true
+ edit: true,
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.cbm.required ? * : ''
+ } {column.title}
+
+ );
+ }
},
{
field: 'tareweight',
key: 'tareweight',
title: '箱皮重',
align: 'left',
- edit: true
+ edit: true,
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.tareweight.required ? * : ''
+ } {column.title}
+
+ );
+ }
},
{
field: 'weightype',
@@ -316,6 +403,15 @@ export default {
总重
)
+ },
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.weightype.required ? * : ''
+ } {column.title}
+
+ );
}
},
{
@@ -323,7 +419,16 @@ export default {
key: 'weighkgs',
title: '称重重量',
align: 'left',
- edit: true
+ edit: true,
+ renderHeaderCell: ({ column }, h) => {
+ return (
+
+ {
+ this.rules.weighkgs.required ? * : ''
+ } {column.title}
+
+ );
+ }
}
],
modelColumns: [
@@ -1373,4 +1478,9 @@ export default {
text-align: center;
line-height: 60px;
}
+.text-bold{
+ text-align: center;
+ width: 100%;
+ display: block;
+}