|
|
|
@ -1,7 +1,9 @@ |
|
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
|
import {Component, OnInit} from '@angular/core'; |
|
|
|
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
|
|
|
|
import {UserService} from '../../../services/user.service'; |
|
|
|
|
import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-user-list', |
|
|
|
@ -17,11 +19,15 @@ export class UserListComponent implements OnInit { |
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
|
loading = true; |
|
|
|
|
regTime; |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
private form: FormBuilder, |
|
|
|
|
private user: UserService, |
|
|
|
|
private message: NzMessageService |
|
|
|
|
) { } |
|
|
|
|
private iconService: IconService, |
|
|
|
|
private message: NzMessageService, |
|
|
|
|
private common: CommonsService |
|
|
|
|
) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.init(); |
|
|
|
@ -30,18 +36,19 @@ export class UserListComponent implements OnInit { |
|
|
|
|
public init(): void { |
|
|
|
|
this.searchForm = this.form.group({ |
|
|
|
|
name: [null], |
|
|
|
|
status: [null], |
|
|
|
|
phone: [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) { |
|
|
|
|
whereObject['regTimeStart'] = whereObject['regTime'][0]; |
|
|
|
|
whereObject['regTimeEnd'] = whereObject['regTime'][1]; |
|
|
|
|
whereObject['regTimeStart'] = whereObject['regTime'][0].getTime(); |
|
|
|
|
whereObject['regTimeEnd'] = whereObject['regTime'][1].getTime(); |
|
|
|
|
} |
|
|
|
|
this.loading = false; |
|
|
|
|
if (reset) { |
|
|
|
@ -49,7 +56,7 @@ export class UserListComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
whereObject['pageNum'] = this.pageNum; |
|
|
|
|
whereObject['pageSize'] = this.pageSize; |
|
|
|
|
this.user.getListUser( whereObject, data => { |
|
|
|
|
this.user.getListUser(whereObject, data => { |
|
|
|
|
console.log(data); |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.requestData = data['return_data'].list; |
|
|
|
@ -65,4 +72,18 @@ export class UserListComponent implements OnInit { |
|
|
|
|
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); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|