Browse Source

[完善]还原用户管理接口

beijing
邵佳豪 2 years ago
parent
commit
a17f7f42e1
  1. 6
      src/app/system-management/user/edituser/edituser.component.html
  2. 6
      src/app/system-management/user/user.component.html
  3. 95
      src/app/system-management/user/user.component.ts

6
src/app/system-management/user/edituser/edituser.component.html

@ -71,10 +71,10 @@
</form> </form>
<div class="btnbox"> <div class="btnbox">
<button [nzLoading]="isLoading" nz-button nzType="default" (click)="cancel()">取消</button> <button [nzLoading]="isLoading" nz-button nzType="default" (click)="cancel()">取消</button>
<button [nzLoading]="isLoading" nz-button nzType="primary" (click)="ok()" [disabled]="data.auditStatus == 1">确定</button> <button [nzLoading]="isLoading" nz-button nzType="primary" (click)="ok()">确定</button>
<button [nzLoading]="isLoading" nz-button nzType="primary" (click)="audit(true)" <!-- <button [nzLoading]="isLoading" nz-button nzType="primary" (click)="audit(true)"
*ngIf="data.auditStatus == 0 || data.auditStatus == 3 || data.auditStatus == 4 || data.auditStatus == 5">提交审核</button> *ngIf="data.auditStatus == 0 || data.auditStatus == 3 || data.auditStatus == 4 || data.auditStatus == 5">提交审核</button>
<button [nzLoading]="isLoading" nz-button nzType="primary" (click)="audit(false)" <button [nzLoading]="isLoading" nz-button nzType="primary" (click)="audit(false)"
*ngIf="data.auditStatus == 1">撤销审核</button> *ngIf="data.auditStatus == 1">撤销审核</button> -->
</div> </div>
</div> </div>

6
src/app/system-management/user/user.component.html

@ -95,7 +95,7 @@
<th>姓名</th> <th>姓名</th>
<th>角色/预警接收级别</th> <th>角色/预警接收级别</th>
<th [width]="'13%'">所属机构</th> <th [width]="'13%'">所属机构</th>
<th [width]="'10%'" *ngIf="level == 2">审核状态</th> <!-- <th [width]="'10%'" *ngIf="level == 2">审核状态</th> -->
<th [width]="'8%'">用户状态</th> <th [width]="'8%'">用户状态</th>
<th [width]="'8%'">备注</th> <th [width]="'8%'">备注</th>
<th [width]="'10%'">操作</th> <th [width]="'10%'">操作</th>
@ -112,9 +112,9 @@
<td> <td>
{{data.organizationName}} {{data.organizationName}}
</td> </td>
<td *ngIf="level == 2"> <!-- <td *ngIf="level == 2">
{{data.auditStatus | auditStatus}} {{data.auditStatus | auditStatus}}
</td> </td> -->
<td> <td>
<ng-container *ngIf="data.isActive; else elseTemplate"> <ng-container *ngIf="data.isActive; else elseTemplate">
<span class="greenColor2">已启用</span> <span class="greenColor2">已启用</span>

95
src/app/system-management/user/user.component.ts

@ -53,21 +53,21 @@ export class UserComponent implements OnInit {
this.level = JSON.parse( this.level = JSON.parse(
sessionStorage.getItem("userdata") sessionStorage.getItem("userdata")
).organization.level; ).organization.level;
if (this.level == 1) { // if (this.level == 1) {
this.getAllUrl = "/api/services/app/User/GetAll"; this.getAllUrl = "/api/services/app/User/GetAll";
this.addUrl = "/api/services/app/User/Create"; this.addUrl = "/api/services/app/User/Create";
this.editUrl = "/api/services/app/User/Update"; this.editUrl = "/api/services/app/User/Update";
this.deleteUrl = "/api/services/app/User/Delete"; this.deleteUrl = "/api/services/app/User/Delete";
this.CountsByOrganizations = this.CountsByOrganizations =
"/api/services/app/User/GetCountsByOrganizations"; "/api/services/app/User/GetCountsByOrganizations";
} else { // } else {
this.getAllUrl = "/api/services/app/EdittingUser/GetAll"; // this.getAllUrl = "/api/services/app/EdittingUser/GetAll";
this.addUrl = "/api/services/app/EdittingUser/Create"; // this.addUrl = "/api/services/app/EdittingUser/Create";
this.editUrl = "/api/services/app/EdittingUser/Update"; // this.editUrl = "/api/services/app/EdittingUser/Update";
this.deleteUrl = "/api/services/app/EdittingUser/Delete"; // this.deleteUrl = "/api/services/app/EdittingUser/Delete";
this.CountsByOrganizations = // this.CountsByOrganizations =
"/api/services/app/EdittingUser/GetCountsByOrganizations"; // "/api/services/app/EdittingUser/GetCountsByOrganizations";
} // }
this.getAllOrganization(); this.getAllOrganization();
this.getAllRoles(); this.getAllRoles();
this.getAllRoles2(); this.getAllRoles2();
@ -102,7 +102,6 @@ export class UserComponent implements OnInit {
.subscribe((data: any) => { .subscribe((data: any) => {
this.usersLIst = data.result.items; this.usersLIst = data.result.items;
this.usersNum = data.result.totalCount; this.usersNum = data.result.totalCount;
console.log("所有用户", this.usersLIst);
this.loading = false; this.loading = false;
}); });
} }
@ -216,7 +215,6 @@ export class UserComponent implements OnInit {
this.defaultExpandedKeys = [this.nodes[0].id]; this.defaultExpandedKeys = [this.nodes[0].id];
this.nzSelectedKeys = [this.nodes[0].id]; this.nzSelectedKeys = [this.nodes[0].id];
this.OrganizationUnitId = [this.nodes[0].id]; this.OrganizationUnitId = [this.nodes[0].id];
console.log(this.nodes, 9000);
}); });
}); });
} }
@ -230,7 +228,6 @@ export class UserComponent implements OnInit {
this.getAllUsers(); this.getAllUsers();
} }
nzClick(event: NzFormatEmitEvent) { nzClick(event: NzFormatEmitEvent) {
console.log(event);
this.nzSelectedKeys[0] = event.node.origin.id; this.nzSelectedKeys[0] = event.node.origin.id;
this.nzSelectedKeys = [...this.nzSelectedKeys]; this.nzSelectedKeys = [...this.nzSelectedKeys];
this.OrganizationUnitId = event.node.origin.id; this.OrganizationUnitId = event.node.origin.id;
@ -295,15 +292,10 @@ export class UserComponent implements OnInit {
}, },
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
modal.afterOpen.subscribe(() => console.log("[afterOpen] emitted!"));
modal.afterClose.subscribe((result) =>
console.log("[afterClose] The result is:", result)
);
} }
//编辑用户 //编辑用户
editUser(data): void { editUser(data): void {
console.log(data);
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: "编辑用户", nzTitle: "编辑用户",
nzContent: EdituserComponent, nzContent: EdituserComponent,
@ -312,7 +304,7 @@ export class UserComponent implements OnInit {
nzFooter: null, nzFooter: null,
nzMaskClosable: false, nzMaskClosable: false,
nzComponentParams: { nzComponentParams: {
data: data, data: JSON.parse(JSON.stringify(data)),
listOfData: this.listOfData, listOfData: this.listOfData,
listOfData2: this.listOfData2, listOfData2: this.listOfData2,
nodes: this.nodes, nodes: this.nodes,
@ -327,27 +319,30 @@ export class UserComponent implements OnInit {
isShowNewPassword: boolean; isShowNewPassword: boolean;
newPasswordObj: any; newPasswordObj: any;
resetPassword(item) { resetPassword(item) {
// console.log(item)
this.modal.confirm({ this.modal.confirm({
nzTitle: `确定要重置${item.userName}这个账户的密码吗?`, nzTitle: `确定要重置${item.userName}这个账户的密码吗?`,
nzOkText: "确定", nzOkText: "确定",
nzOkType: "primary", nzOkType: "primary",
nzOnOk: () => { nzOnOk: () => {
let body; let body;
if (this.level == 1) { // if (this.level == 1) {
body = { // body = {
userId: item.id, // userId: item.id,
}; // };
} else { // } else {
if (item.userId) { // if (item.userId) {
body = { // body = {
userId: item.userId, // userId: item.userId,
}; // };
} else { // } else {
this.message.create("warning", "审核未完成的不能重置密码"); // this.message.create("warning", "审核未完成的不能重置密码");
return; // return;
} // }
} // }
body = {
userId: item.id,
};
this.http this.http
.post("/api/services/app/User/ResetPassword", body) .post("/api/services/app/User/ResetPassword", body)
@ -450,15 +445,19 @@ export class UserComponent implements OnInit {
//停用启用 //停用启用
cancel(data, type) { cancel(data, type) {
let url; let url;
if (this.level == 1) {
type type
? (url = "/api/services/app/User/Activate") ? (url = "/api/services/app/User/Activate")
: (url = "/api/services/app/User/DeActivate"); : (url = "/api/services/app/User/DeActivate");
} else { // if (this.level == 1) {
type // type
? (url = "/api/services/app/EdittingUser/Activate") // ? (url = "/api/services/app/User/Activate")
: (url = "/api/services/app/EdittingUser/DeActivate"); // : (url = "/api/services/app/User/DeActivate");
} // } else {
// type
// ? (url = "/api/services/app/EdittingUser/Activate")
// : (url = "/api/services/app/EdittingUser/DeActivate");
// }
let body = { let body = {
id: data.id, id: data.id,
}; };

Loading…
Cancel
Save