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

@ -155,8 +155,8 @@
<nz-form-label [nzSpan]="3" nzRequired>装货时间</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入装货时间'">
<nz-date-picker
nzShowTime
nzFormat="yyyy-MM-dd HH:mm:ss"
[nzShowTime]="{ nzFormat: 'HH' }"
nzFormat="yyyy-MM-dd HH:00前"
formControlName="loadingTime"
[nzDisabledDate]="disabledDateStart"
></nz-date-picker>
@ -168,7 +168,8 @@
<nz-form-item>
<nz-form-label [nzSpan]="3" nzRequired>卸货时间</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入卸货时间'">
<nz-date-picker nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss" formControlName="unloadingTime"></nz-date-picker>
<nz-date-picker [nzShowTime]="{ nzFormat: 'HH' }"
nzFormat="yyyy-MM-dd HH:00前" formControlName="unloadingTime"></nz-date-picker>
</nz-form-control>
</nz-form-item>
</div>

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) => {

View File

@ -1,18 +1,8 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2021-12-03 11:10:14
* @LastEditors : Shiming
* @LastEditTime : 2022-02-28 20:00:13
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\qrcode-page\\qrcode-page.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<div>
<nz-alert nzType="warning" nzMessage="二维码用于司机扫码抢单" nzShowIcon></nz-alert>
<div style="width: 50%;margin: 0 auto;">
<div class="">
<div style="width: 80%;margin: 0 auto;" id="qr_page">
<div style="text-align: center;">
<h2> {{i?.enterpriseInfoName}}</h2>
<qr [value]="qrCodeValue" #qr></qr>
@ -23,6 +13,6 @@
</div>
<div class="modal-footer text-center">
<button nz-button type="submit" nzType="primary" (click)="downLoadQrcode('二维码')">下载二维码</button>
<button nz-button type="submit" nzType="primary" (click)="toCanvasPhoto()">下载二维码</button>
</div>
</div>

View File

@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2021-12-03 11:10:14
* @LastEditors : Shiming
* @LastEditTime : 2022-02-28 20:00:06
* @LastEditTime : 2022-03-01 14:19:47
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\qrcode-page\\qrcode-page.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
@ -13,6 +13,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { QRComponent } from '@delon/abc/qr';
import { SFSchema, SFUISchema } from '@delon/form';
import { NzModalRef } from 'ng-zorro-antd/modal';
import html2canvas from 'html2canvas';
@Component({
selector: 'app-supply-management-qrcode-page',
@ -50,16 +51,22 @@ export class SupplyManagementQrcodePageComponent implements OnInit {
}
downLoadQrcode(downloadName: any): void {
/**
* 下载二维码
* @param downloadName 文件名
* @param contents 内容
*/
downLoadQrcode(downloadName: any, contents: any): void {
let aLink = document.createElement('a');
const content = this.qr.dataURL;
const content = contents;
let blob = this.base64ToBlob(content); //new Blob([content]);
let evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true);//initEvent 不加后两个参数在IE下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为
aLink.download = downloadName;
aLink.href = URL.createObjectURL(blob);
// aLink.dispatchEvent(evt);
aLink.click()
aLink.click();
}
@ -80,4 +87,17 @@ export class SupplyManagementQrcodePageComponent implements OnInit {
this.modal.destroy();
}
/**
* 把页面装成canvas
*/
toCanvasPhoto() {
let aLink = document.createElement('a');
html2canvas(document.getElementById('qr_page')!, { height: 340 }).then((canvas:any) => {
let url = canvas.toDataURL("image/jpeg");
this.downLoadQrcode('二维码', url);
})
}
}

View File

@ -161,11 +161,11 @@
<nz-form-label [nzSpan]="3" nzRequired>装货时间</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入装货时间'">
<nz-date-picker
nzShowTime
nzFormat="yyyy-MM-dd HH:mm:ss"
formControlName="loadingTime"
[nzDisabledDate]="disabledDateStart"
></nz-date-picker>
[nzShowTime]="{ nzFormat: 'HH' }"
nzFormat="yyyy-MM-dd HH:00前"
formControlName="loadingTime"
[nzDisabledDate]="disabledDateStart"
></nz-date-picker>
</nz-form-control>
</nz-form-item>
</div>
@ -174,7 +174,8 @@
<nz-form-item>
<nz-form-label [nzSpan]="3" nzRequired>卸货时间</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入卸货时间'">
<nz-date-picker nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss" formControlName="unloadingTime"></nz-date-picker>
<nz-date-picker [nzShowTime]="{ nzFormat: 'HH' }"
nzFormat="yyyy-MM-dd HH:00前" formControlName="unloadingTime"></nz-date-picker>
</nz-form-control>
</nz-form-item>
</div>

View File

@ -102,15 +102,25 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
schema7: SFSchema = {};
ui7!: SFUISchema;
formatterRmb = (value: number): string =>{
if(value){
let value2 = Number(value).toLocaleString(undefined,{'minimumFractionDigits':2,'maximumFractionDigits':2});
return `${value2}`;
limitValues = {
maxWeight: 99999,
maxVolume: 99999,
maxPiece: 99999,
maxDays: 999,
intervalDays: 999,
maxTimes: 999,
}
formatterRmb = (value: number): string => {
if (value === null || value === undefined) {
return '';
}else{
let value2 = Number(value).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
return `${value2}`;
}
return `¥ 0.00`
} ;
parserRmb = (value: string): string => value.replace('¥ ', '').replace(',','');
};
parserRmb = (value: string): string => value.replace('¥', '').replace(',', '');
// 页面初始化
ngOnInit(): void {
this.initSF1();
@ -121,6 +131,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
this.initSF7();
this.addStartInfo();
this.addEndInfo();
this.getLimitvalue();
}
initSF1() {
this.schema1 = {
@ -658,6 +669,34 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
grid: { span: 24 }
}
};
}
getLimitvalue() {
// 货物核载信息最大值
// 货物运输费(小计)最大值
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),
maxDays: Number(maxDays),
intervalDays: Number(intervalDays),
maxTimes: Number(maxTimes),
}
})
}
// 不可选择的时间
disabledDateStart = (current: Date): boolean => {

View File

@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2021-12-03 11:10:14
* @LastEditors : Shiming
* @LastEditTime : 2022-02-28 19:34:22
* @LastEditTime : 2022-03-01 14:08:30
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\services\\supply-management.service.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
@ -139,10 +139,14 @@ export class SupplyManagementService extends BaseService {
super(injector);
}
public limitKeys = {
weight: 'sys.config.goods.approvalCarMaxWeight', //整车-核载重量上限
volume: 'sys.config.goods.approvalCarMaxVolume', //整车-核载体积上限
piece: 'sys.config.goods.approvalCarMaxPiece' //整车-核载件数上限
};
weight:'sys.config.goods.approvalCarMaxWeight', //整车-核载重量上限
volume:'sys.config.goods.approvalCarMaxVolume', //整车-核载体积上限
piece:'sys.config.goods.approvalCarMaxPiece', //整车-核载件数上限
maxDays:'sys.config.goods.wholeLoadingMaxDays', //整车-计划装货时间上限
intervalDays:'sys.config.goods.wholeUnloadingIntervalDays', //计划装、卸货时间间隔
maxTimes:'sys.config.goods.wholeLoadingMaxTimes', //整车-多装多卸地点上限
}
// 根据ItemKey获取项值
public $api_findItemValueByItemKeys = '/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys';
// 获取保价费信息