机构或角色删除后影响用户的问题修复
This commit is contained in:
@@ -97,14 +97,34 @@
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>原密码</nz-form-label>
|
||||
<nz-form-control [nzSm]="14" [nzXs]="24">
|
||||
<input type="password" nz-input formControlName="oldPassword" placeholder="原密码">
|
||||
<nz-form-explain *ngIf="validateForm.get('oldPassword').dirty && validateForm.get('oldPassword').errors">请输入原密码</nz-form-explain>
|
||||
<nz-form-explain *ngIf="validateForm.get('oldPassword').dirty && validateForm.get('oldPassword').errors">
|
||||
<ng-container *ngIf="validateForm.get('oldPassword')?.hasError('required')">
|
||||
请输入原密码!
|
||||
</ng-container>
|
||||
<ng-container *ngIf="validateForm.get('oldPassword')?.hasError('minlength')">
|
||||
最小2个字符!
|
||||
</ng-container>
|
||||
<ng-container *ngIf="validateForm.get('oldPassword')?.hasError('maxlength')">
|
||||
最大15个字符!
|
||||
</ng-container>
|
||||
</nz-form-explain>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>新密码</nz-form-label>
|
||||
<nz-form-control [nzSm]="14" [nzXs]="24">
|
||||
<input type="password" nz-input formControlName="newPassword" placeholder="新密码" (ngModelChange)="updateConfirmValidator()">
|
||||
<nz-form-explain *ngIf="validateForm.get('newPassword').dirty && validateForm.get('newPassword').errors">请输入新密码</nz-form-explain>
|
||||
<nz-form-explain *ngIf="validateForm.get('newPassword').dirty && validateForm.get('newPassword').errors">
|
||||
<ng-container *ngIf="validateForm.get('newPassword')?.hasError('required')">
|
||||
请输入新密码!
|
||||
</ng-container>
|
||||
<ng-container *ngIf="validateForm.get('newPassword')?.hasError('minlength')">
|
||||
最小2个字符!
|
||||
</ng-container>
|
||||
<ng-container *ngIf="validateForm.get('newPassword')?.hasError('maxlength')">
|
||||
最大15个字符!
|
||||
</ng-container>
|
||||
</nz-form-explain>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
@@ -118,6 +138,12 @@
|
||||
<ng-container *ngIf="validateForm.get('confirmPassword')?.hasError('confirm')">
|
||||
两次密码不一致!
|
||||
</ng-container>
|
||||
<ng-container *ngIf="validateForm.get('confirmPassword')?.hasError('minlength')">
|
||||
最小2个字符!
|
||||
</ng-container>
|
||||
<ng-container *ngIf="validateForm.get('confirmPassword')?.hasError('maxlength')">
|
||||
最大15个字符!
|
||||
</ng-container>
|
||||
</nz-form-explain>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
|
||||
@@ -81,9 +81,9 @@ export class PagesComponent implements OnInit {
|
||||
});
|
||||
|
||||
this.validateForm = this.fb.group({
|
||||
oldPassword: ['', [Validators.required]],
|
||||
newPassword: ['', [Validators.required]],
|
||||
confirmPassword: ['', [Validators.required, this.confirmationValidator]],
|
||||
oldPassword: ['', [Validators.required, Validators.minLength(2), Validators.maxLength(15)]],
|
||||
newPassword: ['', [Validators.required, Validators.minLength(2), Validators.maxLength(15)]],
|
||||
confirmPassword: ['', [Validators.required, this.confirmationValidator, Validators.minLength(2), Validators.maxLength(15)]],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -111,9 +111,13 @@ export class PagesComponent implements OnInit {
|
||||
}
|
||||
modifyHandleOk(): void {
|
||||
this.isConfirmLoading = true;
|
||||
|
||||
this.httpClient.post('/adminapi/xxxxx', this.validateForm.value).subscribe((response) => {
|
||||
let params = {
|
||||
"curPassword":this.validateForm.get('oldPassword').value,
|
||||
"newPassword":this.validateForm.get('newPassword').value
|
||||
}
|
||||
this.httpClient.put('/sysapi/setting/user/cur/password', params).subscribe((response) => {
|
||||
// console.log(response);
|
||||
if(response.is_success){
|
||||
this.message.success('修改密码成功!');
|
||||
this.validateForm.patchValue({
|
||||
oldPassword: '',
|
||||
@@ -125,6 +129,9 @@ export class PagesComponent implements OnInit {
|
||||
this.validateForm.controls[i].markAsUntouched();
|
||||
this.validateForm.controls[i].updateValueAndValidity();
|
||||
}
|
||||
}else{
|
||||
this.message.error(response.err_msg + ',修改失败!');
|
||||
}
|
||||
this.modalIsVisible = false;
|
||||
this.isConfirmLoading = false;
|
||||
}, err => {
|
||||
|
||||
+7
@@ -140,6 +140,12 @@ export class DepartmentManagementComponent implements OnInit {
|
||||
nzTitle: '删除',
|
||||
nzContent: '确定删除【' + this.orgDetail.organization + '】?',
|
||||
nzOnOk: () => new Promise((resolve, reject) => {
|
||||
if (this.userList && this.userList.length > 0) {
|
||||
setTimeout(()=>{
|
||||
this.message.error('删除失败,请删除此机构下的用户后再执行此操作!');
|
||||
reject()
|
||||
},500);
|
||||
} else {
|
||||
this.http.delete('/sysapi/setting/organization/delOrgByid/' + this.orgDetail.id).subscribe((json) => {
|
||||
if (json.is_success) {
|
||||
resolve();
|
||||
@@ -150,6 +156,7 @@ export class DepartmentManagementComponent implements OnInit {
|
||||
this.message.error(`删除失败!`);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}).catch(() => console.log('Oops errors!'))
|
||||
});
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<div class="user-table table-box" nz-row>
|
||||
<nz-table nz-col nzXs="24" nzSm="20" nzMd="18" nzLg="14" nzXl="12" nzBordered [nzShowPagination]='false'
|
||||
<nz-table nz-col nzXs="24" nzSm="20" nzMd="18" nzLg="14" nzXl="12" nzBordered [nzSize]="'middle'" [nzPageSize]="8"
|
||||
#userDataSet [nzData]="userSelecteds">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
+12
-15
@@ -142,9 +142,6 @@ export class RoleManagementModifyComponent implements OnInit {
|
||||
item.disabled = false;
|
||||
this.userSelecteds = [...this.userSelecteds, item];
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -186,18 +183,18 @@ export class RoleManagementModifyComponent implements OnInit {
|
||||
this.visibleUsers = false;
|
||||
}
|
||||
//处理机构负责人选择和数据回填
|
||||
userSelect() {
|
||||
if (this.userData) {
|
||||
this.userData.forEach(item => {
|
||||
this.userSelecteds.forEach(option => {
|
||||
if (item.uid == option.uid) {
|
||||
item.checked = true;
|
||||
item.disabled = true;
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
// userSelect() {
|
||||
// if (this.userData) {
|
||||
// this.userData.forEach(item => {
|
||||
// this.userSelecteds.forEach(option => {
|
||||
// if (item.uid == option.uid) {
|
||||
// item.checked = true;
|
||||
// item.disabled = true;
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
//删除机构负责人
|
||||
delectConfirm(item) {
|
||||
this.userSelecteds = this.userSelecteds.filter(function (option) {
|
||||
|
||||
@@ -47,12 +47,22 @@ export class RoleManagementComponent implements OnInit {
|
||||
}
|
||||
//删除
|
||||
delectConfirm(item) {
|
||||
this.http.get('/sysapi/setting/role/users/' + item.rid).subscribe((response) => {
|
||||
if (response.is_success) {
|
||||
if (response.body && response.body.length > 0) {
|
||||
this.message.error('删除失败,请删除此角色下的用户后再执行此操作!')
|
||||
} else {
|
||||
this.http.delete('/sysapi/setting/role/delete/' + item.rid).subscribe((json) => {
|
||||
if (json.is_success) {
|
||||
this.message.success(`删除成功!`);
|
||||
this.message.success(`删除成功!`);
|
||||
this.queryTable();
|
||||
} else {
|
||||
this.message.error(`删除失败`)
|
||||
this.message.error(`删除失败!`)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.message.error('获取此角色下的用户列表失败!')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@
|
||||
<nz-form-label nzSpan="7" nzFor="identify_num">身份证号</nz-form-label>
|
||||
<nz-form-control nzSpan="12">
|
||||
<input nz-input id="identify_num" formControlName="identify_num" placeholder="请输入身份证号">
|
||||
<nz-form-explain *ngIf="validateForm.get('identify_num').dirty && validateForm.get('identify_num').errors?.maxlength">身份证号最长20个字符</nz-form-explain>
|
||||
<nz-form-explain *ngIf="validateForm.get('identify_num').dirty && validateForm.get('identify_num').errors?.maxlength">身份证号最长18个字符</nz-form-explain>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user