From e39fc5f8ca984b7725dab448cbabfaed157868b5 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Wed, 12 Oct 2022 15:10:28 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]9.14=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B98=E6=9D=A114=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/login/login.component.ts | 9 ++- .../get-out-of-line-details.component.html | 2 +- .../user/edituser/edituser.component.html | 8 ++ .../user/edituser/edituser.component.scss | 8 ++ .../user/edituser/edituser.component.ts | 73 ++++++++++++++++++- .../user/user.component.html | 4 +- .../system-management/user/user.component.ts | 42 +---------- 7 files changed, 100 insertions(+), 46 deletions(-) diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index b25c2fb..aaca126 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -104,7 +104,7 @@ export class LoginComponent implements OnInit { sessionStorage.setItem("3dSceneData", JSON.stringify(data.result)) this.init3D = data.result.hasBuildingInfo - + }) }) } @@ -148,12 +148,15 @@ export class LoginComponent implements OnInit { sessionStorage.setItem('isDefaultPassword', JSON.stringify(data.result.user.isDefaultPassword)) sessionStorage.setItem('isPasswordExpired', JSON.stringify(data.result.user.isPasswordExpired)) this.isLoading = false; - if (data.result.user.organization.isGasStation) { + if (!data.result.user.organization) { + this.message.create('error', `当前用户没有组织机构信息`); + return + } + if (data.result.user.organization.isGasStation) { await this.getGasStationBaseInfo() if (data.result.user.menus[0].name == "数字油站" && data.result.user.menus.length == 1 && !this.init3D) { this.message.create('error', `当前用户油站未开通3D且仅分配油站菜单`); return - } } //记住密码 diff --git a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html index 87cc3a1..b5969c5 100644 --- a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html +++ b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html @@ -84,7 +84,7 @@ 误报 +
+ + + + +
\ No newline at end of file diff --git a/src/app/system-management/user/edituser/edituser.component.scss b/src/app/system-management/user/edituser/edituser.component.scss index e69de29..501cc4c 100644 --- a/src/app/system-management/user/edituser/edituser.component.scss +++ b/src/app/system-management/user/edituser/edituser.component.scss @@ -0,0 +1,8 @@ +.btnbox{ + display: flex; + justify-content: flex-end; + box-sizing: border-box; + button{ + margin-left: 6px; + } +} \ No newline at end of file diff --git a/src/app/system-management/user/edituser/edituser.component.ts b/src/app/system-management/user/edituser/edituser.component.ts index dcb193b..951de92 100644 --- a/src/app/system-management/user/edituser/edituser.component.ts +++ b/src/app/system-management/user/edituser/edituser.component.ts @@ -3,6 +3,7 @@ import { NzModalRef } from 'ng-zorro-antd/modal'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { HttpClient } from '@angular/common/http'; import { TreeService } from 'src/app/service/tree.service'; +import { NzMessageService } from 'ng-zorro-antd/message'; @Component({ selector: 'app-edituser', @@ -15,8 +16,9 @@ export class EdituserComponent implements OnInit { @Input() listOfData?: any; @Input() listOfData2?: any; @Input() nodes?: any; + @Input() editUrl?: any; validateForm!: FormGroup; - constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } + constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private message: NzMessageService) { } ngOnInit(): void { console.log(this.data) @@ -25,7 +27,7 @@ export class EdituserComponent implements OnInit { this.data.roleNames.forEach(element => { if (element.indexOf('LEVEL') != -1) { roleData2.push(element) - }else{ + } else { roleData1.push(element) } }); @@ -108,5 +110,72 @@ export class EdituserComponent implements OnInit { }) }) } + isLoading = false + //确定 + async ok() { + this.isLoading = true + if (this.validateForm.valid) { + return await new Promise(resolve => { + for (let index = 0; index < this.validateForm.value.role2.length; index++) { + const element = this.validateForm.value.role2[index]; + if (element.indexOf('HANDLE') != -1) { + this.validateForm.value.role2.splice(index, 1) + index-- + } + } + let roleNames = [...this.validateForm.value.role, ...this.validateForm.value.role2] + let body = { + id: this.data.id, + userName: this.validateForm.value.account, + name: this.validateForm.value.name, + organizationUnitId: this.validateForm.value.organization, + roleNames: roleNames, + phoneNumber: this.validateForm.value.phonenum, + isActive: true + } + this.http.put(this.editUrl, body).subscribe((data:any) => { + resolve(data) + this.data.auditStatus = data.result.auditStatus + this.isLoading = false + this.message.create('success', '保存成功!'); + }, err => { + resolve(err) + this.isLoading = false + this.message.create('warning', '保存失败'); + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + } + } + //取消 + cancel() { + this.modal.destroy(); + } + //提交审核 + async audit(type) { + if (type && this.data.auditStatus == 5) {//提交审核 + this.message.create('warning', '审核完成的不能重复提交,请编辑后提交'); + return + } + if(type){ + await this.ok() + } + this.isLoading = true + let url + type ? url = '/api/services/app/EdittingUser/Commit' : url = '/api/services/app/EdittingUser/Uncommit' + this.http.post(url, '', { + params: { + id: this.data.id + } + }).subscribe((data: any) => { + this.data.auditStatus = data.result.auditStatus + this.isLoading = false + this.message.create('success', type ? '提交审核成功' : '撤销审核成功'); + }, err => { + this.isLoading = false + this.message.create('error', type ? '提交审核失败' : '撤销审核失败'); + }) + } } diff --git a/src/app/system-management/user/user.component.html b/src/app/system-management/user/user.component.html index a19b099..32232a4 100644 --- a/src/app/system-management/user/user.component.html +++ b/src/app/system-management/user/user.component.html @@ -99,9 +99,9 @@ 编辑 重置密码 - 提交审核 - 撤销审核 + 撤销审核 --> 启用 停用 注销 diff --git a/src/app/system-management/user/user.component.ts b/src/app/system-management/user/user.component.ts index 418e70f..ae0cace 100644 --- a/src/app/system-management/user/user.component.ts +++ b/src/app/system-management/user/user.component.ts @@ -241,52 +241,18 @@ export class UserComponent implements OnInit { nzContent: EdituserComponent, nzViewContainerRef: this.viewContainerRef, nzWidth: 460, + nzFooter: null, nzMaskClosable: false, nzComponentParams: { data: data, listOfData: this.listOfData, listOfData2: this.listOfData2, - nodes: this.nodes - }, - nzOnOk: async () => { - if (instance.validateForm.valid) { - await new Promise(resolve => { - - for (let index = 0; index < instance.validateForm.value.role2.length; index++) { - const element = instance.validateForm.value.role2[index]; - if (element.indexOf('HANDLE') != -1) { - instance.validateForm.value.role2.splice(index, 1) - index-- - } - } - let roleNames = [...instance.validateForm.value.role, ...instance.validateForm.value.role2] - let body = { - id: data.id, - userName: instance.validateForm.value.account, - name: instance.validateForm.value.name, - organizationUnitId: instance.validateForm.value.organization, - roleNames: roleNames, - phoneNumber: instance.validateForm.value.phonenum, - isActive: true - } - this.http.put(this.editUrl, body).subscribe(data => { - resolve(data) - this.message.create('success', '编辑成功!'); - this.getAllUsers() - return true - }, err => { - resolve(err) - this.message.create('warning', '编辑失败'); - return false - }) - }) - } else { - this.message.create('warning', '请填写完整!'); - return false - } + nodes: this.nodes, + editUrl:this.editUrl } }); const instance = modal.getContentComponent(); + modal.afterClose.subscribe(result => this.getAllUsers()); } //重置密码