车辆对接

This commit is contained in:
wangshiming
2021-12-27 14:08:42 +08:00
parent ce13bc115e
commit a1cf5944c1
20 changed files with 590 additions and 103 deletions

View File

@ -0,0 +1,70 @@
<!--
* @Author: your name
* @Date: 2021-12-24 15:38:08
* @LastEditTime: 2021-12-27 11:21:35
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\sys-setting\components\crm-management\crm-management.component.html
-->
<page-header-wrapper title="结算客户管理">
</page-header-wrapper>
<nz-card >
<div nz-row nzGutter="8">
<!-- 查询字段小于或等于3个时不显示伸缩按钮 -->
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="service.http.loading"
(formSubmit)="st?.load(1)" (formReset)="resetSF()"></sf>
</div>
<!-- 查询字段大于3个时根据展开状态调整布局 -->
<ng-container *ngIf="queryFieldCount > 4">
<div nz-col [nzSpan]="_$expand ? 24 : 18">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading"
(click)="st?.load(1)">查询</button>
<button nz-button nzType="primary"
>导出</button>
<button nz-button (click)="resetSF()">重置</button>
<button nz-button nzType="link" (click)="expandToggle()">
{{ !_$expand ? '展开' : '收起' }}
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
</button>
</div>
</ng-container>
</div>
</nz-card>
<nz-card class="content-box">
<div class="d-flex justify-content-end mb-sm">
<div>
<button nz-button nzType="primary" (click)="roleAction('',1)" >新增结算客户</button>
</div>
</div>
<st #st [data]="service.$api_settlementCustomer_page" [columns]="columns"
[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] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)">
<ng-template st-row="customerType" let-item let-index="index">
<div>
<span *ngIf="item?.customerType == 1">客户</span>
<span *ngIf="item?.customerType == 2">供应商</span>
</div>
</ng-template>
</st>
</nz-card>
<nz-modal [(nzVisible)]="isVisible" [nzFooter]="nzModalFooter" [nzTitle]="editText" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel()">
<ng-container *nzModalContent>
<sf #sfFre [schema]="addSchema" [ui]="ui2" [formData]="formData" [compact]="false" [button]="'none'">
</sf>
</ng-container>
<ng-template #nzModalFooter>
<button nz-button nzType="primary" (click)="handleCancel()" [disabled]="">取消</button>
<button nz-button nzType="default" (click)="handleOK()">确 定</button>
</ng-template>
</nz-modal>

View File

@ -0,0 +1,13 @@
:host::ng-deep{
.search-box{
.ant-card-body{
padding-bottom: 18px;
}
}
.content-box{
.ant-card-body{
padding-top: 14px;
}
}
}

View File

@ -0,0 +1,249 @@
import { Component, OnInit, ViewChild, Type } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
import { ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { SystemService } from '../../services/system.service';
@Component({
selector: 'app-close-account',
templateUrl: './close-account.component.html',
styleUrls: ['./close-account.component.less']
})
export class CloseAccountComponent implements OnInit {
@ViewChild('st', { static: true })
st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
@ViewChild('sfFre', { static: false }) sfFre!: SFComponent;
ui: SFUISchema = {};
ui2: SFUISchema = {};
schema: SFSchema = {};
addSchema: SFSchema = {};
_$expand = false;
editText = '';
formData :any;
isVisible = false;
edit = false;
editId = false;
columns: STColumn[] = [
{ title: '结算客户名称', index: 'customerName' },
{ title: '结算客户编码', index: 'customerCode' },
{ title: '网络货运人', index: 'networkTransporterName' },
{ title: '货主名称', index: 'enterpriseName' },
{ title: '客户编码', index: 'crmCustomerCode' },
{ title: '供应商编码', index: 'crmSupplierCode' },
{
title: '操作',
buttons: [
{
text: '编辑',
click: item => this.roleAction(item, 2)
},
]
}
];
selectedRows: any[] = [];
get reqParams (){
return {
...this.sf?.value,
}};
constructor(
public service: SystemService,
private nzModalService: NzModalService,
public service2: ShipperBaseService,
) {}
ngOnInit(): void {
this.initSF()
this.initSFFre()
}
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
break;
case 'filter':
this.st.load();
break;
}
}
/**
* 伸缩查询条件
*/
expandToggle(): void {
this._$expand = !this._$expand;
this.sf?.setValue('/_$expand', this._$expand);
}
/**
* 查询字段个数
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
initSF(){
this.schema = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
customerName: {
type: 'string',
title: '结算客户名称',
ui: { placeholder: '请输入' }
},
customerShortName: {
type: 'string',
title: '结算客户编码',
ui: { placeholder: '请输入' }
},
networkTransporterId: {
title: '网络货运人',
type: 'string',
ui: {
placeholder: '请选择',
widget: 'select',
asyncData: () => this.service2.getNetworkFreightForwarder(),
visibleIf: {
_$expand: (value: boolean) => value,
},
}
},
enterpriseName: {
type: 'string',
title: '货主名称',
ui: { placeholder: '请输入',
visibleIf: {
_$expand: (value: boolean) => value
} }
},
crmSupplierCode: {
type: 'string',
title: '供应商编码',
ui: { placeholder: '请输入',
visibleIf: {
_$expand: (value: boolean) => value
} }
},
}
};
this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } };
}
initSFFre() {
this.addSchema = {
properties: {
customerName: {
type: 'string',
title: '结算客户名称',
ui: { placeholder: '请输入' }
},
customerCode: {
type: 'string',
title: '结算客户编码',
ui: { placeholder: '请输入' }
},
networkTransporterId: {
title: '网络货运人',
type: 'string',
ui: {
placeholder: '请选择',
widget: 'select',
asyncData: () => this.service2.getNetworkFreightForwarder(),
visibleIf: {
_$expand: (value: boolean) => value,
},
}
},
enterpriseId: {
title: '货主',
type: 'string',
maxLength: 30,
ui: {
widget: 'select',
serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
onSearch: (q: any) => {
console.log(q)
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))))
.toPromise();
} else {
return of([]);
}
},
} as SFSelectWidgetSchema,
},
},
required: ['customerName', 'customerCode', 'networkTransporterId', 'enterpriseId']
};
this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
}
roleAction(value: any,item?: any) {
if(item === 1) {
this.edit = false;
this.editText = '新增';
} else {
this.service.request(this.service.$api_settlementCustomer_get, {id: value.id}).subscribe((res: any) => {
console.log(res)
if(res) {
this.formData = res;
}
})
this.edit = true;
this.editId = value.id;
this.editText = '编辑';
}
this.isVisible = true;
}
deleteAction(item?: any) {
this.nzModalService.error({
nzTitle: '确认删除?',
nzClosable: false,
nzCancelText: '取消',
nzOnOk: () => {}
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
}
handleCancel() {
this.isVisible = false
}
handleOK() {
console.log(this.sfFre.value)
if(!this.sfFre.valid) {
this.service.msgSrv.warning('请正确填写完整!')
return
}
const params ={
...this.sfFre.value
}
if(this.editId) {
params.id = this.editId
}
this.service.request(this.service.$api_settlementCustomer_save, params).subscribe((res:any) => {
if(res) {
this.service.msgSrv.success('保存成功!')
this.isVisible = false
this.st.reload();
} else {
this.service.msgSrv.warning(res?.msg)
}
})
}
}

View File

@ -1,7 +1,7 @@
<!--
* @Author: your name
* @Date: 2021-12-24 15:38:08
* @LastEditTime: 2021-12-24 15:58:48
* @LastEditTime: 2021-12-27 10:46:43
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\sys-setting\components\crm-management\crm-management.component.html
@ -9,29 +9,50 @@
<page-header-wrapper title="网络货运人">
</page-header-wrapper>
<nz-card class="search-box">
<nz-card >
<div nz-row nzGutter="8">
<div nz-col [nzSpan]="6">
<sf #sf [schema]="searchSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 24 } }}" [compact]="true"
[button]="'none'"></sf>
<!-- 查询字段小于或等于3个时不显示伸缩按钮 -->
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="service.http.loading"
(formSubmit)="st?.load(1)" (formReset)="resetSF()"></sf>
</div>
<div nz-col [nzSpan]="8" nzOffset="1">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
<!-- 查询字段大于3个时根据展开状态调整布局 -->
<ng-container *ngIf="queryFieldCount > 4">
<div nz-col [nzSpan]="_$expand ? 24 : 18">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading"
(click)="st?.load(1)">查询</button>
<button nz-button nzType="primary"
>导出</button>
<button nz-button (click)="resetSF()">重置</button>
</div>
</div>
<button nz-button nzType="link" (click)="expandToggle()">
{{ !_$expand ? '展开' : '收起' }}
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
</button>
</div>
</ng-container>
</div>
</nz-card>
<nz-card class="content-box">
<div class="d-flex justify-content-end mb-sm">
<div>
<button nz-button nzType="primary" (click)="roleAction()" >新建角色</button>
</div>
</div>
<st #st [data]="url" [columns]="columns"
<st #st [data]="service.$api_networkTransporter_page" [columns]="columns"
[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] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)"></st>
</nz-card>
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)">
</st>
</nz-card>
<nz-modal [(nzVisible)]="isVisible" [nzFooter]="nzModalFooter" nzTitle="财务设置" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel()">
<ng-container *nzModalContent>
<sf #sfFre [schema]="addSchema" [ui]="ui2" [formData]="formData" [compact]="false" [button]="'none'">
</sf>
</ng-container>
<ng-template #nzModalFooter>
<button nz-button nzType="primary" (click)="handleCancel()" [disabled]="">取消</button>
<button nz-button nzType="default" (click)="handleOK()">确 定</button>
</ng-template>
</nz-modal>

View File

@ -1,6 +1,6 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { SFComponent, SFSchema } from '@delon/form';
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from '../../services/system.service';
@ -12,52 +12,56 @@ import { SystemService } from '../../services/system.service';
export class NetworkFreightComponent implements OnInit {
@ViewChild('st', { static: true })
st!: STComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
url = `/rule?_allow_anonymous=true`;
searchSchema: SFSchema = {
properties: {
receiveName: {
type: 'string',
title: '角色名称',
ui: { placeholder: '请输入' }
}
}
};
@ViewChild('sf', { static: false }) sf!: SFComponent;
@ViewChild('sfFre', { static: false }) sfFre!: SFComponent;
ui: SFUISchema = {};
ui2: SFUISchema = {};
schema: SFSchema = {};
addSchema: SFSchema = {};
_$expand = false;
formData :any;
isVisible = false;
edit = false;
editId = false;
columns: STColumn[] = [
{ title: '角色名称', index: 'no' },
{ title: '角色描述', index: 'description' },
{ title: '创建人手机号', index: 'description' },
{
title: '创建时间',
index: 'updatedAt',
type: 'date'
},
{ title: '公司名称', index: 'enterpriseName' },
{ title: '纳税人识别号', index: 'taxCode' },
{ title: '发票税率', index: 'invoiceTaxRate' },
{ title: '电子发票账号', index: 'electronicInvoiceAccount' },
{ title: 'ETC账号', index: 'etcAccount' },
{ title: '电子合同账号', index: 'electronicContractAccount' },
{ title: '开户行', index: 'bankName' },
{ title: '虚拟账户', index: 'virtualAccount' },
{ title: '附加费比例', index: 'surchargeRate', format: (item: any) => {return item.surchargeRate + '%'} },
{
title: '操作',
buttons: [
{
text: '编辑',
click: item => this.roleAction(item)
text: '财务设置',
click: item => this.roleAction(item, 2)
},
{
text: '删除',
click: item => this.deleteAction(item)
}
text: '合同设置',
click: item => this.roleAction(item, 2)
},
]
}
];
selectedRows: any[] = [];
reqParams = { pageIndex: 1, pageSize: 10 };
get reqParams (){
return {
...this.sf?.value,
}};
constructor(public service: SystemService, private nzModalService: NzModalService) {}
ngOnInit(): void {}
ngOnInit(): void {
this.initSF()
this.initSFFre()
}
stChange(e: STChange): void {
switch (e.type) {
@ -69,17 +73,83 @@ export class NetworkFreightComponent implements OnInit {
break;
}
}
/**
* 伸缩查询条件
*/
expandToggle(): void {
this._$expand = !this._$expand;
this.sf?.setValue('/_$expand', this._$expand);
}
/**
* 查询字段个数
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
initSF(){
this.schema = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
enterpriseName: {
type: 'string',
title: '公司名称',
ui: { placeholder: '请输入' }
},
taxCode: {
type: 'string',
title: '纳税人识别号',
ui: { placeholder: '请输入' }
},
}
};
this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } };
}
initSFFre() {
this.addSchema = {
properties: {
enterpriseName: {
type: 'string',
title: '公司名称',
ui: { placeholder: '请输入' }
},
taxCode: {
type: 'string',
title: '纳税人识别号',
ui: { placeholder: '请输入' }
},
customerCode: {
type: 'string',
title: '税收分类编码',
ui: { placeholder: '请输入' }
},
invoiceTaxRate: {
type: 'string',
title: '发票税率',
ui: { placeholder: '请输入' }
},
surchargeRate: {
type: 'string',
title: '附加费比例',
ui: { placeholder: '请输入' }
},
},
required: ['enterpriseName', 'taxCode', 'customerType', 'invoiceTaxRate', 'surchargeRate']
};
this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
}
roleAction(value: any,item?: any) {
roleAction(item?: any) {
const modal = this.nzModalService.create({
// nzContent: SettingRoleEditComponent,
nzWidth: 900,
nzComponentParams: item ? { i: { ...item } } : { i: { id: 0 } },
nzFooter: null
});
modal.afterClose.subscribe(res => {
this.st.load();
});
this.service.request(this.service.$api_get_crmCustomer, {id: value.id}).subscribe((res: any) => {
console.log(res)
if(res) {
this.formData = res;
}
})
this.edit = true;
this.editId = value.id;
this.isVisible = true;
}
deleteAction(item?: any) {
@ -97,4 +167,31 @@ export class NetworkFreightComponent implements OnInit {
resetSF() {
this.sf.reset();
}
handleCancel() {
this.isVisible = false
}
handleOK() {
console.log(this.sfFre.value)
if(!this.sfFre.valid) {
this.service.msgSrv.warning('请正确填写完整!')
return
}
const params ={
...this.sfFre.value
}
if(this.editId) {
params.id = this.editId
}
this.service.request(this.service.$api_save_crmCustomer, params).subscribe((res:any) => {
if(res) {
this.service.msgSrv.success('保存成功!')
this.isVisible = false
this.st.reload();
} else {
this.service.msgSrv.warning(res?.msg)
}
})
}
}