This commit is contained in:
Taric Xin
2022-01-06 19:33:52 +08:00
parent f38bca116c
commit 024d7ff39d
2 changed files with 50 additions and 127 deletions

View File

@ -17,11 +17,9 @@
</nz-card>
<nz-card>
<div class="card-title"
>装卸货信息<span class="tip-font">预计公里数:{{ totalDistance }}km预计行程耗时{{ totalTime }}小时</span></div
>
<div class="card-title">装卸货信息<span class="tip-font">预计公里数:{{ totalDistance }}km预计行程耗时{{ totalTime }}小时</span></div>
<form nz-form [formGroup]="validateForm1" role="form">
<form #ngForm="ngForm" nz-form role="form">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="10">
<div *ngFor="let data1 of startInfo; let idx = index">
@ -30,17 +28,11 @@
<nz-form-control [nzErrorTip]="'请输入装货地'">
<div class="align-center">
<nz-input-group [nzSuffix]="endInconTemp1">
<input
nz-input
[(ngModel)]="data1.detailedAddress"
(click)="openMap('start', idx)"
formControlName="loadAddress{{ idx }}"
placeholder="请输入装货地"
/>
<input nz-input [(ngModel)]="data1.detailedAddress" (click)="openMap('start', idx)"
name="startDetailedAddress{{ idx }}" placeholder="请输入装货地" required />
</nz-input-group>
<span style="padding: 0 10px"
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="chooseAddress(idx, 'start')"></i
></span>
<span style="padding: 0 10px"><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff"
(click)="chooseAddress(idx, 'start')"></i></span>
</div>
</nz-form-control>
</nz-form-item>
@ -48,23 +40,12 @@
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<div class="align-center">
<nz-form-control [nzErrorTip]="'请输入联系人姓名'">
<input
nz-input
[(ngModel)]="data1.appUserName"
formControlName="loadName{{ idx }}"
maxlength="30"
placeholder="请输入联系人姓名"
/>
<input nz-input [(ngModel)]="data1.appUserName" name="startAppUserName{{ idx }}" maxlength="30"
placeholder="请输入联系人姓名" required />
</nz-form-control>
<nz-form-control [nzErrorTip]="'请输入联系人电话'">
<input
style="margin-left: 12px"
nz-input
[(ngModel)]="data1.contractTelephone"
maxlength="11"
formControlName="loadPhone{{ idx }}"
placeholder="请输入联系人电话"
/>
<input style="margin-left: 12px" nz-input [(ngModel)]="data1.contractTelephone" maxlength="11"
name="startContractTelephone{{ idx }}" placeholder="请输入联系人电话" required/>
</nz-form-control>
</div>
</nz-form-item>
@ -72,7 +53,8 @@
</div>
<div nz-col [nzSpan]="4">
<div style="display: flex; justify-content: center">
<span style="padding: 24 px; font-size: 30px; color: #7d7d7d"><i nz-icon nzType="swap" nzTheme="outline"></i></span>
<span style="padding: 24 px; font-size: 30px; color: #7d7d7d"><i nz-icon nzType="swap"
nzTheme="outline"></i></span>
</div>
</div>
<div nz-col [nzSpan]="10">
@ -82,17 +64,11 @@
<nz-form-control [nzErrorTip]="'请输入卸货地'">
<div class="align-center">
<nz-input-group [nzSuffix]="endInconTemp1">
<input
nz-input
[(ngModel)]="data2.detailedAddress"
(click)="openMap('end', idx)"
formControlName="unloadAddress{{ idx }}"
placeholder="请输入卸货地"
/>
<input nz-input [(ngModel)]="data2.detailedAddress" (click)="openMap('end', idx)"
name="endDetailedAddress{{ idx }}" placeholder="请输入卸货地" required/>
</nz-input-group>
<span style="padding: 0 10px"
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="chooseAddress(idx, 'end')"></i
></span>
<span style="padding: 0 10px"><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff"
(click)="chooseAddress(idx, 'end')"></i></span>
</div>
</nz-form-control>
</nz-form-item>
@ -100,23 +76,12 @@
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<div class="align-center">
<nz-form-control [nzErrorTip]="'请输入联系人姓名'">
<input
nz-input
[(ngModel)]="data2.appUserName"
maxlength="30"
formControlName="unloadName{{ idx }}"
placeholder="请输入联系人姓名"
/>
<input nz-input [(ngModel)]="data2.appUserName" maxlength="30" name="endAppUserName{{ idx }}"
placeholder="请输入联系人姓名" required/>
</nz-form-control>
<nz-form-control [nzErrorTip]="'请输入联系人电话'">
<input
style="margin-left: 12px"
nz-input
[(ngModel)]="data2.contractTelephone"
formControlName="unloadPhone{{ idx }}"
maxlength="11"
placeholder="请输入联系人电话"
/>
<input style="margin-left: 12px" nz-input [(ngModel)]="data2.contractTelephone"
name="endUnloadPhone{{ idx }}" maxlength="11" placeholder="请输入联系人电话" required/>
</nz-form-control>
</div>
</nz-form-item>
@ -139,7 +104,8 @@
</nz-input-group>
<ng-template #addOnAfterTemplate>
<nz-select [ngModel]="sf4.value.freightType" (ngModelChange)="sf4.setValue('/freightType', $event)">
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of freightTypeOptions"></nz-option>
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of freightTypeOptions">
</nz-option>
</nz-select>
</ng-template>
</ng-template>
@ -150,9 +116,8 @@
<nz-option nzLabel="抹除小数" nzValue="2"></nz-option>
<nz-option nzLabel="抹除个数" nzValue="3"></nz-option>
</nz-select>
<span style="padding: 0 12px" nz-tooltip [nzTooltipTitle]="template2" nzTooltipPlacement="bottom"
><i nz-icon nzType="exclamation-circle" nzTheme="outline" style="color: #1890ff"></i
></span>
<span style="padding: 0 12px" nz-tooltip [nzTooltipTitle]="template2" nzTooltipPlacement="bottom"><i nz-icon
nzType="exclamation-circle" nzTheme="outline" style="color: #1890ff"></i></span>
<ng-template #template2>
<p>例如 付司机运费 = 重量*单价 = 999.99</p>
<p>保留小数,即 999.99</p>
@ -163,41 +128,20 @@
</ng-template>
<ng-template sf-template="weight" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input
nz-input
type="number"
[ngModel]="i.value"
min="0"
step="0.01"
(ngModelChange)="i.setValue($event)"
placeholder="总重量,必填"
/>
<input nz-input type="number" [ngModel]="i.value" min="0" step="0.01" (ngModelChange)="i.setValue($event)"
placeholder="总重量,必填" />
</nz-input-group>
</ng-template>
<ng-template sf-template="volume" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input
nz-input
type="number"
[ngModel]="i.value"
min="0"
step="0.01"
(ngModelChange)="i.setValue($event)"
placeholder="总体积"
/>
<input nz-input type="number" [ngModel]="i.value" min="0" step="0.01" (ngModelChange)="i.setValue($event)"
placeholder="总体积" />
</nz-input-group>
</ng-template>
<ng-template sf-template="number" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input
nz-input
type="number"
[ngModel]="i.value"
min="0"
step="0.01"
(ngModelChange)="i.setValue($event)"
placeholder="总车次"
/>
<input nz-input type="number" [ngModel]="i.value" min="0" step="0.01" (ngModelChange)="i.setValue($event)"
placeholder="总车次" />
</nz-input-group>
</ng-template>
</sf>
@ -214,15 +158,8 @@
<div nz-row>
<div class="align-center" style="width: 350px;">
<div nz-col nzSpan="12">
<nz-input-number
[ngModel]="i.value"
style="width: 150px;"
[nzMin]="1"
[nzMax]="30"
[nzStep]="1"
(ngModelChange)="i.setValue($event)"
nzPlaceHolder="请输入1-30"
></nz-input-number>
<nz-input-number [ngModel]="i.value" style="width: 150px;" [nzMin]="1" [nzMax]="30" [nzStep]="1"
(ngModelChange)="i.setValue($event)" nzPlaceHolder="请输入1-30"></nz-input-number>
</div>
<div nz-col nzSpan="6">
<span>天内支付运费</span>
@ -237,10 +174,10 @@
<nz-card>
<div class="align-center">
<button nz-button nzType="primary" (click)="choose()">取消</button>
<button nz-button nzType="primary" (click)="choose()">取消</button>
<button nz-button nzType="primary" (click)="submit('assign')">生成二维码</button>
<button nz-button nzType="primary" (click)="submit('assign')">指派熟车</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit('publish')">司机抢单</button>
</div>
</nz-card>
</nz-card>

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { FormBuilder, FormControl, FormGroup, NgForm, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import {
SFArrayWidgetSchema,
@ -31,7 +31,9 @@ import { PublishSuccessComponent } from '../onecar-publish/publish-success/publi
styleUrls: ['./bulk-release-publish.component.less']
})
export class SupplyManagementBulkReleasePublishComponent implements OnInit {
validateForm1: FormGroup;
@ViewChild('ngForm')
ngForm!: NgForm;
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@ -59,7 +61,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
ruleOptions: any;
constructor(
private http: _HttpClient,
fb: FormBuilder,
private modalService: NzModalService,
private settingSrv: SettingsService,
private service: SupplyManagementService,
@ -67,16 +68,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
private route: ActivatedRoute,
private amapService: AmapService,
public shipperSrv: ShipperBaseService
) {
this.validateForm1 = fb.group({
loadAddress0: [null, [Validators.required]],
loadName0: [null, [Validators.required]],
loadPhone0: [null, [Validators.required]],
unloadAddress0: [null, [Validators.required]],
unloadName0: [null, [Validators.required]],
unloadPhone0: [null, [Validators.required]]
});
}
) {}
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
schema1: SFSchema = {};
@ -151,9 +143,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
},
change: (q: any) => {
this.getRegionCode(q);
},
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
@ -180,9 +169,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
_$expand: (value: boolean) => value
},
allowClear: true,
asyncData: () => this.shipperSrv.getNetworkFreightForwarder()
}
@ -481,17 +467,17 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
});
}
submit(submitType: string): void {
// Object.keys(this.validateForm1.controls).forEach(key => {
// this.validateForm1.controls[key].markAsDirty();
// this.validateForm1.controls[key].updateValueAndValidity();
// });
// this.sf1.validator({ emitError: true });
// this.sf3.validator({ emitError: true });
// this.sf4.validator({ emitError: true });
// this.sf6.validator({ emitError: true });
// if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
// return;
// }
Object.keys(this.ngForm.form.controls).forEach(key => {
this.ngForm.form.controls[key].markAsDirty();
this.ngForm.form.controls[key].updateValueAndValidity();
});
this.sf1.validator({ emitError: true });
this.sf3.validator({ emitError: true });
this.sf4.validator({ emitError: true });
this.sf6.validator({ emitError: true });
if (this.ngForm.form.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
return;
}
// //装卸货信息
const LoadingList = this.startInfo.concat(this.endInfo);