用户管理,角色管理列表翻页无效问题解决
This commit is contained in:
@@ -14,12 +14,12 @@
|
|||||||
<nz-form-item>
|
<nz-form-item>
|
||||||
<nz-form-label class="mr-1" style="vertical-align:top">时间</nz-form-label>
|
<nz-form-label class="mr-1" style="vertical-align:top">时间</nz-form-label>
|
||||||
<nz-form-control style="display:inline-block">
|
<nz-form-control style="display:inline-block">
|
||||||
<nz-date-picker [nzShowToday]="false" class="mr-2" [nzDisabledDate]="disabledStartDate" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"
|
<nz-date-picker [nzShowToday]="false" class="mr-2" [nzDisabledDate]="disabledStartDate"
|
||||||
[(ngModel)]="startValue" nzPlaceHolder="请选择开始时间" (ngModelChange)="onStartChange($event)"
|
nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss" [(ngModel)]="startValue" nzPlaceHolder="请选择开始时间"
|
||||||
(nzOnOpenChange)="handleStartOpenChange($event)">
|
(ngModelChange)="onStartChange($event)" (nzOnOpenChange)="handleStartOpenChange($event)">
|
||||||
</nz-date-picker>
|
</nz-date-picker>
|
||||||
<nz-date-picker [nzShowToday]="false" [nzDisabledDate]="disabledEndDate" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"
|
<nz-date-picker [nzShowToday]="false" [nzDisabledDate]="disabledEndDate" nzShowTime
|
||||||
[(ngModel)]="endValue" nzPlaceHolder="请选择结束时间" [nzOpen]="endOpen"
|
nzFormat="yyyy-MM-dd HH:mm:ss" [(ngModel)]="endValue" nzPlaceHolder="请选择结束时间" [nzOpen]="endOpen"
|
||||||
(ngModelChange)="onEndChange($event)" (nzOnOpenChange)="handleEndOpenChange($event)">
|
(ngModelChange)="onEndChange($event)" (nzOnOpenChange)="handleEndOpenChange($event)">
|
||||||
</nz-date-picker>
|
</nz-date-picker>
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let item of dataSet.data;let i=index">
|
<tr *ngFor="let item of dataSet.data;let i=index">
|
||||||
<td>{{i+1}}</td>
|
<td>{{(search.page_index - 1)*search.page_size+i+1}}</td>
|
||||||
<td>{{item.user_name}}</td>
|
<td>{{item.user_name}}</td>
|
||||||
<td>{{item.model_name}}</td>
|
<td>{{item.model_name}}</td>
|
||||||
<td>{{item.summary}}</td>
|
<td>{{item.summary}}</td>
|
||||||
|
|||||||
+23
-3
@@ -68,11 +68,31 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 机构负责人选择 -->
|
<!-- 机构负责人选择 -->
|
||||||
<div class="org-selete-box">
|
<div class="org-selete-box">
|
||||||
<nz-drawer [nzBodyStyle]="{ height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom':'53px' }" [nzWidth]="auto"
|
<nz-drawer [nzBodyStyle]="{ height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom':'53px' }" [nzWidth]="460"
|
||||||
[nzVisible]="visibleUsers" nzTitle="角色用户" (nzOnClose)="closeUser()">
|
[nzVisible]="visibleUsers" nzTitle="角色用户" (nzOnClose)="closeUser()">
|
||||||
<div class="users-box" [hidden]='statusParamsUsers.status!=3'>
|
<div class="users-box" [hidden]='statusParamsUsers.status!=3'>
|
||||||
<div class="user-table-box">
|
<div class="user-table-box">
|
||||||
<nz-table nzBordered [nzShowPagination]='false' #dataSet [nzData]="userData">
|
<nz-table nzBordered #dataSet [nzFrontPagination]="false" [nzData]="userData" [nzTotal]="collectionSize"
|
||||||
|
[(nzPageIndex)]="search.page_index" [(nzPageSize)]="search.page_size" (nzPageIndexChange)="queryTable()">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>姓名</th>
|
||||||
|
<th>用户名</th>
|
||||||
|
<th>电话</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let item of dataSet.data">
|
||||||
|
<td nzShowCheckbox [(nzChecked)]="item.checked" [nzDisabled]="item.disabled"></td>
|
||||||
|
<td>{{item.real_name}}</td>
|
||||||
|
<td>{{item.login_name}}</td>
|
||||||
|
<td>{{item.mobile}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</nz-table>
|
||||||
|
|
||||||
|
<!-- <nz-table nzBordered [nzShowPagination]='false' #dataSet [nzData]="userData">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
@@ -93,7 +113,7 @@
|
|||||||
<div class="page-box" *ngIf="statusParamsUsers.status==3">
|
<div class="page-box" *ngIf="statusParamsUsers.status==3">
|
||||||
<nz-pagination [nzPageIndex]="search.page_index" (nzPageIndexChange)='pageChange($event)'
|
<nz-pagination [nzPageIndex]="search.page_index" (nzPageIndexChange)='pageChange($event)'
|
||||||
[nzPageSize]='search.page_size' [nzTotal]="collectionSize"></nz-pagination>
|
[nzPageSize]='search.page_size' [nzTotal]="collectionSize"></nz-pagination>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-footer">
|
<div class="drawer-footer">
|
||||||
<button (click)='userSave()' nz-button nzType="primary" class="mr10">保存</button>
|
<button (click)='userSave()' nz-button nzType="primary" class="mr10">保存</button>
|
||||||
|
|||||||
+1
-5
@@ -213,11 +213,7 @@ export class RoleManagementModifyComponent implements OnInit {
|
|||||||
closeUser(): void {
|
closeUser(): void {
|
||||||
this.visibleUsers = false;
|
this.visibleUsers = false;
|
||||||
}
|
}
|
||||||
//翻页
|
|
||||||
pageChange(event) {
|
|
||||||
this.search.page_index = event;
|
|
||||||
this.queryTable();
|
|
||||||
}
|
|
||||||
//获取用户列表
|
//获取用户列表
|
||||||
queryTable(): void {
|
queryTable(): void {
|
||||||
this.statusParamsUsers.status = 1;
|
this.statusParamsUsers.status = 1;
|
||||||
|
|||||||
@@ -23,7 +23,35 @@
|
|||||||
<nz-divider></nz-divider>
|
<nz-divider></nz-divider>
|
||||||
<app-request-status *ngIf='statusParamsTable.status!=4' [statusParams]='statusParamsTable'></app-request-status>
|
<app-request-status *ngIf='statusParamsTable.status!=4' [statusParams]='statusParamsTable'></app-request-status>
|
||||||
<div class="table-box" *ngIf='statusParamsTable.status==3||statusParamsTable.status==4||statusParamsTable.status==0'>
|
<div class="table-box" *ngIf='statusParamsTable.status==3||statusParamsTable.status==4||statusParamsTable.status==0'>
|
||||||
<nz-table nzBordered [nzShowPagination]='false' #dataSet [nzData]="tableData">
|
<nz-table nzBordered #dataSet [nzFrontPagination]="false" [nzData]="tableData" [nzTotal]="collectionSize"
|
||||||
|
[(nzPageIndex)]="search.page_index" [(nzPageSize)]="search.page_size" (nzPageIndexChange)="queryTable()">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>角色名称</th>
|
||||||
|
<th>角色类型</th>
|
||||||
|
<th>创建人</th>
|
||||||
|
<th>创建日期</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let item of dataSet.data">
|
||||||
|
<td>{{item.role_name}}</td>
|
||||||
|
<td><span *ngIf="item.role_type==0">系统内置</span><span *ngIf="item.role_type==1">用户定义</span></td>
|
||||||
|
<td>{{item.create_by}}</td>
|
||||||
|
<td>{{item.create_date| date:'yyyy-MM-dd HH:mm:ss'}}</td>
|
||||||
|
<td>
|
||||||
|
<i (click)="addModify(2,item)" class="table-operation-btn edit" nz-icon type="edit"
|
||||||
|
theme="outline"></i>
|
||||||
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
|
<i nz-popconfirm nzTitle="确定删除该角色?" nzOkText="确定" nzCancelText="取消" (nzOnConfirm)="delectConfirm(item)"
|
||||||
|
class="table-operation-btn danger" nz-icon type="delete" theme="outline"></i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</nz-table>
|
||||||
|
|
||||||
|
<!-- <nz-table nzBordered [nzShowPagination]='false' #dataSet [nzData]="tableData">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>角色名称</th>
|
<th>角色名称</th>
|
||||||
@@ -52,7 +80,7 @@
|
|||||||
<div class="page-box" *ngIf="statusParamsTable.status==3">
|
<div class="page-box" *ngIf="statusParamsTable.status==3">
|
||||||
<nz-pagination [nzPageIndex]="search.page_index" (nzPageIndexChange)='pageChange($event)'
|
<nz-pagination [nzPageIndex]="search.page_index" (nzPageIndexChange)='pageChange($event)'
|
||||||
[nzPageSize]='search.page_size' [nzTotal]="collectionSize"></nz-pagination>
|
[nzPageSize]='search.page_size' [nzTotal]="collectionSize"></nz-pagination>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,88 +4,74 @@ import { Router } from '@angular/router';
|
|||||||
import { NzMessageService } from 'ng-zorro-antd';
|
import { NzMessageService } from 'ng-zorro-antd';
|
||||||
|
|
||||||
import 'ztree';
|
import 'ztree';
|
||||||
declare var $: any;
|
declare var $: any;
|
||||||
declare var jQuery: any;
|
declare var jQuery: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-role-management',
|
selector: 'app-role-management',
|
||||||
templateUrl: './role-management.component.html',
|
templateUrl: './role-management.component.html',
|
||||||
styleUrls: ['./role-management.component.scss']
|
styleUrls: ['./role-management.component.scss']
|
||||||
})
|
})
|
||||||
export class RoleManagementComponent implements OnInit {
|
export class RoleManagementComponent implements OnInit {
|
||||||
collectionSize:any ;
|
collectionSize: any;
|
||||||
public tableData:any=[];
|
public tableData: any = [];
|
||||||
statusParamsTable:any={ //获取用户列表接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
statusParamsTable: any = { //获取用户列表接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
||||||
status:1,
|
status: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
statusParamsDetail:any={ //获取用户详情接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
statusParamsDetail: any = { //获取用户详情接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
||||||
status:1,
|
status: 1,
|
||||||
}
|
}
|
||||||
public search:any={
|
public search: any = {
|
||||||
page_index:'1',
|
page_index: '1',
|
||||||
page_size:'10',
|
page_size: '10',
|
||||||
role_name:'',
|
role_name: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http:HttpClientService,
|
private http: HttpClientService,
|
||||||
private router:Router,
|
private router: Router,
|
||||||
private message: NzMessageService,
|
private message: NzMessageService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.queryTable();
|
this.queryTable();
|
||||||
}
|
}
|
||||||
//新增、修改 1新增 2修改
|
//新增、修改 1新增 2修改
|
||||||
addModify(type,item?){
|
addModify(type, item?) {
|
||||||
if(type==1){
|
if (type == 1) {
|
||||||
this.router.navigate(['app/system/roles/modify'],{queryParams:{operateType:1}})
|
this.router.navigate(['app/system/roles/modify'], { queryParams: { operateType: 1 } })
|
||||||
}else if(type==2){
|
} else if (type == 2) {
|
||||||
this.router.navigate(['app/system/roles/modify'],{queryParams:{operateType:2,id:item.rid}})
|
this.router.navigate(['app/system/roles/modify'], { queryParams: { operateType: 2, id: item.rid } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//删除
|
//删除
|
||||||
delectConfirm(item){
|
delectConfirm(item) {
|
||||||
this.http.delete('/sysapi/setting/role/delete/'+item.rid).subscribe((json)=>{
|
this.http.delete('/sysapi/setting/role/delete/' + item.rid).subscribe((json) => {
|
||||||
if(json.is_success){
|
if (json.is_success) {
|
||||||
this.message.success(`删除成功!`);
|
this.message.success(`删除成功!`);
|
||||||
this.queryTable();
|
this.queryTable();
|
||||||
}else{
|
} else {
|
||||||
this.message.error(`删除失败`)
|
this.message.error(`删除失败`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//重置,重置搜索条件
|
|
||||||
// reset(){
|
|
||||||
// this.search.page_index=1;
|
|
||||||
// this.search.page_size=10;
|
|
||||||
// this.search.role_name='';
|
|
||||||
// this.queryTable();
|
|
||||||
// }
|
|
||||||
//获取列表
|
|
||||||
queryTable():void{
|
|
||||||
this.search.page_index=1;
|
|
||||||
this.statusParamsTable.status=1;
|
|
||||||
this.tableData=[];
|
|
||||||
this.http.get('/sysapi/setting/role/list',this.search).subscribe((json)=>{
|
|
||||||
if(json.is_success){
|
|
||||||
this.tableData=json.body.list;
|
|
||||||
this.collectionSize=json.body.total;
|
|
||||||
if(json.body.list&&json.body.list.length>0){
|
|
||||||
this.statusParamsTable.status=3;
|
|
||||||
}else{
|
|
||||||
this.statusParamsTable.status=4;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
this.statusParamsTable.status=0;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//翻页
|
|
||||||
pageChange(event){
|
|
||||||
this.search.page_index=event;
|
|
||||||
this.queryTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//获取列表
|
||||||
|
queryTable(): void {
|
||||||
|
this.statusParamsTable.status = 1;
|
||||||
|
this.http.get('/sysapi/setting/role/list', this.search).subscribe((json) => {
|
||||||
|
if (json.is_success) {
|
||||||
|
this.tableData = json.body.list;
|
||||||
|
this.collectionSize = json.body.total;
|
||||||
|
if (json.body.list && json.body.list.length > 0) {
|
||||||
|
this.statusParamsTable.status = 3;
|
||||||
|
} else {
|
||||||
|
this.statusParamsTable.status = 4;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.statusParamsTable.status = 0;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,8 @@
|
|||||||
<nz-divider></nz-divider>
|
<nz-divider></nz-divider>
|
||||||
<app-request-status *ngIf='statusParamsTable.status!=4' [statusParams]='statusParamsTable'></app-request-status>
|
<app-request-status *ngIf='statusParamsTable.status!=4' [statusParams]='statusParamsTable'></app-request-status>
|
||||||
<div class="table-box" *ngIf='statusParamsTable.status==3||statusParamsTable.status==4||statusParamsTable.status==0'>
|
<div class="table-box" *ngIf='statusParamsTable.status==3||statusParamsTable.status==4||statusParamsTable.status==0'>
|
||||||
<nz-table nzBordered [nzShowPagination]='false' #dataSet [nzData]="tableData">
|
<nz-table nzBordered #dataSet [nzFrontPagination]="false" [nzData]="tableData" [nzTotal]="collectionSize"
|
||||||
|
[(nzPageIndex)]="search.page_index" [(nzPageSize)]="search.page_size" (nzPageIndexChange)="queryTable()">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>姓名</th>
|
<th>姓名</th>
|
||||||
@@ -54,16 +55,13 @@
|
|||||||
<i (click)="addModify(2,item)" class="table-operation-btn edit" nz-icon type="edit"
|
<i (click)="addModify(2,item)" class="table-operation-btn edit" nz-icon type="edit"
|
||||||
theme="outline"></i>
|
theme="outline"></i>
|
||||||
<nz-divider *ngIf="currentUserInfo.uid!==item.uid" nzType="vertical"></nz-divider>
|
<nz-divider *ngIf="currentUserInfo.uid!==item.uid" nzType="vertical"></nz-divider>
|
||||||
<i *ngIf="currentUserInfo.uid!==item.uid" nz-popconfirm nzTitle="确定删除该用户?" nzOkText="确定" nzCancelText="取消" (nzOnConfirm)="delectConfirm(item)"
|
<i *ngIf="currentUserInfo.uid!==item.uid" nz-popconfirm nzTitle="确定删除该用户?" nzOkText="确定"
|
||||||
class="table-operation-btn danger" nz-icon type="delete" theme="outline"></i>
|
nzCancelText="取消" (nzOnConfirm)="delectConfirm(item)" class="table-operation-btn danger"
|
||||||
|
nz-icon type="delete" theme="outline"></i>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</nz-table>
|
</nz-table>
|
||||||
<div class="page-box" *ngIf="statusParamsTable.status==3">
|
|
||||||
<nz-pagination [nzPageIndex]="search.page_index" (nzPageIndexChange)='pageChange($event)'
|
|
||||||
[nzPageSize]='search.page_size' [nzTotal]="collectionSize"></nz-pagination>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,196 +4,184 @@ import { Router } from '@angular/router';
|
|||||||
import { NzMessageService } from 'ng-zorro-antd';
|
import { NzMessageService } from 'ng-zorro-antd';
|
||||||
|
|
||||||
import 'ztree';
|
import 'ztree';
|
||||||
declare var $: any;
|
declare var $: any;
|
||||||
declare var jQuery: any;
|
declare var jQuery: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-management',
|
selector: 'app-user-management',
|
||||||
templateUrl: './user-management.component.html',
|
templateUrl: './user-management.component.html',
|
||||||
styleUrls: ['./user-management.component.scss',]
|
styleUrls: ['./user-management.component.scss',]
|
||||||
})
|
})
|
||||||
export class UserManagementComponent implements OnInit {
|
export class UserManagementComponent implements OnInit {
|
||||||
treeSelected:any; //树模型-当前选中项
|
treeSelected: any; //树模型-当前选中项
|
||||||
collectionSize:any ;
|
collectionSize: any;
|
||||||
public tableData:any=[];
|
public tableData: any = [];
|
||||||
statusParamsTable:any={ //获取目录树接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
statusParamsTable: any = { //获取目录树接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
||||||
status:1,
|
status: 1,
|
||||||
}
|
}
|
||||||
statusParamsTree:any={ //获取机构接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
statusParamsTree: any = { //获取机构接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
||||||
status:1,
|
status: 1,
|
||||||
}
|
}
|
||||||
statusParamsDetail:any={ //获取用户详情接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
statusParamsDetail: any = { //获取用户详情接口的状态,0请求失败 1请求前 2请求中 3请求成功,有数据 4请求成功,无数据
|
||||||
status:1,
|
status: 1,
|
||||||
}
|
}
|
||||||
public search:any={
|
public search: any = {
|
||||||
page_index:'1',
|
page_index: '1',
|
||||||
page_size:'10',
|
page_size: '10',
|
||||||
real_name:'',
|
real_name: '',
|
||||||
login_name:'',
|
login_name: '',
|
||||||
orgId:'',
|
orgId: '',
|
||||||
}
|
}
|
||||||
visible = false;
|
visible = false;
|
||||||
userDetail:any={}; //用户详情
|
userDetail: any = {}; //用户详情
|
||||||
|
|
||||||
currentUserInfo = JSON.parse(sessionStorage.getItem('userInfo'));
|
currentUserInfo = JSON.parse(sessionStorage.getItem('userInfo'));
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http:HttpClientService,
|
private http: HttpClientService,
|
||||||
private router:Router,
|
private router: Router,
|
||||||
private message: NzMessageService,
|
private message: NzMessageService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
// this.currentUserInfo = JSON.parse(sessionStorage.getItem('userInfo'));
|
// this.currentUserInfo = JSON.parse(sessionStorage.getItem('userInfo'));
|
||||||
// console.log(sessionStorage.getItem('userInfo'));
|
// console.log(sessionStorage.getItem('userInfo'));
|
||||||
// 页面监听 动态改变表单高度
|
// 页面监听 动态改变表单高度
|
||||||
$('#tree-box').css('height',(document.documentElement.clientHeight-106+'px'));
|
$('#tree-box').css('height', (document.documentElement.clientHeight - 106 + 'px'));
|
||||||
$('#main-box-user').css('height',(document.documentElement.clientHeight-106+'px'));
|
$('#main-box-user').css('height', (document.documentElement.clientHeight - 106 + 'px'));
|
||||||
$(window).resize(function(){
|
$(window).resize(function () {
|
||||||
$('#tree-box').css('height',(document.documentElement.clientHeight-126+'px'));
|
$('#tree-box').css('height', (document.documentElement.clientHeight - 126 + 'px'));
|
||||||
$('#main-box-user').css('height',(document.documentElement.clientHeight-126+'px'));
|
$('#main-box-user').css('height', (document.documentElement.clientHeight - 126 + 'px'));
|
||||||
})
|
})
|
||||||
this.initTree();
|
this.initTree();
|
||||||
this.queryTable();
|
this.queryTable();
|
||||||
}
|
}
|
||||||
//删除
|
//删除
|
||||||
delectConfirm(item){
|
delectConfirm(item) {
|
||||||
this.http.delete('/sysapi/setting/user/deleteById/'+item.uid).subscribe((json)=>{
|
this.http.delete('/sysapi/setting/user/deleteById/' + item.uid).subscribe((json) => {
|
||||||
if(json.is_success){
|
if (json.is_success) {
|
||||||
this.message.success(`删除成功!`);
|
this.message.success(`删除成功!`);
|
||||||
this.queryTable();
|
this.queryTable();
|
||||||
}else{
|
} else {
|
||||||
this.message.error(`删除失败`)
|
this.message.error(`删除失败`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//新增、修改 1新增 2修改
|
//新增、修改 1新增 2修改
|
||||||
addModify(type,item?){
|
addModify(type, item?) {
|
||||||
if(type==1){
|
if (type == 1) {
|
||||||
this.router.navigate(['app/system/users/modify'],{queryParams:{operateType:1}})
|
this.router.navigate(['app/system/users/modify'], { queryParams: { operateType: 1 } })
|
||||||
}else if(type==2){
|
} else if (type == 2) {
|
||||||
this.router.navigate(['app/system/users/modify'],{queryParams:{operateType:2,id:item.uid}})
|
this.router.navigate(['app/system/users/modify'], { queryParams: { operateType: 2, id: item.uid } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//打开详情页面
|
//打开详情页面
|
||||||
open(item): void {
|
open(item): void {
|
||||||
this.statusParamsDetail.status=1;
|
this.statusParamsDetail.status = 1;
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
this.userDetail={};
|
this.userDetail = {};
|
||||||
this.http.get('/sysapi/setting/user/detail/list', { uid: item.uid }).subscribe((json)=>{
|
this.http.get('/sysapi/setting/user/detail/list', { uid: item.uid }).subscribe((json) => {
|
||||||
if(json.is_success){
|
if (json.is_success) {
|
||||||
if(json.body){
|
if (json.body) {
|
||||||
this.statusParamsDetail.status=3;
|
this.statusParamsDetail.status = 3;
|
||||||
this.userDetail=json.body;
|
this.userDetail = json.body;
|
||||||
}else{
|
} else {
|
||||||
this.statusParamsDetail.status=4;
|
this.statusParamsDetail.status = 4;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
this.statusParamsDetail.status=0;
|
this.statusParamsDetail.status = 0;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//关闭详情页面
|
//关闭详情页面
|
||||||
close(): void {
|
close(): void {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
}
|
||||||
//重置,重置搜索条件
|
|
||||||
// reset(){
|
|
||||||
// this.search.page_index=1;
|
|
||||||
// this.search.page_size=10;
|
|
||||||
// this.search.real_name='';
|
|
||||||
// this.search.login_name='';
|
|
||||||
// this.queryTable();
|
|
||||||
// }
|
|
||||||
//获取列表
|
|
||||||
queryTable():void{
|
|
||||||
this.search.page_index=1;
|
|
||||||
this.statusParamsTable.status=1;
|
|
||||||
this.http.get('/sysapi/setting/user/list',this.search).subscribe((json)=>{
|
|
||||||
if(json.is_success){
|
|
||||||
this.tableData=json.body.list;
|
|
||||||
this.collectionSize=json.body.total;
|
|
||||||
if(json.body.list&&json.body.list.length>0){
|
|
||||||
this.statusParamsTable.status=3;
|
|
||||||
}else{
|
|
||||||
this.statusParamsTable.status=4;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
this.statusParamsTable.status=0;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//翻页
|
|
||||||
pageChange(event){
|
|
||||||
this.search.page_index=event;
|
|
||||||
this.queryTable();
|
|
||||||
}
|
|
||||||
//树模型参数设置
|
|
||||||
public zNodes: any[];
|
|
||||||
setting = {
|
|
||||||
data: {
|
|
||||||
simpleData: {
|
|
||||||
enable: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
view: {
|
|
||||||
showLine: true,
|
|
||||||
dblClickExpand: false,
|
|
||||||
showIcon:true
|
|
||||||
},
|
|
||||||
callback: {
|
|
||||||
//节点点击事件
|
|
||||||
onClick: (event, treeId, treeNode, clickFlag) => {
|
|
||||||
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
|
||||||
this.treeSelected=treeNode;
|
|
||||||
let isTopNode=this.treeSelected.getParentNode(); //是否为顶级节点 true不是顶级节点 false 为顶级节点
|
|
||||||
if(isTopNode){ //子节点
|
|
||||||
this.search.orgId=this.treeSelected.id;
|
|
||||||
}else{ //顶级节点
|
|
||||||
this.search.orgId='';
|
|
||||||
}
|
|
||||||
this.queryTable();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
//获取机构列表,树模型数据处理
|
|
||||||
initTree(){
|
|
||||||
//获取目录列表
|
|
||||||
this.statusParamsTree.status=1;
|
|
||||||
this.http.get("/sysapi/setting/organization/list",).subscribe(json=>{
|
|
||||||
if(json.is_success){
|
|
||||||
if(json.body.length>0){
|
|
||||||
this.statusParamsTree.status=3;
|
|
||||||
let children=[];
|
|
||||||
json.body.forEach(option=>{
|
|
||||||
option.name=option.organization;
|
|
||||||
if(option.pid){
|
|
||||||
option.pId=option.pid;
|
|
||||||
}else{
|
|
||||||
option.pId='hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
json.body.push({
|
|
||||||
name:"全部机构",
|
|
||||||
isParent:true,
|
|
||||||
open:true,
|
|
||||||
id:'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc',
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
//数据为空
|
|
||||||
this.statusParamsTree.status=4;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
//请求失败
|
|
||||||
this.statusParamsTree.status=0;
|
|
||||||
}
|
|
||||||
this.zNodes=json.body;
|
|
||||||
$.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
|
|
||||||
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
|
||||||
let node = zTree.getNodes();
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
//获取列表
|
||||||
|
queryTable(): void {
|
||||||
|
this.statusParamsTable.status = 1;
|
||||||
|
this.http.get('/sysapi/setting/user/list', this.search).subscribe((json) => {
|
||||||
|
if (json.is_success) {
|
||||||
|
this.tableData = json.body.list;
|
||||||
|
this.collectionSize = json.body.total;
|
||||||
|
if (json.body.list && json.body.list.length > 0) {
|
||||||
|
this.statusParamsTable.status = 3;
|
||||||
|
} else {
|
||||||
|
this.statusParamsTable.status = 4;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.statusParamsTable.status = 0;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//树模型参数设置
|
||||||
|
public zNodes: any[];
|
||||||
|
setting = {
|
||||||
|
data: {
|
||||||
|
simpleData: {
|
||||||
|
enable: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
view: {
|
||||||
|
showLine: true,
|
||||||
|
dblClickExpand: false,
|
||||||
|
showIcon: true
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
//节点点击事件
|
||||||
|
onClick: (event, treeId, treeNode, clickFlag) => {
|
||||||
|
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
||||||
|
this.treeSelected = treeNode;
|
||||||
|
let isTopNode = this.treeSelected.getParentNode(); //是否为顶级节点 true不是顶级节点 false 为顶级节点
|
||||||
|
if (isTopNode) { //子节点
|
||||||
|
this.search.orgId = this.treeSelected.id;
|
||||||
|
} else { //顶级节点
|
||||||
|
this.search.orgId = '';
|
||||||
|
}
|
||||||
|
this.queryTable();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
//获取机构列表,树模型数据处理
|
||||||
|
initTree() {
|
||||||
|
//获取目录列表
|
||||||
|
this.statusParamsTree.status = 1;
|
||||||
|
this.http.get("/sysapi/setting/organization/list").subscribe(json => {
|
||||||
|
if (json.is_success) {
|
||||||
|
if (json.body.length > 0) {
|
||||||
|
this.statusParamsTree.status = 3;
|
||||||
|
let children = [];
|
||||||
|
json.body.forEach(option => {
|
||||||
|
option.name = option.organization;
|
||||||
|
if (option.pid) {
|
||||||
|
option.pId = option.pid;
|
||||||
|
} else {
|
||||||
|
option.pId = 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
json.body.push({
|
||||||
|
name: "全部机构",
|
||||||
|
isParent: true,
|
||||||
|
open: true,
|
||||||
|
id: 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
//数据为空
|
||||||
|
this.statusParamsTree.status = 4;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//请求失败
|
||||||
|
this.statusParamsTree.status = 0;
|
||||||
|
}
|
||||||
|
this.zNodes = json.body;
|
||||||
|
$.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
|
||||||
|
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
|
||||||
|
let node = zTree.getNodes();
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user