cehn 7 months ago
parent
commit
275696a880

+ 1 - 1
projects/textbook/src/modules/login/account-info/account-info.component.scss

@@ -88,7 +88,7 @@ input:-webkit-autofill:active {
   border-radius: 4px;
 }
 .loading{
-  position: absolute;
+  position: fixed;
   top: 0;
   left: 0;
   width: 100vw;

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

@@ -27,7 +27,7 @@ import Parse from 'parse';
 })
 export class ApplyComponent implements OnInit {
   textBook: Parse.Object | any;
-  state: number = 0;
+  state: number = 1;
   get stateMap() {
     let map: any = {
       '0': '教材基本信息',

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

@@ -87,7 +87,7 @@ export class FaithComponent  implements OnInit {
 
   async submitForm(event?: string): Promise<void> {
     if(this.value!='本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'){
-      this.msg.error('诚信承诺输入错误,请正确输入');
+      this.msg.error('诚信承诺输入错误,请正确输入(注意标点符号)');
       // return
     }
     // let params: any = this.validateForm.value;

+ 214 - 66
projects/textbook/src/modules/nav-author/components/textbook-pertain/textbook-pertain.component.html

@@ -1,29 +1,75 @@
 <div class="entry">
-  <form nz-form [formGroup]="validateForm" class="login-form" (ngSubmit)="submitForm()">
+  <form
+    nz-form
+    [formGroup]="validateForm"
+    class="login-form"
+    (ngSubmit)="submitForm()"
+  >
     <div class="first-head">
       <div nz-row>
         <div nz-col nzSpan="12">
           <nz-form-item class="row" style="margin-bottom: 16px">
-            <nz-form-label class="label" [nzNoColon]="true" [nzSm]="16" [nzXs]="16"
-              nzRequired>适用专业代码(六位)及名称</nz-form-label>
-            <nz-form-control class="val" nzErrorTip="适用专业代码(六位)及名称" style="width: 100%">
-              
-              <nz-select style="width: 80%" nzShowSearch nzAllowClear nzPlaceHolder="填写 6 位专业代码选择"
-                formControlName="major" (ngModelChange)="changeCode()" (nzOnSearch)="getCode($event)">
+            <nz-form-label
+              class="label"
+              [nzNoColon]="true"
+              [nzSm]="16"
+              [nzXs]="16"
+              nzRequired
+              >适用专业代码(六位)及名称</nz-form-label
+            >
+            <nz-form-control
+              class="val"
+              nzErrorTip="适用专业代码(六位)及名称"
+              style="width: 100%"
+            >
+              <nz-select
+                style="width: 80%"
+                nzShowSearch
+                nzAllowClear
+                nzPlaceHolder="填写 6 位专业代码选择"
+                formControlName="major"
+                (ngModelChange)="changeCode()"
+                (nzOnSearch)="getCode($event)"
+              >
                 @for(major of selectList; track major.code;let index = $index){
-                <nz-option nzCustomContent [nzValue]="major.code" [nzLabel]="major.name+'-'+major.code">
+                <nz-option
+                  nzCustomContent
+                  [nzValue]="major.code"
+                  [nzLabel]="major.name + '-' + major.code"
+                >
                   <div>{{ major.name }}</div>
-                  <div style="font-size: 12px;color: gray;">{{ major.code }}</div>
+                  <div style="font-size: 12px; color: gray">
+                    {{ major.code }}
+                  </div>
                 </nz-option>
                 }
               </nz-select>
             </nz-form-control>
           </nz-form-item>
           <nz-form-item class="row" style="margin-bottom: 16px">
-            <nz-form-label class="label" [nzNoColon]="true" [nzSm]="8" [nzXs]="8" nzRequired>课程学时</nz-form-label>
-            <nz-form-control class="val" nzErrorTip="请填写课程学时" style="width: 100%">
-              <nz-input-group style="width: 80%" [nzSuffix]="suffixTemplateInfo">
-                <input type="number" formControlName="period" nz-input placeholder="填写学时数" />
+            <nz-form-label
+              class="label"
+              [nzNoColon]="true"
+              [nzSm]="8"
+              [nzXs]="8"
+              nzRequired
+              >课程学时</nz-form-label
+            >
+            <nz-form-control
+              class="val"
+              nzErrorTip="请填写课程学时"
+              style="width: 100%"
+            >
+              <nz-input-group
+                style="width: 80%"
+                [nzSuffix]="suffixTemplateInfo"
+              >
+                <input
+                  type="number"
+                  formControlName="period"
+                  nz-input
+                  placeholder="填写学时数"
+                />
               </nz-input-group>
               <ng-template #suffixTemplateInfo> 学时 </ng-template>
             </nz-form-control>
@@ -31,35 +77,79 @@
         </div>
         <div nz-col nzSpan="12">
           <nz-form-item class="row" style="margin-bottom: 16px">
-            <nz-form-label class="label" [nzNoColon]="true" [nzSm]="6" [nzXs]="6" nzRequired>适用课程</nz-form-label>
-            <nz-form-control class="val" nzErrorTip="请填写适用课程" style="width: 100%">
-              <input type="text" formControlName="lessons" nz-input placeholder="填写适用课程名称,多门课程名称使用“;”分隔" />
+            <nz-form-label
+              class="label"
+              [nzNoColon]="true"
+              [nzSm]="6"
+              [nzXs]="6"
+              nzRequired
+              >适用课程</nz-form-label
+            >
+            <nz-form-control
+              class="val"
+              nzErrorTip="请填写适用课程"
+              style="width: 100%"
+            >
+              <input
+                type="text"
+                formControlName="lessons"
+                nz-input
+                placeholder="填写适用课程名称,多门课程名称使用“;”分隔"
+              />
             </nz-form-control>
           </nz-form-item>
 
           <nz-form-item class="row" style="margin-bottom: 16px">
-            <nz-form-label class="label" [nzNoColon]="true" [nzSm]="6" [nzXs]="6" nzRequired>适用课程性质</nz-form-label>
-            
-            
-            <nz-form-control class="val" nzErrorTip="请选择适用课程性质" style="width: 100%">
+            <nz-form-label
+              class="label"
+              [nzNoColon]="true"
+              [nzSm]="6"
+              [nzXs]="6"
+              nzRequired
+              >适用课程性质</nz-form-label
+            >
+
+            <nz-form-control
+              class="val"
+              nzErrorTip="请选择适用课程性质"
+              style="width: 100%"
+            >
               <nz-checkbox-wrapper class="check">
                 <div nz-row>
                   @for (checkItem of checkOptionsOne; track $index) {
-                    <label [ngModelOptions]="{standalone: true}" nz-checkbox [nzValue]="checkItem.value" [(ngModel)]="checkItem.checked">{{checkItem.value}}</label>
+                  <label
+                    [ngModelOptions]="{ standalone: true }"
+                    nz-checkbox
+                    [nzValue]="checkItem.value"
+                    [(ngModel)]="checkItem.checked"
+                    >{{ checkItem.value }}</label
+                  >
                   }
                 </div>
               </nz-checkbox-wrapper>
-              <nz-radio-group class="check" [ngModelOptions]="{standalone: true}" [(ngModel)]="checkTwo" (ngModelChange)="changeRadio()">
+              <nz-radio-group
+                class="check"
+                [ngModelOptions]="{ standalone: true }"
+                [(ngModel)]="checkTwo"
+                (ngModelChange)="changeRadio()"
+              >
                 @for (checkItem of checkOptionsTwo; track $index) {
-                  <label nz-radio [nzValue]="checkItem.value">{{checkItem.label}}</label>
+                <label nz-radio [nzValue]="checkItem.value">{{
+                  checkItem.label
+                }}</label>
                 }
               </nz-radio-group>
               <nz-checkbox-wrapper class="check">
                 <div nz-row>
                   @for (checkItem of checkOptionsThree; track $index) {
-                    <label [ngModelOptions]="{standalone: true}"  nz-checkbox [nzValue]="checkItem.value" [(ngModel)]="checkItem.checked">{{checkItem.value}}</label>
-                  }
-                  (如不涉及,此行可不选)
+                  <label
+                    [ngModelOptions]="{ standalone: true }"
+                    nz-checkbox
+                    [nzValue]="checkItem.value"
+                    [(ngModel)]="checkItem.checked"
+                    >{{ checkItem.value }}</label
+                  >
+                  } (如不涉及,此行可不选)
                 </div>
               </nz-checkbox-wrapper>
             </nz-form-control>
@@ -76,7 +166,7 @@
         </div>
       </div>
     </div>
-    <div class="author-content">
+    <!-- <div class="author-content">
       <div class="nav">作者信息</div>
       <nz-form-label class="title" [nzNoColon]="true" [nzSm]="24" [nzXs]="24" nzRequired>
         <span style="font-size: 16px">
@@ -96,14 +186,6 @@
             <th nzWidth="300px">手机号码</th>
             <th nzWidth="160px">电子邮箱</th>
             <th nzWidth="160px">分工</th>
-            <!-- <th nzWidth="120px" nzRight>
-              作者诚信承诺签名
-              <span style="color: red;">*</span>
-            </th>
-            <th nzWidth="120px" nzRight>
-              作者政治审查表
-              <span style="color: red;">*</span>
-            </th> -->
             <th nzWidth="100px" nzRight>操作</th>
           </tr>
         </thead>
@@ -135,11 +217,6 @@
               <input nz-input placeholder="请输入作者职称" [ngModelOptions]="{ standalone: true }" [(ngModel)]="data.title"
                 nzStatus="" />
             </td>
-          
-
-            
-
-
             <td>
               <nz-input-group nzCompact>
                 <nz-select style="width: 90px;" [ngModelOptions]="{ standalone: true }" [ngModel]="'+86'">
@@ -150,12 +227,6 @@
                 [(ngModel)]="data.mobile" nzStatus="" style="width: 160px;"/>
               </nz-input-group>
             </td>
-
-
-
-
-
-
             <td>
               <input nz-input placeholder="请输入作者邮箱" [ngModelOptions]="{ standalone: true }" [(ngModel)]="data.email"
                 nzStatus="" />
@@ -170,18 +241,6 @@
                 }
               </nz-select>
             </td>
-            <!-- <td nzRight>
-              @if (data.signature) {
-                <a style="color: #3e49b3;" (click)="openFile(data.signature)">签名文件</a>
-              }
-              <app-comp-upload (change)="upload($event, 'signature',index)"></app-comp-upload>
-            </td>
-            <td nzRight>
-              @if (data.examine) {
-              <a style="color: #3e49b3;" (click)="openFile(data.examine)">政治审查表 </a>
-              }
-              <app-comp-upload (change)="upload($event, 'examine',index)"></app-comp-upload>
-            </td> -->
             <td nzRight>
               <a (click)="onPush('authorList', index)"><span nz-icon style="font-size: 20px; margin-right: 10px"
                   nzType="plus-circle" nzTheme="outline"></span></a>
@@ -192,8 +251,6 @@
           }
         </tbody>
       </nz-table>
-      <!-- <p>输入诚信承诺:本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。</p>
-      <input formControlName="accept" nz-input placeholder="请输入承诺内容" /> -->
     </div>
     <div class="author-content">
       <div class="nav">第一主编(作者)情况</div>
@@ -253,27 +310,118 @@
           }
         </tbody>
       </nz-table>
+    </div> -->
+    <div class="black">
+      <div class="nav">作者信息</div>
+      @if (eduTextbook?.get('type')=='全册') {
+      <nz-collapse [nzBordered]="false">
+        @for (panel of eduTextbook?.get('childrens'); track panel) {
+        <nz-collapse-panel
+        #p
+          [nzHeader]="title"
+          [nzActive]="false"
+          nzExpandedIcon="caret-right"
+          ngStyle="#f7f7f7',
+            'border-radius': '4px',
+            'margin-bottom': '24px',
+            border: '0px'"
+        >
+        <ng-template #title>
+          <span class="panel-title">{{'分册' + ($index+1)}}</span>
+        </ng-template>
+          <div class="">
+            <app-author
+              #children
+              [eduTextbook]="eduTextbook?.id"
+              [eduTextbookVolume]="panel"
+            ></app-author>
+          </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-author
+        #children
+        [eduTextbookVolume]="eduTextbook?.get('childrens')[0]"
+      ></app-author>
+      }
+      <!-- <mat-accordion class="example-headers-align" multi>
+        @if(eduTextbook?.get('type')=='全册'){ @for (item of
+          eduTextbook?.get('childrens'); track $index) {
+        <mat-expansion-panel>
+          <mat-expansion-panel-header>
+            <mat-panel-title>
+              <b>分册{{ $index + 1 }}</b>
+            </mat-panel-title>
+          </mat-expansion-panel-header>
+          <app-author
+            #children
+            [eduTextbook]="eduTextbook?.id"
+            [eduTextbookVolume]="item"
+          ></app-author>
+        </mat-expansion-panel>
+        } } @else {
+
+        <app-author
+          #children
+          [eduTextbookVolume]="eduTextbook?.get('childrens')[0]"
+        ></app-author>
+        }
+      </mat-accordion> -->
     </div>
   </form>
-  
 </div>
-<div style="width: 100%;display: flex;justify-content: flex-end;padding: 30px 0 0;">
+<div
+  style="
+    width: 100%;
+    display: flex;
+    justify-content: flex-end;
+    padding: 30px 0 0;
+  "
+>
   <!-- <a (click)="downloadFile()">
     <span nz-icon nzType="download" nzTheme="outline"></span>
     下载本页所有附件模板
   </a> -->
   <div class="footer">
     <div>
-      <button nz-button nzType="default" style="margin-right: 20px" (click)="submitForm('save')">
+      <button
+        nz-button
+        nzType="default"
+        style="margin-right: 20px"
+        (click)="submitForm('save')"
+      >
         保存本页
       </button>
-      <button nz-button nzType="default" style="margin-right: 20px" (click)="submitForm('pre')">
+      <button
+        nz-button
+        nzType="default"
+        style="margin-right: 20px"
+        (click)="submitForm('pre')"
+      >
         上一页
       </button>
-      <button nz-button nzType="primary" style="background: #3e49b3; border: 1px #3e49b3" (click)="submitForm('next')">
+      <button
+        nz-button
+        nzType="primary"
+        style="background: #3e49b3; border: 1px #3e49b3"
+        (click)="submitForm('next')"
+      >
         下一页
       </button>
     </div>
-  
   </div>
 </div>
+
+<div class="loading" [hidden]="!loading">
+  <nz-spin nzSimple [nzSize]="'large'"></nz-spin>
+</div>

+ 28 - 9
projects/textbook/src/modules/nav-author/components/textbook-pertain/textbook-pertain.component.scss

@@ -18,18 +18,18 @@
       }
     }
   }
+  .nav{
+    font-family: PingFang SC;
+    font-size: 20px;
+    font-weight: 500;
+    line-height: 28px;
+    text-align: left;
+    margin: 10px 0;
+  }
   .author-content{
     a{
       color:#756B6D;
     }
-    .nav{
-      font-family: PingFang SC;
-      font-size: 20px;
-      font-weight: 500;
-      line-height: 28px;
-      text-align: left;
-      margin: 10px 0;
-    }
     .title{
       font-family: PingFang SC;
       font-size: 16px;
@@ -45,7 +45,13 @@
     background: #3e49b314;
     border-radius: 6px;
   }
-
+  .panel-title{
+    font-family: PingFang SC;
+    font-size: 16px;
+    font-weight: 500;
+    line-height: 22px;
+    text-align: left;
+  }
 }
 .footer{
   display: flex;
@@ -56,4 +62,17 @@
 }
 .fileLink{
   color: blue;
+}
+.loading{
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100vw;
+  text-align: center;
+  height: 100vh;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background: rgb(0 0 0 / 30%);
+  z-index: 99;
 }

+ 284 - 234
projects/textbook/src/modules/nav-author/components/textbook-pertain/textbook-pertain.component.ts

@@ -1,4 +1,12 @@
-import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+import {
+  Component,
+  OnInit,
+  Input,
+  Output,
+  EventEmitter,
+  ViewChildren,
+  QueryList,
+} from '@angular/core';
 import { CommonCompModule } from '../../../../services/common.modules';
 import { NzSelectModule } from 'ng-zorro-antd/select';
 import { ReactiveFormsModule } from '@angular/forms';
@@ -18,10 +26,12 @@ import {
   Validators,
 } from '@angular/forms';
 import { textbookServer } from '../../../../services/textbook';
-import { CompUploadComponent } from '../../../../app/comp-upload/comp-upload.component';
-import * as major from '../../../../services/majors.map'
+// import { CompUploadComponent } from '../../../../app/comp-upload/comp-upload.component';
+import * as major from '../../../../services/majors.map';
 import { HttpClient } from '@angular/common/http';
-
+import { MatAccordion, MatExpansionModule } from '@angular/material/expansion';
+import { AuthorComponent } from '../create/author/author.component';
+import { NzCollapseModule } from 'ng-zorro-antd/collapse';
 interface author {
   name: string;
   unit: string;
@@ -50,7 +60,10 @@ interface achievementType {
     NzGridModule,
     NzCheckboxModule,
     NzTableModule,
-    CompUploadComponent,
+    // CompUploadComponent,
+    MatExpansionModule,
+    AuthorComponent,
+    NzCollapseModule,
   ],
   standalone: true,
   templateUrl: './textbook-pertain.component.html',
@@ -63,125 +76,123 @@ export class TextbookPertainComponent implements OnInit {
   @Output() state: EventEmitter<any> = new EventEmitter<any>();
   @Output() save: EventEmitter<any> = new EventEmitter<any>();
   //填写诚信承诺是否正确
-  confirmationValidator: ValidatorFn = (
-    control: AbstractControl
-  ): { [s: string]: boolean } => {
-    if (
-      control.value !=
-      '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实'
-    ) {
-      return { required: true };
-    }
-    return {};
-  };
+  // confirmationValidator: ValidatorFn = (
+  //   control: AbstractControl
+  // ): { [s: string]: boolean } => {
+  //   if (
+  //     control.value !=
+  //     '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实'
+  //   ) {
+  //     return { required: true };
+  //   }
+  //   return {};
+  // };
+  @ViewChildren(AuthorComponent) children: QueryList<AuthorComponent> | any;
+
   validateForm: FormGroup<{
     major: FormControl<string>; //适用专业代码及名称
     period: FormControl<number | any>; //课程学时
     lessons: FormControl<string>; //适用课程
     characteristic: FormControl<Array<any> | any>; //适用课程性质
-    // authorList: FormControl<Array<any> | any>; //作者信息
-    authorDetails: FormControl<string>; //第一主编(作者)相关教学经历
-    // achievement: FormControl<Array<any> | any>; //相关科学研究项目、成果或论文专著(限5项)
-    accept: FormControl<string>; //填写诚信承诺
-
+    // authorDetails: FormControl<string>; //第一主编(作者)相关教学经历
+    // accept: FormControl<string>; //填写诚信承诺
   }> = this.fb.group({
     major: ['', [Validators.required]],
     period: ['', [Validators.required]],
     lessons: ['', [Validators.required]],
     characteristic: ['', [Validators.required]],
-    // authorList: ['', [Validators.required]],
-    authorDetails: ['', [Validators.required]],
-    // achievement: ['', [Validators.required]],
-    accept: ['', [Validators.required, this.confirmationValidator]],
+    // authorDetails: ['', [Validators.required]],
+    // accept: ['', [Validators.required, this.confirmationValidator]],
   });
 
-
-
-
   //适用专业代码及名称
-  selectList = major.majors.options
+  selectList = major.majors.options;
 
   //适用课程性质
-
   checkOptionsOne = [
-    { label: '必修课', value: '必修课',checked:false },
-    { label: '选修课', value: '选修课',checked:false },
+    { label: '必修课', value: '必修课', checked: false },
+    { label: '选修课', value: '选修课', checked: false },
   ];
   checkOptionsTwo = [
-    { label: '通识课', value: '通识课' ,checked:false},
-    { label: '公共基础课', value: '公共基础课' ,checked:false},
-    { label: '专业课', value: '专业课' ,checked:false},
+    { label: '通识课', value: '通识课', checked: false },
+    { label: '公共基础课', value: '公共基础课', checked: false },
+    { label: '专业课', value: '专业课', checked: false },
   ];
   checkOptionsThree = [
-    { label: '思想政治理论课', value: '思想政治理论课',checked:false},
-    { label: '实验课', value: '实验课',checked:false },
+    { label: '思想政治理论课', value: '思想政治理论课', checked: false },
+    { label: '实验课', value: '实验课', checked: false },
   ];
-  checkTwo: any = null
-  changeRadio(){
-    for(let i in this.checkOptionsTwo){
-      if(this.checkOptionsTwo[i].label==this.checkTwo){
-        this.checkOptionsTwo[i].checked=true
-      }else{
-        this.checkOptionsTwo[i].checked=false
+  checkTwo: any = null;
+  changeRadio() {
+    for (let i in this.checkOptionsTwo) {
+      if (this.checkOptionsTwo[i].label == this.checkTwo) {
+        this.checkOptionsTwo[i].checked = true;
+      } else {
+        this.checkOptionsTwo[i].checked = false;
       }
     }
   }
 
-  //作者信息
-  authorList: Array<author> = [
-    {
-      name: '',
-      unit: '',
-      birth: new Date('December 1, 1975 00:00:00'),
-      nationality: '',
-      job: '',
-      title: '',
-      mobile: '',
-      email: '',
-      work: '',
-      // signature: '',
-      examine: '',
-    },
-  ];
-  //相关科学研究项目、成果或论文专著(限5项)
-  achievementOptions: Array<achievementType> = [
-    {
-      name: '',
-      unit: '',
-      date: '',
-    },
-  ];
-  workOptions = ['主编', '副主编', '其他编者'];
-  /**诚信承诺 */
-  accept: string = ''
+  // //作者信息
+  // authorList: Array<author> = [
+  //   {
+  //     name: '',
+  //     unit: '',
+  //     birth: new Date('December 1, 1975 00:00:00'),
+  //     nationality: '',
+  //     job: '',
+  //     title: '',
+  //     mobile: '',
+  //     email: '',
+  //     work: '',
+  //     // signature: '',
+  //     examine: '',
+  //   },
+  // ];
+  // //相关科学研究项目、成果或论文专著(限5项)
+  // achievementOptions: Array<achievementType> = [
+  //   {
+  //     name: '',
+  //     unit: '',
+  //     date: '',
+  //   },
+  // ];
+  // workOptions = ['主编', '副主编', '其他编者'];
+  // /**诚信承诺 */
+  // accept: string = ''
   constructor(
     public tbookSer: textbookServer,
     private fb: NonNullableFormBuilder,
     private modal: NzModalService,
     private msg: NzMessageService,
     private http: HttpClient
-  ) { }
+  ) {}
 
   ngOnInit() {
     console.log(this.eduTextbook);
     if (this.eduTextbook.id) {
-      let list = this.eduTextbook.get('characteristic')||[]
-       if(list.length>0){
-        let one = []
-        let three=[]
-        for(let i in list){
-          if(list[i].label=='必修课'||list[i].label=='选修课'){
-            one.push(list[i])
-          }else if(list[i].label=='思想政治理论课'||list[i].label=='实验课'){
-            three.push(list[i])
-          }else if(list[i].checked){
-            this.checkTwo=list[i].label
-            let index = this.checkOptionsTwo.findIndex(item=>item.value==list[i].label)
-            this.checkOptionsTwo[index].checked=true
+      let list = this.eduTextbook.get('characteristic') || [];
+      if (list.length > 0) {
+        let one = [];
+        let three = [];
+        for (let i in list) {
+          if (list[i].label == '必修课' || list[i].label == '选修课') {
+            one.push(list[i]);
+          } else if (
+            list[i].label == '思想政治理论课' ||
+            list[i].label == '实验课'
+          ) {
+            three.push(list[i]);
+          } else if (list[i].checked) {
+            this.checkTwo = list[i].label;
+            let index = this.checkOptionsTwo.findIndex(
+              (item) => item.value == list[i].label
+            );
+            this.checkOptionsTwo[index].checked = true;
           }
         }
-       this.checkOptionsOne=one
-       this.checkOptionsThree=three
+        this.checkOptionsOne = one;
+        this.checkOptionsThree = three;
       }
 
       // this.checkOptionsOne =
@@ -198,40 +209,39 @@ export class TextbookPertainComponent implements OnInit {
           this.eduTextbook.get('characteristic') || '',
           [Validators.required],
         ],
-        authorDetails: [
-          this.eduTextbook.get('authorDetails') || '',
-          [Validators.required,Validators.maxLength(500)],
-        ],
-        accept: [
-          this.eduTextbook.get('accept') || '',
-          [Validators.required, this.confirmationValidator]
-        ],
+        // authorDetails: [
+        //   this.eduTextbook.get('authorDetails') || '',
+        //   [Validators.required,Validators.maxLength(500)],
+        // ],
+        // accept: [
+        //   this.eduTextbook.get('accept') || '',
+        //   [Validators.required, this.confirmationValidator]
+        // ],
       });
-      this.authorList = this.eduTextbook.get('authorList') || this.authorList
-      this.achievementOptions = this.eduTextbook.get('achievementOptions') || this.achievementOptions
+      // this.authorList = this.eduTextbook.get('authorList') || this.authorList
+      // this.achievementOptions = this.eduTextbook.get('achievementOptions') || this.achievementOptions
     }
   }
   async submitForm(event?: string): Promise<void> {
-        let params: any = this.validateForm.value;
-        let authorListVrifly = !this.authorList.some(item => Object.values(item).some(val => val == '' || val == undefined))
-        let achievementOptionsVrifly = !this.achievementOptions.some(item => Object.values(item).some(val => val == '' || val == undefined))
-        await this.saveEduTextbook(params, (this.validateForm.valid && authorListVrifly && achievementOptionsVrifly));
-        if (event == 'pre') {
-          this.state.emit({ type: 'pre' });
-          return
-        }
-        if (event == 'next') {
-          this.state.emit({ type: 'next', textBook: this.eduTextbook });
-        }
-        if (event == 'save') {
-          this.modal.success({
-            nzTitle: '保存成功',
-            nzContent: '<p>已保存并且至空间</p>',
-            nzOnOk: () => console.log('Info OK'),
-          });
-          return;
-        }
-
+    let params: any = this.validateForm.value;
+    // let authorListVrifly = !this.authorList.some(item => Object.values(item).some(val => val == '' || val == undefined))
+    // let achievementOptionsVrifly = !this.achievementOptions.some(item => Object.values(item).some(val => val == '' || val == undefined))
+    await this.saveEduTextbook(params, this.validateForm.valid);
+    if (event == 'pre') {
+      this.state.emit({ type: 'pre' });
+      return;
+    }
+    if (event == 'next') {
+      this.state.emit({ type: 'next', textBook: this.eduTextbook });
+    }
+    if (event == 'save') {
+      this.modal.success({
+        nzTitle: '保存成功',
+        nzContent: '<p>已保存并且至空间</p>',
+        nzOnOk: () => console.log('Info OK'),
+      });
+      return;
+    }
 
     // if (event == 'pre') {
     //   this.state.emit({ type: 'pre' });
@@ -294,8 +304,8 @@ export class TextbookPertainComponent implements OnInit {
     //   });
     // }
   }
-  changeCode() { }
-  getCode(e: any) { }
+  changeCode() {}
+  getCode(e: any) {}
   // upload(e: any, type: string, index: number) {
   //   console.log(e);
   //   let file = e[0];
@@ -303,80 +313,81 @@ export class TextbookPertainComponent implements OnInit {
   //     this.authorList[index][type] = file?.url
   //   }
   // }
-  //添加作者信息
-  onPush(type: string, idx: number) {
-    switch (type) {
-      case 'authorList':
-        if (this.authorList?.length >= 6) {
-          this.msg.warning('最多添加6条');
-          break;
-        }
-        this.authorList.splice(idx + 1, 0, {
-          name: '',
-          unit: '',
-          birth: new Date('December 1, 1975 00:00:00'),
-          nationality: '',
-          job: '',
-          title: '',
-          mobile: '',
-          email: '',
-          work: '',
-          // signature: '',
-          examine: '',
-        });
-        break;
-      case 'achievementOptions':
-        if (this.achievementOptions.length >= 5) {
-          this.msg.warning('最多添加5条');
-          return;
-        }
-        this.achievementOptions.splice(idx + 1, 0, {
-          name: '',
-          unit: '',
-          date: '',
-        });
-        break;
-    }
-  }
-  //删除作者信息
-  onDel(type: string, idx: number) {
-    switch (type) {
-      case 'authorList':
-        if (this.authorList.length == 1) {
-          this.authorList = [
-            {
-              name: '',
-              unit: '',
-              birth: new Date('December 1, 1975 00:00:00'),
-              nationality: '',
-              job: '',
-              title: '',
-              mobile: '',
-              email: '',
-              work: '',
-              // signature: '',
-              examine: '',
-            },
-          ];
-          return;
-        }
-        this.authorList.splice(idx, 1);
-        break;
-      case 'achievementOptions':
-        if (this.achievementOptions.length == 1) {
-          this.achievementOptions = [
-            {
-              name: '',
-              unit: '',
-              date: '',
-            },
-          ];
-          return;
-        }
-        this.achievementOptions.splice(idx, 1);
-        break;
-    }
-  }
+  // //添加作者信息
+  // onPush(type: string, idx: number) {
+  //   switch (type) {
+  //     case 'authorList':
+  //       if (this.authorList?.length >= 6) {
+  //         this.msg.warning('最多添加6条');
+  //         break;
+  //       }
+  //       this.authorList.splice(idx + 1, 0, {
+  //         name: '',
+  //         unit: '',
+  //         birth: new Date('December 1, 1975 00:00:00'),
+  //         nationality: '',
+  //         job: '',
+  //         title: '',
+  //         mobile: '',
+  //         email: '',
+  //         work: '',
+  //         // signature: '',
+  //         examine: '',
+  //       });
+  //       break;
+  //     case 'achievementOptions':
+  //       if (this.achievementOptions.length >= 5) {
+  //         this.msg.warning('最多添加5条');
+  //         return;
+  //       }
+  //       this.achievementOptions.splice(idx + 1, 0, {
+  //         name: '',
+  //         unit: '',
+  //         date: '',
+  //       });
+  //       break;
+  //   }
+  // }
+  // //删除作者信息
+  // onDel(type: string, idx: number) {
+  //   switch (type) {
+  //     case 'authorList':
+  //       if (this.authorList.length == 1) {
+  //         this.authorList = [
+  //           {
+  //             name: '',
+  //             unit: '',
+  //             birth: new Date('December 1, 1975 00:00:00'),
+  //             nationality: '',
+  //             job: '',
+  //             title: '',
+  //             mobile: '',
+  //             email: '',
+  //             work: '',
+  //             // signature: '',
+  //             examine: '',
+  //           },
+  //         ];
+  //         return;
+  //       }
+  //       this.authorList.splice(idx, 1);
+  //       break;
+  //     case 'achievementOptions':
+  //       if (this.achievementOptions.length == 1) {
+  //         this.achievementOptions = [
+  //           {
+  //             name: '',
+  //             unit: '',
+  //             date: '',
+  //           },
+  //         ];
+  //         return;
+  //       }
+  //       this.achievementOptions.splice(idx, 1);
+  //       break;
+  //   }
+  // }
+  loading: boolean = false;
 
   async saveEduTextbook(params: any, isComplete: boolean) {
     console.log(params);
@@ -387,49 +398,88 @@ export class TextbookPertainComponent implements OnInit {
       // this.eduTextbook = new obj();
     }
     //如果填写未完整,仅保存,状态修改待完善101
-    if (this.eduTextbook.get('status') == '102' && !isComplete) {
-      this.eduTextbook?.set('status', '101');
-      this.eduTextbook.set('complete', false)
-    } else if (!this.eduTextbook.get('status')) {
-      this.eduTextbook?.set('status', '101');
+    if (this.loading) return;
+    this.loading = true;
+    try {
+      let complete = await this.saveEduTextbookVolume();
+      isComplete = isComplete && complete
+      if (
+        this.eduTextbook.get('status') == '102' && isComplete
+      ) {
+        this.eduTextbook?.set('status', '101');
+        this.eduTextbook.set('complete', false);
+      } else if (!this.eduTextbook.get('status')) {
+        this.eduTextbook?.set('status', '101');
+      }
+      this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
+      this.eduTextbook?.set('company', {
+        __type: 'Pointer',
+        className: 'Company',
+        objectId: this.tbookSer.company,
+      });
+      let major = this.selectList.find((item) => item.code == params.major);
+      let lessons = params.lessons.split(';');
+      this.eduTextbook?.set('major', major);
+      params.period && this.eduTextbook?.set('period', params.period);
+      lessons && this.eduTextbook?.set('lessons', lessons);
+      // params.characteristic && this.eduTextbook?.set('characteristic', params.characteristic);
+      this.eduTextbook?.set('characteristic', [
+        ...this.checkOptionsOne,
+        ...this.checkOptionsTwo,
+        ...this.checkOptionsThree,
+      ]);
+      // params.authorDetails && this.eduTextbook?.set('authorDetails', params.authorDetails);
+      // this.eduTextbook?.set('authorList', this.authorList);
+      // this.eduTextbook?.set('achievementOptions', this.achievementOptions);
+      // params.accept && this.eduTextbook?.set('accept', params.accept);
+      await this.eduTextbook?.save();
+      this.loading = false;
+      if(!isComplete){
+        this.msg.warning('保存成功,但存在未填写完成项')
+      }
+    } catch (err) {
+      console.warn('保存错误', err);
+      this.loading = false;
+      this.msg.error('保存出错')
     }
-    this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
-    this.eduTextbook?.set('company', {
-      __type: 'Pointer',
-      className: 'Company',
-      objectId: this.tbookSer.company,
+  }
+  /**上传分册数据 */
+  async saveEduTextbookVolume(): Promise<boolean> {
+    let arr = []; //存储返回的数组id
+    let isVrifly = true; //默认都通过,若一项填写未完成,则不通过
+    return Promise.all(
+      this.children.map(async (comp: any) => {
+        let req = await comp.submitForm();
+        // console.log(req)
+        if (!req) {
+          isVrifly = false;
+        }
+        return isVrifly;
+      })
+    ).then((data) => {
+      // console.log(data);
+      console.log(isVrifly);
+      return isVrifly;
     });
-    let major = this.selectList.find((item) => item.code == params.major);
-    let lessons = params.lessons.split(';');
-    this.eduTextbook?.set('major', major );
-    params.period && this.eduTextbook?.set('period', params.period);
-    lessons && this.eduTextbook?.set('lessons', lessons);
-    // params.characteristic && this.eduTextbook?.set('characteristic', params.characteristic);
-    this.eduTextbook?.set('characteristic', [...this.checkOptionsOne,...this.checkOptionsTwo,...this.checkOptionsThree])
-    params.authorDetails && this.eduTextbook?.set('authorDetails', params.authorDetails);
-    this.eduTextbook?.set('authorList', this.authorList);
-    this.eduTextbook?.set('achievementOptions', this.achievementOptions);
-    params.accept && this.eduTextbook?.set('accept', params.accept);
-    await this.eduTextbook?.save();
-    return;
   }
 
   /**获取文件名 */
-  getFileName(url: string) {
-    if (!url) return ''
-    let str = url?.split('/')[5]
-    let index = str?.indexOf('-')
-    let result = decodeURIComponent(str?.substring(index + 1))
+  // getFileName(url: string) {
+  //   if (!url) return ''
+  //   let str = url?.split('/')[5]
+  //   let index = str?.indexOf('-')
+  //   let result = decodeURIComponent(str?.substring(index + 1))
 
-    return result || '未知文件名'
-  }
-  
-  openFile(url:string){
-    console.log(url);
-    window.open(url)
-  }
-  downloadFile(){
-    let fileName = '十四五”普通高等教育本科国家级规划教材第一次遴选推荐申报表.docx'
+  //   return result || '未知文件名'
+  // }
+
+  // openFile(url:string){
+  //   console.log(url);
+  //   window.open(url)
+  // }
+  downloadFile() {
+    let fileName =
+      '十四五”普通高等教育本科国家级规划教材第一次遴选推荐申报表.docx';
     let fileUrl = `../../../../../public/file/${fileName}`;
     this.http.get(fileUrl, { responseType: 'blob' }).subscribe((blob) => {
       const url = window.URL.createObjectURL(blob);
@@ -440,8 +490,8 @@ export class TextbookPertainComponent implements OnInit {
       a.click();
       document.body.removeChild(a);
       window.URL.revokeObjectURL(url);
-    })
-    let fileName02 = '教材编写人员政治审查表.docx'
+    });
+    let fileName02 = '教材编写人员政治审查表.docx';
     let fileUrl02 = `../../../../../public/file/${fileName02}`;
     this.http.get(fileUrl02, { responseType: 'blob' }).subscribe((blob) => {
       const url = window.URL.createObjectURL(blob);
@@ -452,6 +502,6 @@ export class TextbookPertainComponent implements OnInit {
       a.click();
       document.body.removeChild(a);
       window.URL.revokeObjectURL(url);
-    })
-  }
+    });
   }
+}

+ 4 - 0
server/db/schemas/EduTextbook.js

@@ -14,6 +14,10 @@ export const EduTextbook = {
             "type": "String",
             "required": false
         },
+        "childrens":{//指向所有分册
+            "type": "String",
+            "required": false
+        },
         "user": {
             "type": "Pointer",
             "targetClass":"_User",