Commit 0a769e8f authored by wangqinghua's avatar wangqinghua

update

parent 0df53618
...@@ -73,6 +73,7 @@ import {JhiTranslateComponent} from 'ng-jhipster'; ...@@ -73,6 +73,7 @@ import {JhiTranslateComponent} from 'ng-jhipster';
import {LookPlanComponent} from './work/modal/look-plan/look-plan.component'; import {LookPlanComponent} from './work/modal/look-plan/look-plan.component';
import {PlanModalComponent} from './work/modal/plan-modal/plan-modal.component'; import {PlanModalComponent} from './work/modal/plan-modal/plan-modal.component';
import {SelectPersonComponent} from './modal/select-person/select-person.component'; import {SelectPersonComponent} from './modal/select-person/select-person.component';
import {SelectRoleComponent} from './modal/select-role/select-role.component';
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -145,7 +146,8 @@ import {SelectPersonComponent} from './modal/select-person/select-person.compone ...@@ -145,7 +146,8 @@ import {SelectPersonComponent} from './modal/select-person/select-person.compone
ToUtilPipe, ToUtilPipe,
LookPlanComponent, LookPlanComponent,
PlanModalComponent, PlanModalComponent,
SelectPersonComponent SelectPersonComponent,
SelectRoleComponent
], ],
providers:[ providers:[
OverAllService, OverAllService,
......
<!--添加资源-->
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()">
<nz-table #basicTable [nzData]="dataSet">
<thead>
<tr>
<th>角色名称</th>
<th>说明</th>
<th>权限模块</th>
<th>资源权限</th>
<th>有效</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.name}}</td>
<td>{{data.comments}}</td>
<td>{{data.key3}}</td>
<td>{{data.key4}}</td>
<td>
<ng-container *ngIf="data.status == 0">
<i class="anticon anticon-check"></i>
</ng-container>
</td>
<td class="handle">
<span (click)="grantUser(data)">授予用户</span>
<span>查看</span>
<span (click)="showEditModal(data.id)">编辑</span>
<span (click)="deleteRole(data)">删除</span>
</td>
</tr>
</tbody>
</nz-table>
</nz-modal>
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'smart-select-role',
templateUrl: './select-role.component.html',
styles: []
})
export class SelectRoleComponent implements OnInit {
title;
isVisible = false;
constructor() { }
ngOnInit() {
}
showModal(title){
this.title = title;
this.isVisible = true;
}
getRoleList(){
}
}
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
</div> </div>
<div class="releative" #checkEle> <div class="releative" #checkEle>
<div #colorEle class="checkTags tag-form"> <div #colorEle class="checkTags tag-form">
<span (click)="getCheckList(0)"> <nz-tag [nzColor]="color.green"></nz-tag> <span (click)="getCheckList(0)">
<i *ngIf="!checkStatus.normal && checkStatus.normal !=0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i> <nz-tag [nzColor]="color.green"></nz-tag>
{{checkStatus.normal}} <i *ngIf="!checkStatus.normal && checkStatus.normal !=0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i>{{checkStatus.normal}}
</span> </span>
<span (click)="getCheckList(1)"> <nz-tag [nzColor]="color.yellow"></nz-tag> <span (click)="getCheckList(1)"> <nz-tag [nzColor]="color.yellow"></nz-tag>
<i *ngIf="!checkStatus.warning && checkStatus.warning !=0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i> <i *ngIf="!checkStatus.warning && checkStatus.warning !=0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i>
......
...@@ -18,6 +18,7 @@ import {DatePipe} from '@angular/common'; ...@@ -18,6 +18,7 @@ import {DatePipe} from '@angular/common';
position: absolute; position: absolute;
top: 12px; top: 12px;
left: 233px; left: 233px;
z-index: 9999999;
} }
.time-select{ .time-select{
position: absolute; position: absolute;
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
<td>{{data.mobile}}</td> <td>{{data.mobile}}</td>
<td>{{data.key4}}</td> <td>{{data.key4}}</td>
<td class="handle"> <td class="handle">
<span (click)="grantRole(data)">授权</span>
<span>查看</span> <span>查看</span>
<span>编辑</span> <span>编辑</span>
<span (click)="deleteUser(data)">删除</span> <span (click)="deleteUser(data)">删除</span>
...@@ -77,7 +78,10 @@ ...@@ -77,7 +78,10 @@
</nz-table> </nz-table>
</div> </div>
</div> </div>
<!--新增用户-->
<smart-user #smartUser></smart-user> <smart-user #smartUser></smart-user>
<!--新增部门-->
<smart-group-modal #smartGroupModal></smart-group-modal> <smart-group-modal #smartGroupModal></smart-group-modal>
<!--授予角色-->
<smart-select-role #smartSelectRole ></smart-select-role>
...@@ -4,6 +4,7 @@ import {SystemService} from '../system.service'; ...@@ -4,6 +4,7 @@ import {SystemService} from '../system.service';
import {UserComponent} from '../modal/user/user.component'; import {UserComponent} from '../modal/user/user.component';
import {GroupModalComponent} from '../modal/group-modal/group-modal.component'; import {GroupModalComponent} from '../modal/group-modal/group-modal.component';
import {ToTree} from '../../shared/common/toTree'; import {ToTree} from '../../shared/common/toTree';
import {SelectRoleComponent} from '../../modal/select-role/select-role.component';
@Component({ @Component({
selector: 'jhi-group', selector: 'jhi-group',
...@@ -11,7 +12,7 @@ import {ToTree} from '../../shared/common/toTree'; ...@@ -11,7 +12,7 @@ import {ToTree} from '../../shared/common/toTree';
styles: [] styles: []
}) })
export class GroupComponent implements OnInit { export class GroupComponent implements OnInit {
@ViewChild("smartSelectRole") smartSelectRole:SelectRoleComponent;
@ViewChild('power') power; @ViewChild('power') power;
@ViewChild('smartUser') smartUser: UserComponent; @ViewChild('smartUser') smartUser: UserComponent;
@ViewChild('smartGroupModal') smartGroupModal: GroupModalComponent; @ViewChild('smartGroupModal') smartGroupModal: GroupModalComponent;
...@@ -142,4 +143,9 @@ export class GroupComponent implements OnInit { ...@@ -142,4 +143,9 @@ export class GroupComponent implements OnInit {
this.smartGroupModal.showModal(this.groupList); this.smartGroupModal.showModal(this.groupList);
} }
//授予角色
grantRole(data){
this.smartSelectRole.showModal("选择角色");
}
} }
...@@ -63,4 +63,5 @@ ...@@ -63,4 +63,5 @@
<!--新增角色--> <!--新增角色-->
<smart-role #smartRole (add)="getRole()"></smart-role> <smart-role #smartRole (add)="getRole()"></smart-role>
<smart-select-person #smartSelectPerson></smart-select-person>
\ No newline at end of file <smart-select-person #smartSelectPerson (done)="batchAdduserToRole($event)"></smart-select-person>
\ No newline at end of file
...@@ -16,6 +16,8 @@ export class PowerComponent implements OnInit { ...@@ -16,6 +16,8 @@ export class PowerComponent implements OnInit {
dataSet: any[]; dataSet: any[];
isVisible = false; isVisible = false;
roleId; //角色id
constructor(private systemSer: SystemService,private message:NzMessageService, constructor(private systemSer: SystemService,private message:NzMessageService,
private modalSer:NzModalService) { private modalSer:NzModalService) {
} }
...@@ -43,10 +45,34 @@ export class PowerComponent implements OnInit { ...@@ -43,10 +45,34 @@ export class PowerComponent implements OnInit {
} }
//授予用户 //授予用户
grantUser(){ grantUser(data){
this.roleId = data.id;
this.smartSelectPerson.showModal("授予用户"); this.smartSelectPerson.showModal("授予用户");
} }
//但一角色批量添加用户
batchAdduserToRole(e){
console.log(e);
let str ="";
e.forEach(res=>{
str += res.id +",";
});
str = str.substring(0,str.length-1);
const data = {
roleId:this.roleId,
users:str
}
this.systemSer.batchGrantUserToRole(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.success("授予成功")
}else{
this.message.error(res.errMsg);
}
}
)
}
//删除角色 //删除角色
deleteRole(data) { deleteRole(data) {
this.modalSer.confirm({ this.modalSer.confirm({
...@@ -76,7 +102,4 @@ export class PowerComponent implements OnInit { ...@@ -76,7 +102,4 @@ export class PowerComponent implements OnInit {
e.preventDefault(); e.preventDefault();
} }
hello() {
}
} }
...@@ -69,4 +69,9 @@ export class SystemService { ...@@ -69,4 +69,9 @@ export class SystemService {
logList(data): Observable<any>{ logList(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/log?'+this.toTree.toQuery(data)); return this.http.get(SERVER_API_URL + '/log?'+this.toTree.toQuery(data));
} }
}
\ No newline at end of file //对单一角色批量添加用户
batchGrantUserToRole(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/role/batchGrantUserToRole',data);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment