Commit c0f187f8 authored by dragondean@qq.com's avatar dragondean@qq.com

无收货人的发货人默认控货

parent aef45d70
......@@ -775,22 +775,22 @@ export default {
},
computed:{
rules(){
return {
const rules = {
marks: [
{required: true, message: this.$t('请填写唛头')},
{
validator: (rule, value, callback) => {
/* 20240823 新需求:唛头数据校验修改成字母+数字组合,去掉原必须字母开头的限制
if(!/[a-zA-Z]/.test(value.charAt(0))){
return callback(new Error(this.$t('唛头必须以字母开头')))
} */
// 必须是字母和数字
let reg = /^[a-zA-Z0-9]*$/;
if (!reg.test(value)) {
return callback(new Error(this.$t('唛头只能是字母和数字')));
}
callback()
},
trigger: 'blur'
}
],
consignorContactsId : [{required: true, message: this.$t('发货人不能为空')}],
consigneeContactsId : [{required: true, message: this.$t('收货人不能为空')}],
transportId : [{required: true, message: this.$t('请选择运输方式')}],
departureId : [{required: true, message: this.$t('请选择始发城市')}],
objectiveId : [{required: true, message: this.$t('请选择目的城市')}],
......@@ -806,6 +806,11 @@ export default {
warehouseType : [{required: true, message: this.$t('请选择入仓类型')}],
harvestMethod : [{required: true, message: this.$t('请选择收货方式')}]
}
// 有收货人则添加收货人校验
if(this.hasConsignee){
rules.consigneeContactsId = [{required: true, message: this.$t('收货人不能为空')}]
}
return rules
},
// 是否已完成入仓
inWarehouse(){
......@@ -1342,11 +1347,17 @@ export default {
this.$set(this.form, this.contactChooseType + 'Name', contact.contactsName)
this.$set(this.form, this.contactChooseType + 'NameEn', contact.contactsNameEn||'')
this.$set(this.form, this.contactChooseType + 'Phone', contact.phoneNew)
this.noConsignee = contact.noConsignee
// 如果发货人不允许无收货人,则重置为有收货人
if(!this.noConsignee && !this.hasConsignee){
this.$set(this, 'hasConsignee', true)
if(this.contactChooseType == 'consignor'){
this.noConsignee = contact.noConsignee
// 如果允许无收货人,则默认无收货人、控货
if(this.noConsignee){
this.hasConsignee = false
}
// 如果发货人不允许无收货人,则重置为有收货人
if(!this.noConsignee && !this.hasConsignee){
this.$set(this, 'hasConsignee', true)
}
}
this.contactChooseType = null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment