diff --git a/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts b/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts index 01e7091e..50941381 100644 --- a/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts +++ b/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts @@ -26,7 +26,6 @@ import { PublishAddressListComponent } from '../onecar-publish/address-list/addr }) export class SupplyManagementBulkPublishComponent implements OnInit { validateForm1: FormGroup; - newTempchecked = false; //是否存入新模板 sf1data: any; // 货源单设置回显 sf3data: any; // 货源单设置回显 sf4data: any; // 货源单设置回显 @@ -39,24 +38,20 @@ export class SupplyManagementBulkPublishComponent implements OnInit { totalTime = 0.0; //路程总时间 currentGoodsTypeName: any; enterpriseProjectIds: any; - id = this.route.snapshot.params.id; + id = this.route.snapshot.params.id; // 传参id // // 单位 - unit1 = '吨'; - unit2 = '方'; - unit3 = '保价费金额'; startInfo: any = []; endInfo: any = []; PageStatus = ''; - dataList: any; constructor( private http: _HttpClient, - fb: FormBuilder, - private router: Router, - private route: ActivatedRoute, - private modalService: NzModalService, - public service: SupplyManagementService, - private amapService: AmapService, - public shipperSrv: ShipperBaseService,) { + fb: FormBuilder, + private router: Router, + private route: ActivatedRoute, + private modalService: NzModalService, + public service: SupplyManagementService, + private amapService: AmapService, + public shipperSrv: ShipperBaseService,) { this.validateForm1 = fb.group({ createTime: [null, []], modifyTime: [null, []], @@ -84,17 +79,12 @@ export class SupplyManagementBulkPublishComponent implements OnInit { schema4: SFSchema = {}; ui4!: SFUISchema; - @ViewChild('sf7', { static: false }) sf7!: SFComponent; schema7: SFSchema = {}; ui7!: SFUISchema; + // 初始化 ngOnInit(): void { - if(this.route.snapshot?.queryParams?.sta === '1') { - console.log('修改') - this.PageStatus = '整车修改'; - } else if(this.route.snapshot?.queryParams?.sta === '2') { - this.PageStatus = '整车下一单'; - } else if(this.route.snapshot?.queryParams?.sta === '3') { + if(this.route.snapshot?.queryParams?.sta === '3') { this.PageStatus = '大宗修改'; } else if(this.route.snapshot?.queryParams?.sta === '4') { this.PageStatus = '大宗下一单'; @@ -105,9 +95,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit { this.initSF6(); this.initdata(); } - initSF1() { - this.schema1 = { properties: { shipperAppUserId: { @@ -207,28 +195,6 @@ 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); - if(this.enterpriseProjectIds) { - this.sf1.setValue('/enterpriseProjectId', this.enterpriseProjectIds); - } - }); - } - initSF3() { this.schema3 = { properties: { @@ -428,11 +394,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit { } }; } - - changeValue() { - this.totalFees = Number(this.sf7?.value?.appendFee) + Number(this.sf7?.value?.oilCardPay) + Number(this.sf7?.value?.prePay) + Number(this.sf7?.value?.receiptPay) + Number(this.sf7?.value?.toPay) - console.log(this.totalFees) - } initSF6() { this.schema7 = { properties: { @@ -545,8 +506,29 @@ export class SupplyManagementBulkPublishComponent implements OnInit { } }; } - - + changeValue() { + this.totalFees = Number(this.sf7?.value?.appendFee) + Number(this.sf7?.value?.oilCardPay) + Number(this.sf7?.value?.prePay) + Number(this.sf7?.value?.receiptPay) + Number(this.sf7?.value?.toPay) + } + // 获取城市列表 + getRegionCode(regionCode: any) { + 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); + if(this.enterpriseProjectIds) { + this.sf1.setValue('/enterpriseProjectId', this.enterpriseProjectIds); + } + }); + } addStartInfo(event: any) { if (this.startInfo.length < 5) { const controlId = this.startInfo.length; @@ -567,10 +549,8 @@ export class SupplyManagementBulkPublishComponent implements OnInit { } } subStartInfo(event: any, index: number, id?:any) { - console.log(event, index, id) if(id) { this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe((res) => { - console.log(res) }) } this.startInfo.splice(index, 1); @@ -578,7 +558,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit { this.validateForm1.removeControl(`loadName${index}`); this.validateForm1.removeControl(`loadPhone${index}`); } - addEndInfo(event: any) { if (this.addEndInfo.length < 5) { const controlId = this.endInfo.length; @@ -601,18 +580,14 @@ export class SupplyManagementBulkPublishComponent implements OnInit { subEndInfo(event: any, index: number, id?:any) { if(id) { this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe((res) => { - console.log(res) }) } - console.log(event, index, id) this.endInfo.splice(index, 1); this.validateForm1.removeControl(`unloadAddress${index}`); this.validateForm1.removeControl(`unloadName${index}`); this.validateForm1.removeControl(`unloadPhone${index}`); } - - //指派熟车 - //指派熟车 + // 指派熟车 chooseFamifiar(item: any) { const modalRef = this.modalService.create({ nzTitle: '指派熟车', @@ -629,8 +604,8 @@ export class SupplyManagementBulkPublishComponent implements OnInit { } }); } - // 打开下单完成页面 - openFinishPage(resourceObj: any = null) { + // 打开下单完成页面 + openFinishPage(resourceObj: any = null) { this.modalService.create({ nzTitle: '', nzContent: PublishSuccessComponent, @@ -638,8 +613,10 @@ export class SupplyManagementBulkPublishComponent implements OnInit { nzFooter: null, nzComponentParams: { type: 'bulk' } }); - } + } + // 确认提交 submit(submitType?: string): void { + // 校验规则 Object.keys(this.validateForm1.controls).forEach(key => { this.validateForm1.controls[key].markAsDirty(); this.validateForm1.controls[key].updateValueAndValidity(); @@ -651,7 +628,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit { if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid|| !this.sf4.valid || !this.sf7.valid) { return; } - console.log(this.startInfo) if(typeof(this.validateForm1.value.modifyTime) !== 'string' ) { var c = new Date(this.validateForm1.value.modifyTime); this.validateForm1.value.modifyTime = c.getFullYear() + '-' + (c.getMonth() + 1) + '-' + c.getDate() + ' ' + c.getHours() + ':' + c.getMinutes() + ':' + c.getSeconds() @@ -680,14 +656,12 @@ export class SupplyManagementBulkPublishComponent implements OnInit { return; } } - console.log(params) if(this.PageStatus === '大宗修改') { this.requests(this.service.$api_set_bulkModify, params); } else if(this.PageStatus === '大宗下一单') { this.requests(this.service.$api_set_saveAnotherBulkOrder, params); } } - requests(url: any, params: any) { this.service.request(url, params).subscribe((res: any) => { if (res) { @@ -749,7 +723,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit { }); } // 打开地图 - openMap(type: string, index: number) { + openMap(type: string, index: number) { const modalRef = this.modalService.create({ nzTitle: '', nzContent: AmapPoiPickerComponent, @@ -798,12 +772,10 @@ export class SupplyManagementBulkPublishComponent implements OnInit { this.dataR(res); }) } - asds(i: any) { - console.log(i) - } + // 初始化信息 dataR (res: any) { - // this.dataList = res; + // 注:区分编辑和下一单 区别是初始化的时候加不加ID if (res?.shipperAppUserName) { const List: any = []; this.service.request(this.service.$api_enterpriceList, { enterpriseName: res?.shipperAppUserName }).subscribe(rs => { @@ -942,9 +914,11 @@ export class SupplyManagementBulkPublishComponent implements OnInit { remarks: res?.remarks || '' }; } + // 回退 choose(){ window.history.go(-1); } + // 选择地址 chooseAddress(index: number, type: string) { const modalRef = this.modalService.create({ nzTitle: '选择地址', @@ -952,8 +926,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit { nzWidth: 900, nzComponentParams: { spuStatus: '1' }, nzOnOk: item => { - console.log(item) - console.log(type) const data = item.seleteData; if (JSON.stringify(data) === '{}') return; switch (type) { diff --git a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts index 241bfb9c..b18e3abb 100644 --- a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts +++ b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts @@ -1,10 +1,8 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { FormBuilder, FormControl, FormGroup, NgForm, Validators } from '@angular/forms'; +import { NgForm } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { - SFArrayWidgetSchema, SFComponent, - SFNumberWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, @@ -13,18 +11,14 @@ import { } from '@delon/form'; import { SettingsService, _HttpClient } from '@delon/theme'; import { ShipperBaseService } from '@shared'; -import format from 'date-fns/format'; -import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; +import { NzModalService } from 'ng-zorro-antd/modal'; import { of } from 'rxjs'; import { map } from 'rxjs/operators'; import { AmapPoiPickerComponent, AmapService } from 'src/app/shared/components/amap'; import { SupplyManagementService } from '../../services/supply-management.service'; import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar/choose-famifiar.component'; - -// import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar-bulk/choose-famifiar.component'; import { PublishAddressListComponent } from '../onecar-publish/address-list/address-list.component'; import { PublishSuccessComponent } from '../onecar-publish/publish-success/publish-success.component'; -// import { PublishSuccessComponent } from '../publish-success/publish-success.component'; @Component({ selector: 'app-publish-goods-bulk-publish', templateUrl: './bulk-release-publish.component.html', @@ -33,7 +27,6 @@ import { PublishSuccessComponent } from '../onecar-publish/publish-success/publi export class SupplyManagementBulkReleasePublishComponent implements OnInit { @ViewChild('ngForm') ngForm!: NgForm; - sf1data: any; // 货源单设置回显 sf3data: any; // 货源单设置回显 sf4data: any; // 货源单设置回显 @@ -46,19 +39,11 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { id = ''; type = 'add'; // // 单位 - unit1 = '吨'; - unit2 = '方'; - unit3 = '保价费金额'; startInfo: any[] = []; endInfo: any[] = []; - totalDistance = 0.0; //总里程 totalTime = 0.0; //路程总时间 - - currentGoodsTypeName: any; - freightTypeOptions: any; - ruleOptions: any; constructor( private http: _HttpClient, private modalService: NzModalService, @@ -69,7 +54,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { private amapService: AmapService, public shipperSrv: ShipperBaseService ) {} - @ViewChild('sf1', { static: false }) sf1!: SFComponent; schema1: SFSchema = {}; ui1!: SFUISchema; @@ -85,7 +69,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { @ViewChild('sf6', { static: false }) sf6!: SFComponent; schema6: SFSchema = {}; ui6!: SFUISchema; - + // 初始化 ngOnInit(): void { this.initSF1(); this.initSF3(); @@ -118,7 +102,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { } ]; } - initSF1() { this.schema1 = { properties: { @@ -231,7 +214,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { } }; } - initSF3() { this.schema3 = { properties: { @@ -430,7 +412,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { } }; } - initSF6() { this.schema6 = { properties: { @@ -543,6 +524,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { } }; } + // 选择收回单地址 backBillChange() { const modalRef = this.modalService.create({ nzTitle: '选择收回单地址', @@ -587,6 +569,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { nzComponentParams: { type: 'bulk' } }); } + // 确认提交(下单) submit(submitType: string): void { Object.keys(this.ngForm.form.controls).forEach(key => { this.ngForm.form.controls[key].markAsDirty(); @@ -599,7 +582,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { 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); // 货物信息 @@ -626,7 +608,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { let reqUrl = this.service.$api_consignBulk; if (submitType === 'assign') { - console.log('params', params); this.chooseFamifiar(params); } else { this.service.request(reqUrl, params).subscribe(res => { @@ -644,7 +625,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { } // 获取城市列表 getRegionCode(regionCode: any) { - console.log(regionCode); return this.service .request(this.service.$api_get_enterprise_project, { id: regionCode }) .pipe( @@ -698,7 +678,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { } }); } - + // 选择地址 chooseAddress(index: number, type: string) { const modalRef = this.modalService.create({ nzTitle: '选择地址', @@ -741,6 +721,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { } }); } + // 返回上一页 goBack() { window.history.go(-1); } @@ -772,7 +753,4 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { } }); } - choose() { - window.history.go(-1); - } } diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html index 76a66709..2200caf8 100644 --- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html +++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html @@ -44,7 +44,7 @@ 联系人
- +
- + - +
diff --git a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts index 9050fe04..db94a528 100644 --- a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts +++ b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts @@ -3,7 +3,6 @@ import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms' import { ActivatedRoute, Router } from '@angular/router'; import { cacheConf } from '@conf/cache.conf'; import { - SFArrayWidgetSchema, SFComponent, SFNumberWidgetSchema, SFSchema, @@ -15,10 +14,9 @@ import { import { SettingsService, _HttpClient } from '@delon/theme'; import { EACacheService, ShipperBaseService } from '@shared'; import format from 'date-fns/format'; -import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; +import { NzModalService } from 'ng-zorro-antd/modal'; import { of } from 'rxjs'; import { map } from 'rxjs/operators'; - import { AmapPoiPickerComponent, AmapService } from 'src/app/shared/components/amap'; import { SupplyManagementService } from '../../services/supply-management.service'; import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/assigned-car.component'; @@ -32,91 +30,78 @@ import { TranAgreementComponent } from '../tran-agreement/tran-agreement.compone styleUrls: ['./release-publish.component.less'] }) export class SupplyManagementReleasePublishComponent implements OnInit { - // 环境信息 appId、tenantId - envInfo = this.eaCacheSrv.get(cacheConf.env); - - validateForm1: FormGroup; - sf1data: any; // 货源单设置回显 - sf3data: any; // 货源单设置回显 - sf4data: any; // 货源单设置回显 - sf5data: any; // 货源单设置回显 - sf6data: any; // 货源单设置回显 - sf7data: any; // 货源单设置回显 - creatTime: any; // 货源单设置回显 - modifyTime: any; // 货源单设置回显 - totalFees: any; // 总数信息 - id = ''; - type = 'add'; - - // // 单位 - unit1 = '吨'; - unit2 = '方'; - unit3 = '保价费金额'; - startInfo: any[] = []; - endInfo: any[] = []; - totalDistance = 0.0; //总里程 - totalTime = 0.0; //路程总时间 - - currentGoodsTypeName: any; - currentRate = 0 //实时计算的费率 - - // formatterRmb = (value: number): string => `¥ ${value}`; - // parserRmb = (value: string): string => value.replace('¥ ', ''); - constructor( - private http: _HttpClient, - fb: FormBuilder, - private modalService: NzModalService, - private settingSrv: SettingsService, - public service: SupplyManagementService, - private router: Router, - private route: ActivatedRoute, - private eaCacheSrv: EACacheService, - private amapService: AmapService, + // 环境信息 appId、tenantId + envInfo = this.eaCacheSrv.get(cacheConf.env); + validateForm1: FormGroup; + sf1data: any; // 货源单设置回显 + sf3data: any; // 货源单设置回显 + sf4data: any; // 货源单设置回显 + sf5data: any; // 货源单设置回显 + sf6data: any; // 货源单设置回显 + sf7data: any; // 货源单设置回显 + id = ''; + type = 'add'; + // // 单位 + startInfo: any[] = []; + endInfo: any[] = []; + totalDistance = 0.0; //总里程 + totalTime = 0.0; //路程总时间 + currentRate = 0; //实时计算的费率 + constructor( + private http: _HttpClient, + fb: FormBuilder, + private modalService: NzModalService, + private settingSrv: SettingsService, + public service: SupplyManagementService, + private router: Router, + private route: ActivatedRoute, + private eaCacheSrv: EACacheService, + private amapService: AmapService, public shipperSrv: ShipperBaseService - ) { - this.validateForm1 = fb.group({ - loadingTime: [null, [Validators.required]], - unloadingTime: [null, [Validators.required]] - }); - } - - @ViewChild('sf1', { static: false }) sf1!: SFComponent; - schema1: SFSchema = {}; - ui1!: SFUISchema; - - @ViewChild('sf3', { static: false }) sf3!: SFComponent; - schema3: SFSchema = {}; - ui3!: SFUISchema; - - @ViewChild('sf4', { static: false }) sf4!: SFComponent; - schema4: SFSchema = {}; - ui4!: SFUISchema; - - @ViewChild('sf5', { static: false }) sf5!: SFComponent; - schema5: SFSchema = {}; - ui5!: SFUISchema; - - @ViewChild('sf6', { static: false }) sf6!: SFComponent; - schema6: SFSchema = {}; - ui6!: SFUISchema; - - @ViewChild('sf7', { static: false }) sf7!: SFComponent; - schema7: SFSchema = {}; - ui7!: SFUISchema; - ngOnInit(): void { - this.initSF1(); - this.initSF3(); - this.initSF4(); - this.initSF5(); - this.initSF6(); - this.initSF7(); + ) { + this.validateForm1 = fb.group({ + loadingTime: [null, [Validators.required]], + unloadingTime: [null, [Validators.required]] + }); + } + + @ViewChild('sf1', { static: false }) sf1!: SFComponent; + schema1: SFSchema = {}; + ui1!: SFUISchema; + + @ViewChild('sf3', { static: false }) sf3!: SFComponent; + schema3: SFSchema = {}; + ui3!: SFUISchema; + + @ViewChild('sf4', { static: false }) sf4!: SFComponent; + schema4: SFSchema = {}; + ui4!: SFUISchema; + + @ViewChild('sf5', { static: false }) sf5!: SFComponent; + schema5: SFSchema = {}; + ui5!: SFUISchema; + + @ViewChild('sf6', { static: false }) sf6!: SFComponent; + schema6: SFSchema = {}; + ui6!: SFUISchema; + + @ViewChild('sf7', { static: false }) sf7!: SFComponent; + schema7: SFSchema = {}; + ui7!: SFUISchema; + // 页面初始化 + ngOnInit(): void { + this.initSF1(); + this.initSF3(); + this.initSF4(); + this.initSF5(); + this.initSF6(); + this.initSF7(); this.addStartInfo(); this.addEndInfo(); - } - - initSF1() { - this.schema1 = { - properties: { + } + initSF1() { + this.schema1 = { + properties: { shipperAppUserId: { title: '货主', type: 'string', @@ -129,28 +114,28 @@ export class SupplyManagementReleasePublishComponent implements OnInit { 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)))) + .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) + this.getRegionCode(q); }, visibleIf: { - _$expand: (value: boolean) => value, - }, - } as SFSelectWidgetSchema, - }, + _$expand: (value: boolean) => value + } + } as SFSelectWidgetSchema + }, enterpriseProjectId: { type: 'string', title: '项目', ui: { widget: 'select', placeholder: '请选择', - allowClear: true, + allowClear: true } as SFSelectWidgetSchema }, // enterpriseInfoName: { @@ -168,27 +153,27 @@ export class SupplyManagementReleasePublishComponent implements OnInit { widget: 'select', placeholder: '请选择', visibleIf: { - _$expand: (value: boolean) => value, + _$expand: (value: boolean) => value }, allowClear: true, - asyncData: () => this.shipperSrv.getNetworkFreightForwarder(), - }, + asyncData: () => this.shipperSrv.getNetworkFreightForwarder() + } }, - externalResourceCode: { - type: 'string', - title: '外部货源号', - maxLength: 30, - ui: { - placeholder: '请输入' - } - }, - dispatchPhone: { + externalResourceCode: { + type: 'string', + title: '外部货源号', + maxLength: 30, + ui: { + placeholder: '请输入' + } + }, + dispatchPhone: { type: 'string', title: '手机号', maxLength: 30, ui: { - hidden: true, - placeholder: '请输入' + hidden: true, + placeholder: '请输入' } }, dispatchName: { @@ -200,54 +185,36 @@ export class SupplyManagementReleasePublishComponent implements OnInit { placeholder: '请输入' } }, - dispatchId: { + dispatchId: { type: 'string', title: '调度员', ui: { widget: 'select', placeholder: '请选择', allowClear: true, - change: (value: any, data: any) => { - if(data.label) { - const dat = data.label.split('/') - this.sf1.setValue('/dispatchName', dat[0]); - this.sf1.setValue('/dispatchPhone', dat[1]); + change: (_value: any, data: any) => { + if (data.label) { + const dat = data.label.split('/'); + this.sf1.setValue('/dispatchName', dat[0]); + this.sf1.setValue('/dispatchPhone', dat[1]); } }, optionalHelp: '选择调度员,司机直接联系调度员 ; 不选择,司机直接联系您', asyncData: () => this.shipperSrv.getStaffList2() } as SFSelectWidgetSchema } - }, - required: ['shipperAppUserId','enterpriseProjectId','enterpriseInfoName','dispatchId'] - }; - this.ui1 = { - '*': { - spanLabelFixed: 110, - grid: { span: 12 } - }, - $enterpriseInfoName: { - grid: { span: 24 } - } - }; - } - // 获取城市列表 - 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); - }); + }, + required: ['shipperAppUserId', 'enterpriseProjectId', 'enterpriseInfoName', 'dispatchId'] + }; + this.ui1 = { + '*': { + spanLabelFixed: 110, + grid: { span: 12 } + }, + $enterpriseInfoName: { + grid: { span: 24 } + } + }; } initSF3() { this.schema3 = { @@ -287,7 +254,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { widget: 'select', placeholder: '请选择', errors: { required: '请填写货物名称' }, - change: (value: any, data: any) => { + change: (_value: any, data: any) => { this.sf3.setValue('/goodsName', data.label); }, visibleIf: { @@ -325,559 +292,574 @@ export class SupplyManagementReleasePublishComponent implements OnInit { } }; } - initSF4() { - this.schema4 = { - properties: { - weight: { - type: 'string', - title: '货物数量', - ui: { - widget: 'custom', - placeholder: '请输入', - errors: { required: '必填项' } - } - }, - volume: { - type: 'string', - title: '', - ui: { - widget: 'custom', - placeholder: '请输入' - } - }, - number: { - type: 'string', - title: '', - ui: { - widget: 'custom', - placeholder: '请输入' - } - }, - maxWeight: { - type: 'string', - title: '车型/车长', - ui: { - widget: 'dict-select', - params: { dictKey: 'car:model' }, - mode: 'multiple', - placeholder: '请选择车型', - errors: { required: '请选择车型' } - } - }, - maxCube: { - type: 'string', - title: '', - ui: { - widget: 'dict-select', - params: { dictKey: 'car:length' }, - mode: 'multiple', - placeholder: '请选择车长', - errors: { required: '请选择车长' } - } - } - }, - required: ['weight', 'maxWeight', 'maxCube'] - }; - this.ui4 = { - '*': { - spanLabelFixed: 90, - grid: { span: 24 } - }, - $weight: { - grid: { span: 8 } - }, - $volume: { - grid: { span: 8 } - }, - $number: { - grid: { span: 8 } - }, - $maxWeight: { - grid: { span: 12 } - }, - $maxCube: { - grid: { span: 12 } - } - }; - } - - initSF5() { - this.schema5 = { - properties: { - goodsValue: { - type: 'string', - title: '货物价值', - ui: { - widget: 'custom' - } - } - } - }; - this.ui5 = { - '*': { - spanLabelFixed: 90, - grid: { span: 24 } - } - }; - } - - initSF6() { - this.schema6 = { - properties: { - stateReceipt: { - type: 'string', - title: '是否回单', - enum: [ - { label: '需要', value: true }, - { label: '不需要', value: false } - ], - ui: { - widget: 'select', - errors: { required: '请选择' }, - placeholder: '请选择' - } - }, - receiptType: { - type: 'string', - title: '回单类型', - ui: { - widget: 'dict-select', - params: { dictKey: 'receipt:type' }, - containsAllLable:false, - placeholder: '请选择', - errors: { required: '请选择' }, - visibleIf: { - stateReceipt: value => value === true - } - } - }, - receiptAddressId: { - type: 'string', - title: '选择地址', - ui: { - widget: 'custom', - placeholder: '请点击选择收回单地址', - // validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []), - visibleIf: { - receiptType: value => value === '2' - } - }, - default: '' - }, - receiptUserName: { - type: 'string', - title: '联系人', - ui: { - visibleIf: { - receiptType: value => value === '2' - } - }, - readOnly: true - }, - phon: { - type: 'string', - title: '联系电话', - ui: { - visibleIf: { - receiptType: value => value === '2' - } - }, - readOnly: true - }, - area: { - type: 'string', - title: '所在地区', - ui: { - visibleIf: { - receiptType: value => value === '2' - } - }, - readOnly: true - }, - address: { - type: 'string', - title: '详细地址', - 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','receiptAddressId'] - }; - this.ui6 = { - '*': { - spanLabelFixed: 90, - grid: { span: 24 } - } - }; - } - - initSF7() { - this.schema7 = { - properties: { - prePay: { - type: 'number', - title: '预付', - default: 0, - minimum: 0, - ui: { - prefix: '¥', - change: args => this.payChange() - } as SFNumberWidgetSchema - }, - toPay: { - type: 'number', - title: '到付', - minimum: 0, - default: 0, - ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema - }, - oilCardPay: { - type: 'number', - title: '油卡', - minimum: 0, - default: 0, - ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema - }, - receiptPay: { - type: 'number', - title: '回单付', - minimum: 0, - default: 0, - ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema - }, - subtotal: { type: 'number', title: '小计',default: 0, ui: {widget: 'custom' } as SFNumberWidgetSchema }, - appendFee: { type: 'number', title: '附加费', default: 0, ui: {widget: 'custom' } as SFNumberWidgetSchema }, - total: { type: 'number', title: '总费用', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema }, - paymentDays: { - type: 'string', - title: '到货后', - ui: { - widget: 'custom', - placeholder: '请输入', - errors: { required: '请输入付款承诺天数' } - } - } - }, - required: ['paymentDays'] - }; - this.ui7 = { - '*': { - spanLabelFixed: 90, - grid: { span: 24 } - } - }; - } - - payChange() { - const subtotal = (this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.oilCardPay + this.sf7.value.receiptPay) || 0; - const oilCardPay = this.sf7.value.oilCardPay || 0; - this.service.request(this.service.$api_getCalculatedSurcharge+`?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`).subscribe((res: any) => { - if (res) { - this.sf7.setValue('/appendFee', res.surcharge); - this.sf7.setValue('/subtotal', subtotal); - this.sf7.setValue('/total', subtotal+res.surcharge); - this.service.request(this.service.$api_getcalculatedServiceRate+`?invoiceAmount=${subtotal+res.surcharge}&totalFreight=${subtotal}`).subscribe((res: any) => { - if (res) { - this.currentRate = res.rate; - } else { - this.service.msgSrv.error(res.msg); - } - }); - } else { - this.service.msgSrv.error(res.msg); - } - }); - - } - - addStartInfo() { - 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) { - this.startInfo.splice(index, 1); - this.validateForm1.removeControl(`loadAddress${index}`); - this.validateForm1.removeControl(`loadName${index}`); - this.validateForm1.removeControl(`loadPhone${index}`); - } - - addEndInfo() { - if (this.addEndInfo.length < 5) { - const controlId = this.endInfo.length; - this.endInfo.push({ - detailedAddress: '', - appUserName: '', - contractTelephone: '', - latitude: '', - longitude: '', - province: '', - city: '', - area: '', - type: '2' - }); - this.validateForm1.addControl(`unloadAddress${controlId}`, new FormControl(null, Validators.required)); - this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required)); - this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required)); - } - } - subEndInfo(event: any, index: number) { - this.endInfo.splice(index, 1); - this.validateForm1.removeControl(`unloadAddress${index}`); - this.validateForm1.removeControl(`unloadName${index}`); - this.validateForm1.removeControl(`unloadPhone${index}`); - } - - //指派熟车 - chooseFamifiar(item: any) { - console.log('999') - const modalRef = this.modalService.create({ - nzTitle: '指派熟车', - nzContent: SupplyManagementVehicleAssignedCarComponent, - nzWidth: 1200, - nzComponentParams: { - status: 'new', - url: this.service.$api_save_consignWholeAssign, - params: item - }, - nzFooter: null - }); - modalRef.afterClose.subscribe(result => { - if (result) { - this.openFinishPage(result); - } - }); - } - // 提交前确认,委托运输协议弹窗 - submitConfirm(submitType?: any) { - const modalRef = this.modalService.create({ - nzTitle: '运输协议', - nzContent: TranAgreementComponent, - nzWidth: 900, - nzFooter: null + initSF4() { + this.schema4 = { + properties: { + weight: { + type: 'string', + title: '货物数量', + ui: { + widget: 'custom', + placeholder: '请输入', + errors: { required: '必填项' } + } + }, + volume: { + type: 'string', + title: '', + ui: { + widget: 'custom', + placeholder: '请输入' + } + }, + number: { + type: 'string', + title: '', + ui: { + widget: 'custom', + placeholder: '请输入' + } + }, + maxWeight: { + type: 'string', + title: '车型/车长', + ui: { + widget: 'dict-select', + params: { dictKey: 'car:model' }, + mode: 'multiple', + placeholder: '请选择车型', + errors: { required: '请选择车型' } + } + }, + maxCube: { + type: 'string', + title: '', + ui: { + widget: 'dict-select', + params: { dictKey: 'car:length' }, + mode: 'multiple', + placeholder: '请选择车长', + errors: { required: '请选择车长' } + } + } + }, + required: ['weight', 'maxWeight', 'maxCube'] + }; + this.ui4 = { + '*': { + spanLabelFixed: 90, + grid: { span: 24 } + }, + $weight: { + grid: { span: 8 } + }, + $volume: { + grid: { span: 8 } + }, + $number: { + grid: { span: 8 } + }, + $maxWeight: { + grid: { span: 12 } + }, + $maxCube: { + grid: { span: 12 } + } + }; + } + initSF5() { + this.schema5 = { + properties: { + goodsValue: { + type: 'string', + title: '货物价值', + ui: { + widget: 'custom' + } + } + } + }; + this.ui5 = { + '*': { + spanLabelFixed: 90, + grid: { span: 24 } + } + }; + } + initSF6() { + this.schema6 = { + properties: { + stateReceipt: { + type: 'string', + title: '是否回单', + enum: [ + { label: '需要', value: true }, + { label: '不需要', value: false } + ], + ui: { + widget: 'select', + errors: { required: '请选择' }, + placeholder: '请选择' + } + }, + receiptType: { + type: 'string', + title: '回单类型', + ui: { + widget: 'dict-select', + params: { dictKey: 'receipt:type' }, + containsAllLable: false, + placeholder: '请选择', + errors: { required: '请选择' }, + visibleIf: { + stateReceipt: value => value === true + } + } + }, + receiptAddressId: { + type: 'string', + title: '选择地址', + ui: { + widget: 'custom', + placeholder: '请点击选择收回单地址', + // validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []), + visibleIf: { + receiptType: value => value === '2' + } + }, + default: '' + }, + receiptUserName: { + type: 'string', + title: '联系人', + ui: { + visibleIf: { + receiptType: value => value === '2' + } + }, + readOnly: true + }, + phon: { + type: 'string', + title: '联系电话', + ui: { + visibleIf: { + receiptType: value => value === '2' + } + }, + readOnly: true + }, + area: { + type: 'string', + title: '所在地区', + ui: { + visibleIf: { + receiptType: value => value === '2' + } + }, + readOnly: true + }, + address: { + type: 'string', + title: '详细地址', + 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', 'receiptAddressId'] + }; + this.ui6 = { + '*': { + spanLabelFixed: 90, + grid: { span: 24 } + } + }; + } + initSF7() { + this.schema7 = { + properties: { + prePay: { + type: 'number', + title: '预付', + default: 0, + minimum: 0, + ui: { + prefix: '¥', + change: _args => this.payChange() + } as SFNumberWidgetSchema + }, + toPay: { + type: 'number', + title: '到付', + minimum: 0, + default: 0, + ui: { prefix: '¥', change: _args => this.payChange() } as SFNumberWidgetSchema + }, + oilCardPay: { + type: 'number', + title: '油卡', + minimum: 0, + default: 0, + ui: { prefix: '¥', change: _args => this.payChange() } as SFNumberWidgetSchema + }, + receiptPay: { + type: 'number', + title: '回单付', + minimum: 0, + default: 0, + ui: { prefix: '¥', change: _args => this.payChange() } as SFNumberWidgetSchema + }, + subtotal: { type: 'number', title: '小计', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema }, + appendFee: { type: 'number', title: '附加费', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema }, + total: { type: 'number', title: '总费用', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema }, + paymentDays: { + type: 'string', + title: '到货后', + ui: { + widget: 'custom', + placeholder: '请输入', + errors: { required: '请输入付款承诺天数' } + } + } + }, + required: ['paymentDays'] + }; + this.ui7 = { + '*': { + spanLabelFixed: 90, + grid: { span: 24 } + } + }; + } + // 获取城市列表 + 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); }); - modalRef.afterClose.subscribe(result => { - if (result) { - this.submit(submitType); + } + payChange() { + const subtotal = this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.oilCardPay + this.sf7.value.receiptPay || 0; + const oilCardPay = this.sf7.value.oilCardPay || 0; + this.service + .request(this.service.$api_getCalculatedSurcharge + `?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`) + .subscribe((res: any) => { + if (res) { + this.sf7.setValue('/appendFee', res.surcharge); + this.sf7.setValue('/subtotal', subtotal); + this.sf7.setValue('/total', subtotal + res.surcharge); + this.service + .request(this.service.$api_getcalculatedServiceRate + `?invoiceAmount=${subtotal + res.surcharge}&totalFreight=${subtotal}`) + .subscribe((res: any) => { + if (res) { + this.currentRate = res.rate; + } else { + this.service.msgSrv.error(res.msg); + } + }); + } else { + this.service.msgSrv.error(res.msg); } }); + } + // 添加 删除发货卸货地址 + addStartInfo() { + 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)); } - 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 }); - this.sf7.validator({ emitError: true }); - if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) { - return; - } - - //装卸货信息 - const LoadingList = this.startInfo.concat(this.endInfo); - // 货物信息 - const goodsInfoList = [ - { + } + // 添加 删除发货卸货地址 + subStartInfo(_event: any, index: number) { + this.startInfo.splice(index, 1); + this.validateForm1.removeControl(`loadAddress${index}`); + this.validateForm1.removeControl(`loadName${index}`); + this.validateForm1.removeControl(`loadPhone${index}`); + } + // 添加 删除发货卸货地址 + addEndInfo() { + if (this.addEndInfo.length < 5) { + const controlId = this.endInfo.length; + this.endInfo.push({ + detailedAddress: '', + appUserName: '', + contractTelephone: '', + latitude: '', + longitude: '', + province: '', + city: '', + area: '', + type: '2' + }); + this.validateForm1.addControl(`unloadAddress${controlId}`, new FormControl(null, Validators.required)); + this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required)); + this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required)); + } + } + // 添加 删除发货卸货地址 + subEndInfo(_event: any, index: number) { + this.endInfo.splice(index, 1); + this.validateForm1.removeControl(`unloadAddress${index}`); + this.validateForm1.removeControl(`unloadName${index}`); + this.validateForm1.removeControl(`unloadPhone${index}`); + } + //指派熟车 + chooseFamifiar(item: any) { + console.log('999'); + const modalRef = this.modalService.create({ + nzTitle: '指派熟车', + nzContent: SupplyManagementVehicleAssignedCarComponent, + nzWidth: 1200, + nzComponentParams: { + status: 'new', + url: this.service.$api_save_consignWholeAssign, + params: item + }, + nzFooter: null + }); + modalRef.afterClose.subscribe(result => { + if (result) { + this.openFinishPage(result); + } + }); + } + // 提交前确认,委托运输协议弹窗 + submitConfirm(submitType?: any) { + const modalRef = this.modalService.create({ + nzTitle: '运输协议', + nzContent: TranAgreementComponent, + nzWidth: 900, + nzFooter: null + }); + modalRef.afterClose.subscribe(result => { + if (result) { + this.submit(submitType); + } + }); + } + // 提交 + 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 }); + this.sf7.validator({ emitError: true }); + if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) { + return; + } + + //装卸货信息 + const LoadingList = this.startInfo.concat(this.endInfo); + // 货物信息 + const goodsInfoList = [ + { ...this.sf4.value, ...this.sf3.value, maxWeight: this.sf4.value.maxWeight.join(','), maxCube: this.sf4.value.maxCube.join(',') - } - ]; - // 运费信息 - const expenseList = [ - { expenseCode: 'PRE', expenseName: '预付', price: this.sf7.value.prePay, id: this.sf7data?.prePayId ? this.sf7data?.prePayId : '' }, - { expenseCode: 'RECE', expenseName: '到付', price: this.sf7.value.toPay, id: this.sf7data?.toPayId ? this.sf7data?.toPayId : '' }, - { - expenseCode: 'OIL', - expenseName: '油卡', - price: this.sf7.value.oilCardPay, - id: this.sf7data?.oilCardPayId ? this.sf7data?.oilCardPayId : '' - }, - { - expenseCode: 'BACK', - expenseName: '回单付', - price: this.sf7.value.receiptPay, - id: this.sf7data?.receiptPayId ? this.sf7data?.receiptPayId : '' - } - ]; - const params = { - id: '', - ...this.sf1.value, - unLoadingPlaceDTOList: LoadingList, - unloadingTime: format(this.validateForm1.value.unloadingTime, 'yyyy-MM-dd HH:mm:ss'), - loadingTime: format(this.validateForm1.value.loadingTime, 'yyyy-MM-dd HH:mm:ss'), - goodsInfoDTOList: goodsInfoList, - ...this.sf5.value, - ...this.sf6.value, - expenseDTOList: expenseList, - paymentDays: this.sf7.value.paymentDays - }; - - let reqUrl = this.service.$api_consignWhole; - if(submitType) { + } + ]; + // 运费信息 + const expenseList = [ + { expenseCode: 'PRE', expenseName: '预付', price: this.sf7.value.prePay, id: this.sf7data?.prePayId ? this.sf7data?.prePayId : '' }, + { expenseCode: 'RECE', expenseName: '到付', price: this.sf7.value.toPay, id: this.sf7data?.toPayId ? this.sf7data?.toPayId : '' }, + { + expenseCode: 'OIL', + expenseName: '油卡', + price: this.sf7.value.oilCardPay, + id: this.sf7data?.oilCardPayId ? this.sf7data?.oilCardPayId : '' + }, + { + expenseCode: 'BACK', + expenseName: '回单付', + price: this.sf7.value.receiptPay, + id: this.sf7data?.receiptPayId ? this.sf7data?.receiptPayId : '' + } + ]; + const params = { + id: '', + ...this.sf1.value, + unLoadingPlaceDTOList: LoadingList, + unloadingTime: format(this.validateForm1.value.unloadingTime, 'yyyy-MM-dd HH:mm:ss'), + loadingTime: format(this.validateForm1.value.loadingTime, 'yyyy-MM-dd HH:mm:ss'), + goodsInfoDTOList: goodsInfoList, + ...this.sf5.value, + ...this.sf6.value, + expenseDTOList: expenseList, + paymentDays: this.sf7.value.paymentDays + }; + + let reqUrl = this.service.$api_consignWhole; + if (submitType) { if (submitType == 'assign') { this.chooseFamifiar(params); return; } } - - this.service.request(reqUrl, params).subscribe((res: any) => { - if (res) { - this.openFinishPage(); - } else { - this.service.msgSrv.error(res.msg); - } - }); - } - - // 打开地图 - openMap(type: string, index: number) { - const modalRef = this.modalService.create({ - nzTitle: '', - nzContent: AmapPoiPickerComponent, - nzWidth: 900, - nzOnOk: item => { - const poi = item.poi; - const locList = poi.pois; - switch (type) { - case 'start': - this.startInfo[index].detailedAddress = poi.formattedAddress; - this.startInfo[index].longitude = locList[0]; - this.startInfo[index].latitude = locList[1]; - this.startInfo[index].province = poi.addressComponent.province; - this.startInfo[index].city = poi.addressComponent.city; - this.startInfo[index].area = poi.addressComponent.district; - break; - case 'end': - this.endInfo[index].detailedAddress = poi.formattedAddress; - this.endInfo[index].longitude = locList[0]; - this.endInfo[index].latitude = locList[1]; - this.endInfo[index].province = poi.addressComponent.province; - this.endInfo[index].city = poi.addressComponent.city; - this.endInfo[index].area = poi.addressComponent.district; - break; - default: - break; - } - - if (this.startInfo[0]?.area && this.endInfo[0]?.area) { - this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => { - this.totalDistance = res.distance; - this.totalTime = res.time; - }); - } - } - }); - } - - backBillChange() { - const modalRef = this.modalService.create({ - nzTitle: '选择收回单地址', - nzContent: PublishAddressListComponent, - nzWidth: 900, - nzComponentParams: { spuStatus: '2' }, - nzOnOk: item => { - const data = item.seleteData; - if (JSON.stringify(data) === '{}') return; - this.sf6.setValue('/receiptAddressId', data.id); - this.sf6.setValue('/receiptUserName', data.contactName); - this.sf6.setValue('/phon', data.contactTelephone); - this.sf6.setValue('/area', `${data.province}-${data.city}-${data.area}`); - this.sf6.setValue('/address', data.detailedAddress); - } - }); - } - - chooseAddress(index: number, type: string) { - const modalRef = this.modalService.create({ - nzTitle: '选择地址', - nzContent: PublishAddressListComponent, - nzWidth: 900, - nzComponentParams: { spuStatus: '1' }, - nzOnOk: item => { - console.log(item) - console.log(type) - const data = item.seleteData; - if (JSON.stringify(data) === '{}') return; - switch (type) { - case 'start': - this.startInfo[index] = { - detailedAddress: data.detailedAddress, - appUserName: data.contactName, - contractTelephone: data.contactTelephone, - latitude: data.contactTelephone, - longitude: data.latitude, - province: data.province, - city: data.city, - area: data.area, - type: '1' - }; - break; - case 'end': - this.endInfo[index] = { - detailedAddress: data.detailedAddress, - appUserName: data.contactName, - contractTelephone: data.contactTelephone, - latitude: data.contactTelephone, - longitude: data.latitude, - province: data.province, - city: data.city, - area: data.area, - type: '2' - }; - break; - default: - break; - } - } - }); - } - - - - // 打开下单完成页面 - openFinishPage(resourceObj: any = null) { - this.modalService.create({ - nzTitle: '', - nzContent: PublishSuccessComponent, - nzWidth: 900, - nzFooter: null, - nzComponentParams: { type: 'onecar', resourceObj } - }); - } - changeGoodsType(value: string, data: any) { + + this.service.request(reqUrl, params).subscribe((res: any) => { + if (res) { + this.openFinishPage(); + } else { + this.service.msgSrv.error(res.msg); + } + }); + } + // 打开地图 + openMap(type: string, index: number) { + const modalRef = this.modalService.create({ + nzTitle: '', + nzContent: AmapPoiPickerComponent, + nzWidth: 900, + nzOnOk: item => { + const poi = item.poi; + const locList = poi.pois; + switch (type) { + case 'start': + this.startInfo[index].detailedAddress = poi.formattedAddress; + this.startInfo[index].longitude = locList[0]; + this.startInfo[index].latitude = locList[1]; + this.startInfo[index].province = poi.addressComponent.province; + this.startInfo[index].city = poi.addressComponent.city; + this.startInfo[index].area = poi.addressComponent.district; + break; + case 'end': + this.endInfo[index].detailedAddress = poi.formattedAddress; + this.endInfo[index].longitude = locList[0]; + this.endInfo[index].latitude = locList[1]; + this.endInfo[index].province = poi.addressComponent.province; + this.endInfo[index].city = poi.addressComponent.city; + this.endInfo[index].area = poi.addressComponent.district; + break; + default: + break; + } + + if (this.startInfo[0]?.area && this.endInfo[0]?.area) { + this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => { + this.totalDistance = res.distance; + this.totalTime = res.time; + }); + } + } + }); + } + // 选择收回单地址 + backBillChange() { + const modalRef = this.modalService.create({ + nzTitle: '选择收回单地址', + nzContent: PublishAddressListComponent, + nzWidth: 900, + nzComponentParams: { spuStatus: '2' }, + nzOnOk: item => { + const data = item.seleteData; + if (JSON.stringify(data) === '{}') return; + this.sf6.setValue('/receiptAddressId', data.id); + this.sf6.setValue('/receiptUserName', data.contactName); + this.sf6.setValue('/phon', data.contactTelephone); + this.sf6.setValue('/area', `${data.province}-${data.city}-${data.area}`); + this.sf6.setValue('/address', data.detailedAddress); + } + }); + } + // 选择地址 + chooseAddress(index: number, type: string) { + const modalRef = this.modalService.create({ + nzTitle: '选择地址', + nzContent: PublishAddressListComponent, + nzWidth: 900, + nzComponentParams: { spuStatus: '1' }, + nzOnOk: item => { + console.log(item); + console.log(type); + const data = item.seleteData; + if (JSON.stringify(data) === '{}') return; + switch (type) { + case 'start': + this.startInfo[index] = { + detailedAddress: data.detailedAddress, + appUserName: data.contactName, + contractTelephone: data.contactTelephone, + latitude: data.contactTelephone, + longitude: data.latitude, + province: data.province, + city: data.city, + area: data.area, + type: '1' + }; + break; + case 'end': + this.endInfo[index] = { + detailedAddress: data.detailedAddress, + appUserName: data.contactName, + contractTelephone: data.contactTelephone, + latitude: data.contactTelephone, + longitude: data.latitude, + province: data.province, + city: data.city, + area: data.area, + type: '2' + }; + break; + default: + break; + } + } + }); + } + // 打开下单完成页面 + openFinishPage(resourceObj: any = null) { + this.modalService.create({ + nzTitle: '', + nzContent: PublishSuccessComponent, + nzWidth: 900, + nzFooter: null, + nzComponentParams: { type: 'onecar', resourceObj } + }); + } + changeGoodsType(value: string, data: any) { if (data.label === '其它') return; const params = { pageIndex: 1, @@ -897,21 +879,16 @@ export class SupplyManagementReleasePublishComponent 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); } }); } - /** - * 取消 - */ - close() { - window.history.go(-1); - } - goBack() { + // 返回上一页 + goBack() { window.history.go(-1); } }