This commit is contained in:
wangshiming
2022-03-09 10:15:27 +08:00
parent 9c9b45f96a
commit a11bb90f20
2 changed files with 17 additions and 11 deletions

View File

@ -150,10 +150,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: { ui: {
widget: 'select', widget: 'select',
// serverSearch: true, // serverSearch: true,
allowClear: true,
searchDebounceTime: 300, searchDebounceTime: 300,
searchLoadingText: '搜索中...', searchLoadingText: '搜索中...',
onSearch: (q: any) => { onSearch: (q: any) => {
let str = q.replace(/^\s+|\s+$/g, ''); let str = q?.replace(/^\s+|\s+$/g, '');
if (str) { if (str) {
return this.service return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: str }) .request(this.service.$api_enterpriceList, { enterpriseName: str })
@ -164,7 +165,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} }
}, },
change: (q: any, qs: any) => { change: (q: any, qs: any) => {
let str = q.replace(/^\s+|\s+$/g, ''); let str = q?.replace(/^\s+|\s+$/g, '');
if (str) { if (str) {
this.getRegionCode(str); this.getRegionCode(str);
this.shipperName = qs?.label; this.shipperName = qs?.label;
@ -894,7 +895,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.sf5.validator({ emitError: true }); this.sf5.validator({ emitError: true });
this.sf6.validator({ emitError: true }); this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true }); this.sf7.validator({ emitError: true });
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) { if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) {
this.service.msgSrv.warning('请完善必填项!'); this.service.msgSrv.warning('请完善必填项!');
return; return;
} }
@ -1235,8 +1236,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} }
this.validateForm1.patchValue( this.validateForm1.patchValue(
{ {
loadingTime: new Date(Date.parse(res.loadingTime.replace(/-/g, '/'))), loadingTime: new Date(Date.parse(res?.loadingTime.replace(/-/g, '/'))),
unloadingTime: new Date(Date.parse(res.unloadingTime.replace(/-/g, '/'))) unloadingTime: new Date(Date.parse(res?.unloadingTime.replace(/-/g, '/')))
}, },
{ onlySelf: true } { onlySelf: true }
); );
@ -1383,6 +1384,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} }
// 计算保价费金额 // 计算保价费金额
getInsurersPrice(insuranceType = this.sf5.value.insuranceType) { getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
console.log(this.totalDistance)
if ( insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) { if ( insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) {
const params = { const params = {
insuranceType, insuranceType,

View File

@ -142,12 +142,12 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
maxLength: 30, maxLength: 30,
ui: { ui: {
widget: 'select', widget: 'select',
serverSearch: true, allowClear: true,
searchDebounceTime: 300, searchDebounceTime: 300,
searchLoadingText: '搜索中...', searchLoadingText: '搜索中...',
onSearch: (q: any) => { onSearch: (q: any) => {
console.log(q === ' '); console.log(q === ' ');
let str = q.replace(/^\s+|\s+$/g, ''); let str = q?.replace(/^\s+|\s+$/g, '');
if (str) { if (str) {
return this.service return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: str }) .request(this.service.$api_enterpriceList, { enterpriseName: str })
@ -158,7 +158,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
} }
}, },
change: (q: any, qs: any) => { change: (q: any, qs: any) => {
let str = q.replace(/^\s+|\s+$/g, ''); let str = q?.replace(/^\s+|\s+$/g, '');
if (str) { if (str) {
this.getRegionCode(str); this.getRegionCode(str);
this.shipperName = qs?.label; this.shipperName = qs?.label;
@ -845,12 +845,15 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
this.validateForm1.controls[key].markAsDirty(); this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity(); this.validateForm1.controls[key].updateValueAndValidity();
}); });
this.sf1.validator({ emitError: true });
this.sf3.validator({ emitError: true }); this.sf3.validator({ emitError: true });
this.sf4.validator({ emitError: true }); this.sf4.validator({ emitError: true });
this.sf5.validator({ emitError: true }); this.sf5.validator({ emitError: true });
this.sf6.validator({ emitError: true }); this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true }); this.sf7.validator({ emitError: true });
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) { console.log(!this.sf1.valid)
console.log(this.sf1.value)
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) {
this.service.msgSrv.warning('请完善必填项!'); this.service.msgSrv.warning('请完善必填项!');
return; return;
} }
@ -884,10 +887,10 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
const getFreightParms = { carLengthKeys: this.sf4.value.carLength, km: this.totalDistance }; const getFreightParms = { carLengthKeys: this.sf4.value.carLength, km: this.totalDistance };
this.service.request(this.service.$api_getFreight, getFreightParms).subscribe(res => { this.service.request(this.service.$api_getFreight, getFreightParms).subscribe(res => {
if (this.sf7.value.subtotal > res.maxPrice) { if (this.sf7.value?.subtotal > res?.maxPrice) {
this.service.msgSrv.error(`运费过高,请调整录入`); this.service.msgSrv.error(`运费过高,请调整录入`);
return; return;
} else if (this.sf7.value.subtotal > res.ewPrice) { } else if (this.sf7.value?.subtotal > res?.ewPrice) {
this.modalService.confirm({ this.modalService.confirm({
nzTitle: '', nzTitle: '',
nzContent: `您的录入的运费过高,可能会影响支付,请仔细确认`, nzContent: `您的录入的运费过高,可能会影响支付,请仔细确认`,
@ -1173,6 +1176,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
// 计算保价费金额 // 计算保价费金额
getInsurersPrice(insuranceType = this.sf5.value?.insuranceType) { getInsurersPrice(insuranceType = this.sf5.value?.insuranceType) {
console.log(insuranceType) console.log(insuranceType)
console.log(this.totalDistance)
if ( insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) { if ( insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) {
const params = { const params = {
insuranceType, insuranceType,