车辆对接

This commit is contained in:
wangshiming
2021-12-22 09:50:17 +08:00
parent c79ea5261f
commit d40830c870
11 changed files with 334 additions and 190 deletions

View File

@ -5,6 +5,7 @@ import {
SFComponent,
SFNumberWidgetSchema,
SFSchema,
SFSchemaEnum,
SFSelectWidgetSchema,
SFTextareaWidgetSchema,
SFUISchema
@ -14,6 +15,8 @@ import { AmapPoiPickerComponent, AmapService, ShipperBaseService } from '@shared
import { NzModalService } from 'ng-zorro-antd/modal';
import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar/choose-famifiar.component';
import { SupplyManagementService} from '../../services/supply-management.service';
import { map } from 'rxjs/operators';
import { of } from 'rxjs';
@Component({
selector: 'app-publish-goods-bulk-publish',
templateUrl: './bulk-publish.component.html',
@ -96,26 +99,40 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
this.schema1 = {
properties: {
shipperAppUserName: {
type: 'string',
shipperAppUserId: {
title: '货主',
type: 'string',
maxLength: 30,
ui: {
placeholder: '请输入'
}
},
widget: 'select',
serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
onSearch: (q: any) => {
if (!!q) {
return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: q})
.pipe(map((res) => (res as any[]).map((i) => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
.toPromise();
} else {
return of([]);
}
},
change: (q: any) => {
this.getRegionCode(q)
},
visibleIf: {
_$expand: (value: boolean) => value,
},
} as SFSelectWidgetSchema,
},
enterpriseProjectId: {
type: 'string',
title: '项目',
enum: [
{ label: '项目1', value: '1' },
{ label: '项目2', value: '2' }
],
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
asyncData: () => this.service2.getEnterpriseProject(),
} as SFSelectWidgetSchema
},
enterpriseInfoName: {
@ -166,7 +183,24 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
};
}
// 获取城市列表
getRegionCode(regionCode: any) {
console.log(regionCode)
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
map((res) =>
res.map((item: any) => ({
label: item.projectName,
value: item.id,
})),
),
)
.subscribe((res) => {
this.sf1.getProperty('/enterpriseProjectId')!.schema.enum = res;
this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res);
});
}
// initSF2() {
// this.schema2 = {
// properties: {

View File

@ -5,6 +5,7 @@ import {
SFComponent,
SFNumberWidgetSchema,
SFSchema,
SFSchemaEnum,
SFSelectWidgetSchema,
SFTextareaWidgetSchema,
SFUISchema
@ -17,6 +18,8 @@ import { SupplyManagementService } from '../../services/supply-management.servic
import { debug } from 'console';
import { PublishAddressListComponent } from './address-list/address-list.component';
import { PublishSuccessComponent } from './publish-success/publish-success.component';
import { map } from 'rxjs/operators';
import { of } from 'rxjs';
@Component({
selector: 'app-publish-goods-onecar-publish',
templateUrl: './onecar-publish.component.html',
@ -113,14 +116,30 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
initSF1() {
this.schema1 = {
properties: {
shipperAppUserName: {
type: 'string',
shipperAppUserId: {
title: '货主',
type: 'string',
maxLength: 30,
ui: {
placeholder: '请输入'
}
},
widget: 'select',
serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
onSearch: (q: any) => {
if (!!q) {
return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: q})
.pipe(map((res) => (res as any[]).map((i) => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
.toPromise();
} else {
return of([]);
}
},
visibleIf: {
_$expand: (value: boolean) => value,
},
} as SFSelectWidgetSchema,
},
enterpriseProjectId: {
title: '项目',
type: 'string',