Commit 0a769e8f authored by wangqinghua's avatar wangqinghua

update

parent 0df53618
......@@ -73,6 +73,7 @@ import {JhiTranslateComponent} from 'ng-jhipster';
import {LookPlanComponent} from './work/modal/look-plan/look-plan.component';
import {PlanModalComponent} from './work/modal/plan-modal/plan-modal.component';
import {SelectPersonComponent} from './modal/select-person/select-person.component';
import {SelectRoleComponent} from './modal/select-role/select-role.component';
@NgModule({
imports: [
......@@ -145,7 +146,8 @@ import {SelectPersonComponent} from './modal/select-person/select-person.compone
ToUtilPipe,
LookPlanComponent,
PlanModalComponent,
SelectPersonComponent
SelectPersonComponent,
SelectRoleComponent
],
providers:[
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 @@
</div>
<div class="releative" #checkEle>
<div #colorEle class="checkTags tag-form">
<span (click)="getCheckList(0)"> <nz-tag [nzColor]="color.green"></nz-tag>
<i *ngIf="!checkStatus.normal && checkStatus.normal !=0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i>
{{checkStatus.normal}}
<span (click)="getCheckList(0)">
<nz-tag [nzColor]="color.green"></nz-tag>
<i *ngIf="!checkStatus.normal && checkStatus.normal !=0" class="anticon anticon-spin anticon-loading" style="font-size: 15px;"></i>{{checkStatus.normal}}
</span>
<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>
......
......@@ -18,6 +18,7 @@ import {DatePipe} from '@angular/common';
position: absolute;
top: 12px;
left: 233px;
z-index: 9999999;
}
.time-select{
position: absolute;
......
......@@ -68,6 +68,7 @@
<td>{{data.mobile}}</td>
<td>{{data.key4}}</td>
<td class="handle">
<span (click)="grantRole(data)">授权</span>
<span>查看</span>
<span>编辑</span>
<span (click)="deleteUser(data)">删除</span>
......@@ -77,7 +78,10 @@
</nz-table>
</div>
</div>
<!--新增用户-->
<smart-user #smartUser></smart-user>
<!--新增部门-->
<smart-group-modal #smartGroupModal></smart-group-modal>
<!--授予角色-->
<smart-select-role #smartSelectRole ></smart-select-role>
......@@ -4,6 +4,7 @@ import {SystemService} from '../system.service';
import {UserComponent} from '../modal/user/user.component';
import {GroupModalComponent} from '../modal/group-modal/group-modal.component';
import {ToTree} from '../../shared/common/toTree';
import {SelectRoleComponent} from '../../modal/select-role/select-role.component';
@Component({
selector: 'jhi-group',
......@@ -11,7 +12,7 @@ import {ToTree} from '../../shared/common/toTree';
styles: []
})
export class GroupComponent implements OnInit {
@ViewChild("smartSelectRole") smartSelectRole:SelectRoleComponent;
@ViewChild('power') power;
@ViewChild('smartUser') smartUser: UserComponent;
@ViewChild('smartGroupModal') smartGroupModal: GroupModalComponent;
......@@ -142,4 +143,9 @@ export class GroupComponent implements OnInit {
this.smartGroupModal.showModal(this.groupList);
}
//授予角色
grantRole(data){
this.smartSelectRole.showModal("选择角色");
}
}
......@@ -63,4 +63,5 @@
<!--新增角色-->
<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 {
dataSet: any[];
isVisible = false;
roleId; //角色id
constructor(private systemSer: SystemService,private message:NzMessageService,
private modalSer:NzModalService) {
}
......@@ -43,10 +45,34 @@ export class PowerComponent implements OnInit {
}
//授予用户
grantUser(){
grantUser(data){
this.roleId = data.id;
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) {
this.modalSer.confirm({
......@@ -76,7 +102,4 @@ export class PowerComponent implements OnInit {
e.preventDefault();
}
hello() {
}
}
......@@ -69,4 +69,9 @@ export class SystemService {
logList(data): Observable<any>{
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