This commit is contained in:
Taric Xin
2021-12-27 13:55:46 +08:00
parent 0f532ad744
commit cac371baf3
33 changed files with 59 additions and 79 deletions

View File

@ -18,11 +18,11 @@
<div class="d-flex justify-content-end mb-sm">
<div>
<button nz-button nzType="primary" (click)="roleAction()" >新建角色</button>
<button nz-button nzType="primary" (click)="roleAction()">新建角色</button>
</div>
</div>
<st #st [data]="url" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
<st #st [data]="service.$api_get_role_page" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' },process: beforeReq }"
[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>

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from '../../services/system.service';
@ -20,7 +20,7 @@ export class RoleManagementComponent implements OnInit {
searchSchema: SFSchema = {
properties: {
receiveName: {
roleName: {
type: 'string',
title: '角色名称',
ui: { placeholder: '请输入' }
@ -29,13 +29,14 @@ export class RoleManagementComponent implements OnInit {
};
columns: STColumn[] = [
{ title: '角色名称', index: 'no' },
{ title: '角色描述', index: 'description' },
{ title: '创建人手机号', index: 'description' },
{ title: '角色名称', index: 'roleName' },
{ title: '角色描述', index: 'roleDescription' },
{ title: '创建人手机号', index: 'telephone' },
{
title: '创建时间',
index: 'updatedAt',
type: 'date'
index: 'createTime',
type: 'date',
sort: true
},
{
title: '操作',
@ -54,20 +55,25 @@ export class RoleManagementComponent implements OnInit {
selectedRows: any[] = [];
reqParams = { pageIndex: 1, pageSize: 10 };
constructor(public service: SystemService, private nzModalService: NzModalService) {}
ngOnInit(): void {}
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
Object.assign(requestOptions.body, { ...this.sf.value });
}
if (requestOptions.body?.createTime) {
Object.assign(requestOptions.body, { sort: 'createTime.' + requestOptions.body.createTime });
}
return requestOptions;
};
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
case 'sort':
this.selectedRows = e.checkbox!;
break;
case 'filter':
this.st.load();
break;
}
}