|
@@ -36,7 +36,24 @@ import { NzRadioModule } from 'ng-zorro-antd/radio';
|
|
|
})
|
|
|
export class PageUserComponent implements OnInit {
|
|
|
@ViewChild(CompTableListComponent) list: CompTableListComponent | undefined;
|
|
|
-
|
|
|
+ listOfColumns: any = {
|
|
|
+ identity: {
|
|
|
+ listOfFilter: [
|
|
|
+ { value: '工作联系人', text: '工作联系人' },
|
|
|
+ { value: '高校联系人', text: '高校联系人' },
|
|
|
+ { value: '评审专家', text: '评审专家' },
|
|
|
+ { value: '个人', text: '个人' },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ companyType: {
|
|
|
+ listOfFilter: [
|
|
|
+ { value: '教育部直属高校', text: '教育部直属高校' },
|
|
|
+ { value: '中央有关部门(单位)教育司(局)', text: '中央有关部门(单位)教育司(局)' },
|
|
|
+ { value: '省级教育行政部门', text: '省级教育行政部门' },
|
|
|
+ { value: '出版单位', text: '出版单位' },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ }
|
|
|
// _User = _User;
|
|
|
// ProfileList = Profile;
|
|
|
// className: string | undefined;
|
|
@@ -70,7 +87,11 @@ export class PageUserComponent implements OnInit {
|
|
|
companyType: '',
|
|
|
};
|
|
|
parents: Array<any> = []; //所有一级列表
|
|
|
-
|
|
|
+ //筛选条件
|
|
|
+ filters: any = {
|
|
|
+ identity: { type: 'string', value: [] },
|
|
|
+ companyType: { type: 'string', value: [] },
|
|
|
+ };
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
|
private modal: NzModalService,
|
|
@@ -131,6 +152,12 @@ export class PageUserComponent implements OnInit {
|
|
|
};
|
|
|
}
|
|
|
let query = Parse.Query.fromJSON('Profile', queryParams);
|
|
|
+ for (const key in this.filters) {
|
|
|
+ const element = this.filters[key];
|
|
|
+ if (element.value?.length > 0) {
|
|
|
+ query.containedIn(key, element.value);
|
|
|
+ }
|
|
|
+ }
|
|
|
query.include('user');
|
|
|
query.notEqualTo('identity', '国家级管理员');
|
|
|
query.descending('createdAt');
|
|
@@ -152,6 +179,14 @@ export class PageUserComponent implements OnInit {
|
|
|
this.pageIndex = e;
|
|
|
this.getProfile();
|
|
|
}
|
|
|
+ //筛选条件
|
|
|
+ onChangeFilter(data: any, type:string){
|
|
|
+ console.log(data);
|
|
|
+ this.filters[type].value = data
|
|
|
+ this.profiles = []
|
|
|
+ this.pageIndex = 1
|
|
|
+ this.getProfile()
|
|
|
+ }
|
|
|
createUser() {
|
|
|
this.route.navigate(['/nav-admin/manage/user/create']);
|
|
|
}
|
|
@@ -402,30 +437,12 @@ export class PageUserComponent implements OnInit {
|
|
|
}
|
|
|
/* 添加账号 */
|
|
|
async accountComplete() {
|
|
|
- if (
|
|
|
- !this.account?.name.trim() ||
|
|
|
- !this.account.department?.id ||
|
|
|
- !this.account.password.trim()
|
|
|
- ) {
|
|
|
- this.message.warning('请填写必填项');
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!this.account.identity) {
|
|
|
- this.message.error('请选择人员类型');
|
|
|
- return;
|
|
|
- }
|
|
|
- let a = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
|
|
|
- if (this.account.phone && !String(this.account.phone).match(a)) {
|
|
|
- this.message.error('请填写正确手机号');
|
|
|
- return;
|
|
|
- }
|
|
|
this.account.username = this.account?.username.trim();
|
|
|
this.account.email = this.account?.email.trim();
|
|
|
this.account.phone = this.account?.phone.trim();
|
|
|
- if (!this.account?.email.trim() && !this.account?.phone.trim()) {
|
|
|
- this.message.error('邮箱或手机号必须填写一项');
|
|
|
- return;
|
|
|
- }
|
|
|
+ this.account.name = this.account?.name.trim();
|
|
|
+ this.account.password = this.account?.password.trim();
|
|
|
+ if(!this.authVrifly()) return
|
|
|
try {
|
|
|
let obj = Parse.Object.extend('_User');
|
|
|
let user = new obj();
|
|
@@ -469,4 +486,42 @@ export class PageUserComponent implements OnInit {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ authVrifly():boolean | undefined{
|
|
|
+ this.account.password = this.account?.password.trim();
|
|
|
+ this.account.email = this.account?.email.trim();
|
|
|
+ this.account.phone = this.account?.phone.trim();
|
|
|
+ this.account.name = this.account?.name.trim();
|
|
|
+ if (
|
|
|
+ !this.account?.name ||
|
|
|
+ !this.account.department?.id ||
|
|
|
+ !this.account.password||
|
|
|
+ !this.account.phone || !this.account?.email
|
|
|
+ ) {
|
|
|
+ this.message.warning('请填写必填项');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.account.identity) {
|
|
|
+ this.message.error('请选择人员类型');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let a = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
|
|
|
+ if (this.account.phone && !String(this.account.phone).match(a)) {
|
|
|
+ this.message.error('请填写正确手机号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let m = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
|
+ if(!String(this.account.email).match(m)){
|
|
|
+ this.message.error("邮箱格式有误");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // if (!this.account?.email&& !this.account?.phone) {
|
|
|
+ // this.message.error('邮箱或手机号必须填写一项');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ if(!(this.account.password.length >= 6 && this.account.password.length <= 18)){
|
|
|
+ this.message.error('密码格式错误,请填写6-18位非空字符串(数字、大小写字母或英文符号)');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
}
|