Browse Source

新增联系人加入推荐判断及材料补充页

warrior 2 months ago
parent
commit
713d6e481a

+ 11 - 0
projects/textbook/src/app/textbook/textbook.component.html

@@ -678,6 +678,17 @@
                   <span nz-icon nzType="edit" nzTheme="outline"></span>编辑教材
                 </button>
               </li>
+              }@if(filterObj.btns.uploadPDF && !data?.get('authorSignPDF')?.url){
+              <li nz-menu-item>
+                <button
+                  (click)="toUrl('/common/textbook/plug-pdf/'+ data.id)"
+                  nz-button
+                  nzType="link"
+                  style="color: #231c1f"
+                >
+                  <span nz-icon nzType="file-pdf" nzTheme="outline"></span>签名附件补充
+                </button>
+              </li>
               }@if(filterObj.btns.review){
               <li nz-menu-item>
                 <button

+ 15 - 1
projects/textbook/src/app/textbook/textbook.component.ts

@@ -79,6 +79,7 @@ export class TextbookComponent implements OnInit {
       eduReivew: false, //在线预览
       mark: false, //打分
       exportExcel:false, //导出表格
+      uploadPDF:false, //教材作者诚信承诺上传
     },
   };
   @Input('scoreMap') scoreMap:any = {} //评分状态
@@ -253,7 +254,7 @@ export class TextbookComponent implements OnInit {
   ngOnInit() {
     this.activeRoute.paramMap.subscribe(async (params) => {
       // this.eduProcessId = params.get('id');
-      let arr = ['review', 'verify', 'eduReivew', 'mark', 'exportExcel'];
+      let arr = ['review', 'verify', 'eduReivew', 'mark', 'exportExcel', 'uploadPDF'];
       Object.keys(this.filterObj?.btns).forEach((key) => {
         if (this.filterObj[key] && !arr.includes(key)) this.calc += 70;
       });
@@ -594,14 +595,24 @@ export class TextbookComponent implements OnInit {
       nzOnOk: async () => {
         if (data?.id) {
           data.set('recommend', recommend);
+          if(recommend && !data?.get('authorSignPDF')?.url){
+            this.message.warning('教材未上传作者诚信承诺文件');
+            return
+          }
           await data.save();
           this.getTextbook();
         } else {
+          let passNum = 0
           let selectedList = this.textbookList.filter((item: any) =>
             this.setOfCheckedId.has(item?.id)
           );
           let deletePromiseList = selectedList.map((item: any) => {
             return new Promise((resolve) => {
+              if(recommend && !item?.get('authorSignPDF')?.url){
+                passNum ++
+                resolve(true)
+                return
+              }
               item.set('recommend', recommend);
               item.save().then(() => resolve(true));
             });
@@ -609,6 +620,9 @@ export class TextbookComponent implements OnInit {
           try {
             await Promise.all(deletePromiseList);
             this.getTextbook();
+            if(passNum){
+              this.message.warning(passNum + '条教材未上传作者诚信承诺文件');
+            }
           } catch (err) {}
         }
         this.onAllChecked(false);

+ 5 - 0
projects/textbook/src/modules/common/modules.routes.ts

@@ -1,11 +1,16 @@
 import { NgModule } from '@angular/core';
 import { RouterModule, Routes,RouteReuseStrategy, mapToCanActivate } from '@angular/router';
 import { TextbookDetailsComponent } from './textbook-details/textbook-details.component';
+import { UploadPdfComponent } from './upload-pdf/upload-pdf.component';
 const routes: Routes = [
   {
     path: 'textbook/details/:id', //流程申报
     component: TextbookDetailsComponent,
   },
+  {
+    path: 'textbook/plug-pdf/:id', //流程申报
+    component: UploadPdfComponent,
+  },
 ]
 
 @NgModule({

+ 86 - 0
projects/textbook/src/modules/common/upload-pdf/upload-pdf.component.html

@@ -0,0 +1,86 @@
+<div class="site-page-header">
+  <nz-page-header [nzTitle]="eduTextbook?.get('title')" nzSubtitle="" style="padding: 0">
+    <nz-breadcrumb nz-page-header-breadcrumb>
+      <div class="back" (click)="cancel()">
+        <span nz-icon nzType="left" nzTheme="outline"></span>返回
+      </div>
+    </nz-breadcrumb>
+  </nz-page-header>
+</div>
+<div class="page-upload-file">
+  <div class="entry">
+    <div class="author-content">
+      <div class="nav"><b>教材作者诚信承诺</b></div>
+      <!-- <p>
+        请输入承诺内容:<span style="color: #3e49b3"
+          >本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。</span
+        >请在提交教材前导出申报书及附件获取所有作者诚信承诺签名,返回此页上传已签名的诚信承诺页。教材出现的所有作者均需签字(可用电子签名),如有作者已去世,请标注XXX已去世,不需要签名。
+      </p>
+      <input
+        [(ngModel)]="value"
+        [nzStatus]="authStatus ? '' : 'warning'"
+        nz-input
+        placeholder="请输入承诺内容(注意标点符号)"
+      /> -->
+
+      <div class="val" style="width: 100%">
+        <div class="text">
+          <span style="color: red">*</span>
+          上传签名页
+        </div>
+        <app-comp-upload
+          [type]="'pdf'"
+          [width]="320"
+          (change)="upload($event, 'authorSignPDF')"
+          title="上传文件"
+          [size]="1024"
+          [files]="authorSignPDF?.url ? [authorSignPDF] : []"
+        ></app-comp-upload>
+        <div class="text upText">支持上传PDF,大小不超过 1M</div>
+      </div>
+
+      <div class="nav" style="margin-top: 50px"><b>申报单位承诺意见</b></div>
+      <p>
+        作者 /
+        主编所在高校主管领导或出版单位主管领导在申报单位承诺意见表格亲笔签字 /
+        盖签名章并加盖高校 / 出版单位公章后上传此项。需要使用学校校章
+        /出版社社章 ,不可用二级单位章 /
+        总编室章。请在提交教材前导出申报书及附件获取申报单位承诺意见,返回此页上传已签名并盖章的申报单位承诺意见页。
+      </p>
+      <div class="val" style="width: 100%">
+        <div class="text">
+          <span style="color: red">*</span>
+          申报单位承诺意见材料
+        </div>
+        <app-comp-upload
+          [type]="'pdf'"
+          [width]="320"
+          (change)="upload($event, 'unitMaterial')"
+          title="上传文件"
+          [files]="unitMaterial?.url ? [unitMaterial] : []"
+          [size]="1024"
+        ></app-comp-upload>
+        <div class="text upText">支持上传PDF,大小不超过 1M</div>
+      </div>
+    </div>
+  </div>
+
+  <div class="footer">
+    <button
+      nz-button
+      nzType="primary"
+      (click)="saveEduTextbook()"
+      style="margin-right: 20px;"
+    >
+      保存并提交
+    </button>
+    <button
+      nz-button
+      nzType="default"
+      style="margin-right: 20px"
+      (click)="cancel()"
+    >
+      取消
+    </button>
+  </div>
+</div>

+ 85 - 0
projects/textbook/src/modules/common/upload-pdf/upload-pdf.component.scss

@@ -0,0 +1,85 @@
+.site-page-header {
+  position: sticky;
+  top: 0;
+  z-index: 9;
+  padding: 24px 24px 0px;
+  background-color: white;
+  font-family: PingFang SC;
+  .back {
+    font-family: PingFang SC;
+    font-size: 14px;
+    font-weight: 400;
+    line-height: 22px;
+    text-align: left;
+    cursor: pointer;
+  }
+}
+.page-upload-file {
+  padding: 10px 24px;
+}
+.entry {
+  min-height: 500px;
+  font-family: PingFang SC;
+  .row {
+    display: flex;
+    flex-direction: column;
+    align-items: start;
+    width: 100%;
+    .label {
+      margin: 10px 0 6px;
+    }
+    .val {
+      min-height: auto;
+    }
+  }
+  .author-content {
+    .edit-icon {
+      color: #756b6d;
+    }
+    .nav {
+      font-family: PingFang SC;
+      font-size: 20px;
+      font-weight: 500;
+      line-height: 28px;
+      text-align: left;
+      margin: 20px 0 10px;
+    }
+    .title {
+      font-family: PingFang SC;
+      font-size: 16px;
+      font-weight: 600;
+      line-height: 22px;
+      text-align: left;
+      margin: 10px 0;
+    }
+    .text {
+      font-family: PingFang SC;
+      font-size: 14px;
+      font-weight: 400;
+      line-height: 22px;
+      text-align: left;
+      margin: 10px 0;
+    }
+  }
+  .tips {
+    margin-top: 10px;
+    padding: 10px;
+    background: #3e49b314;
+    border-radius: 6px;
+  }
+}
+.footer {
+  display: flex;
+  margin: 10px auto;
+  align-items: center;
+  justify-content: space-evenly;
+  // width: 200px;
+  justify-content: end;
+  // padding-right: 100px;
+  position: fixed;
+  bottom: 20px;
+  right: 20px;
+}
+.upText {
+  color: gray;
+}

+ 24 - 0
projects/textbook/src/modules/common/upload-pdf/upload-pdf.component.spec.ts

@@ -0,0 +1,24 @@
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { UploadPdfComponent } from './upload-pdf.component';
+
+describe('UploadPdfComponent', () => {
+  let component: UploadPdfComponent;
+  let fixture: ComponentFixture<UploadPdfComponent>;
+
+  beforeEach(waitForAsync(() => {
+    TestBed.configureTestingModule({
+      declarations: [ UploadPdfComponent ],
+      imports: [IonicModule.forRoot()]
+    }).compileComponents();
+
+    fixture = TestBed.createComponent(UploadPdfComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  }));
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 123 - 0
projects/textbook/src/modules/common/upload-pdf/upload-pdf.component.ts

@@ -0,0 +1,123 @@
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+import { CommonCompModule } from '../../../services/common.modules';
+import { NzSelectModule } from 'ng-zorro-antd/select';
+import { ReactiveFormsModule } from '@angular/forms';
+import { NzRadioModule } from 'ng-zorro-antd/radio';
+import { NzMessageService } from 'ng-zorro-antd/message';
+import { NzGridModule } from 'ng-zorro-antd/grid';
+import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
+import { NzTableModule } from 'ng-zorro-antd/table';
+import { NzUploadModule } from 'ng-zorro-antd/upload';
+import { NzModalService } from 'ng-zorro-antd/modal';
+import { CompUploadComponent } from '../../../app/comp-upload/comp-upload.component';
+import { DatePipe } from '@angular/common';
+
+import { textbookServer } from '../../../services/textbook';
+import { ActivatedRoute } from '@angular/router';
+import Parse from 'parse';
+
+@Component({
+  imports: [
+    CommonCompModule,
+    ReactiveFormsModule,
+    NzSelectModule,
+    NzRadioModule,
+    NzGridModule,
+    NzCheckboxModule,
+    NzTableModule,
+    NzUploadModule,
+    CompUploadComponent,
+    DatePipe,
+  ],
+  standalone: true,
+  selector: 'app-upload-pdf',
+  templateUrl: './upload-pdf.component.html',
+  styleUrls: ['./upload-pdf.component.scss'],
+})
+export class UploadPdfComponent implements OnInit {
+  eduTextbook?: Parse.Object;
+
+  /**上传签名页 */
+  authorSignPDF: any = {
+    name: '',
+    url: '',
+  };
+
+  /**申报单位承诺意见 */
+  unitMaterial: any = {
+    name: '',
+    url: '',
+  };
+
+  constructor(
+    public tbookSer: textbookServer,
+    private msg: NzMessageService,
+    private modal: NzModalService,
+    private activeRoute: ActivatedRoute
+  ) {}
+
+  ngOnInit() {
+    this.activeRoute.paramMap.subscribe(async (params) => {
+      let id = params.get('id');
+      let query = new Parse.Query('EduTextbook');
+      query.equalTo('objectId', id);
+      this.eduTextbook = await query.first();
+      console.log(this.eduTextbook);
+      this.authorSignPDF = this.eduTextbook?.get('authorSignPDF') || {
+        name: '',
+        url: '',
+      };
+      this.unitMaterial = this.eduTextbook?.get('unitMaterial') || {
+        name: '',
+        url: '',
+      };
+      if (
+        Parse.User.current()?.id !=
+        (this.eduTextbook?.get('user').id ||
+          this.eduTextbook?.get('user').objectId)
+      ) {
+        window.alert('非创建用户,不可编辑');
+        history.back();
+      } else if (
+        this.eduTextbook?.get('authorSignPDF')?.url &&
+        this.eduTextbook?.get('unitMaterial')?.url
+      ) {
+        window.alert('已提交,禁止编辑');
+        history.back();
+      }
+    });
+  }
+
+  async saveEduTextbook() {
+    if (!this.eduTextbook) {
+      this.msg.error('教材不存在');
+      return;
+    }
+    if(!this.authorSignPDF?.url || !this.unitMaterial?.url){
+      this.msg.warning('请上传完成相应附件');
+      return
+    }
+    this.authorSignPDF &&
+      this.eduTextbook?.set('authorSignPDF', this.authorSignPDF);
+    this.unitMaterial &&
+      this.eduTextbook?.set('unitMaterial', this.unitMaterial);
+    await this.eduTextbook?.save();
+    this.msg.success('提交成功');
+    setTimeout(() => {
+      this.cancel();
+    }, 1500);
+    return;
+  }
+
+  upload(e: any, type: string) {
+    console.log(e);
+    let file = e[e?.length - 1 || 0];
+    if (type == 'unitMaterial' || type == 'authorSignPDF') {
+      this[type].url = file?.url;
+      this[type].name = file?.name;
+    }
+  }
+  cancel() {
+    history.back();
+  }
+}

+ 16 - 16
projects/textbook/src/modules/nav-author/components/faith/faith.component.ts

@@ -13,19 +13,19 @@ import { NzModalService } from 'ng-zorro-antd/modal';
 import Parse from 'parse';
 import { CompUploadComponent } from '../../../../app/comp-upload/comp-upload.component';
 import { DatePipe } from '@angular/common';
-import {
-  FormControl,
-  FormGroup,
-  NonNullableFormBuilder,
-  Validators,
-  ValidatorFn,
-  AbstractControl,
-} from '@angular/forms';
+// import {
+//   FormControl,
+//   FormGroup,
+//   NonNullableFormBuilder,
+//   Validators,
+//   ValidatorFn,
+//   AbstractControl,
+// } from '@angular/forms';
 import { textbookServer } from '../../../../services/textbook';
-import * as eduTextBook from '../../../../services/EduTextbook';
-import { HttpClient } from '@angular/common/http';
-import { Router } from '@angular/router';
-import { FormBuilder } from '@angular/forms';
+// import * as eduTextBook from '../../../../services/EduTextbook';
+// import { HttpClient } from '@angular/common/http';
+// import { Router } from '@angular/router';
+// import { FormBuilder } from '@angular/forms';
 
 @Component({
   imports: [
@@ -74,10 +74,10 @@ export class FaithComponent implements OnInit {
     public tbookSer: textbookServer,
     private msg: NzMessageService,
     private modal: NzModalService,
-    private http: HttpClient,
-    private router: Router,
-    private formBuilder: FormBuilder,
-    private fb: NonNullableFormBuilder
+    // private http: HttpClient,
+    // private router: Router,
+    // private formBuilder: FormBuilder,
+    // private fb: NonNullableFormBuilder
   ) {}
   ngOnInit() {
     if (this.eduTextbook.id) {

+ 1 - 2
projects/textbook/src/modules/nav-author/recycle/recycle.component.ts

@@ -2,13 +2,12 @@ import { Component, OnInit } from '@angular/core';
 import { CommonCompModule } from '../../../services/common.modules';
 import { Router } from '@angular/router';
 import * as Parse from 'parse';
-import { PageTextbookComponent } from '../components/page-textbook/page-textbook.component';
 import { TextbookComponent } from '../../../app/textbook/textbook.component';
 
 @Component({
   selector: 'app-recycle',
   standalone: true,
-  imports: [CommonCompModule,PageTextbookComponent,TextbookComponent],
+  imports: [CommonCompModule,TextbookComponent],
   templateUrl: './recycle.component.html',
   styleUrls: ['./recycle.component.scss'],
 })

+ 1 - 0
projects/textbook/src/modules/nav-author/space/space.component.ts

@@ -39,6 +39,7 @@ export class SpaceComponent implements OnInit {
     status:['103','200','201','400'],
     btns:{
       review:true,//查阅
+      uploadPDF:true
     }
   }
   eduProcess?:Parse.Object