warrior 8 months ago
parent
commit
c94239b53d

+ 2 - 2
projects/textbook/src/app/textbook/textbook.component.ts

@@ -73,10 +73,10 @@ export class TextbookComponent implements OnInit {
       });
       query = Parse.Query.or(query1, query2);
     }
-    if (this.tbookSer.profile.user.department.objectId) {
+    if (this.tbookSer.profile.user.department?.objectId) {
       query.equalTo(
         'department',
-        this.tbookSer.profile.user.department.objectId
+        this.tbookSer.profile.user.department?.objectId
       );
     }
     this.depart && query.equalTo('department', this.depart);

+ 2 - 2
projects/textbook/src/modules/nav-admin/page-user/page-user.component.ts

@@ -89,10 +89,10 @@ export class PageUserComponent implements OnInit {
         }]
       }
     }
-    if(this.tbookSer.profile.identity != '国家级管理员' || this.tbookSer.profile.user.department){
+    if(this.tbookSer.profile.identity != '国家级管理员' && this.tbookSer.profile.user.department){
       this.tbookSer.profile.user.department
       queryParams['where']['$or'][0]['user']['$inQuery']['where']['department'] = {
-        "$eq": this.tbookSer.profile.user.department.objectId
+        "$eq": this.tbookSer.profile.user.department?.objectId
       }
     }
     let query = Parse.Query.fromJSON('Profile',queryParams);

+ 2 - 2
projects/textbook/src/modules/nav-province-contact/page-process/process-list/process-list.component.ts

@@ -188,7 +188,7 @@ export class ProcessListComponent implements OnInit {
     query.select('code', 'name', 'branch', 'parent', 'type');
     query.descending('createdAt');
     query.limit(100);
-    query.equalTo('objectId', this.tbookSer.profile.user.department.objectId)
+    query.equalTo('objectId', this.tbookSer.profile.user.department?.objectId)
     let res = await query.find();
     res.forEach((item) => {
       nodes.push({
@@ -235,7 +235,7 @@ export class ProcessListComponent implements OnInit {
     let query = Parse.Query.or(query1, query2)
     query.include('profileSubmitted', 'profileSubmitted.user');
     query.notEqualTo('isDeleted', true);
-    query.equalTo('department',this.tbookSer.profile.user.department.objectId)
+    query.equalTo('department',this.tbookSer.profile.user.department?.objectId)
     let r = await query.find();
     let list: any[] = [];
     r.forEach((item) => {

+ 4 - 4
projects/textbook/src/modules/nav-province-contact/page-role/page-role.component.ts

@@ -121,15 +121,15 @@ export class PageRoleComponent implements OnInit {
       //   this.queryParams.where['isDeleted'] = { $ne: true };
       // }
       // this.list?.ngOnInit();
-      if(!this.tbookSer.profile.user.department.objectId){
+      if(!this.tbookSer.profile.user.department?.objectId){
         this.message.warning('权限不足')
         history.back()
         return
       }
       this.nodes = [{
         title: this.tbookSer.profile.user.department.name,
-        key: this.tbookSer.profile.user.department.objectId,
-        children: [...await this.getDepart(this.tbookSer.profile.user.department.objectId)],
+        key: this.tbookSer.profile.user.department?.objectId,
+        children: [...await this.getDepart(this.tbookSer.profile.user.department?.objectId)],
         isParent: false,
         isLeaf: false,
       }];
@@ -263,7 +263,7 @@ export class PageRoleComponent implements OnInit {
         this.parentList = await this.getDepart(this.activatedNode.parentNode.origin.key);
       }
     }else{
-      this.parentList = await this.getDepart(this.tbookSer.profile.user.department.objectId)
+      this.parentList = await this.getDepart(this.tbookSer.profile.user.department?.objectId)
     }
     this.editType = type;
     this.isVisible = true;

+ 1 - 1
projects/textbook/src/modules/nav-province-contact/page-textbook/page-textbook.component.ts

@@ -46,7 +46,7 @@ export class PageTextbookComponent implements OnInit {
         isDeleted: { $ne: true },
         render: true,
         discard: { $ne: true },
-        department: this.tbookSer.profile.user.department.objectId,
+        department: this.tbookSer.profile.user.department?.objectId,
       },
     };
   }