|
|
|
@ -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) |
|
|
|
@ -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 ? '提交审核失败' : '撤销审核失败'); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|