Merge branch 'feature/partner' of https://gitlab.eascs.com/tms-ui/tms-obc-web into feature/partner

This commit is contained in:
heqinghang
2022-02-24 14:14:40 +08:00
13 changed files with 799 additions and 573 deletions

View File

@ -49,9 +49,9 @@ export class StartupService {
let data; let data;
if (this.coreSrv.loginStatus) { if (this.coreSrv.loginStatus) {
// 本地菜单 // 本地菜单
// data = this.loadMockData(); data = this.loadMockData();
// 远程菜单 // 远程菜单
data = this.loadRemoteData(); // data = this.loadRemoteData();
} else { } else {
data = this.loadMockData(); data = this.loadMockData();
} }

View File

@ -1,9 +1,11 @@
<page-header [action]="phActionTpl"> <page-header-wrapper [title]="''" [tab]="tpTab">
<ng-template #phActionTpl>
<button (click)="add()" nz-button nzType="primary">新建</button> </page-header-wrapper>
</ng-template> <ng-template #tpTab>
</page-header> <nz-tabset [(nzSelectedIndex)]="selectedIndex" (nzSelectChange)="change($event)">
<nz-card> <nz-tab [nzTitle]="item.name" *ngFor="let item of tabs">
<sf mode="search" [schema]="searchSchema" (formSubmit)="st.reset($event)" (formReset)="st.reset($event)"></sf> </nz-tab>
<st #st [data]="url" [columns]="columns"></st> </nz-tabset>
</nz-card> </ng-template>
<app-partner-partner-statistics *ngIf="selectedIndex === 0"></app-partner-partner-statistics>
<app-partner-sale-statistics *ngIf="selectedIndex === 1"></app-partner-sale-statistics>

View File

@ -9,37 +9,31 @@ import { ModalHelper, _HttpClient } from '@delon/theme';
}) })
export class PartnerBusinessStatisticsIndexComponent implements OnInit { export class PartnerBusinessStatisticsIndexComponent implements OnInit {
url = `/user`; url = `/user`;
searchSchema: SFSchema = { schema!: SFSchema;
properties: {
no: {
type: 'string',
title: '编号'
}
}
};
@ViewChild('st') private readonly st!: STComponent; @ViewChild('st') private readonly st!: STComponent;
columns: STColumn[] = [ columns: STColumn[] = [];
{ title: '编号', index: 'no' }, selectedIndex = 0;
{ title: '调用次数', type: 'number', index: 'callNo' }, tabs = [
{ title: '头像', type: 'img', width: '50px', index: 'avatar' },
{ title: '时间', type: 'date', index: 'updatedAt' },
{ {
title: '', name: '合伙人统计',
buttons: [ value: '0'
// { text: '查看', click: (item: any) => `/form/${item.id}` }, },
// { text: '编辑', type: 'static', component: FormEditComponent, click: 'reload' }, {
] name: '渠道销售统计',
value: '1'
} }
]; ]
constructor(private http: _HttpClient, private modal: ModalHelper) { } constructor() { }
change(e: any) {
console.log(this.selectedIndex);
}
ngOnInit(): void { } ngOnInit(): void { }
add(): void { add(): void {
// this.modal
// .createStatic(FormEditComponent, { i: { id: 0 } })
// .subscribe(() => this.st.reload());
} }
} }

View File

@ -0,0 +1,24 @@
<nz-card>
<sf mode="search" [schema]="schema" [ui]="ui" (formSubmit)="st.reset($event)" (formReset)="st.reset($event)"></sf>
</nz-card>
<nz-card>
<st #st [data]="url" [columns]="columns">
<ng-template st-row="approvalStatus" let-item>
<a [routerLink]="'/'">{{item.approvalStatus}}</a>
</ng-template>
<ng-template st-row="approvalStatus1" let-item>
<div class="text-right">{{item.approvalStatus1 | currency:' '}}</div>
</ng-template>
<ng-template st-row="approvalStatus2" let-item>
<div class="text-right">{{item.approvalStatus1 | currency:' '}}</div>
</ng-template>
<ng-template st-row="approvalStatus3" let-item>
<div class="text-right">{{item.approvalStatus1 | currency:' '}}</div>
</ng-template>
<ng-template st-row="approvalStatus4" let-item>
<div class="text-right">{{item.approvalStatus1 | currency:' '}}</div>
</ng-template>
</st>
</nz-card>

View File

@ -0,0 +1,24 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { PartnerPartnerStatisticsComponent } from './partner-statistics.component';
describe('PartnerPartnerStatisticsComponent', () => {
let component: PartnerPartnerStatisticsComponent;
let fixture: ComponentFixture<PartnerPartnerStatisticsComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ PartnerPartnerStatisticsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PartnerPartnerStatisticsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,79 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn, STComponent } from '@delon/abc/st';
import { SFSchema, SFUISchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
@Component({
selector: 'app-partner-partner-statistics',
templateUrl: './partner-statistics.component.html',
})
export class PartnerPartnerStatisticsComponent implements OnInit {
url = `/user`;
schema!: SFSchema;
ui!: SFUISchema;
@ViewChild('st') private readonly st!: STComponent;
columns: STColumn[] = [];
constructor(private http: _HttpClient, private modal: ModalHelper) { }
ngOnInit(): void {
this.initSF();
this.initST();
}
initSF() {
this.schema = {
properties: {
abnormalCause: {
title: '合伙人名称',
type: 'string',
ui: {
placeholder: '请输入',
},
},
abnormalCause1: {
title: '类型',
type: 'string',
default: '',
enum: [
{
label: '全部',
value: ''
},
{
label: '个人',
value: '1'
},
{
label: '企业',
value: '2'
}
],
ui: {
widget: 'select'
},
},
}
}
this.ui = { '*': { spanLabelFixed: 120, grid: { span: 8, gutter: 4 } } };
}
/**
* 初始化数据列表
*/
initST() {
this.columns = [
{ title: '合伙人名称', index: 'carNo', className: 'text-center' },
{ title: '类型', render: 'carModelLabel', className: 'text-center' },
{ title: '注册时间', index: 'carNo', className: 'text-center' },
{ title: '本月新增客户', render: 'approvalStatus', className: 'text-center', sort: true },
{ title: '客户总数', render: 'approvalStatus', className: 'text-center', sort: true },
{ title: '本月已结算金额(元)', render: 'approvalStatus1', className: 'text-center', sort: true },
{ title: '累计已结算金额(元)', render: 'approvalStatus2', className: 'text-center', sort: true },
{ title: '本月预估收益(元)', render: 'approvalStatus3', className: 'text-center', sort: true },
{ title: '累计收益(元)', render: 'approvalStatus4', className: 'text-center', sort: true },
];
}
}

View File

@ -0,0 +1,21 @@
<nz-card>
<sf mode="search" [schema]="schema" (formSubmit)="st.load(1)" (formReset)="st.reset($event)"></sf>
</nz-card>
<nz-card>
<st #st [data]="url" [columns]="columns">
<ng-template st-row="approvalStatus" let-item>
<a [routerLink]="'/'">{{item.approvalStatus}}</a>
</ng-template>
<ng-template st-row="approvalStatus1" let-item>
<div>{{item.approvalStatus1 | currency:' '}}</div>
</ng-template>
<ng-template st-row="approvalStatus2" let-item>
<div class="text-right">{{item.approvalStatus1 | currency:' '}}</div>
</ng-template>
<ng-template st-row="approvalStatus3" let-item>
<div class="text-right">{{item.approvalStatus1 | currency:' '}}</div>
</ng-template>
</st>
</nz-card>

View File

@ -0,0 +1,24 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { PartnerSaleStatisticsComponent } from './sale-statistics.component';
describe('PartnerSaleStatisticsComponent', () => {
let component: PartnerSaleStatisticsComponent;
let fixture: ComponentFixture<PartnerSaleStatisticsComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ PartnerSaleStatisticsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PartnerSaleStatisticsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,62 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn, STComponent } from '@delon/abc/st';
import { SFSchema, SFUISchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
@Component({
selector: 'app-partner-sale-statistics',
templateUrl: './sale-statistics.component.html',
})
export class PartnerSaleStatisticsComponent implements OnInit {
url = `/user`;
schema!: SFSchema;
@ViewChild('st') private readonly st!: STComponent;
columns: STColumn[] = [];
ui!: SFUISchema;
constructor(private http: _HttpClient, private modal: ModalHelper) { }
ngOnInit(): void {
this.initSF();
this.initST();
}
initSF() {
this.schema = {
properties: {
abnormalCause: {
title: '渠道销售姓名',
type: 'string',
ui: {
placeholder: '请输入',
},
},
abnormalCause1: {
title: '手机号',
type: 'string',
ui: {
placeholder: '请输入'
},
},
}
};
this.ui = { '*': { spanLabelFixed: 120, grid: { span: 8, gutter: 8 } } };
}
/**
* 初始化数据列表
*/
initST() {
this.columns = [
{ title: '姓名', index: 'carNo', className: 'text-center' },
{ title: '手机号', render: 'carModelLabel', className: 'text-center' },
{ title: '添加时间', index: 'carNo', className: 'text-center' },
{ title: '本月新增客户', render: 'approvalStatus', className: 'text-center', sort: true },
{ title: '客户总数', render: 'approvalStatus', className: 'text-center', sort: true },
{ title: '本月新增合伙人', render: 'approvalStatus1', className: 'text-center', sort: true },
{ title: '合伙人总数', render: 'approvalStatus1', className: 'text-center', sort: true },
{ title: '本月已结算金额(元)', render: 'approvalStatus2', className: 'text-center', sort: true },
{ title: '累计已结算金额(元)', render: 'approvalStatus3', className: 'text-center', sort: true },
];
}
}

View File

@ -5,9 +5,13 @@ import { ParterChannelSalesEditComponent } from './channel-sales/components/edit
import { ParterChannelSalesListComponent } from './channel-sales/components/list/list.component'; import { ParterChannelSalesListComponent } from './channel-sales/components/list/list.component';
import { ParterLevelConfigEditComponent } from './level-config/components/edit/edit.component'; import { ParterLevelConfigEditComponent } from './level-config/components/edit/edit.component';
import { ParterLevelConfigListComponent } from './level-config/components/list/list.component'; import { ParterLevelConfigListComponent } from './level-config/components/list/list.component';
import { PartnerPartnerStatisticsComponent } from './business-statistics/components/partner-statistics/partner-statistics.component';
import { PartnerSaleStatisticsComponent } from './business-statistics/components/sale-statistics/sale-statistics.component';
const routes: Routes = [ const routes: Routes = [
{ path: 'index', component: PartnerBusinessStatisticsIndexComponent }, { path: 'index', component: PartnerBusinessStatisticsIndexComponent },
{ path: 'partner-statistics', component: PartnerPartnerStatisticsComponent },
{ path: 'sale-statistics', component: PartnerSaleStatisticsComponent },
{ path: 'channel-sales', { path: 'channel-sales',
children:[ children:[
{path: 'list', component: ParterChannelSalesListComponent}, {path: 'list', component: ParterChannelSalesListComponent},
@ -22,7 +26,6 @@ const routes: Routes = [
}, },
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule] exports: [RouterModule]

View File

@ -7,14 +7,19 @@ import { ParterChannelSalesListComponent } from './channel-sales/components/list
import { ParterChannelSalesEditComponent } from './channel-sales/components/edit/edit.component'; import { ParterChannelSalesEditComponent } from './channel-sales/components/edit/edit.component';
import { ParterLevelConfigEditComponent } from './level-config/components/edit/edit.component'; import { ParterLevelConfigEditComponent } from './level-config/components/edit/edit.component';
import { ParterLevelConfigListComponent } from './level-config/components/list/list.component'; import { ParterLevelConfigListComponent } from './level-config/components/list/list.component';
import { PartnerPartnerStatisticsComponent } from './business-statistics/components/partner-statistics/partner-statistics.component';
import { PartnerSaleStatisticsComponent } from './business-statistics/components/sale-statistics/sale-statistics.component';
const COMPONENTS: any[] = [ const COMPONENTS: any[] = [
PartnerBusinessStatisticsIndexComponent, PartnerBusinessStatisticsIndexComponent,
ParterChannelSalesListComponent, ParterChannelSalesListComponent,
ParterChannelSalesEditComponent, ParterChannelSalesEditComponent,
ParterLevelConfigListComponent, ParterLevelConfigListComponent,
ParterLevelConfigEditComponent ParterLevelConfigEditComponent,
PartnerPartnerStatisticsComponent,
PartnerSaleStatisticsComponent
]; ];
@NgModule({ @NgModule({
declarations: [...COMPONENTS], declarations: [...COMPONENTS],
imports: [CommonModule, PartnerRoutingModule, SharedModule] imports: [CommonModule, PartnerRoutingModule, SharedModule]

View File

@ -152,22 +152,22 @@ export class EAUserService extends BaseService {
* 加载用户菜单 * 加载用户菜单
*/ */
async loadUserMenus() { async loadUserMenus() {
return this.asyncRequest(this.$api_get_user_menus, { // return this.asyncRequest(this.$api_get_user_menus, {
appId: this.envSrv.getEnvironment().appId // appId: this.envSrv.getEnvironment().appId
}).then(res => { // }).then(res => {
this.cacheSrv.set(cacheConf.menu, res); // this.cacheSrv.set(cacheConf.menu, res);
this.menuService.add(res); // this.menuService.add(res);
});
// this.request('assets/mocks/menu-data.json', {}, 'GET').subscribe((res: any) => {
// this.cacheSrv.set(cacheConf.menu, res.menu);
// this.menuService.add(res.menu);
// }); // });
this.request('assets/mocks/menu-data.json', {}, 'GET').subscribe((res: any) => {
this.cacheSrv.set(cacheConf.menu, res.menu);
this.menuService.add(res.menu);
});
} }
/** /**
* 加载用户角色 * 加载用户角色
*/ */
loadUserRoles() {} loadUserRoles() { }
/** /**
* 登出 * 登出

File diff suppressed because it is too large Load Diff