edit
This commit is contained in:
@ -0,0 +1,11 @@
|
||||
<div class="modal-header">
|
||||
<div class="modal-title">{{ i.id === 0 ? '新增配置' : '编辑配置' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<sf #sf [compact]="true" [ui]="ui" [schema]="schema" [button]="'none'">
|
||||
</sf>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button nz-button type="button" (click)="close()">取消</button>
|
||||
<button nz-button type="button" nzType="primary" (click)="sure()" [disabled]="!sf.valid">保存</button>
|
||||
</div>
|
||||
@ -0,0 +1,106 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef } from 'ng-zorro-antd/modal';
|
||||
import { SystemService } from '../../../services/system.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-basic-config-action-modal',
|
||||
templateUrl: './basic-config-action-modal.component.html',
|
||||
styleUrls: ['./basic-config-action-modal.component.less']
|
||||
})
|
||||
export class BasicConfigActionModalComponent implements OnInit {
|
||||
@ViewChild('sf', { static: false })
|
||||
sf!: SFComponent;
|
||||
i: any;
|
||||
schema!: SFSchema;
|
||||
ui: SFUISchema = {
|
||||
'*': {
|
||||
spanLabelFixed: 120,
|
||||
grid: { span: 24 }
|
||||
}
|
||||
};
|
||||
constructor(private modal: NzModalRef,public service: SystemService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.initSF(this.i);
|
||||
}
|
||||
initSF(staff: any) {
|
||||
this.schema = {
|
||||
properties: {
|
||||
name: {
|
||||
title: '配置类型',
|
||||
type: 'string',
|
||||
enum: [
|
||||
{ label: '全部', value: '全部' },
|
||||
{ label: '企业认证审核', value: '企业认证审核' },
|
||||
{ label: '企业管理员审核', value: '企业管理员审核' },
|
||||
{ label: '用户实名认证审核', value: '用户实名认证审核' },
|
||||
{ label: '司机实名认证审核', value: '司机实名认证审核' },
|
||||
{ label: '司机驾驶证审核', value: '司机驾驶证审核' },
|
||||
{ label: '车辆审核', value: '车辆审核' }
|
||||
],
|
||||
ui: {
|
||||
widget: 'select',
|
||||
placeholder: '请选择',
|
||||
change: (i: any) => {
|
||||
this.sf.value.name = i;
|
||||
this.sf?.setValue('/name', i);
|
||||
}
|
||||
},
|
||||
default: staff.name
|
||||
},
|
||||
phone: {
|
||||
title: '配置项',
|
||||
type: 'string',
|
||||
ui: { placeholder: '请输入' },
|
||||
default: staff.phone
|
||||
},
|
||||
roleId: {
|
||||
type: 'string',
|
||||
title: '启用状态',
|
||||
enum: [
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '停用', value: 0 }
|
||||
],
|
||||
ui: {
|
||||
widget: 'radio'
|
||||
} as SFRadioWidgetSchema,
|
||||
default: staff?.roleId || 1
|
||||
}
|
||||
},
|
||||
required: ['name', 'phone', 'roleId']
|
||||
};
|
||||
}
|
||||
|
||||
sure() {
|
||||
if (this.i.id === 0) {
|
||||
const params: any = {
|
||||
...this.sf.value,
|
||||
roleId: this.sf.value.roleId,
|
||||
telephone: this.sf.value.phone,
|
||||
staffName: this.sf.value.name
|
||||
};
|
||||
// this.service.request(this.service.$api_addStaff, params).subscribe((res) => {
|
||||
// console.log(res);
|
||||
// if (res) {
|
||||
// this.service.msgSrv.success('保存成功!');
|
||||
// this.modal.close(true);
|
||||
// }
|
||||
// // this.showInviteFlag = true;
|
||||
// // this.inviteCode = res.inviteCode;
|
||||
// });
|
||||
} else {
|
||||
const params: any = {
|
||||
appUserId: this.i.appUserId,
|
||||
staffName: this.sf.value.name,
|
||||
roleId: this.sf.value.roleId,
|
||||
telephone: this.i.telephone
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
this.modal.destroy();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
<page-header-wrapper title="基础配置">
|
||||
</page-header-wrapper>
|
||||
|
||||
<nz-card class="search-box">
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col [nzSpan]="6">
|
||||
<sf #sf [schema]="searchSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 24 } }}" [compact]="true"
|
||||
[button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="8" nzOffset="1">
|
||||
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
|
||||
<button nz-button (click)="resetSF()">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</nz-card>
|
||||
|
||||
<nz-card class="content-box">
|
||||
|
||||
<div class="d-flex justify-content-end mb-sm">
|
||||
<div>
|
||||
<button nz-button nzType="primary" (click)="configAction()" >新增</button>
|
||||
</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>
|
||||
@ -0,0 +1,13 @@
|
||||
:host::ng-deep{
|
||||
.search-box{
|
||||
.ant-card-body{
|
||||
padding-bottom: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.content-box{
|
||||
.ant-card-body{
|
||||
padding-top: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
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 '../../services/system.service';
|
||||
import { BasicConfigActionModalComponent } from './basic-config-action-modal/basic-config-action-modal.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-basic-config',
|
||||
templateUrl: './basic-config.component.html',
|
||||
styleUrls: ['./basic-config.component.less']
|
||||
})
|
||||
export class BasicConfigComponent implements OnInit {
|
||||
@ViewChild('st', { static: true })
|
||||
st!: STComponent;
|
||||
@ViewChild('sf', { static: false })
|
||||
sf!: SFComponent;
|
||||
|
||||
url = `/rule?_allow_anonymous=true`;
|
||||
|
||||
searchSchema: SFSchema = {
|
||||
properties: {
|
||||
receiveName: {
|
||||
title: '配置类型',
|
||||
type: 'string',
|
||||
ui: {
|
||||
widget: 'select',
|
||||
placeholder: '请选择',
|
||||
// asyncData: () => {
|
||||
// return this.service.request(this.service.$api_getAppRoleList).pipe(
|
||||
// map((res: any) => {
|
||||
// this.roleList = res;
|
||||
// return res.map((item: any) => {
|
||||
// return { label: item.roleName, value: item.id };
|
||||
// });
|
||||
// }),
|
||||
// );
|
||||
// },
|
||||
change: (i: any) => {
|
||||
this.sf.value.receiveName = i;
|
||||
this.sf?.setValue('/receiveName', i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
columns: STColumn[] = [
|
||||
{ title: '配置类型', index: 'no' },
|
||||
{ title: '配置项', index: 'description' },
|
||||
{
|
||||
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: 'updatedAt',
|
||||
type: 'date'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
buttons: [
|
||||
{
|
||||
text: '编辑',
|
||||
click: item => this.configAction(item)
|
||||
},
|
||||
{
|
||||
text: '停用',
|
||||
click: item => this.deactivateConfig(item)
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
selectedRows: any[] = [];
|
||||
|
||||
reqParams = { pageIndex: 1, pageSize: 10 };
|
||||
|
||||
constructor(public service: SystemService, private nzModalService: NzModalService) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
stChange(e: STChange): void {
|
||||
switch (e.type) {
|
||||
case 'checkbox':
|
||||
this.selectedRows = e.checkbox!;
|
||||
break;
|
||||
case 'filter':
|
||||
this.st.load();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
configAction(item?: any) {
|
||||
const modal = this.nzModalService.create({
|
||||
nzContent: BasicConfigActionModalComponent,
|
||||
nzComponentParams: item ? { i: { ...item, roleId: 1, name: '车辆审核', phone: 18555555555 } } : { i: { id: 0 } },
|
||||
nzFooter: null
|
||||
});
|
||||
modal.afterClose.subscribe(res => {
|
||||
this.st.load();
|
||||
});
|
||||
}
|
||||
|
||||
deactivateConfig(item?: any) {
|
||||
this.nzModalService.error({
|
||||
nzTitle: '确认停用?',
|
||||
nzContent: `<label class="error-color">停用后配置将无法使用,请谨慎操作!</label>`,
|
||||
nzClosable: false,
|
||||
nzCancelText: '取消',
|
||||
nzOnOk: () => {}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 重置表单
|
||||
*/
|
||||
resetSF() {
|
||||
this.sf.reset();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user