Browse Source

用户列表筛选条件

cehn 7 months ago
parent
commit
d2cd0deb66

+ 1 - 1
projects/textbook/src/modules/nav-admin/page-role/page-role.component.ts

@@ -263,7 +263,7 @@ export class PageRoleComponent implements OnInit {
                 where: {
                   $or: [
                     {
-                      department: { $in: [childrens] },
+                      department: { $in: childrens },
                     },
                   ],
                 },

+ 11 - 5
projects/textbook/src/modules/nav-admin/page-user/page-user.component.html

@@ -85,17 +85,24 @@
           nzWidth="120px"
           [nzShowFilter]="true"
           [nzFilters]="listOfColumns.identity.listOfFilter"
-          (nzFilterChange)="onChangeFilter($event,'identity')"
+          (nzFilterChange)="onChangeFilter($event, 'identity')"
         >
           人员类型
         </th>
-        <th nzWidth="80px">认证状态</th>
+        <th
+          nzWidth="80px"
+          [nzShowFilter]="true"
+          [nzFilters]="listOfColumns.accountState.listOfFilter"
+          (nzFilterChange)="onChangeFilter($event, 'accountState')"
+        >
+          认证状态
+        </th>
         <th
           nzWidth="150px"
           nzEllipsis
           [nzShowFilter]="true"
           [nzFilters]="listOfColumns.companyType.listOfFilter"
-          (nzFilterChange)="onChangeFilter($event,'companyType')"
+          (nzFilterChange)="onChangeFilter($event, 'companyType')"
         >
           单位类型
         </th>
@@ -238,7 +245,7 @@
   <ng-container *nzModalContent>
     <div nz-row class="depart-modal">
       <div nz-col nzSpan="12">
-        <div class="row" style="margin-bottom: 6px;">
+        <div class="row" style="margin-bottom: 6px">
           <div class="label">
             选择所属部门 <span style="color: #e8353e">*</span>
           </div>
@@ -377,7 +384,6 @@
             </ng-template> -->
           </div>
         </div>
-
       </div>
     </div>
   </ng-container>

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

@@ -45,6 +45,13 @@ export class PageUserComponent implements OnInit {
         { value: '教师', text: '教师' },
       ],
     },
+    accountState: {
+      listOfFilter: [
+        { value: '已认证', text: '已认证' },
+        { value: '待认证', text: '待认证' },
+        { value: '已禁用', text: '已禁用' },
+      ],
+    },
     companyType: {
       listOfFilter: [
         { value: '教育部直属高校', text: '教育部直属高校' },
@@ -92,8 +99,9 @@ export class PageUserComponent implements OnInit {
   parents: Array<any> = []; //所有一级列表
   //筛选条件
   filters: any = {
-    identity: { type: 'string', value: [] },
-    companyType: { type: 'string', value: [] },
+    identity: { type: 'profile', value: [] },
+    companyType: { type: 'profile', value: [] },
+    accountState: { type: 'user', value: [] },
   };
   constructor(
     public tbookSer: textbookServer,
@@ -156,17 +164,25 @@ export class PageUserComponent implements OnInit {
       let childrens = await this.tbookSer.getChild(
         this.tbookSer.profile.user.department?.objectId
       );
-      this.tbookSer.profile.user.department;
+      // this.tbookSer.profile.user.department;
       queryParams['where']['$or'][0]['user']['$inQuery']['where'][
         'department'
       ] = {
-        $in: [childrens],
+        $in: childrens,
       };
     }
+    for (const key in this.filters) {
+      const element = this.filters[key];
+      if (element.type == 'user' && element.value?.length > 0) {
+        queryParams['where']['$or'][0]['user']['$inQuery']['where'][key] = {
+          $in: element.value,
+        };
+      }
+    }
     let query = Parse.Query.fromJSON('Profile', queryParams);
     for (const key in this.filters) {
       const element = this.filters[key];
-      if (element.value?.length > 0) {
+      if (element.type == 'profile' && element.value?.length > 0) {
         query.containedIn(key, element.value);
       }
     }

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

@@ -309,7 +309,7 @@ export class PageRoleComponent implements OnInit {
                 where: {
                   $or: [
                     {
-                      department: { $in: [childrens] },
+                      department: { $in: childrens },
                     },
                   ],
                 },