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;
if (this.coreSrv.loginStatus) {
// 本地菜单
// data = this.loadMockData();
data = this.loadMockData();
// 远程菜单
data = this.loadRemoteData();
// data = this.loadRemoteData();
} else {
data = this.loadMockData();
}

View File

@ -1,9 +1,11 @@
<page-header [action]="phActionTpl">
<ng-template #phActionTpl>
<button (click)="add()" nz-button nzType="primary">新建</button>
</ng-template>
</page-header>
<nz-card>
<sf mode="search" [schema]="searchSchema" (formSubmit)="st.reset($event)" (formReset)="st.reset($event)"></sf>
<st #st [data]="url" [columns]="columns"></st>
</nz-card>
<page-header-wrapper [title]="''" [tab]="tpTab">
</page-header-wrapper>
<ng-template #tpTab>
<nz-tabset [(nzSelectedIndex)]="selectedIndex" (nzSelectChange)="change($event)">
<nz-tab [nzTitle]="item.name" *ngFor="let item of tabs">
</nz-tab>
</nz-tabset>
</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 {
url = `/user`;
searchSchema: SFSchema = {
properties: {
no: {
type: 'string',
title: '编号'
}
}
};
schema!: SFSchema;
@ViewChild('st') private readonly st!: STComponent;
columns: STColumn[] = [
{ title: '编号', index: 'no' },
{ title: '调用次数', type: 'number', index: 'callNo' },
{ title: '头像', type: 'img', width: '50px', index: 'avatar' },
{ title: '时间', type: 'date', index: 'updatedAt' },
columns: STColumn[] = [];
selectedIndex = 0;
tabs = [
{
title: '',
buttons: [
// { text: '查看', click: (item: any) => `/form/${item.id}` },
// { text: '编辑', type: 'static', component: FormEditComponent, click: 'reload' },
]
name: '合伙人统计',
value: '0'
},
{
name: '渠道销售统计',
value: '1'
}
];
]
constructor(private http: _HttpClient, private modal: ModalHelper) { }
constructor() { }
change(e: any) {
console.log(this.selectedIndex);
}
ngOnInit(): 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 { ParterLevelConfigEditComponent } from './level-config/components/edit/edit.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 = [
{ path: 'index', component: PartnerBusinessStatisticsIndexComponent },
{ path: 'partner-statistics', component: PartnerPartnerStatisticsComponent },
{ path: 'sale-statistics', component: PartnerSaleStatisticsComponent },
{ path: 'channel-sales',
children:[
{path: 'list', component: ParterChannelSalesListComponent},
@ -22,7 +26,6 @@ const routes: Routes = [
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
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 { ParterLevelConfigEditComponent } from './level-config/components/edit/edit.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[] = [
PartnerBusinessStatisticsIndexComponent,
ParterChannelSalesListComponent,
ParterChannelSalesEditComponent,
ParterLevelConfigListComponent,
ParterLevelConfigEditComponent
ParterLevelConfigEditComponent,
PartnerPartnerStatisticsComponent,
PartnerSaleStatisticsComponent
];
@NgModule({
declarations: [...COMPONENTS],
imports: [CommonModule, PartnerRoutingModule, SharedModule]

View File

@ -152,22 +152,22 @@ export class EAUserService extends BaseService {
* 加载用户菜单
*/
async loadUserMenus() {
return this.asyncRequest(this.$api_get_user_menus, {
appId: this.envSrv.getEnvironment().appId
}).then(res => {
this.cacheSrv.set(cacheConf.menu, 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);
// return this.asyncRequest(this.$api_get_user_menus, {
// appId: this.envSrv.getEnvironment().appId
// }).then(res => {
// this.cacheSrv.set(cacheConf.menu, 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);
});
}
/**
* 加载用户角色
*/
loadUserRoles() {}
loadUserRoles() { }
/**
* 登出

File diff suppressed because it is too large Load Diff