登录接口实现

This commit is contained in:
Taric Xin
2021-12-07 15:35:48 +08:00
parent 9167bb35f4
commit 4e0c3a3d03
14 changed files with 425 additions and 248 deletions

View File

@ -1 +1,39 @@
<amap-path-simplifier></amap-path-simplifier>
<page-header-wrapper [title]="'黑名单'" [content]="content">
<ng-template #content>
<nz-tabset class="tabs-wrap">
<nz-tab *ngFor="let tab of tabs" [nzTitle]="tab.name" (nzSelect)="changeTab(tab)"> </nz-tab>
</nz-tabset>
</ng-template>
</page-header-wrapper>
<nz-card class="search-box">
<div nz-row nzGutter="8">
<div nz-col [nzXl]="18" [nzLg]="24" [nzSm]="24" [nzXs]="24">
<sf #sf [schema]="searchSchema"
[ui]="{ '*': { spanLabelFixed: 90,grid: { lg: 8, md: 12, sm: 12, xs: 24 } }}" [compact]="true"
[button]="'none'"></sf>
</div>
<div nz-col [nzXl]="6" [nzLg]="24" [nzMd]="24" [nzSm]="24" [nzXs]="24" class="text-right">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button>
<button nz-button> 导出</button>
</div>
</div>
</nz-card>
<nz-card>
<div class="d-flex align-items-center mb-md">
<button nz-button>添加</button>
<button nz-button>删除</button>
<div class="ml-md">
已选择
<strong class="text-primary">{{ selectedRows.length }}</strong> 条删除
<a *ngIf="selectedRows.length > 0" (click)="st.clearCheck()" class="ml-lg">清空</a>
</div>
</div>
<st #st [data]="url" [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>

View File

@ -0,0 +1,21 @@
:host::ng-deep {
.search-box {
.ant-card-body {
padding-bottom: 18px;
}
}
.content-box {
.ant-card-body {
padding-top: 14px;
}
}
.tabs-wrap>.ant-tabs-nav {
margin-bottom: 0;
}
h1 {
margin: 0;
}
}

View File

@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { SFComponent, SFSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from 'src/app/routes/sys-setting/services/system.service';
@Component({
selector: 'app-etc-blacklist',
@ -6,10 +10,178 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./etc-blacklist.component.less']
})
export class ETCBlacklistComponent implements OnInit {
@ViewChild('st', { static: true })
st!: STComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
tabs = [
{
name: '货主',
type: 1,
isActived: false
},
{
name: '车辆',
type: 2,
isActived: false
}
];
tabType = 1;
url = `/rule?_allow_anonymous=true`;
constructor() { }
searchSchema: SFSchema = {
properties: {
tabType: {
type: 'number',
ui: {
hidden: true
}
},
params1: {
title: '企业名称',
type: 'string',
ui: {
placeholder: '请输入',
visibleIf: {
tabType: (value: number) => this.tabType === 1
}
}
},
params2: {
title: '联系人姓名',
type: 'string',
ui: {
placeholder: '姓名/手机/车牌号',
visibleIf: {
tabType: (value: number) => this.tabType === 1
}
}
},
params3: {
title: '手机号',
type: 'string',
ui: {
placeholder: '请输入',
visibleIf: {
tabType: (value: number) => this.tabType === 1
}
}
},
params4: {
title: '车牌号',
type: 'string',
ui: {
placeholder: '请输入',
visibleIf: {
tabType: (value: number) => this.tabType === 2
}
}
},
params5: {
title: '司机姓名',
type: 'string',
ui: {
placeholder: '请输入',
visibleIf: {
tabType: (value: number) => this.tabType === 2
}
}
},
params6: {
title: '手机号',
type: 'string',
ui: {
placeholder: '请输入',
visibleIf: {
tabType: (value: number) => this.tabType === 2
}
}
}
}
};
ngOnInit(): void {
columns: STColumn[] = [
{ title: '', index: 'key', type: 'checkbox' },
{ title: '企业名称', index: 'no', iif: () => this.tabType === 1 },
{ title: '联系人姓名', index: 'no', iif: () => this.tabType === 1 },
{ title: '车牌号', index: 'no', iif: () => this.tabType === 2 },
{ title: '司机姓名', index: 'no', iif: () => this.tabType === 2 },
{ title: '手机号', index: 'no' },
{
title: '认证状态',
className: 'text-center',
index: 'status',
type: 'badge',
badge: {
0: { text: '启用', color: 'success' },
2: { text: '禁用', color: 'error' },
3: { text: '禁用', color: 'error' },
1: { text: '禁用', color: 'error' }
}
},
{ title: '创建者', index: 'no' },
{
title: '创建时间',
index: 'updatedAt',
type: 'date'
},
{
title: '操作',
buttons: [
{
text: '删除',
click: item => this.deleteAction(item)
}
]
}
];
selectedRows: any[] = [];
reqParams = { pageIndex: 1, pageSize: 10 };
constructor(public service: SystemService, private nzModalService: NzModalService) {}
ngOnInit(): void {}
// 切换Tab
changeTab(item: any) {
this.tabType = item.type;
this.sf?.setValue('/tabType', item.type);
this.sf?.reset();
setTimeout(() => {
this.tabs.forEach(i => (i.isActived = false));
item.isActived = !item.isActived;
this.st.load(1);
this.st.resetColumns();
}, 500);
}
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
break;
case 'filter':
this.st.load();
break;
}
}
configAction(item?: any) {}
deleteAction(item?: any) {
this.nzModalService.error({
nzTitle: '确认删除?',
nzClosable: false,
nzCancelText: '取消',
nzOnOk: () => {}
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
}
}