|
@@ -324,7 +324,31 @@ export class PageRoleComponent implements OnInit {
|
|
|
}
|
|
|
//删除部门
|
|
|
onDelDepart() {
|
|
|
- this.message.warning('权限灰度中');
|
|
|
+ console.log(this.activatedNode);
|
|
|
+ this.modal.confirm({
|
|
|
+ nzTitle: '删除',
|
|
|
+ nzContent: '删除后数据不可恢复,请谨慎操作',
|
|
|
+ nzOkText: '确认',
|
|
|
+ nzOkType: 'primary',
|
|
|
+ nzOkDanger: true,
|
|
|
+ nzOnOk: async () => {
|
|
|
+ new Promise(async (resolve, reject) => {
|
|
|
+ if (this.activatedNode?.key) {
|
|
|
+ let query = new Parse.Query('Department');
|
|
|
+ let r = await query.get(this.activatedNode?.key);
|
|
|
+ if (r?.id) {
|
|
|
+ r.set('isDeleted', true);
|
|
|
+ await r.save();
|
|
|
+ }
|
|
|
+ this.message.success('删除成功');
|
|
|
+ this.nodes = await this.getDepart();
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+ }).catch(() => console.log('Oops errors!'));
|
|
|
+ },
|
|
|
+ nzCancelText: '取消',
|
|
|
+ nzOnCancel: () => console.log('Cancel'),
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
onAllChecked(checked: boolean): void {
|
|
@@ -531,12 +555,18 @@ export class PageRoleComponent implements OnInit {
|
|
|
this.account.password = this.tbookSer.randomPassword();
|
|
|
}
|
|
|
/* 添加账号 */
|
|
|
+ isLoadingOne:boolean = false
|
|
|
async accountComplete() {
|
|
|
+ if(this.isLoadingOne) return
|
|
|
+ this.isLoadingOne = true
|
|
|
this.account.email = this.account?.email.trim();
|
|
|
this.account.phone = this.account?.phone.trim();
|
|
|
this.account.name = this.account?.name.trim();
|
|
|
this.account.password = this.account?.password.trim();
|
|
|
- if(!this.authVrifly()) return
|
|
|
+ if(!await this.authVrifly()){
|
|
|
+ this.isLoadingOne = false
|
|
|
+ return
|
|
|
+ }
|
|
|
try {
|
|
|
let obj = Parse.Object.extend('_User');
|
|
|
let user = new obj();
|
|
@@ -559,6 +589,7 @@ export class PageRoleComponent implements OnInit {
|
|
|
profile?.set('email', this.account.email);
|
|
|
profile?.set('identity', this.account.identity);
|
|
|
let res = await profile?.save();
|
|
|
+ this.isLoadingOne = false
|
|
|
this.accountIsVisible = false;
|
|
|
this.account = null;
|
|
|
this.modal.success({
|
|
@@ -570,11 +601,12 @@ export class PageRoleComponent implements OnInit {
|
|
|
});
|
|
|
} catch (err: any) {
|
|
|
console.warn('添加用户错误', err);
|
|
|
+ this.isLoadingOne = false
|
|
|
this.message.error(err?.Error || '错误:请检查用户邮箱是否已存在');
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- authVrifly():boolean | undefined{
|
|
|
+ async authVrifly():Promise< boolean | undefined>{
|
|
|
this.account.email = this.account?.email.trim();
|
|
|
this.account.phone = this.account?.phone.trim();
|
|
|
this.account.name = this.account?.name.trim();
|
|
@@ -607,6 +639,10 @@ export class PageRoleComponent implements OnInit {
|
|
|
this.message.error('密码格式错误,请填写6-18位非空字符串(数字、大小写字母或英文符号)');
|
|
|
return;
|
|
|
}
|
|
|
+ if(!await this.tbookSer.userFind(this.account.phone)){
|
|
|
+ this.message.error('手机号已存在');
|
|
|
+ return
|
|
|
+ }
|
|
|
return true
|
|
|
}
|
|
|
|