| | |
| | | <pro-header [title]="'账户列表'"></pro-header> |
| | | <nz-card [nzBordered]="false"> |
| | | <form nz-form [nzLayout]="'inline'"> |
| | | <form nz-form (ngSubmit)="load(true)" [nzLayout]="'inline'"> |
| | | <div nz-row [nzGutter]="24"> |
| | | <div nz-col [nzSpan]="8" class="mb-md"> |
| | | <div nz-form-item class="d-flex"> |
| | |
| | | <label>是否删除</label> |
| | | </div> |
| | | <div nz-form-control class="flex-1"> |
| | | <nz-select [(ngModel)]="query.isDelete" name="isDelete" [nzSize]="'large'" > |
| | | <nz-select [(ngModel)]="query.isDelete" name="isDelete" [nzSize]="'large'"> |
| | | <nz-option *ngFor="let option of options" [nzLabel]="option.label" [nzValue]="option.value" ></nz-option> |
| | | </nz-select> |
| | | </nz-select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <i class="anticon anticon-plus"></i><span>新建</span> |
| | | </button> |
| | | <ng-container *ngIf="selectedRows.length > 0"> |
| | | <button nz-button [nzSize]="'large'" (click)="remove()">批量删除</button> |
| | | <button nz-button [nzSize]="'large'" (click)="remove()">批量删除</button> |
| | | </ng-container> |
| | | </div> |
| | | |
| | |
| | | <tbody nz-tbody> |
| | | <tr nz-tbody-tr *ngFor="let account of nzTable.data"> |
| | | <td nz-td [nzCheckbox]="true"> |
| | | <label nz-checkbox [(ngModel)]="account.checked" (ngModelChange)="refreshStatus($event)"></label> |
| | | <label nz-checkbox [(ngModel)]="account.checked" (ngModelChange)="refreshStatus($event)" [nzDisabled]="account.isDelete == '1'? true : false"></label> |
| | | </td> |
| | | <td nz-td>{{account.accountName}}</td> |
| | | <td nz-td>{{account.mobile}}</td> |
| | |
| | | |
| | | query: any = { |
| | | pageIndex: 1, |
| | | pageSize: 3, |
| | | pageSize: 10, |
| | | isDelete: this.options[1].value |
| | | }; |
| | | data: any[] = []; |
| | | total: 0; |
| | | |
| | | selectedRows: any[] = []; |
| | | curRows: any[] = []; |
| | | allChecked = false; |
| | | indeterminate = false; |
| | | sortMap: any = {}; |
| | |
| | | this.data = res.data.data; |
| | | this.total = res.data.total; |
| | | |
| | | this.dataChange(this.data); |
| | | this.refreshStatus(); |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | checkAll(value: boolean) { |
| | | this.curRows.forEach(i => { |
| | | this.data.forEach(i => { |
| | | i.checked = value; |
| | | }); |
| | | this.refreshStatus(); |
| | | } |
| | | |
| | | dataChange(res: any) { |
| | | this.curRows = res; |
| | | this.refreshStatus(); |
| | | } |
| | | |
| | | refreshStatus() { |
| | | const allChecked = this.curRows.every(value => value.checked); |
| | | const allUnChecked = this.curRows.every(value => !value.checked); |
| | | const allChecked = this.data.every(value => value.checked); |
| | | const allUnChecked = this.data.every(value => !value.checked); |
| | | this.allChecked = allChecked; |
| | | this.indeterminate = (!allChecked) && (!allUnChecked); |
| | | this.selectedRows = this.data.filter(value => value.checked); |
| | |
| | | this.sortMap = {}; |
| | | this.sortMap[field] = value; |
| | | this.query.sorter = value ? `${field} ${value}` : ''; |
| | | this.load(true); |
| | | } |
| | | |
| | | reset(ls: any[]) { |
| | | for (const item of ls) item.value = false; |
| | | this.load(true); |
| | | } |
| | | |
| | |
| | | public http: HttpClient) { } |
| | | |
| | | ngOnInit() { |
| | | if (this.user.id > 0) { |
| | | this.http.get(environment.SERVER_BASH_URL + '/user/operate_user/' + this.user.id).subscribe((res: any) => { |
| | | this.user = res; |
| | | this.user.createTime = this.dateSrv.date_format(this.user.createTime, 'YYYY-MM-DD'); |
| | | this.user.expireTime = this.dateSrv.date_format(this.user.expireTime, 'YYYY-MM-DD'); |
| | | }); |
| | | } else { |
| | | this.user.createTime = this.dateSrv.today('YYYY-MM-DD'); |
| | | this.user.expireTime = this.dateSrv.today('YYYY-MM-DD'); |
| | | } |
| | | // if (this.user.id > 0) { |
| | | // this.http.get(environment.SERVER_BASH_URL + '/user/operate_user/' + this.user.id).subscribe((res: any) => { |
| | | // this.user = res; |
| | | // this.user.createTime = this.dateSrv.date_format(this.user.createTime, 'YYYY-MM-DD'); |
| | | // this.user.expireTime = this.dateSrv.date_format(this.user.expireTime, 'YYYY-MM-DD'); |
| | | // }); |
| | | // } else { |
| | | // this.user.createTime = this.dateSrv.today('YYYY-MM-DD'); |
| | | // this.user.expireTime = this.dateSrv.today('YYYY-MM-DD'); |
| | | // } |
| | | } |
| | | |
| | | save() { |
| | | console.log(this.user); |
| | | if (this.user.name == null || this.user.name === '') { |
| | | this.msgSrv.error('请输入姓名'); |
| | | } else if (this.user.mobile == null || this.user.mobile === '') { |
| | |
| | | } else if (this.user.password == null || this.user.password === '') { |
| | | this.msgSrv.error('请输入密码'); |
| | | } else { |
| | | this.http.post(environment.SERVER_BASH_URL + '/user/operate_user/save', this.user).subscribe(() => { |
| | | this.http.post(environment.SERVER_BASH_URL + '/operateUser/operateUser', this.user).subscribe(() => { |
| | | this.subject.next('true'); |
| | | this.close(); |
| | | }); |
| | |
| | | </nz-alert> |
| | | </div> |
| | | <nz-table #nzTable |
| | | [nzDataSource]="data" |
| | | [nzAjaxData]="data" |
| | | [nzLoading]="http.loading" |
| | | [nzTotal]="total" |
| | | [(nzPageIndex)]="q.pi" |
| | | [nzPageSize]="q.ps" |
| | | [nzShowTotal]="true" |
| | | (nzPageIndexChange)="load()" |
| | | (nzDataChange)="dataChange($event)"> |
| | | (nzPageIndexChange)="load()"> |
| | | <thead nz-thead> |
| | | <tr> |
| | | <th nz-th [nzCheckbox]="true"> |
| | |
| | | <th nz-th><span>创建日期</span></th> |
| | | <th nz-th> |
| | | <span>过期日期</span> |
| | | <nz-table-sort [(nzValue)]="sortMap.updatedAt" (nzValueChange)="sort('expireTime', $event)"></nz-table-sort> |
| | | <nz-table-sort [(nzValue)]="sortMap.updatedAt" (nzValueChange)="sort('expire_time', $event)"></nz-table-sort> |
| | | </th> |
| | | <th nz-th><span>操作</span></th> |
| | | </tr> |
| | |
| | | |
| | | q: any = { |
| | | pi: 1, |
| | | ps: 10, |
| | | ps: 1, |
| | | sorter: '', |
| | | u_name: '', |
| | | u_mobile: '' |
| | |
| | | if (reload) { |
| | | this.q.pi = 1; |
| | | } |
| | | this.http.get(environment.SERVER_BASH_URL + '/user/operate_user', this.q).subscribe((res: any) => { |
| | | this.http.get(environment.SERVER_BASH_URL + '/operateUser/list', {params: this.q}).subscribe((res: any) => { |
| | | // let data = res.data; |
| | | // const total = res.total; |
| | | // |
| | |
| | | // this.data = data.slice(start, start + this.q.ps); |
| | | // this.total = total; |
| | | |
| | | this.data = res.data; |
| | | this.total = res.total; |
| | | this.data = res.data.data; |
| | | this.total = res.data.total; |
| | | this.dataChange(this.data); |
| | | |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | delete(user) { |
| | | this.http.delete(environment.SERVER_BASH_URL + '/user/operate_user/' + user.id).subscribe((res: any) => { |
| | | this.http.post(environment.SERVER_BASH_URL + '/operateUser/operateUser/id',user).subscribe((res: any) => { |
| | | this.msgSrv.success('安装用户删除成功!'); |
| | | this.load(true); |
| | | }); |
| | |
| | | this.selectedRows.forEach(i => { |
| | | ids.push(i.id); |
| | | }); |
| | | console.log(ids); |
| | | this.http.post(environment.SERVER_BASH_URL + '/user/operate_user/deleteList', ids).subscribe((res: any) => { |
| | | this.http.post(environment.SERVER_BASH_URL + '/operateUser/operateUsers/ids', ids).subscribe((res: any) => { |
| | | this.load(true); |
| | | }); |
| | | } |
| | |
| | | sort(field: string, value: any) { |
| | | this.sortMap = {}; |
| | | this.sortMap[field] = value; |
| | | this.q.sorter = value ? `${field}_${value}` : ''; |
| | | this.q.sorter = value ? `${field} ${value}` : ''; |
| | | this.load(true); |
| | | } |
| | | |