|
|
@ -1,7 +1,9 @@ |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
import {Component, OnInit} from '@angular/core'; |
|
|
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
|
|
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
|
|
|
import {UserService} from '../../../services/user.service'; |
|
|
|
import {UserService} from '../../../services/user.service'; |
|
|
|
import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
|
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
|
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-user-list', |
|
|
|
selector: 'app-user-list', |
|
|
@ -17,11 +19,15 @@ export class UserListComponent implements OnInit { |
|
|
|
pageSize = 10; // 条码
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
loading = true; |
|
|
|
loading = true; |
|
|
|
regTime; |
|
|
|
regTime; |
|
|
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
private form: FormBuilder, |
|
|
|
private form: FormBuilder, |
|
|
|
private user: UserService, |
|
|
|
private user: UserService, |
|
|
|
private message: NzMessageService |
|
|
|
private iconService: IconService, |
|
|
|
) { } |
|
|
|
private message: NzMessageService, |
|
|
|
|
|
|
|
private common: CommonsService |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
this.init(); |
|
|
|
this.init(); |
|
|
@ -30,18 +36,19 @@ export class UserListComponent implements OnInit { |
|
|
|
public init(): void { |
|
|
|
public init(): void { |
|
|
|
this.searchForm = this.form.group({ |
|
|
|
this.searchForm = this.form.group({ |
|
|
|
name: [null], |
|
|
|
name: [null], |
|
|
|
|
|
|
|
status: [null], |
|
|
|
phone: [null], |
|
|
|
phone: [null], |
|
|
|
regTime: [null], |
|
|
|
regTime: [null], |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.getRequest(true , this.searchForm.value); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 查询列表
|
|
|
|
// 查询列表
|
|
|
|
public getRequest(reset: boolean = false , whereObject: object) { |
|
|
|
public getRequest(reset: boolean = false, whereObject: object) { |
|
|
|
|
|
|
|
|
|
|
|
if (whereObject['regTime'] != null && whereObject['regTime'].length !== 0) { |
|
|
|
if (whereObject['regTime'] != null && whereObject['regTime'].length !== 0) { |
|
|
|
whereObject['regTimeStart'] = whereObject['regTime'][0]; |
|
|
|
whereObject['regTimeStart'] = whereObject['regTime'][0].getTime(); |
|
|
|
whereObject['regTimeEnd'] = whereObject['regTime'][1]; |
|
|
|
whereObject['regTimeEnd'] = whereObject['regTime'][1].getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.loading = false; |
|
|
|
this.loading = false; |
|
|
|
if (reset) { |
|
|
|
if (reset) { |
|
|
@ -49,7 +56,7 @@ export class UserListComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
whereObject['pageNum'] = this.pageNum; |
|
|
|
whereObject['pageNum'] = this.pageNum; |
|
|
|
whereObject['pageSize'] = this.pageSize; |
|
|
|
whereObject['pageSize'] = this.pageSize; |
|
|
|
this.user.getListUser( whereObject, data => { |
|
|
|
this.user.getListUser(whereObject, data => { |
|
|
|
console.log(data); |
|
|
|
console.log(data); |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.requestData = data['return_data'].list; |
|
|
|
this.requestData = data['return_data'].list; |
|
|
@ -65,4 +72,18 @@ export class UserListComponent implements OnInit { |
|
|
|
this.searchForm.reset(); |
|
|
|
this.searchForm.reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getForbiddenUser(id, status: any): void { |
|
|
|
|
|
|
|
const message = (status === 1 ? '是否禁用当前用户' : '是否启用当前用户'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.common.showConfirm(message, data => { |
|
|
|
|
|
|
|
if (data) { |
|
|
|
|
|
|
|
this.user.forbiddenUser(id, dataUser => { |
|
|
|
|
|
|
|
console.log(dataUser); |
|
|
|
|
|
|
|
this.getRequest(false , this.searchForm.value); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|