cehn 8 сар өмнө
parent
commit
d42c1c93e2

+ 41 - 40
projects/textbook/src/modules/common/textbook-details/textbook-details.component.html

@@ -10,49 +10,50 @@
       </div>
     </nz-breadcrumb>
   </nz-page-header>
+  @if (this.tbookSer.profile.identity == '工作联系人' ||
+  this.tbookSer.profile.user?.department == textBook?.department) {
+  <nz-tabset [(nzSelectedIndex)]="active">
+    <nz-tab nzTitle="教材申报书及附件"> </nz-tab>
+    <nz-tab nzTitle="教材评审明细"> </nz-tab>
+  </nz-tabset>
+  }
 </div>
 
-@if (this.tbookSer.profile.identity == '工作联系人' ||
-this.tbookSer.profile.user?.department == textBook?.department) {
-<nz-tabset style="margin: 0 24px">
-  <nz-tab nzTitle="教材申报书及附件">
-    <ng-container *ngTemplateOutlet="one"></ng-container>
-  </nz-tab>
-  <nz-tab nzTitle="教材评审明细">
-    <nz-table
-      [nzLoading]="groupLogin || reviewLogin"
-      class="reviewTable"
-      #basicTable
-      [nzData]="groupList"
-      [nzScroll]="{ x: '100%' }"
-    >
-      <thead>
-        <tr>
-          <th style="width: 130px" nzLeft>所属评审组</th>
-          @for (item of reviewList; track $index) {
-          <th style="width: 100px">
-            {{
-              item?.get("profile")?.get("user")?.get("name") || "未命名评审专家"
-            }}
-          </th>
-          }
-          <th style="width: 80px" nzRight>合计分值</th>
-        </tr>
-      </thead>
-      <tbody>
-        <tr *ngFor="let data of basicTable.data">
-          <td nzLeft>{{ data?.get("name") }}</td>
-          @for (item of reviewList; track $index) {
-          <td>{{ item?.get("score") || "-" }}</td>
-          }
-          <td nzRight>{{ textBook?.score || "-" }}</td>
-        </tr>
-      </tbody>
-    </nz-table>
-  </nz-tab>
-</nz-tabset>
-} @else {
+@if(active == 0) {
 <ng-container *ngTemplateOutlet="one"></ng-container>
+} @else if (active == 1) {
+<div class="content">
+  <nz-table
+    [nzLoading]="groupLogin || reviewLogin"
+    class="reviewTable"
+    #basicTable
+    [nzData]="groupList"
+    [nzScroll]="{ x: '100%' }"
+  >
+    <thead>
+      <tr>
+        <th style="width: 130px" nzLeft>所属评审组</th>
+        @for (item of reviewList; track $index) {
+        <th style="width: 100px">
+          {{
+            item?.get("profile")?.get("user")?.get("name") || "未命名评审专家"
+          }}
+        </th>
+        }
+        <th style="width: 80px" nzRight>合计分值</th>
+      </tr>
+    </thead>
+    <tbody>
+      <tr *ngFor="let data of basicTable.data">
+        <td nzLeft>{{ data?.get("name") }}</td>
+        @for (item of reviewList; track $index) {
+        <td>{{ item?.get("score") || "-" }}</td>
+        }
+        <td nzRight>{{ total }}</td>
+      </tr>
+    </tbody>
+  </nz-table>
+</div>
 }
 
 <ng-template #one>

+ 14 - 1
projects/textbook/src/modules/common/textbook-details/textbook-details.component.ts

@@ -11,6 +11,7 @@ import { CommonModule } from '@angular/common';
 import { NzTabsModule } from 'ng-zorro-antd/tabs';
 import { NzTableModule } from 'ng-zorro-antd/table';
 import { textbookServer } from '../../../services/textbook';
+import * as compute from '../../../services/compute';
 
 @Component({
   selector: 'app-textbook-details',
@@ -33,7 +34,7 @@ export class TextbookDetailsComponent implements OnInit {
   @ViewChild('templ1') templ1: any;
   user?: Parse.Object;
   textBook: object | any = {};
-
+  active:number = 0
   /**扩展表记录 */
   eduTextbookVolumeList: Array<any> = [];
 
@@ -42,6 +43,17 @@ export class TextbookDetailsComponent implements OnInit {
   /** 申报类型*/
   type: any;
 
+  get total():number{
+    let num = 0
+    this.reviewList.forEach(item=>{
+      num = compute.addNum(
+        item?.get('score'),
+        num
+      );
+    })
+    return num
+  }
+
   constructor(
     public tbookSer: textbookServer,
     private router: Router,
@@ -115,6 +127,7 @@ export class TextbookDetailsComponent implements OnInit {
     query.notEqualTo('isDeleted', true);
     query.equalTo('eduTextbook', this.textBook?.objectId);
     query.include('profile', 'profile.user');
+    query.equalTo('verify',true)
     this.reviewList = await query.find();
     console.log(this.reviewList);
     this.reviewLogin = false;

+ 1 - 1
projects/textbook/src/modules/nav-province-contact/components/review-details/review-details.component.html

@@ -63,7 +63,7 @@
         <td
           nzEllipsis
           class="activeTd"
-          (click)="toUrl('/common/textbook/details/' + data.id)"
+          (click)="toUrl('/common/textbook/details/' + data?.get('eduTextbook')?.id)"
           nz-popover
           [nzPopoverContent]="contentTemplatetitle"
         >

+ 239 - 55
projects/textbook/src/modules/nav-province-contact/components/review-details/review-details.component.ts

@@ -67,6 +67,28 @@ export class ReviewDetailsComponent implements OnInit {
 
   showLoading: boolean = false; //全局
   time: any;
+  /* 格式化拓展表字段 */
+  fromatFiled(list: Array<Parse.Object>, filed: string): string {
+    let arr: Array<string | null> = [];
+    let isDate = false;
+    list.forEach((item: Parse.Object) => {
+      // arr.add(item.get(filed))
+      if (
+        isDate ||
+        Object.prototype.toString.call(item.get(filed)).indexOf('Date') != -1
+      ) {
+        arr.push(this.datePipe.transform(item.get(filed), 'yyyy-MM'));
+        isDate = true;
+      } else {
+        arr.push(item.get(filed));
+      }
+    });
+    let j = Array.from(arr).join(',');
+    if (!isDate) {
+      j = Array.from(new Set(arr)).join(' ');
+    }
+    return j || '-';
+  }
 
   constructor(
     private activeRoute: ActivatedRoute,
@@ -84,7 +106,7 @@ export class ReviewDetailsComponent implements OnInit {
   }
   async getTextbook(val?: string, exported?: boolean): Promise<any[] | void> {
     if (this.loading) return;
-    if(!exported) this.loading = true;
+    if (!exported) this.loading = true;
     try {
       let queryParams: any = {
         where: {
@@ -153,7 +175,14 @@ export class ReviewDetailsComponent implements OnInit {
       this.eduProcess?.id && query.equalTo('eduProcess', this.eduProcess.id);
       query.descending('updatedAt');
       query.notEqualTo('isDeleted', true);
-      query.include('eduTextbook', 'profile', 'profile.user');
+      query.exists('score');
+      query.equalTo('verify',true)
+      query.include(
+        'eduTextbook',
+        'eduTextbook.childrens',
+        'profile',
+        'profile.user'
+      );
       this.count = await query.count();
       query.limit(this.limit);
       query.skip(this.limit * (this.pageIndex - 1));
@@ -208,61 +237,13 @@ export class ReviewDetailsComponent implements OnInit {
     if (this.showLoading) return;
     this.showLoading = true;
     try {
+      let table;
       let data: any = await this.getTextbook('', true);
-      let table = `<table border="1px" cellspacing="0" cellpadding="0">
-        <thead>
-          <tr>
-            <th>序号</th>
-            <th>申报教材名称</th>
-            ${this.filterObj.showGroup ? '<th>所属评审组</th>' : ''}
-            <th>评审专家</th>
-            <th>提交时间</th>
-            <th>分值</th>
-          </tr>
-        </thead>
-        <tbody>
-        `;
-      let _body = '';
-      for (var row = 0; row < data.length; row++) {
-        _body += '<tr>';
-        _body += '<td>';
-        _body += `${row + 1}`;
-        _body += '</td>';
-
-        _body += '<td>';
-        _body += `&nbsp;${data[row]?.get('eduTextbook')?.get('title') || ''}`;
-        _body += '</td>';
-
-        if(this.filterObj.showGroup){
-          _body += '<td>';
-          _body += ` &nbsp;${
-            this.filterObj.bookMap[data[row]?.get('eduTextbook')?.id].name || '-'
-          }`;
-          _body += '</td>';
-        }
-
-        _body += '<td>';
-        _body += `${
-          data[row]?.get('profile')?.get('user')?.get('name') || '-'
-        }`;
-        _body += '</td>';
-
-        _body += '<td>';
-        _body += `&nbsp;${this.datePipe.transform(
-          data[row]?.updatedAt,
-          'yyyy-MM-dd HH:mm:ss'
-        )}`;
-        _body += '</td>';
-
-        _body += '<td>';
-        _body += `${data[row]?.get('score') ?? '-'}`;
-        _body += '</td>';
-
-        _body += '</tr>';
+      if (this.filterObj.showGroup) {
+        table = this.getActivityTable(data);
+      } else {
+        table = this.getTable(data);
       }
-      table += _body;
-      table += '</tbody>';
-      table += '</table>';
       let title = '评审明细表';
       this.excel(table, `${title}.xls`);
       this.showLoading = false;
@@ -272,6 +253,209 @@ export class ReviewDetailsComponent implements OnInit {
       this.msg.error('导出超时');
     }
   }
+  //合并后(活动详情)
+  getActivityTable(data: Array<Parse.Object>): string {
+    let groupMap: any = {};
+    data.forEach((item: Parse.Object) => {
+      let obj = {
+        name: item?.get('profile')?.get('user')?.get('name'),
+        score: item?.get('score'),
+      };
+      if (!groupMap[item?.get('eduTextbook')?.id]) {
+        groupMap[item?.get('eduTextbook')?.id] = {
+          eduTextbook: item?.get('eduTextbook'),
+          groupList: [obj],
+        };
+      } else {
+        groupMap[item?.get('eduTextbook')?.id]['groupList'].push(obj);
+      }
+    });
+    console.log(groupMap);
+
+    let table = `<table border="1px" cellspacing="0" cellpadding="0">
+    <thead>
+      <tr>
+        <th>序号</th>
+        <th>教材申报编号</th>
+        <th>申报教材名称</th>
+        <th>所属学科专业类</th>
+        <th>第一主编/作者</th>
+        <th>出版单位</th>
+    `;
+    let l = 0;
+    let dataLsit: any = Object.values(groupMap);
+    dataLsit.forEach((val: any) => {
+      if (val?.groupList.length > l) l = val?.groupList.length;
+    });
+    for (let index = 0; index < l; index++) {
+      table += `<th>评审专家${index + 1}</th>`;
+    }
+    table += `
+        <th>平均分值(若为空请点击计算后再导出)</th>
+      </tr>
+    </thead>
+    <tbody>`;
+    let _body = '';
+    for (var row = 0; row < dataLsit.length; row++) {
+      _body += '<tr>';
+      _body += '<td>';
+      _body += `${row + 1}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${dataLsit[row]?.eduTextbook?.get('code') || ''}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${dataLsit[row]?.eduTextbook?.get('title') || ''}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${
+        (dataLsit[row]?.eduTextbook?.get('majorPoniter')?.code || '') +
+          '/' +
+          dataLsit[row]?.eduTextbook?.get('majorPoniter')?.name || ''
+      }`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${this.fromatFiled(
+        dataLsit[row]?.eduTextbook?.get('childrens'),
+        'author'
+      )}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `${this.fromatFiled(
+        dataLsit[row]?.eduTextbook?.get('childrens'),
+        'editionUnit'
+      )}`;
+      _body += '</td>';
+
+      for (let i = 0; i < l; i++) {
+        const element = dataLsit[row]['groupList'][i];
+        _body += '<td>';
+        _body += `${element?.name ?? ''} ${element?.score??''}`;
+        _body += '</td>';
+      }
+
+      // _body += '<td>';
+      // _body += ` &nbsp;${
+      //   this.filterObj.bookMap[dataLsit[row]?.eduTextbook?.id].name || '-'
+      // }`;
+      // _body += '</td>';
+
+      // _body += '<td>';
+      // _body += `${
+      //   dataLsit[row]?.get('profile')?.get('user')?.get('name') || '-'
+      // }`;
+      // _body += '</td>';
+
+      // _body += '<td>';
+      // _body += `&nbsp;${this.datePipe.transform(
+      //   dataLsit[row]?.updatedAt,
+      //   'yyyy-MM-dd HH:mm:ss'
+      // )}`;
+      // _body += '</td>';
+
+      _body += '<td>';
+      _body += `${dataLsit[row]?.eduTextbook?.get('score') ?? '-'}`;
+      _body += '</td>';
+
+      _body += '</tr>';
+    }
+    table += _body;
+    table += '</tbody>';
+    table += '</table>';
+    return table;
+  }
+  //非合并(评审组详情)
+  getTable(data: Array<Parse.Object>): string {
+    let table = `<table border="1px" cellspacing="0" cellpadding="0">
+    <thead>
+      <tr>
+        <th>序号</th>
+        <th>教材申报编号</th>
+        <th>申报教材名称</th>
+        <th>所属学科专业类</th>
+        <th>第一主编/作者</th>
+        <th>出版单位</th>
+        <th>评审专家</th>
+        <th>提交时间</th>
+        <th>分值</th>
+      </tr>
+    </thead>
+    <tbody>
+    `;
+    let _body = '';
+    for (var row = 0; row < data.length; row++) {
+      _body += '<tr>';
+      _body += '<td>';
+      _body += `${row + 1}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${data[row]?.get('eduTextbook')?.get('code') || ''}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${data[row]?.get('eduTextbook')?.get('title') || ''}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${
+        (data[row]?.get('eduTextbook')?.get('majorPoniter')?.code || '') +
+          '/' +
+          data[row]?.get('eduTextbook')?.get('majorPoniter')?.name || ''
+      }`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${this.fromatFiled(
+        data[row]?.get('eduTextbook')?.get('childrens'),
+        'author'
+      )}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `${this.fromatFiled(
+        data[row]?.get('eduTextbook')?.get('childrens'),
+        'editionUnit'
+      )}`;
+      _body += '</td>';
+
+      // if (this.filterObj.showGroup) {
+      //   _body += '<td>';
+      //   _body += ` &nbsp;${
+      //     this.filterObj.bookMap[data[row]?.get('eduTextbook')?.id].name ||
+      //     '-'
+      //   }`;
+      //   _body += '</td>';
+      // }
+
+      _body += '<td>';
+      _body += `${data[row]?.get('profile')?.get('user')?.get('name') || '-'}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `&nbsp;${this.datePipe.transform(
+        data[row]?.updatedAt,
+        'yyyy-MM-dd HH:mm:ss'
+      )}`;
+      _body += '</td>';
+
+      _body += '<td>';
+      _body += `${data[row]?.get('score') ?? '-'}`;
+      _body += '</td>';
+
+      _body += '</tr>';
+    }
+    table += _body;
+    table += '</tbody>';
+    table += '</table>';
+    return table;
+  }
+
   excel(data: any, filename: string) {
     let html =
       "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>";

+ 1 - 0
projects/textbook/src/services/compute.ts

@@ -1,4 +1,5 @@
 /* 加减乘除精度计算 */
+//相加
 export const addNum = function addNum(arg1: number, arg2: number): number {
   arg1 = arg1 ? arg1 : 0;
   arg2 = arg2 ? arg2 : 0;