This commit is contained in:
Lingzi
2022-03-30 17:54:15 +08:00
81 changed files with 2568 additions and 244 deletions

View File

@ -0,0 +1,43 @@
<!-- <page-header [title]="'订单管理'"> </page-header> -->
<nz-card [nzBordered]="false">
<!-- 搜索表单 -->
<div nz-row nzGutter="8">
<!-- 查询字段小于或等于3个时不显示伸缩按钮 -->
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
<sf #sf mode="search" [schema]="schema" [button]="'none'">
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="false"
(click)="st?.load(1)" acl [acl-ability]="['companyStaff-search']">查询</button>
<button nz-button (click)="resetSF()">重置</button>
</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]="false"
(click)="st?.load(1)" acl [acl-ability]="['companyStaff-search']">查询</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>
<div class="list-table-header-btn">
<!-- <button nz-button nzType="default" (click)="gotoInviteRecord()">员工邀请记录</button> -->
</div>
<!-- 数据列表 -->
<st #st multiSort bordered [data]="service.$api_listOperationalReportPage" [columns]="columns" [ps]="20"
[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: [20, 50, 100] }" [loading]="false">
</st>
</nz-card>

View File

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

View File

@ -0,0 +1,147 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STChange, STColumn, STComponent, STData } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { ModalHelper } from '@delon/theme';
import { EAEnvironmentService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { DataService } from '../../../services/data.service';
@Component({
selector: 'app-datatable-partnertable',
templateUrl: './partnertable.component.html',
})
export class DatatablePartnertableComponent implements OnInit {
@ViewChild('st', { static: false }) st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
_$expand = false;
ui!: SFUISchema;
schema!: SFSchema;
phone = '';
columns!: STColumn[];
constructor(
public service: DataService,
private modalSrv: NzModalService,
private modal: ModalHelper,
private envSrv: EAEnvironmentService,
) {}
/**
* 查询字段个数
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
/**
* 查询参数
*/
get reqParams() {
const params = Object.assign({}, this.sf?.value || {});
delete params._$expand;
return { ...params };
}
/**
* 选中行
*/
get selectedRows() {
return this.st?.list.filter((item) => item.checked) || [];
}
/**
* 伸缩查询条件
*/
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/_$expand', this._$expand);
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
}
/**
* 程序初始化入口
*/
ngOnInit() {
this.initSF();
this.initST()
}
/**
* 初始化查询表单
*/
initSF() {
this.schema = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
name: {
title: '合伙人名称',
type: 'string',
ui: { placeholder: '请输入' },
readOnly: false,
},
phone: {
title: '合伙人类型',
type: 'string',
ui: {
widget: 'select',
placeholder: '请输入' },
readOnly: false,
},
phone01: {
title: '合伙人状态',
type: 'string',
ui: {
widget: 'select',
placeholder: '请输入' },
readOnly: false,
},
createTime: {
type: 'string',
title: '注册时间',
ui: { widget: 'sl-from-to', type: 'date', format: 'yyyy-MM-dd' } as SFDateWidgetSchema,
},
},
type: 'object',
};
this.ui = { '*': { spanLabelFixed: 80, grid: { span: 8, gutter: 4 }, enter: () => this.st?.load(1) } };
}
/**
* 初始化数据列表
*/
initST() {
this.columns = [
{ title: '合伙人名称', index: 'name', className: 'text-center' },
{ title: '注册时间', index: 'telephone', className: 'text-center' },
{ title: '注册时间', index: 'roleName', className: 'text-center' },
{ title: '业务员', index: 'lastLoginDate', className: 'text-center' },
{
title: '合伙人状态',
index: 'stateLocked',
className: 'text-center',
type: 'enum',
enum: { 0: '正常', 1: '冻结' },
},
{ title: '客户数', index: 'lastLoginDate', className: 'text-center' },
{ title: '收益额', index: 'lastLoginDate', className: 'text-center' },
{ title: '已提现金额', index: 'lastLoginDate', className: 'text-center' },
{ title: '订单数', index: 'lastLoginDate', className: 'text-center' },
{ title: '订单金额', index: 'lastLoginDate', className: 'text-center' },
{ title: '应收订单数', index: 'lastLoginDate', className: 'text-center' },
];
}
/**
* 数据列表状态变化事件
*/
change(change: STChange) {
// console.log(change);
}
}