This commit is contained in:
Taric Xin
2022-01-06 17:09:14 +08:00
parent 55da844c79
commit 3261a3fc5a
3 changed files with 115 additions and 112 deletions

View File

@ -100,35 +100,33 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
this.initSF4();
this.initSF6();
this.startInfo = [
{
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
type: '1'
}
];
{
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
type: '1'
}
];
this.endInfo = [
{
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
type: '2'
}
]
{
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
type: '2'
}
];
}
initSF1() {
this.schema1 = {
properties: {
@ -144,20 +142,20 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
onSearch: (q: any) => {
if (!!q) {
return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: q})
.pipe(map((res: any[]) => (res as any[]).map((i) => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
.request(this.service.$api_enterpriceList, { enterpriseName: q })
.pipe(map((res: any[]) => (res as any[]).map(i => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
.toPromise();
} else {
return of([]);
}
},
change: (q: any) => {
this.getRegionCode(q)
this.getRegionCode(q);
},
visibleIf: {
_$expand: (value: boolean) => value,
},
} as SFSelectWidgetSchema,
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
enterpriseProjectId: {
type: 'string',
@ -165,7 +163,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
allowClear: true
} as SFSelectWidgetSchema
},
// enterpriseInfoName: {
@ -183,11 +181,11 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
widget: 'select',
placeholder: '请选择',
visibleIf: {
_$expand: (value: boolean) => value,
_$expand: (value: boolean) => value
},
allowClear: true,
asyncData: () => this.shipperSrv.getNetworkFreightForwarder(),
},
asyncData: () => this.shipperSrv.getNetworkFreightForwarder()
}
},
deadlineTime: {
title: '截至日期',
@ -464,7 +462,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
submitParams: item,
submitUrl: this.service.$api_save_bulk_assign
},
nzWidth: 1300,
nzWidth: 1300
});
modalRef.afterClose.subscribe(result => {
if (result) {
@ -472,16 +470,16 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
});
}
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'bulk' }
});
}
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'bulk' }
});
}
submit(submitType: string): void {
// Object.keys(this.validateForm1.controls).forEach(key => {
// this.validateForm1.controls[key].markAsDirty();
@ -533,26 +531,24 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
nzFooter: null,
nzComponentParams: { type: 'bulk' }
});
} else {
this.service.msgSrv.error(res.msg);
}
});
}
}
// 获取城市列表
getRegionCode(regionCode: any) {
console.log(regionCode)
console.log(regionCode);
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
map((res) =>
map(res =>
res.map((item: any) => ({
label: item.projectName,
value: item.id,
})),
),
value: item.id
}))
)
)
.subscribe((res) => {
.subscribe(res => {
this.sf1.getProperty('/enterpriseProjectId')!.schema.enum = res;
this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res);
});
@ -661,15 +657,15 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
if (res) {
this.sf3.getProperty('/goodsNameId')!.schema.enum = res;
this.sf3.getProperty('/goodsNameId')!.widget.reset(res);
if(this.sf3data?.goodsNameId){
this.sf3.setValue('/goodsNameId',this.sf3data.goodsNameId);
if (this.sf3data?.goodsNameId) {
this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId);
}
} else {
this.service.msgSrv.error(res.msg);
}
});
}
choose(){
choose() {
window.history.go(-1);
}
}

View File

@ -7,56 +7,53 @@
* @FilePath: \tms-obc-web\src\app\routes\supply-management\components\choose-famifiar\choose-famifiar.component.html
-->
<button nz-button nzType="primary" style="margin-bottom: 24px" (click)="add()"><i nz-icon
nzType="plus"></i>添加司机</button>
nzType="plus"></i>添加司机</button>
<!-- 搜索区 -->
<div nz-row nzGutter="8">
<div nz-col [nzSpan]="12">
<div nz-row nzGutter="8">
<div nz-col [nzSpan]="18">
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf>
</div>
<div nz-col [nzSpan]="6">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button>
<div nz-col [nzSpan]="12">
<div nz-row nzGutter="8">
<div nz-col [nzSpan]="18">
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf>
</div>
<div nz-col [nzSpan]="6">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button>
</div>
</div>
</div>
</div>
</div>
<div nz-row nzGutter="8">
<div nz-col [nzSpan]="12">
<!-- 数据列表 -->
<st #st [bordered]="true" [data]="service.$api_getList_card" [columns]="columns" size="small"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } , process: reqProcess}"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }"
style="margin-top: 22px;">
<ng-template st-row="userCarLicenseDesensitizationVOList" let-item let-index="index">
<nz-select [(ngModel)]="item.default" (ngModelChange)="carChange($event, item)" style="width: 100%;">
<nz-option nzValue="" nzLabel="不限"></nz-option>
<nz-option [nzValue]="cart" [nzLabel]="cart.carNo"
*ngFor="let cart of item.userCarLicenseDesensitizationVOList">
</nz-option>
</nz-select>
</ng-template>
</st>
</div>
<div nz-col [nzSpan]="12">
<!-- 选中列表 -->
<div>已选择{{ st2Data.length }}位司机</div>
<st #st2 [bordered]="true" [data]="st2Data" [columns]="columns2" size="small"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }">
<ng-template st-row="captain" let-item let-index="index">
<span>{{ item.captainName }}&nbsp;{{ item.captainPhone }}</span> &nbsp;
<a (click)="setCaptain(item,index)">设置</a>
</ng-template>
</st>
</div>
<div nz-col [nzSpan]="12">
<!-- 数据列表 -->
<st #st *ngIf="columns" [bordered]="true" [data]="service.$api_getList_card" [columns]="columns" size="small"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } , process: reqProcess}"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }"
style="margin-top: 22px;width: 100%;">
<ng-template st-row="userCarLicenseDesensitizationVOList" let-item let-index="index">
<nz-select [(ngModel)]="item.default" (ngModelChange)="carChange($event, item)" style="width: 100%;">
<nz-option nzValue="" nzLabel="不限"></nz-option>
<nz-option [nzValue]="cart" [nzLabel]="cart.carNo"
*ngFor="let cart of item.userCarLicenseDesensitizationVOList">
</nz-option>
</nz-select>
</ng-template>
</st>
</div>
<div nz-col [nzSpan]="12">
<!-- 选中列表 -->
<div>已选择{{ st2Data.length }}位司机</div>
<st #st2 *ngIf="columns2" [bordered]="true" [data]="st2Data" [columns]="columns2" size="small"
[page]="{ show: false }" [scroll]="{ x: '600px',y:'300px' }" style="width: 100%;">
<ng-template st-row="captain" let-item let-index="index">
<span>{{ item.captainName }}&nbsp;{{ item.captainPhone }}</span> &nbsp;
<a (click)="setCaptain(item,index)">设置</a>
</ng-template>
</st>
</div>
</div>
<div *nzModalFooter>
<button nz-button nzType="default" (click)="cancel()">取消</button>
<button nz-button nzType="primary" (click)="ok()">发布并指派给司机</button>
<button nz-button nzType="default" (click)="cancel()">取消</button>
<button nz-button nzType="primary" (click)="ok()">发布并指派给司机</button>
</div>

View File

@ -1,4 +1,4 @@
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { ChangeDetectorRef, Component, Input, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
@ -46,7 +46,8 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
private drawerService: NzDrawerService,
public service: SupplyManagementService,
private modalService: NzModalService,
private modalHelper: ModalHelper
private modalHelper: ModalHelper,
private cdr: ChangeDetectorRef
) {}
/**
@ -60,8 +61,11 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
}
ngOnInit() {
this.initSF();
this.initST();
this.initST2();
setTimeout(() => {
this.initST();
this.initST2();
}, 200);
}
initSF() {
@ -94,11 +98,13 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
this.columns = [
{
title: '司机姓名',
index: 'name'
index: 'name',
width: 120
},
{
title: '手机号',
index: 'telephone'
index: 'telephone',
width: 120
},
{
title: '指定车辆',
@ -109,6 +115,7 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
title: '状态',
className: 'text-center',
index: 'certificationStatus',
width: 120,
type: 'badge',
badge: {
'-1': { text: '未提交', color: 'default' },
@ -120,6 +127,7 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
{
title: '操作',
className: 'text-center',
width: 80,
buttons: [
{
text: '选择',
@ -136,7 +144,8 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
this.columns2 = [
{
title: '司机姓名',
index: 'name'
index: 'name',
width: 120
},
{
title: '手机号',
@ -146,7 +155,7 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
{
title: '车队长',
render: 'captain',
width: '200px'
width: '100px'
},
{
title: '指定车辆',
@ -156,6 +165,7 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
{
title: '操作',
className: 'text-center',
width: 80,
buttons: [
{
text: '移除',