Newer
Older
import {Component, OnInit, ViewChild} from '@angular/core';
import {NzMessageService, NzModalService, NzTreeNode, NzTreeNodeOptions} from 'ng-zorro-antd';
import {SystemService} from '../system.service';
import {GroupModalComponent} from '../modal/group-modal/group-modal.component';
import {SelectRoleComponent} from '../../modal/select-role/select-role.component';
import {CommonService} from '../../shared/common/common.service';
import {pageSize, SERVER_API_URL_COMS} from '../../app.constants';
import 'rxjs/Rx' ;
import {UploadComponent} from '../../work/modal/upload/upload.component';
selector: 'jhi-group',
templateUrl: './group.component.html',
styles: []
@ViewChild('smartUser') smartUser: UserComponent;
@ViewChild('smartGroupModal') smartGroupModal: GroupModalComponent;
allChecked = false;
disabledButton = true;
indeterminate = false;
checkedNumber = 0;
nodes: any[];
isVisible = true;
constructor(private systemSer: SystemService, private message: NzMessageService,
private modalSer: NzModalService, private commonSer: CommonService) {
currentPageDataChange($event: Array<{ checked: boolean }>): void {
this.dataSet = $event;
const allChecked = this.dataSet.every(value => value.checked === true);
const allUnChecked = this.dataSet.every(value => !value.checked);
this.allChecked = allChecked;
this.indeterminate = (!allChecked) && (!allUnChecked);
this.disabledButton = !this.dataSet.some(value => value.checked);
this.checkedNumber = this.dataSet.filter(value => value.checked).length;
}
mouseAction(name: string, e: any): void {
}
ngOnInit() {
'search': this.name = this.name == '' ? null : this.name,
'organizationId': this.organizationId = this.organizationId == '' ? null : this.organizationId,
this.dataSet = res.data.data;
this.totalNum = res.data.totalCount;
this.groupList.forEach(
res => {
res.title = res.name;
res.key = res.id;
}
);
this.nodeTree();
const tree = this.commonSer.listToTree('id', 'parentId', this.groupList,);
const list = tree.map(res => {
return new NzTreeNode(res);
});
this.nodes = list;
}
showModal(): void {
this.isVisible = true;
}
handleOk(): void {
this.isVisible = false;
}
handleCancel(): void {
this.isVisible = false;
}
showEditModal(item) {
this.smartUser.showEditModal(this.groupList, '编辑用户', item.id);
this.modalSer.confirm({
nzTitle: '删除',
nzContent: '<b style="color: red">确定删除该用户吗</b>',
nzOkText: '确定',
nzCancelText: '取消',
nzOnOk: () => {
this.message.success("删除用户成功");
}else{
this.message.error(res.errMsg);
this.message.success("删除用户成功");
}else{
this.message.error(res.errMsg);
this.commonSer.confirmThing("删除","确认删除该组织",()=>{
this.systemSer.deleteOrg(item.key).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.success("删除成功");
this.getGroup();
}else{
this.message.error(res.errMsg);
}
}
)
})
return e.id;
}),
};
this.systemSer.batchUserToAuth(data).subscribe(
return e.id;
}),
};
this.systemSer.aloneUserToAuth(data).subscribe(
selectRoleModal() {
this.setType = '批量';
this.smartSelectRole.showModal('选择角色', null);
this.systemSer.downloadTemplate("",SERVER_API_URL_COMS + "/user/downloadTemplate/").subscribe(
}
);
}
//导入用户
showUploadModalUser(){
this.smartUpload.showModal("上传用户文件");
}
//导入组织
showUploadModalOrg(){
this.smartUpload.showModal("上传组织文件");
}