cehn 7 hónapja
szülő
commit
54ac6ff50c

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

@@ -281,6 +281,7 @@
               "
             >
               <app-comp-upload
+              [type]="'pdf'"
                 [width]="320"
                 (change)="upload($event)"
                 title="上传文件"

+ 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 = 1;
+  state: number = 0;
   get stateMap() {
     let map: any = {
       '0': '教材基本信息',

+ 211 - 101
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.html

@@ -1,23 +1,57 @@
 <div class="entry">
-  <form nz-form [formGroup]="validateForm" class="login-form" (ngSubmit)="submitForm()">
+  <form
+    nz-form
+    [formGroup]="validateForm"
+    class="login-form"
+    (ngSubmit)="submitForm()"
+  >
     <nz-form-item style="margin-bottom: 16px">
-      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired nzFor="user">申报教材名称</nz-form-label>
+      <nz-form-label
+        [nzSm]="8"
+        [nzNoColon]="true"
+        [nzXs]="8"
+        nzRequired
+        nzFor="user"
+        >申报教材名称</nz-form-label
+      >
       <nz-form-control nzErrorTip="请输入申报教材名称" [nzSm]="12" [nzXs]="12">
         <nz-input-group>
-          <input type="text" nz-input formControlName="title" placeholder="请输入申报教材名称" />
+          <input
+            type="text"
+            nz-input
+            formControlName="title"
+            placeholder="请输入申报教材名称"
+          />
         </nz-input-group>
       </nz-form-control>
     </nz-form-item>
     <nz-form-item style="margin-bottom: 16px">
-      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired>教材应用对象及所属学科专业类</nz-form-label>
-      <nz-form-control nzErrorTip="输入所属本科专业类代码(四位)搜索所属学科" [nzSm]="12" [nzXs]="12">
+      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired
+        >教材应用对象及所属学科专业类</nz-form-label
+      >
+      <nz-form-control
+        nzErrorTip="输入所属本科专业类代码(四位)搜索所属学科"
+        [nzSm]="12"
+        [nzXs]="12"
+      >
         <nz-input-group>
-          <nz-select style="width: 80%" nzShowSearch nzAllowClear nzPlaceHolder="填写 6 位专业代码选择"
-            formControlName="majorPoniter" (ngModelChange)="changeCode()" (nzOnSearch)="getCode($event)">
+          <nz-select
+            style="width: 80%"
+            nzShowSearch
+            nzAllowClear
+            nzPlaceHolder="填写 6 位专业代码选择"
+            formControlName="majorPoniter"
+            (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>
@@ -33,12 +67,24 @@
       </nz-form-control>
     </nz-form-item>
     <nz-form-item style="margin-bottom: 16px">
-      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired>是否重点立项教材</nz-form-label>
+      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired
+        >是否重点立项教材</nz-form-label
+      >
       <nz-form-control nzErrorTip="请输入完成项" [nzSm]="12" [nzXs]="12">
         <nz-input-group>
-          <nz-select nzShowSearch nzAllowClear nzPlaceHolder="请输入是否重点立项教材" formControlName="approval">
+          <nz-select
+            nzShowSearch
+            nzAllowClear
+            nzPlaceHolder="请输入是否重点立项教材"
+            formControlName="approval"
+          >
             @for (item of options; track item.code) {
-            <nz-option nzCustomContent [nzValue]="item.name" [nzLabel]="item.name">{{item.name}}</nz-option>
+            <nz-option
+              nzCustomContent
+              [nzValue]="item.name"
+              [nzLabel]="item.name"
+              >{{ item.name }}</nz-option
+            >
             }
             <!-- <nz-option nzCustomContent [nzValue]="'基础学科“101计划”核心教材'" [nzLabel]="'基础学科“101计划”核心教材'">基础学科“101计划”核心教材</nz-option>
             <nz-option nzCustomContent [nzValue]="'战略性新兴领域教材'" [nzLabel]="'战略性新兴领域教材'">战略性新兴领域教材</nz-option>
@@ -50,23 +96,34 @@
     </nz-form-item>
     @if (validateForm.value.approval && validateForm.value.approval != '否') {
     <nz-form-item style="margin-bottom: 16px">
-      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired>教材获批截图</nz-form-label>
+      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired
+        >教材获批截图</nz-form-label
+      >
       <nz-form-control nzErrorTip="请上传教材获批截图" [nzSm]="12" [nzXs]="12">
         @if (validateForm.value.approvedImgUrl) {
-        <a style="color: #3e49b3;font-size: 14px;" (click)="openFile(validateForm.value.approvedImgUrl)">
+        <a
+          style="color: #3e49b3; font-size: 14px"
+          (click)="openFile(validateForm.value.approvedImgUrl)"
+        >
           <span nz-icon nzType="file" nzTheme="outline"></span>
           教材获批截图
         </a>
         }
         <nz-input-group>
-          <app-comp-upload (change)="upload($event, 'approvedImgUrl')" title="上传教材获批截图"></app-comp-upload>
+          <app-comp-upload
+          [type]="'pdf'"
+            (change)="upload($event, 'approvedImgUrl')"
+            title="上传教材获批截图"
+          ></app-comp-upload>
         </nz-input-group>
-        <p style="color: gray;">支持上传 PDF 格式,文件大小不超过 2M</p>
+        <p style="color: gray">支持上传 PDF 格式,文件大小不超过 2M</p>
       </nz-form-control>
     </nz-form-item>
     }
     <nz-form-item style="margin-bottom: 16px">
-      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired>申报类型</nz-form-label>
+      <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired
+        >申报类型</nz-form-label
+      >
       <nz-form-control nzErrorTip="请输入申报类型" [nzSm]="12" [nzXs]="12">
         <nz-input-group>
           <!-- <input
@@ -76,108 +133,161 @@
             placeholder="请输入申报类型"
           /> -->
 
-          <nz-radio-group style="display: flex; flex-direction: column" formControlName="type">
+          <nz-radio-group
+            style="display: flex; flex-direction: column"
+            formControlName="type"
+          >
             <label (click)="checkSingle()" nz-radio nzValue="单册">单册</label>
             <div class="basic-row">
               <label (click)="checkAll()" nz-radio nzValue="全册">全册</label>
-              @if (validateForm.value.type =='全册') {
-              <nz-input-group style="flex: 1; margin-left: 20px" [nzSuffix]="suffixTemplateInfo">
-                <input min="2" type="number" [ngModelOptions]="{standalone: true}" [(ngModel)]="typeNumber"
-                  (ngModelChange)="typeNumberChange()" nz-input placeholder="输入册数" />
+              <!-- @if (validateForm.value.type =='全册') {
+              <nz-input-group
+                style="flex: 1; margin-left: 20px"
+                [nzSuffix]="suffixTemplateInfo"
+              >
+                <input
+                  min="2"
+                  type="number"
+                  [ngModelOptions]="{ standalone: true }"
+                  [(ngModel)]="typeNumber"
+                  (ngModelChange)="typeNumberChange()"
+                  nz-input
+                  placeholder="输入册数"
+                />
               </nz-input-group>
               <ng-template #suffixTemplateInfo> 册 </ng-template>
-              }
+              } -->
             </div>
           </nz-radio-group>
         </nz-input-group>
       </nz-form-control>
     </nz-form-item>
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@if(!loading){
-
-  @if(validateForm.value.type=='全册'){
-    <mat-accordion class="example-headers-align" multi>
-
-      @for (item of eduTextbookVolumeList; track $index) {
-      <mat-expansion-panel>
-        <mat-expansion-panel-header>
-          <mat-panel-title>
-            <b>分册{{$index+1}}</b>
-        <span (click)="deleteVolume($index)" style="margin-left: 20px;" nz-icon nzType="delete"></span>
-
-          </mat-panel-title>
-        </mat-expansion-panel-header>
-
-        <app-one #children [eduTextbookId]="eduTextbookId" [eduTextbookVolumeId]="item?.id"></app-one>
-      </mat-expansion-panel>
-      }
-    </mat-accordion>
-    }
-    @else {
-    @if (singleId) {
-    <app-one #children [eduTextbookId]="eduTextbookId" [eduTextbookVolumeId]="singleId"></app-one>
-    }
-    @if(!singleId){
-    <app-one #children [eduTextbookId]="eduTextbookId" eduTextbookVolumeId=""></app-one>
+    @if(!loading){ 
+      <!-- @if(validateForm.value.type=='全册'){
+        <mat-accordion class="example-headers-align" multi>
+          @for (item of eduTextbookVolumeList; track $index) {
+          <mat-expansion-panel>
+            <mat-expansion-panel-header>
+              <mat-panel-title>
+                <b>分册{{ $index + 1 }}</b>
+                <span
+                  (click)="deleteVolume($index)"
+                  style="margin-left: 20px"
+                  nz-icon
+                  nzType="delete"
+                ></span>
+              </mat-panel-title>
+            </mat-expansion-panel-header>
+
+            <app-one
+              #children
+              [eduTextbookId]="eduTextbookId"
+              [eduTextbookVolumeId]="item?.id"
+            ></app-one>
+          </mat-expansion-panel>
+          }
+        </mat-accordion>
+        } @else { 
+          @if (singleId) {
+          <app-one
+            #children
+            [eduTextbookId]="eduTextbookId"
+            [eduTextbookVolumeId]="singleId"
+          ></app-one>
+        }
+         @if(!singleId){
+          <app-one
+            #children
+            [eduTextbookId]="eduTextbookId"
+            eduTextbookVolumeId=""
+          ></app-one>
+        } 
+      } } -->
+      @if (validateForm.value.type =='全册') {
+        <nz-collapse [nzBordered]="false">
+          @for (panel of eduTextbookVolumeList; track panel) {
+          <nz-collapse-panel
+            #p
+            [nzHeader]="title"
+            [nzActive]="false"
+            nzExpandedIcon="caret-right"
+            [nzExtra]="extraTpl"
+            style="
+              background: #f7f7f7;
+              border-radius: 4px;
+              margin-bottom: 24px;
+              border: 0px;
+            "
+          >
+          <ng-template #title>
+            <span class="panel-title">{{'分册' + ($index+1)}}</span>
+          </ng-template>
+          <ng-template #extraTpl>
+            <span nz-icon nzType="delete" (click)="deleteVolume($index, children)"></span>
+          </ng-template>
+            <div class="">
+              <app-one
+              #children
+              [eduTextbookId]="eduTextbookId"
+              [eduTextbookVolumeId]="panel?.id"
+            ></app-one>
+            </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 { 
+          @if (singleId) {
+          <app-one
+            #children
+            [eduTextbookId]="eduTextbookId"
+            [eduTextbookVolumeId]="singleId"
+          ></app-one>
+        }
+         @if(!singleId){
+          <app-one
+            #children
+            [eduTextbookId]="eduTextbookId"
+            eduTextbookVolumeId=""
+          ></app-one>
+        } }
     }
+    @if (validateForm.value.type == '全册' && this.eduTextbookVolumeList.length < 12 ) {
+      <div class="add-bar" (click)="addVolume()">
+        新增分页
+      </div>
     }
-}
-
-
-
-
-
   </form>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 </div>
 <div class="footer">
-  <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="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 class="loading" [hidden]="!saveLoading">
+  <nz-spin nzSimple [nzSize]="'large'"></nz-spin>
 </div>

+ 20 - 0
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.scss

@@ -14,6 +14,13 @@
     background: #3e49b314;
     border-radius: 6px;
   }
+  .add-bar{
+    padding: 10px;
+    background: #EAE6E6;
+    text-align: center;
+    border-radius: 4px;
+    cursor: pointer;
+  }
 }
 .footer{
   display: flex;
@@ -23,4 +30,17 @@
   // width: 200px;
   justify-content: end;
   // padding-right: 100px;
+}
+.loading{
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100vw;
+  text-align: center;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background: rgb(0 0 0 / 30%);
+  z-index: 99;
 }

+ 373 - 358
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.ts

@@ -8,7 +8,7 @@ import { NzUploadModule } from 'ng-zorro-antd/upload';
 import { NzTagModule } from 'ng-zorro-antd/tag';
 import { NzMessageService } from 'ng-zorro-antd/message';
 import { NzModalService } from 'ng-zorro-antd/modal';
-import { textbookServer } from '../../../../services/textbook'
+import { textbookServer } from '../../../../services/textbook';
 import Parse from 'parse';
 import {
   FormControl,
@@ -18,14 +18,11 @@ import {
 } from '@angular/forms';
 import { CompUploadComponent } from '../../../../app/comp-upload/comp-upload.component';
 import { NzInputModule } from 'ng-zorro-antd/input';
-import * as major from '../../../../services/majors4.map'
+import * as major from '../../../../services/majors4.map';
 import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
 
 import { BasicComponent } from '../create/basic/basic.component';
 
-
-
-
 import { ChangeDetectorRef } from '@angular/core';
 import { ViewChild } from '@angular/core';
 import { MatAccordion, MatExpansionModule } from '@angular/material/expansion';
@@ -36,7 +33,8 @@ import { MatIconModule } from '@angular/material/icon';
 import { MatButtonModule } from '@angular/material/button';
 import { provideNativeDateAdapter } from '@angular/material/core';
 import { ViewChildren, QueryList } from '@angular/core';
-import { CreatedService } from '../../../../services/created.service'
+import { CreatedService } from '../../../../services/created.service';
+import { NzCollapseModule } from 'ng-zorro-antd/collapse';
 
 @Component({
   selector: 'app-basic',
@@ -57,12 +55,12 @@ import { CreatedService } from '../../../../services/created.service'
     MatFormFieldModule,
     MatInputModule,
     MatDatepickerModule,
+    NzCollapseModule,
   ],
   standalone: true,
   templateUrl: './basic-in.component.html',
   styleUrls: ['./basic-in.component.scss'],
   providers: [provideNativeDateAdapter()],
-
 })
 export class BasicInComponent implements OnInit {
   @Input('eduTextbook') eduTextbook: Parse.Object | any;
@@ -70,353 +68,305 @@ export class BasicInComponent implements OnInit {
   @Output() state: EventEmitter<any> = new EventEmitter<any>();
   @Output() save: EventEmitter<any> = new EventEmitter<any>();
 
-
-
   @ViewChild(MatAccordion) accordion: MatAccordion | any;
 
-
-
   @ViewChildren(BasicComponent) children: QueryList<BasicComponent> | any;
 
   /**删除分册 */
-  async deleteVolume(index: any) {
-    console.log('hhhhhh', index)
+  async deleteVolume(index: number, comp: BasicComponent) {
+    console.log(comp);
     if (this.eduTextbookVolumeList.length <= 2) {
-      this.msg.create('warning', '全册最少两册')
-      return
-    }
-    console.log(this.eduTextbookVolumeList)
-    console.log(this.eduTextbookVolumeList[index])
-    if (this.eduTextbookVolumeList[index]?.id) {
-      this.eduTextbookVolumeList[index]?.set('isDeleted', true)
-      await this.eduTextbookVolumeList[index]?.save()
-      delete this.eduTextbookVolumeList[index]
-      this.typeNumber = this.typeNumber - 1
-    } else {
-      delete this.eduTextbookVolumeList[index]
-      this.typeNumber = this.typeNumber - 1
+      this.msg.create('warning', '全册最少两册');
+      return;
     }
-    // this.eduTextbookVolumeList.splice(index, 1)
-
+    this.eduTextbookVolumeList.splice(index, 1);
+    this.typeNumber = this.typeNumber - 1;
+    return;
+    // console.log(this.eduTextbookVolumeList)
+    // console.log(this.eduTextbookVolumeList[index])
+    // if (this.eduTextbookVolumeList[index]?.id) {
+    //   this.eduTextbookVolumeList[index]?.set('isDeleted', true)
+    //   await this.eduTextbookVolumeList[index]?.save()
+    //   delete this.eduTextbookVolumeList[index]
+    //   this.typeNumber = this.typeNumber - 1
+    // } else {
+    //   delete this.eduTextbookVolumeList[index]
+    //   this.typeNumber = this.typeNumber - 1
+    // }
+    // console.log(this.eduTextbookVolumeList);
   }
 
   /**上传分册数据 */
-  async saveEduTextbookVolume(eduTextbookId?: any) {
-    console.log(eduTextbookId)
-    let arr = [] //存储返回的数组id
-    let isVrifly = true //默认都通过,若一项填写未完成,则不通过
-    return Promise.all(this.children.map(async (comp: any) => {
-      console.log(comp);
-      let req = await comp.saveEduTextbook(eduTextbookId)
-      console.log(req)
-      // arr.push(comp.saveEduTextbook())
-      //加上子组件返回是否填写完成的方法
-      // return arr
-    })).then(data => {
-      console.log(data);
-    })
-  }
-  async saveEduTextbook(params: any, isComplete: boolean) {
-    this.changeImportantProject()
-    console.log(params);
-    if (!this.eduTextbook) {
-      let obj = Parse.Object.extend('EduTextbook');
-      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');
-    }
-    this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
-    this.eduTextbook?.set('company', {
-      __type: 'Pointer',
-      className: 'Company',
-      objectId: this.tbookSer.company,
+  async saveEduTextbookVolume(eduTextbookId?: string): Promise<any> {
+    // console.log(eduTextbookId);
+    let arr: Array<any> = []; //存储返回的数组id
+    let isVrifly = true; //默认都通过,若一项填写未完成,则不通过
+    return Promise.all(
+      this.children.map(async (comp: any) => {
+        // console.log(comp);
+        let etvId = await comp.submitForm(eduTextbookId);
+        console.log('返回eduTextbookVolume:'+etvId);
+        arr.push({
+          __type: 'Pointer',
+          className: 'EduTextbookVolume',
+          objectId: etvId,
+        });
+        if (!comp.isComlpete) {
+          isVrifly = false;
+        }
+        //加上子组件返回是否填写完成的方法
+        return arr;
+      })
+    ).then((data) => {
+      // console.log(data);
+      return {
+        list: arr,
+        isVrifly,
+      };
     });
-    this.eduTextbook?.set('title', params.title);
-    this.eduTextbook?.set('ISBN', (params.ISBN || 0).toString());
-    this.eduTextbook?.set('author', params.author);
-    this.eduTextbook?.set('unit', params.unit);
-    this.eduTextbook?.set('type', params.type);
-    // this.eduTextbook?.set('typeNumber', params.typeNumber);
-    this.eduTextbook?.set('typeNumber', this.typeNumber);
-    let majorPoniter = this.selectList.find((item) => item.code == params.majorPoniter);
-    this.eduTextbook?.set('majorPoniter', majorPoniter);
-    this.eduTextbook?.set('lang', params.lang);
-    this.eduTextbook?.set('authors', params.authors);
-    this.eduTextbook?.set('editor', params.editor);
-    this.eduTextbook?.set('approval', params.approval);
-    this.eduTextbook?.set('editionUnit', params.editionUnit);
-    this.eduTextbook?.set('editionFirst', params.editionFirst);
-    this.eduTextbook?.set('carrierShape', params.carrierShape);
-    this.eduTextbook?.set('editionDate', params.editionDate);
-    this.eduTextbook?.set('editionNumber', params.editionNumber);
-    this.eduTextbook?.set('printDate', params.printDate);
-    this.eduTextbook?.set('printNumber', params.printNumber);
-    this.eduTextbook?.set('printSum', params.printSum);
-    // this.eduTextbook?.set('importantProject', params.importantProject);
-    this.eduTextbook?.set('importantProject', this.importantProject);
-    this.eduTextbook?.set('importantProjectOther', params.importantProjectOther);
-    // this.eduTextbook?.set('copyrightImgUrl', params.copyrightImgUrl);
-    // this.eduTextbook?.set('CIPImgUrl', params.CIPImgUrl);
-    this.eduTextbook?.set('approvedImgUrl', params.approvedImgUrl)
-    this.eduTextbook?.set('unitType', params.unitType)
-    if (!this.eduTextbook?.get('code')) {
-      let t =
-        this.tbookSer.formatTime('YYYYmmdd', new Date()) +
-        Math.random().toString().slice(-4);
-      this.eduTextbook.set('code', t);
-    }
-    let res = await this.eduTextbook?.save();
-    this.eduTextbookId = await res?.id
-    console.log(res?.id)
-    await this.saveEduTextbookVolume(this.eduTextbookId)
-    return
   }
+  eduTextbookId: string = '';
+  saveLoading: boolean = false; //保存等待
+  async saveEduTextbook(params: any, isComplete: boolean) {
+    if (this.saveLoading) return;
+    this.saveLoading = true;
+    try {
+      // this.changeImportantProject()
+      // console.log(params);
+      if (!this.eduTextbook) {
+        let obj = Parse.Object.extend('EduTextbook');
+        this.eduTextbook = new obj();
+      }
 
-  eduTextbookId: string = ''
-
-
-
-
-
-
-
-
-  ngAfterViewInit() {
-    this.eduTextbookId = this.eduTextbook?.id
-    this.accordion?.openAll()
-    this.cdr.detectChanges()
-    this.getEduTextbookVolumeList()
-
+      this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
+      this.eduTextbook?.set('company', {
+        __type: 'Pointer',
+        className: 'Company',
+        objectId: this.tbookSer.company,
+      });
+      let majorPoniter = this.selectList.find(
+        (item) => item.code == params.majorPoniter
+      );
+      this.eduTextbook?.set('title', params.title);
+      this.eduTextbook?.set('majorPoniter', majorPoniter);
+      this.eduTextbook?.set('approval', params.approval);
+      this.eduTextbook?.set('type', params.type);
+      this.eduTextbook?.set('approvedImgUrl', params.approvedImgUrl);
+      // this.eduTextbook?.set('typeNumber', this.typeNumber);
+      if (!this.eduTextbook?.get('code')) {
+        let t =
+          this.tbookSer.formatTime('YYYYmmdd', new Date()) +
+          Math.random().toString().slice(-4);
+        this.eduTextbook.set('code', t);
+      }
+      // this.eduTextbook?.set('ISBN', (params.ISBN || 0).toString());
+      // this.eduTextbook?.set('author', params.author);
+      // this.eduTextbook?.set('unit', params.unit);
+      // this.eduTextbook?.set('lang', params.lang);
+      // this.eduTextbook?.set('authors', params.authors);
+      // this.eduTextbook?.set('editor', params.editor);
+      // this.eduTextbook?.set('editionUnit', params.editionUnit);
+      // this.eduTextbook?.set('editionFirst', params.editionFirst);
+      // this.eduTextbook?.set('carrierShape', params.carrierShape);
+      // this.eduTextbook?.set('editionDate', params.editionDate);
+      // this.eduTextbook?.set('editionNumber', params.editionNumber);
+      // this.eduTextbook?.set('printDate', params.printDate);
+      // this.eduTextbook?.set('printNumber', params.printNumber);
+      // this.eduTextbook?.set('printSum', params.printSum);
+      // this.eduTextbook?.set('importantProject', this.importantProject);
+      // this.eduTextbook?.set('importantProjectOther', params.importantProjectOther);
+      // this.eduTextbook?.set('unitType', params.unitType)
+
+      let res = await this.eduTextbook?.save();
+      this.eduTextbookId = await res?.id;
+      // console.log(res?.id);
+      let eduTextbookVolumes = await this.saveEduTextbookVolume(
+        this.eduTextbookId
+      );
+      console.log(eduTextbookVolumes?.isVrifly);
+      console.log(eduTextbookVolumes.list);
+      this.eduTextbook?.set('childrens', eduTextbookVolumes.list);
+      this.eduTextbook?.set('typeNumber', eduTextbookVolumes.list.length);
+      
+      isComplete = eduTextbookVolumes?.isVrifly;
+      //如果填写未完整,仅保存,状态修改待完善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');
+      }
+      await this.eduTextbook?.save();
+      this.saveLoading = false;
+      if (!isComplete) {
+        this.msg.warning('保存成功,但存在未填写完成项');
+      }
+      return;
+    } catch (err) {
+      console.warn('保存错误:', err);
+      this.saveLoading = false;
+      this.msg.error('保存出错');
+    }
   }
   /**扩展表记录 */
-  eduTextbookVolumeList: Array<any> = []
+  eduTextbookVolumeList: Array<any> = [];
   /**获取扩展表记录 */
   async getEduTextbookVolumeList() {
     if (this.typeNumber && this.typeNumber > 12) {
-      this.typeNumber = 12
+      this.typeNumber = 12;
     }
-    console.log(this.validateForm?.value?.type, this.typeNumber)
-    let query = new Parse.Query('EduTextbookVolume')
-    query.equalTo('eduTextbook', this.eduTextbook?.id)
-    // query.equalTo()
-    query.select('objectId')
-    query.ascending('createdAt')//小到大
-    query.notEqualTo('isDeleted', true)
-    if (this.validateForm?.value?.type == '全册') {
-      query.limit(this.typeNumber)
-    } else {
-      query.limit(1)
-    }
-    let list = await query.find()
-    console.log(list)
+    console.log(this.validateForm?.value?.type, this.typeNumber);
+    // let query = new Parse.Query('EduTextbookVolume')
+    // query.equalTo('eduTextbook', this.eduTextbook?.id)
+    // // query.equalTo()
+    // query.select('objectId')
+    // query.ascending('createdAt')//小到大
+    // query.notEqualTo('isDeleted', true)
+    // if (this.validateForm?.value?.type == '全册') {
+    //   query.limit(this.typeNumber)
+    // } else {
+    //   query.limit(1)
+    // }
+    let query = new Parse.Query('EduTextbook');
+    query.equalTo('objectId', this.eduTextbook?.id);
+    query.select('childrens');
+    let r = await query.first();
+    let list: any = r?.get('childrens') || [];
+    console.log(list);
+    this.eduTextbookVolumeList = new Array(this.typeNumber).fill({
+      objectId: '',
+    });
     if (this.validateForm?.value?.type == '全册') {
-      this.eduTextbookVolumeList = new Array(this.typeNumber).fill({ objectId: '' })
-      for (let i in list) {
-        this.eduTextbookVolumeList[i] = list[i]
-      }
+      list.forEach((item: any, index: number) => {
+        this.eduTextbookVolumeList[index] = item;
+      });
     } else {
-      this.eduTextbookVolumeList[0] = list[0]
-      console.log(this.eduTextbookVolumeList)
-      this.singleId = list[0]?.id
+      this.singleId = list[0]?.id;
     }
-
   }
-  singleId: string = ''
-  loading = false
+  singleId: string = '';
+  loading = false;
   async checkSingle() {
-    this.loading = true
-    this.validateForm.get("type")?.setValue('单册')
-    await this.getEduTextbookVolumeList()
-    this.loading = false
-
+    this.loading = true;
+    this.validateForm.get('type')?.setValue('单册');
+    await this.getEduTextbookVolumeList();
+    this.loading = false;
   }
   /**申报类型选择全册 */
   async checkAll() {
-    this.validateForm.get("type")?.setValue('全册')
-
-    this.accordion?.openAll()
-    this.getEduTextbookVolumeList()
-  }
-  ngOnInit() {
-
-    if (this.eduTextbook?.get('editionUnit')) {
-      this.isShowChooseEU = false
-    }
-    this.importantProject = this.eduTextbook?.get('importantProject') || []
-    if (this.importantProject?.length > 0) {
-      for (let i in this.importantProjectList) {
-        if (this.importantProject.indexOf(this.importantProjectList[i].value) != -1) {
-          this.importantProjectList[i].checked = true
-        }
-      }
-    }
-
-    this.approvedImgList[0].url = this.eduTextbook?.get('approvedImgUrl')
-    this.typeNumber = this.eduTextbook?.get('typeNumber') || 2
-    if (this.typeNumber > 12) this.typeNumber = 12
-    // console.log(this.approvedImgList)
-    console.log(this.eduTextbook);
-    this.validateForm = this.fb.group({
-      title: [this.eduTextbook?.get('title') || '', [Validators.required]],
-      ISBN: [parseInt(this.eduTextbook?.get('ISBN') || '') || null, [Validators.required]],
-      author: [this.eduTextbook?.get('author') || '', [Validators.required]],
-      unit: [this.eduTextbook?.get('unit') || '', [Validators.required]],
-      type: [this.eduTextbook?.get('type') || '单册', [Validators.required]],
-      // typeNumber: [this.eduTextbook?.get('typeNumber') || 2],
-
-      majorPoniter: [this.eduTextbook?.get('majorPoniter')?.code || '', [Validators.required]],
-      lang: [this.eduTextbook?.get('lang') || '', [Validators.required]],
-      authors: [this.eduTextbook?.get('authors') || ''],
-      editor: [this.eduTextbook?.get('editor') || '',],
-      approval: [this.eduTextbook?.get('approval') || '', [Validators.required]],
-      editionUnit: [this.eduTextbook?.get('editionUnit') || '', [Validators.required]],
-      editionFirst: [this.eduTextbook?.get('editionFirst') || new Date(), [Validators.required]],
-      carrierShape: [this.eduTextbook?.get('carrierShape') || '', [Validators.required]],
-      editionDate: [this.eduTextbook?.get('editionDate') || new Date(), [Validators.required]],
-      editionNumber: [this.eduTextbook?.get('editionNumber') || 0, [Validators.required]],
-      printDate: [this.eduTextbook?.get('printDate') || new Date(), [Validators.required]],
-      printNumber: [this.eduTextbook?.get('printNumber') || 0, [Validators.required]],
-      printSum: [this.eduTextbook?.get('printSum') || 0, [Validators.required]],
-      // importantProject: [this.eduTextbook?.get('importantProject') || '', [Validators.required]],
-      importantProjectOther: [this.eduTextbook?.get('importantProjectOther') || ''],
-      approvedImgUrl: [this.eduTextbook?.get('approvedImgUrl') || ''],
-      unitType: [this.eduTextbook?.get('unitType') || '', [Validators.required]],
-
-      // copyrightImgUrl: [this.eduTextbook?.get('copyrightImgUrl') || '', [Validators.required]],
-      // CIPImgUrl: [this.eduTextbook?.get('CIPImgUrl') || '', [Validators.required]],
-    });
+    this.validateForm.get('type')?.setValue('全册');
+    this.accordion?.openAll();
+    this.getEduTextbookVolumeList();
   }
 
-
-  changeCode() { }
-  getCode(e: any) { }
+  changeCode() {}
+  getCode(e: any) {}
 
   /***教材获批截图 */
-  approvedImgList: Array<any> = [{
-    name: '获批截图',
-    status: 'done',
-    url: ''
-  }]
+  approvedImgList: Array<any> = [
+    {
+      name: '获批截图',
+      status: 'done',
+      url: '',
+    },
+  ];
   /**
    * 书号自动补全函数
    * @param isbn 书号
    */
-  async autoCompleteByISBN() {
-    let isbn = this.validateForm.value?.ISBN;
-    let result = await Parse.Cloud.run("tbookISBN", {
-      isbn: isbn
-    })
-    if (!result?.isbn) {
-      this.msg.warning('未找到该书号的图书信息,请手动填写')
-    }
-
-    // 其他字段,需补充接口与数据库对应关系
-    this.validateForm.get("title")?.setValue(result?.book_name)
-    this.validateForm.get("author")?.setValue(result?.author_name)
-    this.validateForm.get("authors")?.setValue(result?.author)
-    this.validateForm.get("majorPoniter")?.setValue(result?.major)
-    this.validateForm.get("lang")?.setValue(languages.options?.[result?.languages]?.name)
-    this.validateForm.get("editionUnit")?.setValue(result?.publisher)
-    this.validateForm.get("editionDate")?.setValue(new Date(result?.publish_time))
-    this.validateForm.get("carrierShape")?.setValue(result?.publication_class)
-
-    console.log(result)
-  }
+  // async autoCompleteByISBN() {
+  //   let isbn = this.validateForm.value?.ISBN;
+  //   let result = await Parse.Cloud.run("tbookISBN", {
+  //     isbn: isbn
+  //   })
+  //   if (!result?.isbn) {
+  //     this.msg.warning('未找到该书号的图书信息,请手动填写')
+  //   }
+
+  //   // 其他字段,需补充接口与数据库对应关系
+  //   this.validateForm.get("title")?.setValue(result?.book_name)
+  //   this.validateForm.get("author")?.setValue(result?.author_name)
+  //   this.validateForm.get("authors")?.setValue(result?.author)
+  //   this.validateForm.get("majorPoniter")?.setValue(result?.major)
+  //   this.validateForm.get("lang")?.setValue(languages.options?.[result?.languages]?.name)
+  //   this.validateForm.get("editionUnit")?.setValue(result?.publisher)
+  //   this.validateForm.get("editionDate")?.setValue(new Date(result?.publish_time))
+  //   this.validateForm.get("carrierShape")?.setValue(result?.publication_class)
+  //   console.log(result)
+  // }
   /**出版时间及版次不可选择时间 */
   disabledEditionDate = (current: Date): boolean => {
-    return current < new Date(2022, 11, 1)
-  }
-
-
+    return current < new Date(2022, 11, 1);
+  };
 
   /** 全册次数*/
-  typeNumber: number = 2
-  typeNumberChange() {
-    if (this.typeNumber < 2) {
-      this.msg.create('warning', '不得小于两册')
-      this.typeNumber = 2
-    } else {
-
-    }
-    this.getEduTextbookVolumeList()
-    // this.eduTextbookVolumeList = []
-    //   // for (let i = 1; i++; i <= this.typeNumber) {
-    //   //   this.eduTextbookVolumeList.push(false)
-    //   // }
-    //   this.eduTextbookVolumeList=new Array(this.typeNumber-1).fill(false)
-    //   console.log(this.eduTextbookVolumeList)
-
-  }
+  typeNumber: number = 2;
+  // typeNumberChange() {
+  //   if (this.typeNumber < 2) {
+  //     this.msg.create('warning', '不得小于两册')
+  //     this.typeNumber = 2
+  //   } else {
+  //   }
+  //   this.getEduTextbookVolumeList()
+  //   // this.eduTextbookVolumeList = []
+  //   //   // for (let i = 1; i++; i <= this.typeNumber) {
+  //   //   //   this.eduTextbookVolumeList.push(false)
+  //   //   // }
+  //   //   this.eduTextbookVolumeList=new Array(this.typeNumber-1).fill(false)
+  //   //   console.log(this.eduTextbookVolumeList)
+
+  // }
   validateForm: FormGroup<{
     title: FormControl<string>; //申报教材名称
-    ISBN: FormControl<any>; //国际标准书号
-    author: FormControl<string>; //第一主编(作者)
-    unit: FormControl<string>; //第一主编(作者)单位
-    unitType: FormControl<string>//第一主编(作者)单位类型
-
-    type: FormControl<string>; //申报类型
-    // typeNumber: FormControl<number|any>; //全册次数
-
     majorPoniter: FormControl<string>; //教材应用对象及所诉学科专业类
-    lang: FormControl<string>; //教材主要语种类型
-    authors: FormControl<string>; //其他主编姓名
-    editor: FormControl<string>; //其他编者姓名
-
     approval: FormControl<string>; //是否为重点立项教材
-    editionUnit: FormControl<string>; //出版单位
-    editionFirst: FormControl<Date>; //初版时间
-    carrierShape: FormControl<string>; //载体形式
-
-    editionDate: FormControl<Date>; //出版时间
-    editionNumber: FormControl<number>; //出版版次
-    printDate: FormControl<Date>; //最新印次时间
-    printNumber: FormControl<number>; //最新印次
-
-    printSum: FormControl<number>; //初版以来合计印数
-
-    // importantProject: FormControl<string>; //初版以来是否列为重点项目
-    importantProjectOther: FormControl<string>; //其他省部级及以上项目
-    approvedImgUrl: FormControl<string>//重点立项教材获批截图
-
-
-    // remember: FormControl<boolean>;
+    type: FormControl<string>; //申报类型
+    approvedImgUrl: FormControl<string>; //重点立项教材获批截图
+
+    // ISBN: FormControl<any>; //国际标准书号
+    // author: FormControl<string>; //第一主编(作者)
+    // unit: FormControl<string>; //第一主编(作者)单位
+    // unitType: FormControl<string>//第一主编(作者)单位类型
+    // lang: FormControl<string>; //教材主要语种类型
+    // authors: FormControl<string>; //其他主编姓名
+    // editor: FormControl<string>; //其他编者姓名
+    // editionUnit: FormControl<string>; //出版单位
+    // editionFirst: FormControl<Date>; //初版时间
+    // carrierShape: FormControl<string>; //载体形式
+    // editionDate: FormControl<Date>; //出版时间
+    // editionNumber: FormControl<number>; //出版版次
+    // printDate: FormControl<Date>; //最新印次时间
+    // printNumber: FormControl<number>; //最新印次
+    // printSum: FormControl<number>; //初版以来合计印数
+    // importantProjectOther: FormControl<string>; //其他省部级及以上项目
   }> = this.fb.group({
     title: ['', [Validators.required]],
-    ISBN: [null, [Validators.required]],
-    author: ['', [Validators.required]],
-    unit: ['', [Validators.required]],
-    type: ['', [Validators.required]],
-    // typeNumber: [2],
     majorPoniter: ['', [Validators.required]],
-    lang: ['', [Validators.required]],
-    authors: [''],
-    editor: [''],
     approval: ['', [Validators.required]],
-    editionUnit: ['', [Validators.required]],
-    editionFirst: [new Date(), [Validators.required]],
-    carrierShape: ['', [Validators.required]],
-    editionDate: [new Date(), [Validators.required]],
-    editionNumber: [0, [Validators.required]],
-    printDate: [new Date(), [Validators.required]],
-    printNumber: [0, [Validators.required]],
-    printSum: [0, [Validators.required]],
-    // importantProject: ['', [Validators.required]],
-    importantProjectOther: [''],
+    type: ['', [Validators.required]],
     approvedImgUrl: [''],
-    // copyrightImgUrl: [''],
-    // CIPImgUrl: [''],
-    // remember: [true],
-    unitType: ['', [Validators.required]],
+
+    // ISBN: [null, [Validators.required]],
+    // author: ['', [Validators.required]],
+    // unit: ['', [Validators.required]],
+    // lang: ['', [Validators.required]],
+    // authors: [''],
+    // editor: [''],
+    // editionUnit: ['', [Validators.required]],
+    // editionFirst: [new Date(), [Validators.required]],
+    // carrierShape: ['', [Validators.required]],
+    // editionDate: [new Date(), [Validators.required]],
+    // editionNumber: [0, [Validators.required]],
+    // printDate: [new Date(), [Validators.required]],
+    // printNumber: [0, [Validators.required]],
+    // printSum: [0, [Validators.required]],
+    // importantProjectOther: [''],
+    // unitType: ['', [Validators.required]],
   });
   /** 所属学科专业类显示数量*/
-  nzOptionOverflowSize = 5
+  nzOptionOverflowSize = 5;
   //教材应用对象及所诉学科专业类
-  selectList = major.majors.options
+  selectList = major.majors.options;
   //语言选择
   selectLang: Array<any> = languages.options;
   //可选单位类型
@@ -458,36 +408,37 @@ export class BasicInComponent implements OnInit {
     {
       label: '首届全国教材建设奖全国优秀教材(高等教育类)',
       value: '首届全国教材建设奖全国优秀教材(高等教育类)',
-      checked: false
+      checked: false,
     },
     {
       label: '“十二五”普通高等教育本科国家级规划教材',
       value: '“十二五”普通高等教育本科国家级规划教材',
-      checked: false
+      checked: false,
     },
     {
       label: '“十二五”以来省级优秀教材',
       value: '“十二五”以来省级优秀教材',
-      checked: false
+      checked: false,
     },
     {
       label: '“十二五”以来省级规划教材',
       value: '“十二五”以来省级规划教材',
-      checked: false
+      checked: false,
     },
     {
       label: '其他省部级及以上项目',
       value: '其他省部级及以上项目',
-      checked: false
+      checked: false,
     },
   ];
   /**选中的重点项目 */
-  importantProject: Array<any> = []
+  importantProject: Array<any> = [];
   /**多选框改变 */
   changeImportantProject() {
-    let checkedList = this.importantProjectList.filter(item => item.checked) || []
-    this.importantProject = checkedList.map(item => item.value)
-    console.log(this.importantProject)
+    let checkedList =
+      this.importantProjectList.filter((item) => item.checked) || [];
+    this.importantProject = checkedList.map((item) => item.value);
+    console.log(this.importantProject);
   }
   /* 是否重点立项教材可选列表 */
   options: Array<any> = [
@@ -510,7 +461,7 @@ export class BasicInComponent implements OnInit {
     {
       name: '否',
       code: '否',
-    }
+    },
   ];
 
   constructor(
@@ -519,82 +470,146 @@ export class BasicInComponent implements OnInit {
     private modal: NzModalService,
     private msg: NzMessageService,
     private cdr: ChangeDetectorRef,
-    private creatSev:CreatedService
-  ) {
-  }
+    private creatSev: CreatedService
+  ) {}
 
-  isShowChooseEU: boolean = true
+  isShowChooseEU: boolean = true;
+  ngOnInit() {
+    // if (this.eduTextbook?.get('editionUnit')) {
+    //   this.isShowChooseEU = false
+    // }
+    // this.importantProject = this.eduTextbook?.get('importantProject') || []
+    // if (this.importantProject?.length > 0) {
+    //   for (let i in this.importantProjectList) {
+    //     if (this.importantProject.indexOf(this.importantProjectList[i].value) != -1) {
+    //       this.importantProjectList[i].checked = true
+    //     }
+    //   }
+    // }
+
+    this.approvedImgList[0].url = this.eduTextbook?.get('approvedImgUrl');
+    this.typeNumber = this.eduTextbook?.get('childrens').length || 2;
+    if (this.typeNumber > 12) this.typeNumber = 12;
+    // console.log(this.approvedImgList)
+    // console.log(this.eduTextbook);
+    this.validateForm = this.fb.group({
+      title: [this.eduTextbook?.get('title') || '', [Validators.required]],
+      majorPoniter: [
+        this.eduTextbook?.get('majorPoniter')?.code || '',
+        [Validators.required],
+      ],
+      approval: [
+        this.eduTextbook?.get('approval') || '',
+        [Validators.required],
+      ],
+      type: [this.eduTextbook?.get('type') || '单册', [Validators.required]],
+      approvedImgUrl: [this.eduTextbook?.get('approvedImgUrl') || ''],
 
+      // ISBN: [parseInt(this.eduTextbook?.get('ISBN') || '') || null, [Validators.required]],
+      // author: [this.eduTextbook?.get('author') || '', [Validators.required]],
+      // unit: [this.eduTextbook?.get('unit') || '', [Validators.required]],
+      // lang: [this.eduTextbook?.get('lang') || '', [Validators.required]],
+      // authors: [this.eduTextbook?.get('authors') || ''],
+      // editor: [this.eduTextbook?.get('editor') || '',],
+      // editionUnit: [this.eduTextbook?.get('editionUnit') || '', [Validators.required]],
+      // editionFirst: [this.eduTextbook?.get('editionFirst') || new Date(), [Validators.required]],
+      // carrierShape: [this.eduTextbook?.get('carrierShape') || '', [Validators.required]],
+      // editionDate: [this.eduTextbook?.get('editionDate') || new Date(), [Validators.required]],
+      // editionNumber: [this.eduTextbook?.get('editionNumber') || 0, [Validators.required]],
+      // printDate: [this.eduTextbook?.get('printDate') || new Date(), [Validators.required]],
+      // printNumber: [this.eduTextbook?.get('printNumber') || 0, [Validators.required]],
+      // printSum: [this.eduTextbook?.get('printSum') || 0, [Validators.required]],
+      // importantProjectOther: [this.eduTextbook?.get('importantProjectOther') || ''],
+      // unitType: [this.eduTextbook?.get('unitType') || '', [Validators.required]],
+    });
+  }
 
+  ngAfterViewInit() {
+    this.eduTextbookId = this.eduTextbook?.id;
+    this.accordion?.openAll();
+    this.cdr.detectChanges();
+    this.getEduTextbookVolumeList();
+  }
+  addVolume() {
+    if (this.eduTextbookVolumeList.length >= 12) {
+      this.msg.error('已超过最多册数');
+      return;
+    }
+    this.eduTextbookVolumeList.push({ objectId: '' });
+    this.typeNumber++;
+  }
   upload(e: any, type: string) {
     console.log(e);
     let file = e[0];
     // if(type == 'copyrightImgUrl' || type == 'CIPImgUrl' ||type=='approvedImgUrl'){
     if (type == 'approvedImgUrl') {
-      this.validateForm.value[type] = file?.url
+      this.validateForm.value[type] = file?.url;
     }
-    console.log(this.validateForm.value)
+    console.log(this.validateForm.value);
   }
   async submitForm(event?: string): Promise<void> {
     console.log(this.validateForm.value);
     console.log(this.validateForm.valid);
-    if (this.validateForm.valid) {
-      let params = this.validateForm.value
-      if (event == 'next') {
-        await this.saveEduTextbook(params, this.validateForm.valid)
-        this.state.emit({ type: 'next', textBook: this.eduTextbook });
-      }
-    } else {
-      if (event == 'save') {
-        let params = this.validateForm.value
-        await this.saveEduTextbook(params, this.validateForm.valid)
-        await this.getEduTextbookVolumeList()
-        this.modal.success({
-          nzTitle: '保存成功',
-          nzContent: '<p>已保存并且至空间</p>',
-          nzOnOk: () => console.log('Info OK')
-        });
-        return
-      }
-      if (event == 'next') {
-        let params = this.validateForm.value
-        await this.saveEduTextbook(params, this.validateForm.valid)
-        this.state.emit({ type: 'next', textBook: this.eduTextbook });
-      }
+    if (event == 'next') {
+      let params = this.validateForm.value;
+      await this.saveEduTextbook(params, this.validateForm.valid);
+      this.state.emit({ type: 'next', textBook: this.eduTextbook });
     }
+    // if (this.validateForm.valid) {
+    //   let params = this.validateForm.value
+    //   if (event == 'next') {
+    //     await this.saveEduTextbook(params, this.validateForm.valid)
+    //     this.state.emit({ type: 'next', textBook: this.eduTextbook });
+    //   }
+    // } else {
+    //   if (event == 'save') {
+    //     let params = this.validateForm.value
+    //     await this.saveEduTextbook(params, this.validateForm.valid)
+    //     // await this.getEduTextbookVolumeList()
+    //     this.modal.success({
+    //       nzTitle: '保存成功',
+    //       nzContent: '<p>已保存并且至空间</p>',
+    //       nzOnOk: () => console.log('Info OK')
+    //     });
+    //     return
+    //   }
+    //   if (event == 'next') {
+    //     let params = this.validateForm.value
+    //     await this.saveEduTextbook(params, this.validateForm.valid)
+    //     this.state.emit({ type: 'next', textBook: this.eduTextbook });
+    //   }
+    // }
     if (event == 'save') {
-      let params = this.validateForm.value
-      await this.saveEduTextbook(params, this.validateForm.valid)
-      await this.getEduTextbookVolumeList()
+      let params = this.validateForm.value;
+      await this.saveEduTextbook(params, this.validateForm.valid);
+      // await this.getEduTextbookVolumeList()
       this.modal.success({
         nzTitle: '保存成功',
         nzContent: '<p>已保存并且至空间</p>',
-        nzOnOk: () => console.log('Info OK')
+        nzOnOk: () => console.log('Info OK'),
       });
     }
   }
 
-
   selectedValue = null;
   listOfOption: Array<{ value: string; text: string }> = [];
   nzFilterOption = (): boolean => true;
-  eduTimeout: any
+  eduTimeout: any;
   /**出版单位列表 */
-  eduList: Array<Parse.Object> = []
+  eduList: Array<Parse.Object> = [];
   /**搜索出版单位 */
   async search(value: string) {
-    clearTimeout(this.eduTimeout)
+    clearTimeout(this.eduTimeout);
     this.eduTimeout = setTimeout(async () => {
-      let query = new Parse.Query('Department')
-      query.notEqualTo('isDeleted', true)
-      query.equalTo('parent', '66865d66ad23a23355b12aa7')
-      query.contains('name', value)
-      query.limit(10)
-      this.eduList = await query.find()
+      let query = new Parse.Query('Department');
+      query.notEqualTo('isDeleted', true);
+      query.equalTo('parent', '66865d66ad23a23355b12aa7');
+      query.contains('name', value);
+      query.limit(10);
+      this.eduList = await query.find();
     }, 500);
-
   }
   openFile(url: any) {
-    window.open(url)
+    window.open(url);
   }
 }

+ 4 - 2
projects/textbook/src/modules/nav-author/components/create/basic/basic.component.ts

@@ -100,7 +100,8 @@ export class BasicComponent implements OnInit {
       unitType: [this.eduTextbookVolume?.get('unitType') || '', [Validators.required]],
     });
   }
-  async saveEduTextbook(eduTextbookId?:any) {
+  public isComlpete:boolean = false //填写是否完整
+  async submitForm(eduTextbookId?:any) {
     console.log('执行了分册组件的save方法',eduTextbookId)
     if((!this.eduTextbookId)&&(!eduTextbookId)){
       this.msg.create('error','出错了,教材id未获取')
@@ -137,7 +138,8 @@ export class BasicComponent implements OnInit {
     this.eduTextbookVolume?.set('importantProjectOther', params.importantProjectOther);
     this.eduTextbookVolume?.set('unitType', params.unitType)
     let save = await this.eduTextbookVolume?.save();
-    return save
+    this.isComlpete = this.validateForm.valid
+    return save.id
   }
 
   changeCode() { }

+ 11 - 9
projects/textbook/src/modules/nav-author/components/textbook-pertain/textbook-pertain.component.html

@@ -317,18 +317,20 @@
       <nz-collapse [nzBordered]="false">
         @for (panel of eduTextbook?.get('childrens'); track panel) {
         <nz-collapse-panel
-        #p
+          #p
           [nzHeader]="title"
           [nzActive]="false"
           nzExpandedIcon="caret-right"
-          ngStyle="#f7f7f7',
-            'border-radius': '4px',
-            'margin-bottom': '24px',
-            border: '0px'"
+          style="
+            background: #f7f7f7;
+            border-radius: 4px;
+            margin-bottom: 24px;
+            border: 0px;
+          "
         >
-        <ng-template #title>
-          <span class="panel-title">{{'分册' + ($index+1)}}</span>
-        </ng-template>
+          <ng-template #title>
+            <span class="panel-title">{{ "分册" + ($index + 1) }}</span>
+          </ng-template>
           <div class="">
             <app-author
               #children
@@ -424,4 +426,4 @@
 
 <div class="loading" [hidden]="!loading">
   <nz-spin nzSimple [nzSize]="'large'"></nz-spin>
-</div>
+</div>