|
@@ -60,11 +60,11 @@ export class AccountInfoComponent implements OnInit {
|
|
|
postName: [''],
|
|
|
});
|
|
|
identityFile: string = ''; //单位联系人认证文件
|
|
|
- companyName: string = ''; //单位名称
|
|
|
+ companyId: string = ''; //单位名称
|
|
|
|
|
|
provinces: Array<string> = provinces.options; //省份
|
|
|
unitTypes: Array<any> = [];
|
|
|
- companys: Array<string> = [];
|
|
|
+ companys: Array<any> = [];
|
|
|
userType: Array<string> = ['报送联系人', '评审专家', '高校联系人', '个人'];
|
|
|
|
|
|
constructor(
|
|
@@ -105,10 +105,10 @@ export class AccountInfoComponent implements OnInit {
|
|
|
departmentName: [user?.get('departmentName') || ''],
|
|
|
postName: [profile?.get('postName') || ''],
|
|
|
});
|
|
|
- // this.identityFile = profile?.get('identityFile') || ''
|
|
|
- this.companyName = user?.get('companyName') || '';
|
|
|
+ this.identityFile = profile?.get('identityFile') || ''
|
|
|
+ this.companyId = user?.get('department')?.id || '';
|
|
|
this.provinceChange();
|
|
|
- // console.log(this.companyName, this.identityFile);
|
|
|
+ // console.log(this.companyId, this.identityFile);
|
|
|
// console.log(this.validateForm.value);
|
|
|
}
|
|
|
async getUnitTypes() {
|
|
@@ -125,7 +125,7 @@ export class AccountInfoComponent implements OnInit {
|
|
|
//根据所选单位类型获取对应单位
|
|
|
async provinceChange(val?: string, isChange?: boolean) {
|
|
|
// console.log(val);
|
|
|
- if (isChange) this.companyName = '';
|
|
|
+ if (isChange) this.companyId = '';
|
|
|
this.companys = [];
|
|
|
let parent = this.unitTypes.find(item=>item.name == this.validateForm.value.companyType)
|
|
|
let query = new Parse.Query('Department');
|
|
@@ -136,14 +136,14 @@ export class AccountInfoComponent implements OnInit {
|
|
|
val && query.contains('name', val);
|
|
|
let r = await query.find();
|
|
|
if (r.length > 0) {
|
|
|
- this.companys = r.map((item: Parse.Object) => item.get('name'));
|
|
|
+ this.companys = r.map((item: Parse.Object) =>{ return { id: item.id, name: item.get('name') }});
|
|
|
}
|
|
|
}
|
|
|
submitForm(): void {
|
|
|
console.log(this.validateForm.value);
|
|
|
- console.log(this.companyName, this.identityFile);
|
|
|
+ console.log(this.companyId);
|
|
|
if (this.validateForm.valid) {
|
|
|
- if (!this.companyName) {
|
|
|
+ if (!this.companyId) {
|
|
|
this.message.error('单位名称未选择或与单位类型不匹配,请重新选择');
|
|
|
return;
|
|
|
}
|
|
@@ -171,11 +171,24 @@ export class AccountInfoComponent implements OnInit {
|
|
|
}
|
|
|
|
|
|
async profileSave(params: any) {
|
|
|
+ let queryDepart = new Parse.Query('Department')
|
|
|
+ queryDepart.equalTo('objectId', this.companyId);
|
|
|
+ queryDepart.select('objectId');
|
|
|
+ let depart = await queryDepart.first()
|
|
|
+ if(!depart?.id){
|
|
|
+ this.message.error('单位名称未选择或与单位类型不匹配,请重新选择');
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.user?.set('name', params.name);
|
|
|
this.user?.set('email', params.email);
|
|
|
this.user?.set('phone', params.phone);
|
|
|
this.user?.set('province', params.province);
|
|
|
- this.user?.set('companyName', this.companyName);
|
|
|
+ this.user?.set('companyName', depart?.get('name'));
|
|
|
+ this.user?.set('department', {
|
|
|
+ __type: 'Pointer',
|
|
|
+ className: 'Department',
|
|
|
+ objectId: depart?.id,
|
|
|
+ });
|
|
|
!this.user?.get('accountState') && this.user?.set('accountState', '待认证');
|
|
|
this.user?.set('departmentName', params.departmentName);
|
|
|
await this.user?.save();
|