This commit is contained in:
wangshiming
2022-03-01 14:30:58 +08:00
parent adbe2a402f
commit 201b0eaa1a
9 changed files with 181 additions and 55 deletions

View File

@ -38,8 +38,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
limitValues = {
maxWeight: 99999,
maxVolume: 99999,
maxPiece: 99999
};
maxPiece: 99999,
maxDays: 999,
intervalDays: 999,
maxTimes: 999,
}
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@ -110,14 +113,18 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
schema7: SFSchema = {};
ui7!: SFUISchema;
formatterRmb = (value: number): string => {
if (value) {
if (value === null || value === undefined) {
return '';
}else{
let value2 = Number(value).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
return ` ${value2}`;
return `${value2}`;
}
return `¥ 0.00`;
};
parserRmb = (value: string): string => value.replace('¥ ', '').replace(',', '');
parserRmb = (value: string): string => value.replace('¥', '').replace(',', '');
// 页面初始化
ngOnInit(): void {
if (this.route.snapshot?.queryParams?.sta === '1') {
@ -761,17 +768,30 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
getLimitvalue() {
// 货物核载信息最大值
// 货物运输费(小计)最大值
const getlimitvaluesParms = [this.service.limitKeys.weight, this.service.limitKeys.volume, this.service.limitKeys.piece];
this.service.request(this.service.$api_findItemValueByItemKeys, getlimitvaluesParms).subscribe(res => {
const getlimitvaluesParms = [
this.service.limitKeys.weight,
this.service.limitKeys.volume,
this.service.limitKeys.piece,
this.service.limitKeys.maxDays,
this.service.limitKeys.intervalDays,
this.service.limitKeys.maxTimes,
];
this.service.request(this.service.$api_findItemValueByItemKeys, getlimitvaluesParms).subscribe((res) => {
const maxWeight = res.filter((item: any) => item.itemKey === this.service.limitKeys.weight)[0].itemValue;
const maxVolume = res.filter((item: any) => item.itemKey === this.service.limitKeys.volume)[0].itemValue;
const maxPiece = res.filter((item: any) => item.itemKey === this.service.limitKeys.piece)[0].itemValue;
const maxDays = res.filter((item: any) => item.itemKey === this.service.limitKeys.maxDays)[0].itemValue;
const intervalDays = res.filter((item: any) => item.itemKey === this.service.limitKeys.intervalDays)[0].itemValue;
const maxTimes = res.filter((item: any) => item.itemKey === this.service.limitKeys.maxTimes)[0].itemValue;
this.limitValues = {
maxWeight: Number(maxWeight),
maxVolume: Number(maxVolume),
maxPiece: Number(maxPiece)
};
});
maxPiece: Number(maxPiece),
maxDays: Number(maxDays),
intervalDays: Number(intervalDays),
maxTimes: Number(maxTimes),
}
})
}
subStartInfo(event: any, index: number) {
this.startInfo.splice(index, 1);
@ -898,7 +918,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.service.msgSrv.warning('总费用不能为0');
return;
}
const num = (Number(this.validateForm1.value.unloadingTime) - Number(this.validateForm1.value.loadingTime))/(24*60*60*1000);
if (num > this.limitValues.maxDays) {
this.service.msgSrv.error(`当前计划装卸货时间间隔已超出限定值【${this.limitValues.maxDays}天】`);
return;
}
if (
this.sf4.value.weight > this.limitValues.maxWeight ||
this.sf4.value.volume > this.limitValues.maxVolume ||
@ -1328,10 +1352,16 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
});
}
// 不可选择的时间
disabledDateStart = (current: Date): boolean => {
return differenceInCalendarDays(new Date(), current) > 0;
};
// 不可选择的时间
disabledDateStart = (current: Date): boolean => {
let d = new Date();
let year = d.getFullYear();
let month = d.getMonth();
let date = d.getDate();
let hours = d.getHours();
let mydate = new Date(year, month, date + this.limitValues.maxDays,hours+1);
return differenceInCalendarDays(new Date(), current) > 0 || new Date(current) > mydate;
};
// 装卸货地址互换
swapAddress() {
this.startInfo.forEach((element: any, index: any) => {