xll 7 ヶ月 前
コミット
c42c8482b6

+ 15 - 228
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.html

@@ -79,7 +79,7 @@
           <nz-radio-group style="display: flex; flex-direction: column" formControlName="type">
             <label nz-radio nzValue="单册">单册</label>
             <div class="basic-row">
-              <label (click)="accordion?.openAll()" nz-radio nzValue="全册">全册</label>
+              <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"
@@ -110,237 +110,24 @@
 
     <mat-accordion class="example-headers-align" multi>
 
-      <mat-expansion-panel>
-        <mat-expansion-panel-header>
-          <mat-panel-title>
-            <b>{{validateForm.value.type =='单册'?'单册':'分册1'}}</b>
-          </mat-panel-title>
-        </mat-expansion-panel-header>
-        <nz-form-item style="margin-bottom: 16px">
-          <nz-form-label [nzSm]="8" [nzNoColon]="true" [nzXs]="8" nzRequired>国际标准书号(ISBN)</nz-form-label>
-          <nz-form-control nzErrorTip="请输入国际标准书号,仅可输入数字" [nzSm]="12" [nzXs]="12">
-            <nz-input-group nzSearch [nzAddOnAfter]="autoButton">
-              <input type="number" nz-input formControlName="ISBN" placeholder="请输入国际标准书号,仅可输入数字" />
-            </nz-input-group>
-            <ng-template #autoButton>
-              <button (click)="autoCompleteByISBN()" nz-button nzType="primary">获取教材信息</button>
-            </ng-template>
-          </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-input-group>
-              <input type="text" nz-input formControlName="author" 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-input-group>
-              <input type="text" nz-input formControlName="unit" 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-input-group>
-              <nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择第一主编(作者)单位类型" formControlName="unitType">
-                @for(type of unitSelects; track type.code;let index = $index){
-                <nz-option nzCustomContent [nzValue]="type.name" [nzLabel]="type.name">
-                  <div>{{ type.name }}</div>
-                </nz-option>
-                }
-              </nz-select>
-            </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-input-group>
-              <nz-select nzShowSearch nzAllowClear nzPlaceHolder="选择教材主要语种" formControlName="lang">
-                @for(lang of selectLang; track lang.lang;let index = $index){
-                <nz-option nzCustomContent [nzValue]="lang.name" [nzLabel]="lang.name">{{ lang.name }}</nz-option>
-                }
-              </nz-select>
-            </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">其他主编姓名</nz-form-label>
-          <nz-form-control nzErrorTip="请输入其他主编姓名,使用「;」隔开" [nzSm]="12" [nzXs]="12">
-            <nz-input-group>
-              <textarea type="text" nz-input formControlName="authors" placeholder="请输入其他主编姓名,使用「;」隔开"></textarea>
-            </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">其他编者姓名</nz-form-label>
-          <nz-form-control nzErrorTip="请输入其他编者姓名,使用「;」隔开" [nzSm]="12" [nzXs]="12">
-            <nz-input-group>
-              <textarea type="text" nz-input formControlName="editor" placeholder="请输入其他编者姓名,使用「;」隔开"></textarea>
-            </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>
-          @if (!isShowChooseEU) {
-          <p title="点击更改出版单位" (click)="isShowChooseEU=true" style="margin-top: 6px;color: rgb(0, 140, 255);">
-            {{validateForm.value.editionUnit}}</p>
-          }@else{
-          <nz-form-control nzErrorTip="请输入出版单位" [nzSm]="12" [nzXs]="12">
-            <nz-input-group>
-              <nz-select nzShowSearch nzServerSearch nzPlaceHolder="选择出版单位" formControlName="editionUnit"
-                [nzShowArrow]="false" [nzFilterOption]="nzFilterOption" (nzOnSearch)="search($event)">
-                @for(edu of eduList; track edu;let index = $index){
-                <nz-option nzCustomContent [nzLabel]="edu?.get('name')" [nzValue]="edu?.get('name')">
-                  {{edu?.get('name')}}
-                </nz-option>
-                }
-              </nz-select>
-            </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-input-group>
-              <nz-date-picker nzMode="month" style="width: 100%" formControlName="editionFirst"></nz-date-picker>
-            </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>
-            载体形式
-            <span style="padding: 0 5px;" nz-icon nzType="info-circle" nzTheme="outline"></span>
-          </nz-form-label>
-          <nz-form-control nzErrorTip="请输入载体形式" [nzSm]="12" [nzXs]="12">
-            <nz-input-group>
-              <nz-select nzShowSearch nzAllowClear nzPlaceHolder="选择载体形式" formControlName="carrierShape">
-                @for(item of carrierOptions; track item.code;let index = $index){
-                <nz-option nzCustomContent [nzValue]="item.name" [nzLabel]="item.name">{{ item.name }}</nz-option>
-                }
-              </nz-select>
-            </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-input-group>
-              <div class="basic-row">
-                <nz-date-picker nzMode="month" style="flex: 1" formControlName="editionDate"></nz-date-picker>
-                <nz-input-group style="width: 100px; margin-left: 20px" [nzSuffix]="suffixTemplateInfo">
-                  <input type="number" formControlName="editionNumber" nz-input placeholder="输入版次" />
-                </nz-input-group>
-                <ng-template #suffixTemplateInfo> 版 </ng-template>
-              </div>
-            </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-input-group>
-              <div class="basic-row">
-                <nz-date-picker nzMode="month" style="flex: 1" formControlName="printDate"
-                  [nzDisabledDate]="disabledEditionDate"></nz-date-picker>
-                <nz-input-group style="width: 100px; margin-left: 20px" [nzSuffix]="suffixTemplateInfo02">
-                  <input type="number" formControlName="printNumber" nz-input placeholder="输入印次" />
-                </nz-input-group>
-                <ng-template #suffixTemplateInfo02> 次 </ng-template>
-              </div>
-            </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-input-group>
-              <nz-input-group [nzSuffix]="suffixTemplateInfo02">
-                <input type="number" formControlName="printSum" nz-input placeholder="输入合计印数" />
-              </nz-input-group>
-              <ng-template #suffixTemplateInfo02> 册 </ng-template>
-            </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">初版以来是否列为重点项目</nz-form-label>
-          <nz-form-control nzErrorTip="" [nzSm]="12" [nzXs]="12">
-            <nz-checkbox-wrapper>
-              @for (item of importantProjectList; track item.value) {
-              <label style="margin: 0;padding: 0;" [ngModelOptions]="{standalone: true}" nz-checkbox
-                [nzValue]="item.value" [(ngModel)]="item.checked">{{item.value}}</label>
-              <br>
-              }
-            </nz-checkbox-wrapper>
-            @if (importantProjectList[4].checked) {
-            <input type="text" formControlName="importantProjectOther" placeholder="请输入入选项目名称" nz-input />
-            }
-            <!-- <nz-input-group>
-              <nz-radio-group style="display: flex; flex-direction: column" formControlName="importantProject">
-                @for (item of importantProjectList; track item.value) {
-                <label (click)="onChangeRadio()" nz-radio [nzValue]="item.value">{{item.title}}</label>
-                }
-                @if (validateForm.value.importantProject == '其他省部级及以上项目') {
-                <input type="text" formControlName="importantProjectOther" placeholder="请输入入选项目名称" nz-input />
-                }
-                <label nz-radio nzValue="否">否</label>
-              </nz-radio-group>
-            </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-input-group>
-              <app-comp-upload [width]="320" (change)="upload($event, 'copyrightImgUrl')" title="上传截图"></app-comp-upload>
-            </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>中国版本图书馆CIP查询截图</nz-form-label>
-          <nz-form-control nzErrorTip="" [nzSm]="12" [nzXs]="12">
-            <nz-input-group>
-              <div class="row-block">
-                <app-comp-upload [width]="320" (change)="upload($event, 'CIPImgUrl')" title="上传截图"></app-comp-upload>
-                <div class="tips">
-                  <span nz-icon nzType="exclamation-circle" nzTheme="fill"
-                    style="font-size: 16px; color: #3e49b3; margin-right: 4px"></span>如 CIP
-                  数据中无“教材”字样的,须再上传内容提要或前言或后记中可以证明本书为教材的相关内容截图
-                </div>
-              </div>
-            </nz-input-group>
-          </nz-form-control>
-        </nz-form-item> -->
-
-      </mat-expansion-panel>
-
 
 
       @if(validateForm.value.type=='全册'){
-
-      @for (item of eduTextbookVolumeList; track $index) {
-      <mat-expansion-panel>
-        <mat-expansion-panel-header>
-          <mat-panel-title>
-            <b>分册{{$index+2}}</b>
-          </mat-panel-title>
-        </mat-expansion-panel-header>
-        <app-one ></app-one>
-      </mat-expansion-panel>
+        @for (item of eduTextbookVolumeList; track $index) {
+        <mat-expansion-panel>
+          <mat-expansion-panel-header>
+            <mat-panel-title>
+              <b>分册{{$index+1}}</b>
+              <span style="margin-left: 20px;" nz-icon nzType="delete"></span>
+            </mat-panel-title>
+          </mat-expansion-panel-header>
+          <app-one #children [eduTextbookId]="eduTextbook?.id" [eduTextbookVolumeId]="item?.objectId"></app-one>
+        </mat-expansion-panel>
+        }
       }
+      @else {
+        
+        <app-one #children [eduTextbookId]="eduTextbook?.id" [eduTextbookVolumeId]="eduTextbookVolumeList[0]?.objectId"></app-one>
 
       }
     </mat-accordion>

+ 125 - 71
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.ts

@@ -35,7 +35,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
 import { MatIconModule } from '@angular/material/icon';
 import { MatButtonModule } from '@angular/material/button';
 import { provideNativeDateAdapter } from '@angular/material/core';
-
+import { ViewChildren, QueryList } from '@angular/core';
 
 @Component({
   selector: 'app-basic',
@@ -73,12 +73,125 @@ export class BasicInComponent implements OnInit {
 
   @ViewChild(MatAccordion) accordion: MatAccordion | any;
 
+
+
+  @ViewChildren(BasicComponent) children: QueryList<BasicComponent> | any;
+
+
+  /**上传分册数据 */
+  async saveEduTextbookVolume() {
+    let arr = [] //存储返回的数组id
+    let isVrifly = true //默认都通过,若一项填写未完成,则不通过
+    return Promise.all(this.children.map(async (comp: any) => {
+      console.log(comp);
+      let req = await comp.saveEduTextbook()
+      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,
+    });
+    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)
+    await this.eduTextbook?.save();
+    this.saveEduTextbookVolume()
+    return
+  }
+
+
+
+
+
+
+
+
+
+
   ngAfterViewInit() {
     this.accordion?.openAll()
     this.cdr.detectChanges()
+    this.getEduTextbookVolumeList()
+
+  }
+  /**扩展表记录 */
+  eduTextbookVolumeList: Array<any> = []
+  /**获取扩展表记录 */
+  async getEduTextbookVolumeList() {
+    console.log(this.validateForm?.value?.type)
+    // if(this.validateForm?.value?.type=='全册'){
+    let query = new Parse.Query('EduTextbookVolume')
+    query.equalTo('eduTextbook', this.eduTextbook?.id)
+    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)
+    this.eduTextbookVolumeList = new Array(this.typeNumber).fill({ objectId: '' })
+    for (let i in list) {
+      this.eduTextbookVolumeList[i] = { objectId: list[i]?.id }
+    }
+    // }
+  }
+  /**申报类型选择全册 */
+  checkAll() {
+    this.validateForm.get("type")?.setValue('全册')
+
+    this.accordion?.openAll()
+    this.getEduTextbookVolumeList()
   }
-    /**扩展表记录 */
-    eduTextbookVolumeList: Array<any> = []
   ngOnInit() {
     if (this.eduTextbook?.get('editionUnit')) {
       this.isShowChooseEU = false
@@ -94,15 +207,7 @@ export class BasicInComponent implements OnInit {
 
     this.approvedImgList[0].url = this.eduTextbook?.get('approvedImgUrl')
     this.typeNumber = this.eduTextbook?.get('typeNumber') || 2
-    if(this.eduTextbook?.get('type')=='全册'){
-      let query = new Parse.Query('eduTextbookVolume')
-      
-      this.eduTextbookVolumeList=new Array(this.typeNumber-1).fill(false)
-      console.log(this.eduTextbookVolumeList)
-    }
-    
 
-      
     // console.log(this.approvedImgList)
     console.log(this.eduTextbook);
     this.validateForm = this.fb.group({
@@ -185,14 +290,15 @@ export class BasicInComponent implements OnInit {
       this.msg.create('warning', '不得小于两册')
       this.typeNumber = 2
     } else {
-      
+
     }
-    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)
+    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<{
@@ -366,7 +472,7 @@ export class BasicInComponent implements OnInit {
   }
 
   isShowChooseEU: boolean = true
- 
+
 
   upload(e: any, type: string) {
     console.log(e);
@@ -414,59 +520,7 @@ export class BasicInComponent implements OnInit {
     }
   }
 
-  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,
-    });
-    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)
 
-    await this.eduTextbook?.save();
-    return
-  }
 
 
 

+ 47 - 35
projects/textbook/src/modules/nav-author/components/create/basic/basic.component.ts

@@ -42,6 +42,10 @@ import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
 export class BasicComponent implements OnInit {
   /**传递的分册记录id */
   @Input('eduTextbookVolumeId') eduTextbookVolumeId: string | any
+  /** 所属教材id*/
+  @Input('eduTextbookId') eduTextbookId: string | any
+
+
 
 
   /**分册记录Parse */
@@ -49,14 +53,14 @@ export class BasicComponent implements OnInit {
 
 
 
-  ngAfterViewInit(): void { }
-  ngOnInit() {
+  ngAfterViewInit(): void {
     this.refersh()
   }
+  ngOnInit() { }
   /**获取扩展分册记录 */
   async getEduTextbookVolume() {
     if (this.eduTextbookVolumeId) {
-      let query = new Parse.Query('eduTextbookVolume')
+      let query = new Parse.Query('EduTextbookVolume')
       this.eduTextbookVolume = await query.get(this.eduTextbookVolumeId)
       console.log(this.eduTextbookVolume);
     } else {
@@ -76,7 +80,6 @@ export class BasicComponent implements OnInit {
         }
       }
     }
-
     this.validateForm = this.fb.group({
       ISBN: [parseInt(this.eduTextbookVolume?.get('ISBN') || '') || null, [Validators.required]],
       author: [this.eduTextbookVolume?.get('author') || '', [Validators.required]],
@@ -96,7 +99,45 @@ export class BasicComponent implements OnInit {
       unitType: [this.eduTextbookVolume?.get('unitType') || '', [Validators.required]],
     });
   }
-
+  async saveEduTextbook() {
+    console.log('执行了分册组件的save方法')
+    if(!this.eduTextbookId){
+      this.msg.create('error','出错了,教材id未获取')
+      return
+    }
+    let params = this.validateForm.value
+    this.changeImportantProject()
+    console.log(params);
+    if (!this.eduTextbookVolume) {
+      let obj = Parse.Object.extend('EduTextbookVolume');
+      this.eduTextbookVolume = new obj();
+    }
+    this.eduTextbookVolume?.set('eduTextbook',{
+      __type: 'Pointer',
+      className: 'EduTextbook',
+      objectId: this.eduTextbookId,
+    })
+    this.eduTextbookVolume?.set('user', Parse.User.current()?.toPointer());
+    this.eduTextbookVolume?.set('ISBN', (params.ISBN || 0).toString());
+    this.eduTextbookVolume?.set('author', params.author);
+    this.eduTextbookVolume?.set('unit', params.unit);
+    this.eduTextbookVolume?.set('lang', params.lang);
+    this.eduTextbookVolume?.set('authors', params.authors);
+    this.eduTextbookVolume?.set('editor', params.editor);
+    this.eduTextbookVolume?.set('editionUnit', params.editionUnit);
+    this.eduTextbookVolume?.set('editionFirst', params.editionFirst);
+    this.eduTextbookVolume?.set('carrierShape', params.carrierShape);
+    this.eduTextbookVolume?.set('editionDate', params.editionDate);
+    this.eduTextbookVolume?.set('editionNumber', params.editionNumber);
+    this.eduTextbookVolume?.set('printDate', params.printDate);
+    this.eduTextbookVolume?.set('printNumber', params.printNumber);
+    this.eduTextbookVolume?.set('printSum', params.printSum);
+    this.eduTextbookVolume?.set('importantProject', this.importantProject);
+    this.eduTextbookVolume?.set('importantProjectOther', params.importantProjectOther);
+    this.eduTextbookVolume?.set('unitType', params.unitType)
+    let save = await this.eduTextbookVolume?.save();
+    return save
+  }
 
   changeCode() { }
   getCode(e: any) { }
@@ -236,7 +277,7 @@ export class BasicComponent implements OnInit {
   ];
   /**选中的重点项目 */
   importantProject: Array<any> = []
-  /**多选框改变 */
+  /**多选框改变/获取选中的重点项目 */
   changeImportantProject() {
     let checkedList = this.importantProjectList.filter(item => item.checked) || []
     this.importantProject = checkedList.map(item => item.value)
@@ -264,36 +305,7 @@ export class BasicComponent implements OnInit {
   }
 
 
-  async saveEduTextbook(params: any, isComplete: boolean) {
-    this.changeImportantProject()
-    console.log(params);
-    if (!this.eduTextbookVolume) {
-      let obj = Parse.Object.extend('EduTextbook');
-      this.eduTextbookVolume = new obj();
-    }
-
-
-    this.eduTextbookVolume?.set('user', Parse.User.current()?.toPointer());
 
-    this.eduTextbookVolume?.set('ISBN', (params.ISBN || 0).toString());
-    this.eduTextbookVolume?.set('author', params.author);
-    this.eduTextbookVolume?.set('unit', params.unit);
-    this.eduTextbookVolume?.set('lang', params.lang);
-    this.eduTextbookVolume?.set('authors', params.authors);
-    this.eduTextbookVolume?.set('editor', params.editor);
-    this.eduTextbookVolume?.set('editionUnit', params.editionUnit);
-    this.eduTextbookVolume?.set('editionFirst', params.editionFirst);
-    this.eduTextbookVolume?.set('carrierShape', params.carrierShape);
-    this.eduTextbookVolume?.set('editionDate', params.editionDate);
-    this.eduTextbookVolume?.set('editionNumber', params.editionNumber);
-    this.eduTextbookVolume?.set('printDate', params.printDate);
-    this.eduTextbookVolume?.set('printNumber', params.printNumber);
-    this.eduTextbookVolume?.set('printSum', params.printSum);
-    this.eduTextbookVolume?.set('importantProject', this.importantProject);
-    this.eduTextbookVolume?.set('importantProjectOther', params.importantProjectOther);
-    this.eduTextbookVolume?.set('unitType', params.unitType)
-    await this.eduTextbookVolume?.save();
-  }
   nzFilterOption = (): boolean => true;
   /** 搜索出版单位防抖定时器*/
   eduTimeout: any