This commit is contained in:
wangshiming
2022-03-07 17:05:09 +08:00
parent 31959f9cbf
commit 4d61c136ff
2 changed files with 154 additions and 140 deletions

View File

@ -337,7 +337,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '必填项' }
errors: { required: '必填项' },
validator: val => this.customValidator(val)
}
},
volume: {
@ -345,7 +346,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
placeholder: '请输入',
}
},
number: {
@ -353,7 +354,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
placeholder: '请输入',
}
},
carModel: {
@ -385,37 +386,60 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }),
change: (tag: any, org: any) => {
if (tag.includes('999')) {
this.sf4.setValue('/carModel', ['999']);
this.sf4.setValue('/carLength', ['999']);
}
}
}
}
},
hidenField: {
type: 'string',
title: '',
default: ' ',
ui: {
widget: 'text'
}
},
insurancePackagedGoods: {
type: 'string',
title: '货物包装',
ui: {
widget: 'dict-select',
params: { dictKey: 'insure:packaged:goods' },
containsAllLabel: false,
validator: val => {
if (this.sf5.value.insuranceType !=='3' && this.isEmpty(val)) {
return [{ keyword: 'required', message: '必填项' }];
} else {
return [];
}
}
} as SFSelectWidgetSchema
},
goodsValue: {
type: 'string',
title: '货物价值',
ui: {
widget: 'custom',
validator: val => {
if (this.sf5.value.insuranceType !=='3' && this.isEmpty(val)) {
return [{ keyword: 'required', message: '必填项' }];
} else {
return [];
}
}
}
},
},
required: ['weight', 'carModel', 'carLength']
};
this.ui4 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
},
$weight: {
grid: { lg: 8, md: 12, sm: 12, xs: 24 }
},
$volume: {
grid: { lg: 8, md: 12, sm: 12, xs: 24 }
},
$number: {
grid: { lg: 8, md: 12, sm: 12, xs: 24 }
},
$carModel: {
spanLabelFixed: 100,
grid: { span: 8 }
},
$carLength: {
spanLabelFixed: 115,
grid: { span: 8 }
}
};
}
initSF5() {
this.schema5 = {
properties: {
@ -445,73 +469,30 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type1: {
type: 'string',
title: '',
enum: ['源曝光率 +10', '车源匹配率 +10'],
enum: ['源曝光率 +10', '车源匹配率 +10'],
readOnly: true,
ui: {
widget: 'checkbox',
visibleIf: { insuranceType: (value: string) => value === '0' }
} as SFCheckboxWidgetSchema,
default: ['源曝光率 +10', '车源匹配率 +10']
default: ['源曝光率 +10', '车源匹配率 +10']
},
type2: {
type: 'string',
title: '',
enum: ['源曝光率 +20', '车源匹配率 +20'],
enum: ['源曝光率 +20', '车源匹配率 +20'],
readOnly: true,
ui: {
widget: 'checkbox',
visibleIf: { insuranceType: (value: string) => value === '1' }
} as SFCheckboxWidgetSchema,
default: ['源曝光率 +20', '车源匹配率 +20']
},
freeInsurance1: {
type: 'string',
title: '赠送基本险',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '0' }
}
},
freeInsurance2: {
type: 'string',
title: '赠送综合险',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '1' }
}
},
insurancePackagedGoods: {
type: 'string',
title: '货物包装',
ui: {
widget: 'dict-select',
params: { dictKey: 'insure:packaged:goods' },
containsAllLabel: false,
visibleIf: { insuranceType: (value: string) => value !== '3' }
} as SFSelectWidgetSchema
},
hidenField: {
type: 'string',
title: '',
default: ' ',
ui: {
widget: 'text'
}
},
goodsValue: {
type: 'string',
title: '货物价值',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
default: ['源曝光率 +20', '车源匹配率 +20']
},
insurancePremium: {
type: 'string',
title: '',
title: '服务包费用',
readOnly:true,
ui: {
widget: 'custom',
validator: val => this.customValidator(val),
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
},
@ -521,9 +502,27 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
hidden: true
}
}
},
freeInsurance1: {
type: 'string',
title: '预投基本险',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '0' }
}
},
freeInsurance2: {
type: 'string',
title: '预投综合险',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '1' }
}
},
},
required: ['insurancePackagedGoods', 'insurancePremium']
required: [ 'insurancePremium']
};
this.ui5 = {
'*': {
@ -544,6 +543,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
/**
* 自定义校验数据
* @param val
@ -1002,6 +1002,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
paymentDays: this.sf7.value.paymentDays,
estimatedKilometers: this.totalDistance,
estimatedTravelTime: this.totalTime,
insurancePackagedGoods:this.sf4.value.insurancePackagedGoods,
goodsValue:this.sf4.value.goodsValue,
};
const modalRef = this.modalService.create({
nzTitle: '运输协议',
@ -1243,7 +1245,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
volume: res?.goodsInfoVOList[0]?.volume || '',
number: res?.goodsInfoVOList[0]?.number || '',
carModel: res?.goodsInfoVOList[0]?.carModel?.split(',') || [],
carLength: res?.goodsInfoVOList[0]?.carLength?.split(',') || []
carLength: res?.goodsInfoVOList[0]?.carLength?.split(',') || [],
goodsValue: res?.goodsValue || '',
insurancePackagedGoods: res?.insurancePackagedGoods || '',
};
if (this.PageStatus === '整车修改') {
this.sf4data.id = res?.goodsInfoVOList[0]?.id;
@ -1251,10 +1255,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.totalFees = res?.shippingInformationVO?.totalFee || '0';
this.sf5data = {
insuranceType: res?.insuranceType || '',
goodsValue: res?.goodsValue || '',
insurancePremium: res?.insurancePremium || '',
insuranceRate: res?.insuranceRate || '',
insurancePackagedGoods: res?.insurancePackagedGoods || ''
};
this.sf6data = {
stateReceipt: res?.stateReceipt,
@ -1381,17 +1383,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
// 计算保价费金额
getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
if (this.sf5.value.goodsValue >= 50000 && this.totalDistance > 0) {
if ( this.sf5.value.insuranceType !=='3' && this.sf4.value.goodsValue >= 50000 && this.totalDistance > 0 ) {
const params = {
insuranceType,
goodsValue: this.sf5.value.goodsValue,
goodsValue: this.sf4.value.goodsValue,
km: this.totalDistance
};
this.service.request(this.service.$api_getWholeInsuranceInfo, params).subscribe(res => {
if (res) {
this.sf5.setValue('/insurancePremium', res.insurancePremium);
this.sf5.setValue('/insuranceRate', res.insuranceRate);
} else {
}else{
this.sf5.setValue('/insurancePremium', null);
this.sf5.setValue('/insuranceRate', null);
}

View File

@ -329,7 +329,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
placeholder: '请输入',
}
},
number: {
@ -337,7 +337,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
placeholder: '请输入',
}
},
carModel: {
@ -373,7 +373,45 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}
}
}
}
},
hidenField: {
type: 'string',
title: '',
default: ' ',
ui: {
widget: 'text'
}
},
insurancePackagedGoods: {
type: 'string',
title: '货物包装',
ui: {
widget: 'dict-select',
params: { dictKey: 'insure:packaged:goods' },
containsAllLabel: false,
validator: val => {
if (this.sf5.value.insuranceType !=='3' && this.isEmpty(val)) {
return [{ keyword: 'required', message: '必填项' }];
} else {
return [];
}
}
} as SFSelectWidgetSchema
},
goodsValue: {
type: 'string',
title: '货物价值',
ui: {
widget: 'custom',
validator: val => {
if (this.sf5.value.insuranceType !=='3' && this.isEmpty(val)) {
return [{ keyword: 'required', message: '必填项' }];
} else {
return [];
}
}
}
},
},
required: ['weight', 'carModel', 'carLength']
};
@ -381,10 +419,6 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
'*': {
spanLabelFixed: 115,
grid: { span: 8 }
},
$carModel: {
spanLabelFixed: 100,
grid: { span: 8 }
}
};
}
@ -418,73 +452,30 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
type1: {
type: 'string',
title: '',
enum: ['源曝光率 +10', '车源匹配率 +10'],
enum: ['源曝光率 +10', '车源匹配率 +10'],
readOnly: true,
ui: {
widget: 'checkbox',
visibleIf: { insuranceType: (value: string) => value === '0' }
} as SFCheckboxWidgetSchema,
default: ['源曝光率 +10', '车源匹配率 +10']
default: ['源曝光率 +10', '车源匹配率 +10']
},
type2: {
type: 'string',
title: '',
enum: ['源曝光率 +20', '车源匹配率 +20'],
enum: ['源曝光率 +20', '车源匹配率 +20'],
readOnly: true,
ui: {
widget: 'checkbox',
visibleIf: { insuranceType: (value: string) => value === '1' }
} as SFCheckboxWidgetSchema,
default: ['源曝光率 +20', '车源匹配率 +20']
},
freeInsurance1: {
type: 'string',
title: '赠送基本险',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '0' }
}
},
freeInsurance2: {
type: 'string',
title: '赠送综合险',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '1' }
}
},
insurancePackagedGoods: {
type: 'string',
title: '货物包装',
ui: {
widget: 'dict-select',
params: { dictKey: 'insure:packaged:goods' },
containsAllLabel: false,
visibleIf: { insuranceType: (value: string) => value !== '3' }
} as SFSelectWidgetSchema
},
hidenField: {
type: 'string',
title: '',
default: ' ',
ui: {
widget: 'text'
}
},
goodsValue: {
type: 'string',
title: '货物价值',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
default: ['源曝光率 +20', '车源匹配率 +20']
},
insurancePremium: {
type: 'string',
title: '',
title: '服务包费用',
readOnly:true,
ui: {
widget: 'custom',
validator: val => this.customValidator(val),
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
},
@ -494,9 +485,27 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: {
hidden: true
}
}
},
freeInsurance1: {
type: 'string',
title: '预投基本险',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '0' }
}
},
freeInsurance2: {
type: 'string',
title: '预投综合险',
ui: {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '1' }
}
},
},
required: ['insurancePackagedGoods', 'insurancePremium']
required: [ 'insurancePremium']
};
this.ui5 = {
'*': {
@ -518,6 +527,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
};
}
initSF6() {
this.schema6 = {
properties: {
@ -935,6 +945,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
paymentDays: this.sf7.value.paymentDays,
estimatedKilometers: this.totalDistance,
estimatedTravelTime: this.totalTime,
insurancePackagedGoods:this.sf4.value.insurancePackagedGoods,
goodsValue:this.sf4.value.goodsValue,
};
console.log(params);
const modalRef = this.modalService.create({
@ -1150,17 +1162,17 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}
// 计算保价费金额
getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
if (this.sf5.value.goodsValue >= 50000 && this.totalDistance > 0) {
if ( this.sf5.value.insuranceType !=='3' && this.sf4.value.goodsValue >= 50000 && this.totalDistance > 0 ) {
const params = {
insuranceType,
goodsValue: this.sf5.value.goodsValue,
goodsValue: this.sf4.value.goodsValue,
km: this.totalDistance
};
this.service.request(this.service.$api_getWholeInsuranceInfo, params).subscribe(res => {
if (res) {
this.sf5.setValue('/insurancePremium', res.insurancePremium);
this.sf5.setValue('/insuranceRate', res.insuranceRate);
} else {
}else{
this.sf5.setValue('/insurancePremium', null);
this.sf5.setValue('/insuranceRate', null);
}