mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 20:50:14 +08:00
Roles dynamic - >category
This commit is contained in:
@@ -21,14 +21,13 @@ import { BaseEntity } from './BaseEntity';
|
||||
export class Roles extends BaseEntity {
|
||||
roleCode!: String;
|
||||
roleName!: String;
|
||||
dynamic!: String;
|
||||
category!: String;
|
||||
filters!: String;
|
||||
orgIdsList!: String;
|
||||
resumeTime!: String;
|
||||
suspendTime!: String;
|
||||
isdefault!: String;
|
||||
|
||||
switch_dynamic: boolean = false;
|
||||
picker_resumeTime: Date = new Date(format(new Date(), 'yyyy-MM-dd 00:00:00'));
|
||||
picker_suspendTime: Date = new Date(format(new Date(), 'yyyy-MM-dd 00:00:00'));
|
||||
|
||||
@@ -41,9 +40,7 @@ export class Roles extends BaseEntity {
|
||||
if (this.status == 1) {
|
||||
this.switch_status = true;
|
||||
}
|
||||
if (this.dynamic == '1') {
|
||||
this.switch_dynamic = true;
|
||||
}
|
||||
|
||||
if (this.resumeTime != '') {
|
||||
this.picker_resumeTime = new Date(format(new Date(), `yyyy-MM-dd ${this.resumeTime}:00`));
|
||||
}
|
||||
@@ -57,11 +54,6 @@ export class Roles extends BaseEntity {
|
||||
} else {
|
||||
this.status = 0;
|
||||
}
|
||||
if (this.switch_dynamic) {
|
||||
this.dynamic = '1';
|
||||
} else {
|
||||
this.dynamic = '0';
|
||||
}
|
||||
|
||||
if (this.picker_resumeTime) {
|
||||
this.resumeTime = format(this.picker_resumeTime, 'HH:mm');
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { I18NService } from '@core';
|
||||
import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme';
|
||||
import { format, addDays } from 'date-fns';
|
||||
@@ -100,11 +101,16 @@ export class PermissionsComponent implements OnInit {
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
||||
private route: ActivatedRoute,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private http: _HttpClient
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.route.snapshot.queryParams['roleId']) {
|
||||
this.query.params.roleId = this.route.snapshot.queryParams['roleId'];
|
||||
this.query.params.roleName = this.route.snapshot.queryParams['roleName'];
|
||||
}
|
||||
this.query.tableInitialize = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
(nzCheckedChange)="onTableAllChecked($event)"></th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.username' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.employeeNumber' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.displayName' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.department' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.jobTitle' | i18n }}</th>
|
||||
@@ -71,7 +70,6 @@
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"></td>
|
||||
<td nzAlign="left"> {{ data.roleName }}</td>
|
||||
<td nzAlign="left"> {{ data.username }}</td>
|
||||
<td nzAlign="left"> {{ data.employeeNumber }}</td>
|
||||
<td nzAlign="left"> {{ data.displayName }}</td>
|
||||
<td nzAlign="left"> {{ data.department }}</td>
|
||||
<td nzAlign="left"> {{ data.jobTitle }}</td>
|
||||
@@ -79,7 +77,7 @@
|
||||
i18n) }}</td>
|
||||
<td nzAlign="left" nzBreakWord="false">
|
||||
<div nz-col>
|
||||
<button *ngIf="data.dynamic == '0'" nz-button type="button" (click)="onDelete($event, data.id)"
|
||||
<button *ngIf="data.category == 'static'" nz-button type="button" (click)="onDelete($event, data.id)"
|
||||
nzDanger>{{
|
||||
'mxk.text.delete' | i18n
|
||||
}}</button>
|
||||
|
||||
@@ -110,6 +110,10 @@ export class RoleMembersComponent implements OnInit {
|
||||
if (this.route.snapshot.queryParams['username']) {
|
||||
this.query.params.username = this.route.snapshot.queryParams['username'];
|
||||
}
|
||||
if (this.route.snapshot.queryParams['roleId']) {
|
||||
this.query.params.roleId = this.route.snapshot.queryParams['roleId'];
|
||||
this.query.params.roleName = this.route.snapshot.queryParams['roleName'];
|
||||
}
|
||||
this.query.tableInitialize = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,29 +22,29 @@
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="dynamic">{{ 'mxk.roles.dynamic' | i18n }}</nz-form-label>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="dynamic">{{ 'mxk.roles.category' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="The input is not valid status!">
|
||||
<nz-switch [(ngModel)]="form.model.switch_dynamic" [ngModelOptions]="{ standalone: true }" name="dynamic"
|
||||
[nzCheckedChildren]="checkedTemplate" [nzUnCheckedChildren]="unCheckedTemplate"></nz-switch>
|
||||
<ng-template #checkedTemplate><i nz-icon nzType="check"></i></ng-template>
|
||||
<ng-template #unCheckedTemplate><i nz-icon nzType="close"></i></ng-template>
|
||||
<nz-radio-group [(ngModel)]="form.model.category" [ngModelOptions]="{ standalone: true }" nzButtonStyle="solid">
|
||||
<label nz-radio-button nzValue="static">{{ 'mxk.roles.category.static' | i18n }}</label>
|
||||
<label nz-radio-button nzValue="dynamic">{{ 'mxk.roles.category.dynamic' | i18n }}</label>
|
||||
</nz-radio-group>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-item *ngIf="form.model.category == 'dynamic'">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="resumeTime">{{ 'mxk.roles.resumeTime' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid port!">
|
||||
<nz-time-picker [(ngModel)]="form.model.picker_resumeTime" [ngModelOptions]="{ standalone: true }"
|
||||
nzFormat="HH:mm" name="picker_resumeTime" id="picker_resumeTime"></nz-time-picker>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-item *ngIf="form.model.category == 'dynamic'">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="suspendTime">{{ 'mxk.roles.suspendTime' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid suspendTime!">
|
||||
<nz-time-picker [(ngModel)]="form.model.picker_suspendTime" [ngModelOptions]="{ standalone: true }"
|
||||
nzFormat="HH:mm" name="picker_suspendTime" id="picker_suspendTime"></nz-time-picker>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-item *ngIf="form.model.category == 'dynamic'">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="orgIdsList">{{ 'mxk.roles.orgIdsList' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid upperCase!">
|
||||
<input type="hidden" [(ngModel)]="form.model.orgIdsList" [ngModelOptions]="{ standalone: true }" nz-input
|
||||
@@ -55,7 +55,7 @@
|
||||
</nz-tree-select>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-item *ngIf="form.model.category == 'dynamic'">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="filters">{{ 'mxk.roles.filters' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid filters!">
|
||||
<textarea rows="4" nz-input [(ngModel)]="form.model.filters" [ngModelOptions]="{ standalone: true }" nz-input
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
(nzCheckedChange)="onTableAllChecked($event)"></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.dynamic' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.category' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.text.description' | i18n }}</th>
|
||||
<th nzAlign="center"><a>{{ 'mxk.text.action' | i18n }}</a></th>
|
||||
</tr>
|
||||
@@ -54,11 +54,18 @@
|
||||
<span>{{ data.id }}</span>
|
||||
</td>
|
||||
<td nzAlign="left" nzBreakWord="false">{{ data.roleName }}</td>
|
||||
<td nzAlign="center"> <i *ngIf="data.dynamic == 1" nz-icon nzType="check-circle" nzTheme="fill"
|
||||
style="color: green"></i></td>
|
||||
<td nzAlign="center" *ngIf="data.category == 'dynamic'"> {{ 'mxk.roles.category.dynamic' | i18n }}</td>
|
||||
<td nzAlign="center" *ngIf="data.category == 'static'"> {{ 'mxk.roles.category.static' | i18n }}</td>
|
||||
<td nzAlign="left">{{ data.description }}</td>
|
||||
<td nzAlign="left" nzBreakWord="false">
|
||||
<div nz-col>
|
||||
<button nz-button type="button" (click)="onMembers($event, data.id, data.roleName)" style="float: left">{{
|
||||
'mxk.roles.member' | i18n
|
||||
}}</button>
|
||||
<button nz-button type="button" (click)="onPermissions($event, data.id, data.roleName)"
|
||||
style="float: left">{{
|
||||
'mxk.roles.permissions' | i18n
|
||||
}}</button>
|
||||
<button nz-button type="button" (click)="onEdit($event, data.id)" style="float: left">{{ 'mxk.text.edit' |
|
||||
i18n }}</button>
|
||||
<button
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { I18NService } from '@core';
|
||||
import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme';
|
||||
import { format, addDays } from 'date-fns';
|
||||
@@ -88,6 +89,7 @@ export class RolesComponent implements OnInit {
|
||||
private rolesService: RolesService,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
private router: Router,
|
||||
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
||||
private cdr: ChangeDetectorRef
|
||||
) { }
|
||||
@@ -173,6 +175,14 @@ export class RolesComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onMembers(e: MouseEvent, roleId: String, roleName: String): void {
|
||||
this.router.navigateByUrl(`/access/rolemembers?roleId=${roleId}&roleName=${roleName}`);
|
||||
}
|
||||
|
||||
onPermissions(e: MouseEvent, roleId: String, roleName: String): void {
|
||||
this.router.navigateByUrl(`/access/permissions?roleId=${roleId}&roleName=${roleName}`);
|
||||
}
|
||||
|
||||
fetch(): void {
|
||||
this.query.submitLoading = true;
|
||||
this.query.tableLoading = true;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<th></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.dynamic' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.category' | i18n }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -44,8 +44,8 @@
|
||||
<span>{{ data.id }}</span>
|
||||
</td>
|
||||
<td nzAlign="left"> {{ data.roleName }}</td>
|
||||
<td nzAlign="center"> <i *ngIf="data.dynamic == 1" nz-icon nzType="check-circle" nzTheme="fill"
|
||||
style="color: green"></i></td>
|
||||
<td nzAlign="center" *ngIf="data.category == 'dynamic'"> {{ 'mxk.roles.category.dynamic' | i18n }}</td>
|
||||
<td nzAlign="center" *ngIf="data.category == 'static'"> {{ 'mxk.roles.category.static' | i18n }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
|
||||
@@ -118,8 +118,11 @@
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item style="width: 100%">
|
||||
<nz-form-control [nzOffset]="7" [nzSpan]="12">
|
||||
<button nz-button nzType="primary" type="submit" [nzLoading]="form.submitting">提交</button>
|
||||
<nz-form-control [nzOffset]="10" [nzSpan]="8">
|
||||
<button nz-button nzType="primary" type="submit" [nzLoading]="form.submitting"> {{ 'mxk.text.submit' | i18n
|
||||
}}</button>
|
||||
<button nz-button nzType="default" (click)="onTest($event)" [nzLoading]="form.submitting"> {{ 'mxk.text.test' |
|
||||
i18n }}</button>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</form>
|
||||
|
||||
@@ -3,6 +3,15 @@
|
||||
<nz-card [nzBordered]="false">
|
||||
<form nz-form [nzLayout]="'inline'" (ngSubmit)="onSearch()" class="search__form">
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col nzMd="10" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="roleName">{{ 'mxk.roles.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<input nz-input [(ngModel)]="query.params.roleName" [ngModelOptions]="{ standalone: true }" name="roleName"
|
||||
placeholder="" id="roleName" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
<div nz-col nzMd="10" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="name">{{ 'mxk.resources.appName' | i18n }}</nz-form-label>
|
||||
@@ -18,16 +27,7 @@
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
<div nz-col nzMd="8" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="roleName">{{ 'mxk.roles.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<input nz-input [(ngModel)]="query.params.roleName" [ngModelOptions]="{ standalone: true }" name="roleName"
|
||||
placeholder="" id="roleName" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="query.expandForm ? 24 : 6" [class.text-right]="query.expandForm">
|
||||
<div nz-col [nzSpan]="query.expandForm ? 24 : 4" [class.text-right]="query.expandForm">
|
||||
<button nz-button type="submit" [nzType]="'primary'" [nzLoading]="query.submitLoading">{{ 'mxk.text.query' |
|
||||
i18n }}</button>
|
||||
<button nz-button type="reset" (click)="onReset()" class="mx-sm" style="display: none">{{ 'mxk.text.reset' |
|
||||
@@ -44,6 +44,36 @@
|
||||
</div>
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col [nzSpan]="10" class="grid-border">
|
||||
<nz-table #dynamicTable nzTableLayout="auto" nzSize="small" nzBordered nzShowSizeChanger
|
||||
[nzData]="query.results.rows" [nzFrontPagination]="false" [nzTotal]="query.results.records"
|
||||
[nzPageSizeOptions]="query.params.pageSizeOptions" [nzPageSize]="query.params.pageSize"
|
||||
[nzPageIndex]="query.params.pageNumber" [nzLoading]="this.query.tableLoading"
|
||||
(nzQueryParams)="onQueryParamsChange($event)">
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th [nzChecked]="query.checked" [nzIndeterminate]="query.indeterminate" (nzCheckedChange)="onTableAllChecked($event)"></th>
|
||||
-->
|
||||
<th nzAlign="center"></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.category' | i18n }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of query.results.rows">
|
||||
<td [nzChecked]="query.tableCheckedId.has(data.id)" [nzDisabled]="data.disabled"
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"></td>
|
||||
<td nzAlign="left" style="display: none">
|
||||
<span>{{ data.id }}</span>
|
||||
</td>
|
||||
<td nzAlign="left" nzBreakWord="false">{{ data.roleName }}</td>
|
||||
<td nzAlign="center" *ngIf="data.category == 'dynamic'"> {{ 'mxk.roles.category.dynamic' | i18n }}</td>
|
||||
<td nzAlign="center" *ngIf="data.category == 'static'"> {{ 'mxk.roles.category.static' | i18n }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="14" class="grid-border">
|
||||
<nz-tree #nzTreeComponent nzShowLine="false" [nzCheckable]="treeNodes.checkable"
|
||||
[nzCheckedKeys]="treeNodes.checkedKeys" nzBlockNode [nzData]="treeNodes.nodes" (nzDblClick)="openFolder($event)"
|
||||
[nzTreeTemplate]="nzTreeTemplate"></nz-tree>
|
||||
@@ -60,35 +90,5 @@
|
||||
</span>
|
||||
</ng-template>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="14" class="grid-border">
|
||||
<nz-table #dynamicTable nzTableLayout="auto" nzSize="small" nzBordered nzShowSizeChanger
|
||||
[nzData]="query.results.rows" [nzFrontPagination]="false" [nzTotal]="query.results.records"
|
||||
[nzPageSizeOptions]="query.params.pageSizeOptions" [nzPageSize]="query.params.pageSize"
|
||||
[nzPageIndex]="query.params.pageNumber" [nzLoading]="this.query.tableLoading"
|
||||
(nzQueryParams)="onQueryParamsChange($event)">
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th [nzChecked]="query.checked" [nzIndeterminate]="query.indeterminate" (nzCheckedChange)="onTableAllChecked($event)"></th>
|
||||
-->
|
||||
<th nzAlign="center"></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.dynamic' | i18n }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of query.results.rows">
|
||||
<td [nzChecked]="query.tableCheckedId.has(data.id)" [nzDisabled]="data.disabled"
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"></td>
|
||||
<td nzAlign="left" style="display: none">
|
||||
<span>{{ data.id }}</span>
|
||||
</td>
|
||||
<td nzAlign="left" nzBreakWord="false">{{ data.roleName }}</td>
|
||||
<td nzAlign="center"> <i *ngIf="data.dynamic == 1" nz-icon nzType="check-circle" nzTheme="fill"
|
||||
style="color: green"></i></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</div>
|
||||
</div>
|
||||
</nz-card>
|
||||
@@ -160,7 +160,7 @@ export class PrivilegesComponent implements OnInit {
|
||||
this.query.tableLoading = false;
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.operate.success'));
|
||||
this.fetch();
|
||||
//this.fetch();
|
||||
} else {
|
||||
this.msg.error(this.i18n.fanyi('mxk.alert.operate.error'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user