Kaynağa Gözat

update 申报单位人员问题

cehn 8 ay önce
ebeveyn
işleme
8ff2de99bc

+ 23 - 19
projects/textbook/src/app/textbook/textbook.component.ts

@@ -33,6 +33,7 @@ interface filter {
     NzEmptyModule,
   ],
   standalone: true,
+  providers: [DatePipe]
 })
 export class TextbookComponent implements OnInit {
   textbookList: Array<Parse.Object> = [];
@@ -159,7 +160,8 @@ export class TextbookComponent implements OnInit {
     private route: Router,
     private activeRoute: ActivatedRoute,
     private message: NzMessageService,
-    private modal: NzModalService
+    private modal: NzModalService,
+    private datePipe: DatePipe
   ) {}
 
   ngOnInit() {
@@ -711,14 +713,14 @@ export class TextbookComponent implements OnInit {
         <thead>
           <tr>
             <th>申报编号</th>
-            <th>教材名称</th>
-            <th>册数</th>
+            <th>申报教材名称</th>
             <th>第一主编/作者</th>
-            <th>所属单位</th>
-            <th>所属本科专业</th>
-            <th>主要语种类型</th>
-            <th>ISBN</th>
+            <th>第一主编(作者)单位</th>
+            <th>申报类型</th>
+            <th>是否为重点建设教材</th>
             <th>出版单位</th>
+            <th>初版时间</th>
+            <th>载体形式</th>
           </tr>
         </thead>
         <tbody>
@@ -727,7 +729,7 @@ export class TextbookComponent implements OnInit {
     for (var row = 0; row < data.length; row++) {
       _body += '<tr>';
       _body += '<td>';
-      _body += `${row + 1}`;
+      _body += `${data[row].get('code') || ''}`;
       _body += '</td>';
 
       _body += '<td>';
@@ -735,36 +737,38 @@ export class TextbookComponent implements OnInit {
       _body += '</td>';
 
       _body += '<td>';
-      _body += `${
-        data[row]?.get('type') == '单册'
-          ? '单册'
-          : data[row]?.get('typeNumber') || '-'
-      }`;
+      _body += `${data[row]?.get('author') || '-'}`;
       _body += '</td>';
 
       _body += '<td>';
-      _body += `${data[row]?.get('author') || '-'}`;
+      _body += `${data[row]?.get('unit') || '-'}`;
       _body += '</td>';
 
       _body += '<td>';
-      _body += `${data[row]?.get('unit') || '-'}`;
+      _body += `${
+        data[row]?.get('type') == '单册'
+          ? '单册'
+          : data[row]?.get('typeNumber') || '-'
+      }`;
       _body += '</td>';
 
       _body += '<td>';
-      _body += `${data[row]?.get('major').name || '-'}`;
+      _body += `${data[row]?.get('approval') || '-'}`;
       _body += '</td>';
 
       _body += '<td>';
-      _body += `${data[row]?.get('lang') || '-'}`;
+      _body += `${data[row]?.get('editionUnit') || '-'}`;
       _body += '</td>';
 
+
       _body += '<td>';
-      _body += `${data[row]?.get('ISBN') || '-'}`;
+      _body += `${this.datePipe.transform(data[row]?.get('editionFirst'), 'yyyy-MM') || '-'}`;
       _body += '</td>';
 
       _body += '<td>';
-      _body += `${data[row]?.get('editionUnit') || '-'}`;
+      _body += `${data[row]?.get('carrierShape') || '-'}`;
       _body += '</td>';
+      
       _body += '</tr>';
     }
     table += _body;

+ 84 - 25
projects/textbook/src/modules/nav-province-contact/page-role/page-role.component.html

@@ -41,7 +41,7 @@
           nz-dropdown
           [nzDropdownMenu]="menutep"
           [nzPlacement]="'bottomLeft'"
-          style="margin-left: 0px; width: 180px;"
+          style="margin-left: 0px; width: 180px"
         >
           <span nz-icon nzType="plus" nzTheme="outline"></span>新建
         </button>
@@ -76,8 +76,10 @@
         <span nz-icon nzType="team" nzTheme="outline"></span>
         {{ profiles.length }}人
       </div>
-      <label nz-checkbox [(ngModel)]="checkedShowFilter"
-      (ngModelChange)="onChecked()"
+      <label
+        nz-checkbox
+        [(ngModel)]="checkedShowFilter"
+        (ngModelChange)="onChecked()"
         >仅显示部门直属成员</label
       >
     </div>
@@ -142,50 +144,51 @@
       >
         <thead>
           <tr>
-            <!-- <th
+            <th
               nzWidth="50px"
               nzLeft
               [nzChecked]="checkedAll"
               [nzIndeterminate]="indeterminate"
               nzLabel="Select all"
               (nzCheckedChange)="onAllChecked($event)"
-            ></th> -->
+            ></th>
             <th nzWidth="120px">用户</th>
             <th nzWidth="120px">手机号</th>
             <th nzWidth="120px">邮箱</th>
             <th nzWidth="120px">人员类型</th>
             <th nzWidth="120px">所属部门</th>
-            <!-- <th nzWidth="50px" nzRight>操作</th> -->
+            <th nzWidth="50px" nzRight>操作</th>
           </tr>
         </thead>
         <tbody>
           @for (data of profiles; track data.objectId) {
           <tr>
-            <!-- <td
+            <td
               nzLeft
-              [nzChecked]="data.checked"
+              [nzChecked]="setOfCheckedId.has(data.id)"
               (nzCheckedChange)="onItemChecked(data.objectId, $event)"
-            ></td> -->
-            <td nzEllipsis
+            ></td>
+            <td
+              nzEllipsis
               (click)="goDateil(data.get('user')?.id)"
               class="activeTd"
             >
               <nz-avatar nzIcon="user"></nz-avatar>
-              {{ data?.get("user")?.get("name") || '-'}}
+              {{ data?.get("user")?.get("name") || "-" }}
             </td>
             <td nzEllipsis>
-              {{ data?.get("user")?.get("phone") || '-' }}
+              {{ data?.get("user")?.get("phone") || "-" }}
             </td>
             <td nzEllipsis>
-              {{ data?.get("user")?.get("email") || data?.get("email") || '-'}}
+              {{ data?.get("user")?.get("email") || data?.get("email") || "-" }}
             </td>
             <td nzEllipsis>
               {{ data?.get("identity") }}
             </td>
             <td nzEllipsis>
-              {{ data?.get("user").get("departmentName") || '-' }}
+              {{ data?.get("user").get("departmentName") || "-" }}
             </td>
-            <!-- <td nzEllipsis nzRight>
+            <td nzEllipsis nzRight>
               @if(data?.user?.objectId == user?.id || data?.identity ==
               '工作联系人' || data?.identity == '高校联系人'){ - } @else {
               <button
@@ -201,13 +204,24 @@
                   <li nz-menu-item>
                     <button nz-button style="color: #231c1f" nzType="link">
                       <span nz-icon nzType="stop" nzTheme="outline"></span
-                      >移除部门
+                      >更换部门
+                    </button>
+                  </li>
+                  <li nz-menu-item>
+                    <button nz-button style="color: #231c1f" nzType="link">
+                      <span
+                        nz-icon
+                        nzType="delete"
+                        (click)="deleteSelected()"
+                        nzTheme="outline"
+                      ></span
+                      >删除用户
                     </button>
                   </li>
                 </ul>
               </nz-dropdown-menu>
               }
-            </td> -->
+            </td>
           </tr>
           }
         </tbody>
@@ -273,15 +287,26 @@
             <nz-input-group nzSearch [nzAddOnAfter]="suffixIconclear">
               <input
                 nz-input
-                placeholder="可输入搜索{{editObject.parent?.title || nodes[0]?.title}}下级所属部门"
+                placeholder="可输入搜索{{
+                  editObject.parent?.title || nodes[0]?.title
+                }}下级所属部门"
                 [(ngModel)]="modalValue"
-                (ngModelChange)="onSearchNodes($event, true,editObject.parent?.id)"
+                (ngModelChange)="
+                  onSearchNodes($event, true, editObject.parent?.id)
+                "
                 (blur)="onblur('editObject')"
                 type="text"
               />
             </nz-input-group>
             <ng-template #suffixIconclear>
-               <button nz-button nzType="primary" nzSearch (click)="reset('editObject')">清空</button>
+              <button
+                nz-button
+                nzType="primary"
+                nzSearch
+                (click)="reset('editObject')"
+              >
+                清空
+              </button>
             </ng-template>
           </div>
         </div>
@@ -291,7 +316,7 @@
             @for (data of parentMap; track data.title) {
             <span style="margin: 0 10px">/</span>
             @if ($index !=0 && data?.verify) {
-            <a (click)="onPre('editObject',data, $index)">{{ data.title }}</a>
+            <a (click)="onPre('editObject', data, $index)">{{ data.title }}</a>
             }@else {
             <a style="color: #86909c">{{ data.title }}</a>
             } }
@@ -342,7 +367,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>
@@ -350,15 +375,26 @@
             <nz-input-group nzSearch [nzAddOnAfter]="suffixIconclear">
               <input
                 nz-input
-                placeholder="可输入搜索{{account.department?.title || nodes[0]?.title}}下级所属部门"
+                placeholder="可输入搜索{{
+                  account.department?.title || nodes[0]?.title
+                }}下级所属部门"
                 [(ngModel)]="modalValue"
-                (ngModelChange)="onSearchNodes($event, true, account.department?.id)"
+                (ngModelChange)="
+                  onSearchNodes($event, true, account.department?.id)
+                "
                 type="text"
                 (blur)="onblur('account')"
               />
             </nz-input-group>
             <ng-template #suffixIconclear>
-               <button nz-button nzType="primary" nzSearch (click)="reset('account')">清空</button>
+              <button
+                nz-button
+                nzType="primary"
+                nzSearch
+                (click)="reset('account')"
+              >
+                清空
+              </button>
             </ng-template>
           </div>
         </div>
@@ -493,3 +529,26 @@
     </button>
   </div>
 </nz-modal>
+
+<!-- 全选操作:批量操作 -->
+<div class="batch-toolbar-modal" *ngIf="setOfCheckedId?.size">
+  <div class="batch-toolbar">
+    <div class="styles_counter__18S08">
+      <span>已选</span>
+      <span class="styles_num__178Wa">{{ setOfCheckedId.size }}</span>
+    </div>
+    <div class="batch-toolbar-actions">
+      <div class="ant-space ant-space-horizontal ant-space-align-center">
+        <div class="ant-space-item" style="margin-right: 16px">
+          <button nz-button nzType="text" (click)="deleteSelected()">
+            <span nz-icon nzType="delete"></span>
+            删除
+          </button>
+        </div>
+      </div>
+    </div>
+    <div class="styles_cancel__AARoT">
+      <button nz-button nzType="text" (click)="resetChange()">取消选中</button>
+    </div>
+  </div>
+</div>

+ 55 - 0
projects/textbook/src/modules/nav-province-contact/page-role/page-role.component.scss

@@ -108,6 +108,61 @@
     }
   }
 }
+
+// 选中,批量操作区域
+.batch-toolbar-modal{
+  position: fixed;
+  display: flex;
+  justify-content: center;
+  bottom: 80px;
+  left: calc(50% - 184px);
+  -webkit-transform: translate(0);
+  transform: translate(0);
+}
+.batch-toolbar {
+  display: flex;
+  align-items: center;
+  height: 56px;
+  // min-width: 600px;
+  background: #fff;
+  border: 1px solid #e5e6eb;
+  box-sizing: border-box;
+  box-shadow: 0 16px 32px -10px rgba(4, 24, 115, .1);
+  border-radius: 4px;
+  button{
+      color:#545968;
+  }
+}
+.batch-toolbar .styles_counter__18S08 {
+  color: #fff;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  height: 100%;
+  background: #C6233F;
+  width: 100px;
+  font-size: 12px;
+  border-top-left-radius: 4px;
+  border-bottom-left-radius: 4px;
+}
+.batch-toolbar .batch-toolbar-actions {
+  display: flex;
+  margin: auto;
+  padding: 0 20px;
+}
+.batch-toolbar .styles_cancel__AARoT {
+  font-size: 16px;
+  border-left: 1px solid #a9aeb8;
+  // padding-left: 20px;
+  display: flex;
+  justify-content: center;
+  width: 128px;
+}
+.batch-toolbar .styles_counter__18S08 .styles_num__178Wa {
+  font-size: 24px;
+  margin-left: 8px;
+}
+
 input:-webkit-autofill,
 input:-webkit-autofill:hover,
 input:-webkit-autofill:focus,

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

@@ -115,6 +115,7 @@ export class PageRoleComponent implements OnInit {
   };
   userType: Array<string> = ['教师'];
   parents: Array<any> = []; //所有一级列表
+  setOfCheckedId = new Set<string>();
 
   constructor(
     public tbookSer: textbookServer,
@@ -367,21 +368,24 @@ export class PageRoleComponent implements OnInit {
   }
 
   onAllChecked(checked: boolean): void {
-    console.log(checked);
-    this.profiles = this.profiles.map((item) => {
-      item.checked = checked;
-      return item;
+    this.profiles.forEach((item) => {
+      if (checked) {
+        this.setOfCheckedId.add(item.id);
+      } else {
+        this.setOfCheckedId.delete(item.id);
+      }
     });
     this.checkedAll = checked;
   }
   onItemChecked(id: string, e: boolean) {
-    let checkedAll = true;
-    this.profiles = this.profiles.map((item) => {
-      if (id == item.objectId) item.checked = e;
-      if (!item.checked) checkedAll = false;
-      return item;
-    });
-    this.checkedAll = checkedAll;
+    if (e) {
+      this.setOfCheckedId.add(id);
+    } else {
+      this.setOfCheckedId.delete(id);
+    }
+    this.checkedAll = this.profiles.every((item) =>
+      this.setOfCheckedId.has(item.id)
+    );
   }
   //新建打开弹窗
   async showModalDepart(type: string) {
@@ -676,8 +680,6 @@ export class PageRoleComponent implements OnInit {
     return true
   }
 
-
-  setOfCheckedId = new Set<string>();
   //移除部门
   async removeBranch(data: Parse.Object) {
     if (data?.get('user')?.id) {
@@ -716,6 +718,42 @@ export class PageRoleComponent implements OnInit {
       nzOnCancel: () => console.log('Cancel'),
     });
   }
+  //删除用户
+  deleteSelected(data?:Parse.Object) {
+    let filters = []
+    if(data?.id){
+      filters = [data?.id]
+    }else{
+      filters = Array.from(this.setOfCheckedId)
+    }
+    this.modal.confirm({
+      nzTitle: '批量删除',
+      nzContent: `删除后数据不可恢复,请谨慎操作`,
+      nzOkText: '确认',
+      nzOkType: 'primary',
+      nzOkDanger: true,
+      nzOnOk: async () => {
+        let selectedList = this.profiles.filter((item: any) =>
+          this.setOfCheckedId.has(item?.id)
+        );
+        let deletePromiseList = selectedList.map((item: any) => {
+          return new Promise(async (resolve) => {
+            await item.get('user')?.destroy()
+            await item.destroy()
+            resolve(true)
+          });
+        });
+        try {
+          await Promise.all(deletePromiseList);
+          this.setOfCheckedId = new Set<string>();
+          this.checkedAll = false
+          this.getProfile();
+        } catch (err) {}
+      },
+      nzCancelText: '取消',
+      nzOnCancel: () => console.log('Cancel'),
+    });
+  }
   resetChange() {
     this.setOfCheckedId = new Set<string>();
     this.checkedAll = false;