Przeglądaj źródła

国家级管理员新增源文件修改权限

warrior 1 miesiąc temu
rodzic
commit
c0666e17a0

+ 143 - 20
projects/textbook/src/modules/nav-admin/components/collect-textbook/collect-textbook.component.html

@@ -41,10 +41,10 @@
         <th nzEllipsis nzWidth="120px">出版单位</th>
         <th nzEllipsis nzWidth="120px">出版单位联系人</th>
         @if (!eduProcess?.id) {
-          <th nzEllipsis nzWidth="120px">申报部门</th>
+        <th nzEllipsis nzWidth="120px">申报部门</th>
         }
         <th nzEllipsis nzWidth="80px" nzAlign="center">文件状态</th>
-        <th nzEllipsis nzWidth="100px" nzAlign="center" nzRight>操作</th>
+        <th nzEllipsis nzWidth="50px" nzAlign="center" nzRight>操作</th>
       </tr>
     </thead>
     @if (textbookList.length > 0) {
@@ -54,9 +54,7 @@
         <td
           nzEllipsis
           class="activeTd"
-          (click)="
-            toUrl('/common/textbook/details/' + data?.id)
-          "
+          (click)="toUrl('/common/textbook/details/' + data?.id)"
           nz-popover
           [nzPopoverContent]="contentTemplatetitle"
         >
@@ -113,20 +111,64 @@
           </ng-template>
         </td>
         @if (!eduProcess?.id) {
-          <td nzEllipsis>{{data?.get('department')?.get('name')}}</td>
+        <td nzEllipsis>{{ data?.get("department")?.get("name") }}</td>
         }
         <td nzEllipsis nzAlign="center">
           <span [style.color]="statusMap[data.id].color">{{
             statusMap[data.id].status
           }}</span>
         </td>
-        <td nzEllipsis nzRight nzAlign="left">
-          @if (statusMap[data.id].btn == '查看') {
+        <td nzEllipsis nzRight nzAlign="center">
+          <button
+            nz-button
+            nz-dropdown
+            [nzDropdownMenu]="menu"
+            [nzPlacement]="'bottomLeft'"
+          >
+            <span nz-icon nzType="ellipsis" nzTheme="outline"></span>
+          </button>
+          <nz-dropdown-menu #menu="nzDropdownMenu">
+            <ul nz-menu>
+              <li nz-menu-item (click)="onEditModal(data)">
+                <button nz-button nzType="link" style="color: #231c1f">
+                  <span nz-icon nzType="edit" nzTheme="outline"></span
+                  >编辑源文件
+                </button>
+              </li>
+              @if(statusMap[data.id].btn == '查看'){
+              <li nz-menu-item (click)="onReview(data)">
+                <button nz-button nzType="link" style="color: #231c1f">
+                  <span nz-icon nzType="eye" nzTheme="outline"></span>查看源文件
+                </button>
+              </li>
+              <li nz-menu-item (click)="onReject(data)">
+                <button nz-button nzType="link" style="color: #231c1f">
+                  <span nz-icon nzType="rollback" nzTheme="outline"></span
+                  >退回源文件
+                </button>
+              </li>
+              }@else {
+              <li nz-menu-item (click)="onEmitMsg(data)">
+                <button nz-button nzType="link" style="color: #231c1f">
+                  <span nz-icon nzType="read" nzTheme="outline"></span
+                  >短信提醒上传
+                </button>
+              </li>
+              }
+            </ul>
+          </nz-dropdown-menu>
+          <!-- @if (statusMap[data.id].btn == '查看') {
           <a nz-button nzType="link" (click)="onReview(data)">查看</a>
-          <a nz-button nzType="link" style="color:#c6233f;" (click)="onReject(data)">退回</a>
+          <a
+            nz-button
+            nzType="link"
+            style="color: #c6233f"
+            (click)="onReject(data)"
+            >退回</a
+          >
           }@else {
           <a nz-button nzType="link" (click)="onEmitMsg(data)">提醒</a>
-          }
+          } -->
         </td>
       </tr>
       }
@@ -211,12 +253,7 @@
                   <td
                     nzEllipsis
                     class="activeTd"
-                    (click)="
-                      toUrl(
-                        '/common/textbook/details/' +
-                          data?.id
-                      )
-                    "
+                    (click)="toUrl('/common/textbook/details/' + data?.id)"
                     nz-popover
                     [nzPopoverContent]="contentTemplatetitle"
                   >
@@ -281,11 +318,11 @@
     </button>
   </div>
 </nz-modal>
-
+<!-- 查看预览 -->
 <nz-modal
-  [(nzVisible)]="isVisible"
+  [(nzVisible)]="isVisiblePreview"
   nzTitle="教材源文件"
-  (nzOnCancel)="isVisible = false"
+  (nzOnCancel)="isVisiblePreview = false"
   nzWidth="600px"
 >
   <ng-container *nzModalContent>
@@ -339,6 +376,92 @@
     </div>
   </ng-container>
   <div *nzModalFooter>
-    <button nz-button nzType="primary" (click)="isVisible = false">关闭</button>
+    <button nz-button nzType="primary" (click)="isVisiblePreview = false">
+      关闭
+    </button>
+  </div>
+</nz-modal>
+<!-- 编辑源文件 -->
+<nz-modal
+  [(nzVisible)]="isVisible"
+  nzTitle="上传教材源文件"
+  (nzOnCancel)="isVisible = false"
+  nzWidth="600px"
+>
+  <ng-container *nzModalContent>
+    <div nz-row class="modal-content">
+      @if (currentTextbook?.get('type')=='全册') {
+      <nz-collapse [nzBordered]="false">
+        @for (panel of currentTextbook?.get('childrens'); track panel) { @if
+        (this.tbookSer.profile.identity === '国家级管理员') {
+        <nz-collapse-panel
+          #p
+          [nzHeader]="title"
+          [nzActive]="false"
+          nzExpandedIcon="caret-right"
+          style="
+            background: #f7f7f7;
+            border-radius: 4px;
+            margin-bottom: 24px;
+            border: 0px;
+          "
+        >
+          <ng-template #title>
+            <span class="panel-title">{{
+              "分册" + ($index + 1) + "-" + currentTextbook?.get("title")
+            }}</span>
+          </ng-template>
+          <div class="">
+            <app-upload-collect
+              #children
+              [eduTextbookVolume]="panel"
+            ></app-upload-collect>
+          </div>
+          <ng-template #expandedIcon let-active>
+            {{ active }}
+            <span
+              nz-icon
+              nzType="caret-right"
+              class="ant-collapse-arrow"
+              [nzRotate]="p.nzActive ? 90 : -90"
+            ></span>
+          </ng-template>
+        </nz-collapse-panel>
+        } }
+      </nz-collapse>
+      } @else {
+      <app-upload-collect
+        #children
+        [eduTextbookVolume]="currentTextbook?.get('childrens')[0]"
+      ></app-upload-collect>
+      }
+    </div>
+  </ng-container>
+  <div *nzModalFooter>
+    <button
+      nz-button
+      nzType="default"
+      [disabled]="btnLoading"
+      (click)="isVisible = false"
+    >
+      取消
+    </button>
+    <button
+      nz-button
+      nzType="default"
+      [nzLoading]="btnLoading"
+      (click)="saveCollect('sbmit')"
+    >
+      确认修改
+    </button>
+    <!-- <button
+      nz-button
+      nzType="primary"
+      [disabled]="false"
+      (click)="saveCollect('save')"
+      [nzLoading]="btnLoading"
+    >
+      保存
+    </button> -->
   </div>
 </nz-modal>

+ 80 - 6
projects/textbook/src/modules/nav-admin/components/collect-textbook/collect-textbook.component.ts

@@ -1,4 +1,4 @@
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, QueryList, ViewChildren } from '@angular/core';
 import { CommonModule } from '@angular/common';
 import { NzSpaceModule } from 'ng-zorro-antd/space';
 import { CommonCompModule } from '../../../../services/common.modules';
@@ -6,7 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
 import { NzMessageModule } from 'ng-zorro-antd/message';
 import { NzMessageService } from 'ng-zorro-antd/message';
 import Parse from 'parse';
-// import { textbookServer } from '../../../../services/textbook';
+import { textbookServer } from '../../../../services/textbook';
 import { NzModalService } from 'ng-zorro-antd/modal';
 import { MatDialog } from '@angular/material/dialog';
 import { NzEmptyModule } from 'ng-zorro-antd/empty';
@@ -38,7 +38,10 @@ export class CollectTextbookComponent implements OnInit {
   textbookList: Array<Parse.Object> = [];
   count: number = 0;
   timeDefaultValue = setHours(new Date(), 0);
-
+  @ViewChildren(UploadCollectComponent) children:
+    | QueryList<UploadCollectComponent>
+    | any;
+    
   @Input('limit') limit: number = 10;
   pageIndex: number = 1;
   loading: boolean = false;
@@ -89,12 +92,12 @@ export class CollectTextbookComponent implements OnInit {
   }
   statusMap: any = {}; //任务状态
 
-  isVisible: boolean = false;
+  isVisiblePreview: boolean = false;
   currentTextbook?: Parse.Object; //当前预览教材
 
   constructor(
     // private activeRoute: ActivatedRoute,
-    // public tbookSer: textbookServer,
+    public tbookSer: textbookServer,
     private msg: NzMessageService,
     public dialog: MatDialog,
     private route: Router,
@@ -245,7 +248,7 @@ export class CollectTextbookComponent implements OnInit {
 
   onReview(data:Parse.Object){
     this.currentTextbook = data;
-    this.isVisible = true;
+    this.isVisiblePreview = true;
   }
   //短信提醒
   async onEmitMsg(data:Parse.Object){
@@ -337,4 +340,75 @@ export class CollectTextbookComponent implements OnInit {
       nzOnCancel: () => console.log('Cancel')
     });
   }
+
+
+  /* 2025-2-18新增需求:国家级管理员新增修改教材源文件权限 */
+  //打开上传弹窗
+  isVisible: boolean = false; //编辑弹窗
+  btnLoading: boolean = false;
+  onEditModal(data: Parse.Object) {
+    // if (
+    //   !data.get('eduProcess')?.get('collectStartData') ||
+    //   !data.get('eduProcess')?.get('collectEndData') ||
+    //   data.get('eduProcess')?.get('collectStartData') > new Date() ||
+    //   data.get('eduProcess')?.get('collectEndData') < new Date()
+    // ) {
+    //   this.msg.warning('非收集文件工作期内');
+    //   return;
+    // }
+    this.currentTextbook = data;
+    this.isVisible = true;
+  }
+  async saveCollect(type: string): Promise<any> {
+    console.log(type);
+    this.btnLoading = true;
+    if (type == 'sbmit') {
+      this.modal.confirm({
+        nzTitle: '温馨提示',
+        nzContent: '由于“教材资源上传”工作阶段持续时间较短,教材资源一经上传将无法撤回或修改,请务必在确认无误之后再上传。',
+        nzOkText: '确定',
+        nzOkType: 'primary',
+        nzOkDanger: false,
+        nzOnOk: async () => {
+          let isVrifly = await this.saveEduTextbookVolume(type);
+          if (!isVrifly) {
+            this.btnLoading = false;
+            this.msg.warning('填写信息不完整');
+            return;
+          }
+          this.msg.success('提交成功');
+          this.btnLoading = false;
+          this.isVisible = false;
+          this.getTextbook(this.searchValue);
+        },
+        nzCancelText: '取消',
+        nzOnCancel: () => {
+          this.btnLoading = false;
+        },
+      });
+    } else {
+      await this.saveEduTextbookVolume(type);
+      this.msg.success('保存成功');
+      this.btnLoading = false;
+      this.isVisible = false;
+      this.getTextbook(this.searchValue);
+    }
+  }
+  /**上传分册数据 */
+  async saveEduTextbookVolume(type: string): Promise<any> {
+    let isVrifly = true; //默认都通过,若一项填写未完成,则不通过
+    return Promise.all(
+      this.children.map(async (comp: any) => {
+        let complete = await comp.submitForm(type);
+        console.log(comp?.eduTextbookVolume?.id + '===' + complete);
+        if (!complete) {
+          isVrifly = false;
+        }
+        return isVrifly;
+      })
+    ).then((data) => {
+      console.log(isVrifly);
+      return isVrifly;
+    });
+  }
 }

+ 2 - 2
projects/textbook/src/modules/nav-author/components/attachment/attachment.component.html

@@ -354,7 +354,7 @@
   </div>
   <div class="author-content">
     <div class="title">6.其他材料(可选提供)</div>
-    <div class="text">其他佐证材料,限份以内。</div>
+    <div class="text">其他佐证材料,限份以内。</div>
     <!-- @if (moreMaterial.length>0) { @for (url of moreMaterial; track $index) {
     <p>
       <a style="color: #3e49b3; font-size: 14px" (click)="openFile(url?.url)">
@@ -367,7 +367,7 @@
       [files]="moreMaterial"
       [type]="'pdf'"
       [width]="320"
-      [maxlenght]="2"
+      [maxlenght]="3"
       (change)="upload($event, 'moreMaterial')"
       title="上传文件"
     ></app-comp-upload>