车辆对接

This commit is contained in:
wangshiming
2022-01-14 14:39:00 +08:00
parent f03a738c98
commit eb783b95f1
12 changed files with 224 additions and 31 deletions

View File

@ -1,8 +1,9 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { SFCascaderWidgetSchema, SFComponent, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { DynamicSettingModalComponent } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { takeLast } from 'rxjs/operators';
import { SystemService } from '../../services/system.service';
@Component({
@ -15,13 +16,20 @@ export class NetworkFreightComponent implements OnInit {
st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
@ViewChild('sfFre', { static: false }) sfFre!: SFComponent;
@ViewChild('sfTicket', { static: false }) sfTicket!: SFComponent;
ui: SFUISchema = {};
ui2: SFUISchema = {};
ui3: SFUISchema = {};
schema: SFSchema = {};
addSchema: SFSchema = {};
ticketSchema: SFSchema = {};
_$expand = false;
formData: any;
ticketId: any;
ticketItem: any;
formDataTicket: any
isVisible = false;
isVisibleTicket = false;
edit = false;
editId = false;
@ -48,6 +56,10 @@ export class NetworkFreightComponent implements OnInit {
text: '财务设置',
click: item => this.roleAction(item, 2)
},
{
text: '票务设置',
click: item => this.ticket(item)
},
{
text: '合同设置',
click: item => this.roleAction(item, 2)
@ -73,6 +85,7 @@ export class NetworkFreightComponent implements OnInit {
ngOnInit(): void {
this.initSF();
this.initSFFre();
// this.initSFTicket();
}
stChange(e: STChange): void {
@ -116,6 +129,88 @@ export class NetworkFreightComponent implements OnInit {
};
this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } };
}
initSFTicket() {
this.ticketSchema = {
properties: {
enterpriseName1: {
type: 'string',
title: '公司名称',
ui: {
widget: 'text',
},
default: this.ticketItem?.enterpriseName,
},
taxCode2: {
type: 'string',
title: '纳税人识别号',
ui: {
widget: 'text',
},
default: this.ticketItem?.taxCode,
},
bankName: {
type: 'string',
title: '开户银行',
ui: { placeholder: '请输入' }
},
bankAccount: {
type: 'string',
title: '银行账号',
ui: { placeholder: '请输入' }
},
registerAddress: {
type: 'string',
title: '注册地址',
ui: { placeholder: '请输入' }
},
registerPhone: {
type: 'string',
title: '注册电话',
ui: { placeholder: '请输入' }
},
senderName: {
type: 'string',
title: '寄件人姓名',
ui: { placeholder: '请输入' }
},
senderPhone: {
type: 'string',
title: '寄件人电话',
ui: { placeholder: '请输入' }
},
senderRegionCode: {
type: 'number',
title: '营业执照所在地',
ui: {
grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
widget: 'cascader',
valueProperty: 'regionCode',
labelProperty: 'name',
asyncData: (node: any, index: any) => {
return new Promise(resolve => {
this.getRegionDetailByCode(node?.regionCode || '').subscribe(
res => {
node.children = res.map((item: any) => ({ ...item, isLeaf: index === 1 }));
},
_ => {},
() => {
resolve();
}
);
});
}
} as SFCascaderWidgetSchema
},
senderAddress: {
type: 'string',
title: '详细地址',
ui: { placeholder: '请输入' }
},
},
required: ['enterpriseName', 'taxCode', 'bankName', 'bankAccount', 'registerAddress','registerPhone', 'senderName','senderRegionCode','senderPhone', 'senderAddress']
};
this.ui3 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
}
initSFFre() {
this.addSchema = {
properties: {
@ -160,7 +255,37 @@ export class NetworkFreightComponent implements OnInit {
this.editId = value.id;
this.isVisible = true;
}
ticket(value: any) {
this.formDataTicket = [];
this.ticketItem = value;
this.initSFTicket();
this.service.request(this.service.$api_getTicketByNetworkTransporterId, { id: value.id }).subscribe((res: any) => {
console.log(res);
if (res) {
let List = {
...res
};
delete List.senderRegionCode;
List.senderRegionCode = this.getProvinceData(res?.senderRegionCode),
this.formDataTicket = List;
this.ticketId = res.id;
}
});
this.isVisibleTicket = true;
}
getProvinceData(value: any) {
this.service.http.post(this.service.$api_getRegionDetailByCode, { regionCode: value}).subscribe(res => {
console.log(res.data)
console.log(this.formDataTicket)
let enterpriseAddressCode : any= [];
let regioin = res?.data?.regionFullCodes.split(',');
console.log(regioin)
regioin?.forEach((element: any) => {
enterpriseAddressCode.push(Number(element))
});
return enterpriseAddressCode;
});
}
deleteAction(item?: any) {
this.nzModalService.error({
nzTitle: '确认删除?',
@ -192,6 +317,32 @@ export class NetworkFreightComponent implements OnInit {
handleCancel() {
this.isVisible = false;
}
handleCancelTicket() {
this.isVisibleTicket = false;
}
handleOKTicket() {
console.log(this.sfTicket.valid)
console.log(this.sfTicket.value)
if (!this.sfTicket.valid) {
this.service.msgSrv.warning('请正确填写完整!');
return;
}
const params = {
...this.sfTicket.value
};
if (this.ticketId) {
params.id = this.ticketId;
}
params.senderRegionCode = this.sfTicket.value.senderRegionCode[2]
console.log(params)
this.service.request(this.service.$api_networkTransporterTicket_save, params).subscribe((res: any) => {
if (res) {
this.service.msgSrv.success('保存成功!');
this.isVisibleTicket = false;
this.st.reload(1);
}
});
}
handleOK() {
console.log(this.sfFre.value);
@ -215,4 +366,11 @@ export class NetworkFreightComponent implements OnInit {
}
});
}
/*
* 根据地区code查询地区列表
*/
getRegionDetailByCode(regionCode: any) {
return this.service.request(this.service.$api_get_region_by_code, { regionCode });
}
}