分单必填项, 箱信息必填项

dev
lilu 2 years ago
parent 5cbfb1e4dd
commit 5947f93f82

@ -44,7 +44,7 @@
<!-- 备注信息 -->
<remarksInfo ref="remarksInfo" :details="editDetails" :rules="remarksRules" @changeDetail="changeDetailFun"></remarksInfo>
<!-- 箱型 -->
<goodsTable ref="goodsTable" :details="editDetails" @changeDetail="changeDetailFun"></goodsTable>
<goodsTable ref="goodsTable" :details="editDetails" :rules="tableRules" @changeDetail="changeDetailFun"></goodsTable>
</div>
</a-tab-pane>
<a-tab-pane key="2" tab="EDI补充信息">
@ -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

@ -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

@ -86,6 +86,12 @@ export default {
default: () => {
return {}
}
},
rules: {
type: Object,
default: () => {
return {}
}
}
},
data() {
@ -175,6 +181,15 @@ export default {
// />
// </div>
)
},
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.ctnall.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
@ -183,7 +198,16 @@ export default {
title: '箱量',
align: 'left',
width: 60,
edit: true
edit: true,
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.ctnnum.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
field: 'cntrno',
@ -191,21 +215,48 @@ export default {
title: '箱号',
align: 'left',
width: 130,
edit: true
edit: true,
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.cntrno.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
field: 'sealno',
key: 'sealno',
title: '封号',
align: 'left',
edit: true
edit: true,
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.sealno.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
field: 'pkgs',
key: 'pkgs',
title: '件数',
align: 'left',
edit: true
edit: true,
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.pkgs.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
field: 'kindpkgs',
@ -265,6 +316,15 @@ export default {
})}
</a-select>
)
},
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.kindpkgs.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
@ -272,21 +332,48 @@ export default {
key: 'kgs',
title: '重量',
align: 'left',
edit: true
edit: true,
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.kgs.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
field: 'cbm',
key: 'cbm',
title: '尺码',
align: 'left',
edit: true
edit: true,
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.cbm.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
field: 'tareweight',
key: 'tareweight',
title: '箱皮重',
align: 'left',
edit: true
edit: true,
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.tareweight.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
field: 'weightype',
@ -316,6 +403,15 @@ export default {
<a-select-option value="总重">总重</a-select-option>
</a-select>
)
},
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.weightype.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
},
{
@ -323,7 +419,16 @@ export default {
key: 'weighkgs',
title: '称重重量',
align: 'left',
edit: true
edit: true,
renderHeaderCell: ({ column }, h) => {
return (
<span class="text-bold" style="text-align: center;">
{
this.rules.weighkgs.required ? <i style="color: #f00">*</i> : ''
} {column.title}
</span>
);
}
}
],
modelColumns: [
@ -1373,4 +1478,9 @@ export default {
text-align: center;
line-height: 60px;
}
.text-bold{
text-align: center;
width: 100%;
display: block;
}
</style>

Loading…
Cancel
Save