This commit is contained in:
wangshiming
2021-12-13 10:43:03 +08:00
parent d13b27e76b
commit cc7f7c7649
23 changed files with 572 additions and 354 deletions

View File

@ -21,7 +21,13 @@
<nz-form-control [nzErrorTip]="'请输入装货地'">
<div class="align-center">
<nz-input-group [nzSuffix]="endInconTemp1">
<input nz-input [(ngModel)]="data.detailedAddress" [ngModelOptions]="{ standalone: true }" />
<input
nz-input
[(ngModel)]="data.detailedAddress"
(click)="openMap('start', idx)"
formControlName="loadAddress{{ idx }}"
placeholder="请输入装货地"
/>
</nz-input-group>
<span style="padding: 0 10px"
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="openMap('start', idx)"></i
@ -113,13 +119,42 @@
<sf #sf3 [schema]="schema3" [formData]="sf3data" [button]="'none'" [ui]="ui3"></sf>
<sf #sf4 [schema]="schema4" [formData]="sf4data" [button]="'none'" [ui]="ui4">
<ng-template sf-template="weight" let-i let-ui="ui">
<nz-input-group nzAddOnAfter="吨">
<input nz-input [ngModel]="i.value" (ngModelChange)="i.setValue($event)" />
<nz-input-group [nzAddOnAfter]="''">
<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 [ngModel]="i.value" (ngModelChange)="i.setValue($event)" />
<nz-input-group [nzAddOnAfter]="''">
<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="总车次"
/>
</nz-input-group>
</ng-template>
</sf>

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { FormBuilder, FormGroup,Validators,FormControl } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import {
SFComponent,
@ -248,10 +248,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
properties: {
weight: {
type: 'string',
title: '重量/体积',
title: '货物数量',
ui: {
widget: 'custom',
placeholder: '请输入'
placeholder: '请输入',
errors: { required: '必填项' }
}
},
volume: {
@ -262,16 +263,27 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
placeholder: '请输入'
}
},
vehicleDemand: {
number: {
type: 'string',
title: '用车需求',
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
maxWeight: {
type: 'string',
title: '车型/车长',
enum: [
{ label: '1', value: '1' },
{ label: '2', value: '2' }
],
ui: {
widget: 'select',
placeholder: '请选择车型'
placeholder: '请选择车型',
mode: 'multiple',
errors: { required: '请选择车型' }
// asyncData: () =>
// this.categoryService.loadChildData2('0', '2').pipe(
// map((data: any) => {
@ -292,7 +304,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
],
ui: {
widget: 'select',
placeholder: '请选择车长'
placeholder: '请选择车长',
mode: 'multiple',
errors: { required: '请选择车长' }
// asyncData: () =>
// this.categoryService.loadChildData2('0', '2').pipe(
// map((data: any) => {
@ -304,7 +318,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
}
}
},
required: ['weight', 'maxWeight', 'maxCube']
};
this.ui4 = {
'*': {
@ -312,12 +327,15 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
grid: { span: 24 }
},
$weight: {
grid: { span: 12 }
grid: { span: 8 }
},
$volume: {
grid: { span: 12 }
grid: { span: 8 }
},
$vehicleDemand: {
$number: {
grid: { span: 8 }
},
$maxWeight: {
grid: { span: 12 }
},
$maxCube: {
@ -354,33 +372,97 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 'string',
title: '是否回单',
enum: [
{ label: '', value: '1' },
{ label: '', value: '2' }
{ label: '需要', value: true },
{ label: '不需要', value: false }
],
ui: {
widget: 'select',
errors: { required: '请选择' },
placeholder: '请选择'
// asyncData: () =>
// this.categoryService.loadChildData2('0', '2').pipe(
// map((data: any) => {
// return data.map((m: any) => {
// return { label: m.name, value: m.id };
// });
// }),
// ),
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
}
},
receiptType: {
type: 'string',
title: '回单类型',
enum: [
{ label: '电子回单', value: 1 },
{ label: '纸质回单', value: 2 }
],
ui: {
widget: 'select',
placeholder: '请选择',
errors: { required: '请选择' },
visibleIf: {
stateReceipt: value => value === true
}
}
},
receiptUserId: {
type: 'string',
title: '选择地址',
ui: {
widget: 'custom',
placeholder: '请点击选择收回单地址',
validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []),
visibleIf: {
receiptType: value => value === '2'
}
},
default: '1212'
},
name4: {
type: 'string',
title: '联系人',
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
readOnly: true
},
name5: {
type: 'string',
title: '联系电话',
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
readOnly: true
},
name6: {
type: 'string',
title: '所在地区',
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
readOnly: true
},
receiptAddress: {
type: 'string',
title: '详细地址',
maxLength: 20,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
readOnly: true
},
remarks: {
type: 'string',
title: '备注',
maxLength: 200,
ui: {
widget: 'textarea',
placeholder: '请输入',
autosize: { minRows: 3, maxRows: 3 }
} as SFTextareaWidgetSchema
}
}
},
required: ['stateReceipt', 'receiptType']
};
this.ui6 = {
'*': {
@ -468,12 +550,23 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
addStartInfo(event: any) {
this.startInfo.push({
detailedAddress: '',
appUserName: '',
contractTelephone: '',
type: 1
});
if (this.startInfo.length < 5) {
const controlId = this.startInfo.length;
this.startInfo.push({
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
type: 1
});
this.validateForm1.addControl(`loadAddress${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadName${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required));
}
}
subStartInfo(event: any, index: number, id?:any) {
console.log(event, index, id)
@ -709,14 +802,5 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
if(this.PageStatus === '整车修改' || this.PageStatus === '大宗修改') {
}
// console.log(this.sf1.value)
// console.log(this.startInfo)
// console.log(this.endInfo)
// console.log(this.validateForm1.value)
// console.log(this.sf3.value)
// console.log(this.sf4.value)
// console.log(this.sf5.value)
// console.log(this.sf6.value)
}
}