cehn vor 7 Monaten
Ursprung
Commit
5b89046cc8

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

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

@@ -14,7 +14,7 @@
       后,对应作者姓名上传“作者政治审查表”,支持 PDF、JPG、JPEG、PNG 格式,大小不超过 2M。作者单位党委对作者进行审查,对政治思想表现情况进行评价,确保作者的正确政治方向、价值取向,无违法违纪等记录。
       教材编写成员涉及多个不同单位时需要各单位分别出具意见,并由所在单位党委盖章。 -->
     </div>
-    <nz-table #basicTable [nzData]="authorList" [nzScroll]="{ x: (maxWidth || '1200') + 'px' }">
+    <!-- <nz-table #basicTable [nzData]="authorList" [nzScroll]="{ x: (maxWidth || '1200') + 'px' }">
       <thead>
         <tr>
           <th nzWidth="80px" nzLeft nzAlign="right">序号</th>
@@ -27,10 +27,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>
@@ -69,12 +65,6 @@
           <td>
             {{data.work}}
           </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>
@@ -82,15 +72,56 @@
             <app-comp-upload [type]="'pdf'" (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> -->
             <a (click)="onDel('authorList', index)"><span nz-icon style="font-size: 20px" nzType="delete"
                 nzTheme="outline"></span></a>
           </td>
         </tr>
         }
       </tbody>
-    </nz-table>
+    </nz-table> -->
+    @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"
+          style="
+            background: #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-file
+              #children
+              [eduTextbook]="eduTextbook?.id"
+              [eduTextbookVolume]="panel"
+            ></app-author-file>
+          </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-file
+        #children
+        [eduTextbookVolume]="eduTextbook?.get('childrens')[0]"
+      ></app-author-file>
+      }
   </div>
  
   <div class="author-content">
@@ -331,4 +362,8 @@
   </button>
   <button nz-button nzType="primary" style="background: #3e49b3; border: 1px #3e49b3"
     (click)="submitForm('complete')">完成</button>
+</div>
+
+<div class="loading" [hidden]="!saveLoading">
+  <nz-spin nzSimple [nzSize]="'large'"></nz-spin>
 </div>

+ 13 - 0
projects/textbook/src/modules/nav-author/components/attachment/attachment.component.scss

@@ -62,4 +62,17 @@
 }
 .upText{
   color: gray;
+}
+.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;
 }

+ 86 - 53
projects/textbook/src/modules/nav-author/components/attachment/attachment.component.ts

@@ -1,4 +1,4 @@
-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';
@@ -25,7 +25,8 @@ import { textbookServer } from '../../../../services/textbook';
 import * as eduTextBook from '../../../../services/EduTextbook'
 import { HttpClient } from '@angular/common/http';
 import { Router } from '@angular/router'
-
+import { NzCollapseModule } from 'ng-zorro-antd/collapse';
+import{AuthorFileComponent} from '../create/author-file/author-file.component'
 
 @Component({
   selector: 'app-attachment',
@@ -36,9 +37,10 @@ import { Router } from '@angular/router'
     NzRadioModule,
     NzGridModule,
     NzCheckboxModule,
-    NzTableModule,
+    NzTableModule,NzCollapseModule,
     NzUploadModule,
     CompUploadComponent,DatePipe,
+    AuthorFileComponent
   ],
   standalone: true,
   templateUrl: './attachment.component.html',
@@ -50,6 +52,7 @@ export class AttachmentComponent implements OnInit {
   @Input('maxWidth') maxWidth: number = 0;
   @Output() state: EventEmitter<any> = new EventEmitter<any>();
   @Output() save: EventEmitter<any> = new EventEmitter<any>();
+  @ViewChildren(AuthorFileComponent) children: QueryList<AuthorFileComponent> | any;
 
   //填写诚信承诺是否正确
   confirmationValidator: ValidatorFn = (
@@ -118,7 +121,7 @@ export class AttachmentComponent implements OnInit {
       this.cipProveFile = this.eduTextbook?.get('cipProveFile') || this.cipProveFile
       this.unitMaterial = this.eduTextbook?.get('unitMaterial') || this.unitMaterial
       // this.examine = this.eduTextbook?.get('examine') || this.examine
-      this.authorList = this.eduTextbook?.get('authorList')
+      // this.authorList = this.eduTextbook?.get('authorList')
     }
   }
 
@@ -235,11 +238,11 @@ export class AttachmentComponent implements OnInit {
     })
     /* 检验authorList字段是否留空 */
     let authorListAuth
-    console.log(this.authorList);
-    authorListAuth = this.authorList.some((obj:any)=>{
-      return Object.keys(obj).some((item: string) => item!= 'signature' && !obj[item])
-    })
-    console.log(authorListAuth);
+    // console.log(this.authorList);
+    // authorListAuth = this.authorList.some((obj:any)=>{
+    //   return Object.keys(obj).some((item: string) => item!= 'signature' && !obj[item])
+    // })
+    // console.log(authorListAuth);
 
     if (isVrifly || authorListAuth) {
       this.msg.warning('已保存,存在未填项')
@@ -250,6 +253,8 @@ export class AttachmentComponent implements OnInit {
   }
 
   async submitForm(event?: string): Promise<void> {
+    if (this.saveLoading) return;
+    this.saveLoading = true;
     let params = {
       copyrightImgUrl: this.copyrightImgUrl,
       CIPImgUrl: this.CIPImgUrl,
@@ -259,28 +264,20 @@ export class AttachmentComponent implements OnInit {
       evidence: this.evidence,
       moreMaterial: this.moreMaterial,
       // examine: this.examine,
-      authorList:this.authorList
+      // authorList:this.authorList
       // unitMaterial: this.unitMaterial,
     }
     
     let isPageNull = this.examineNull()//检查本页空项
-    let isIgnoreFiled = this.isIgnoreFiledNull()//检查数据空项
+    // let isIgnoreFiled = this.isIgnoreFiledNull()//检查数据空项
     // console.log(isPageNull,isIgnoreFiled);
-    await this.saveEduTextbook(params, (!isPageNull && !isIgnoreFiled));
-
+    let isComplete = await this.saveEduTextbook(params, (!isPageNull));
     if (event == 'pre') {//上一步
       this.state.emit({ type: 'pre' });
       return;
-    }else
-    // await this.saveEduTextbook(params, (!isPageNull && !isIgnoreFiled));
-    if (event == 'complete') {
+    }else if (event == 'complete') {
       this.state.emit({ type: 'complete', textBook: this.eduTextbook });
-      if (isPageNull || isIgnoreFiled) {
-        console.log('教材填写不完整');
-      } else {
-        this.eduTextbook.set('complete', true)
-        this.eduTextbook.set('status', '102')
-        await this.eduTextbook.save()
+      if (isComplete) {
         this.msg.success('已填写完成')
       }
       this.router.navigate(['/nav-author/manage/space'])
@@ -294,42 +291,78 @@ export class AttachmentComponent implements OnInit {
     }
   }
 
-  async saveEduTextbook(params: any, isComplete: boolean) {
+  
+  /**上传分册数据 */
+  async saveEduTextbookVolume() {
+    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(isVrifly);
+      return isVrifly;
+    });
+  }
+  saveLoading: boolean = false;
+  async saveEduTextbook(params: any, isComplete: boolean):Promise<boolean|undefined> {
     console.log(isComplete);
     if (!this.eduTextbook) {
+      this.saveLoading = false;
       this.msg.error('请先创建教材');
       return;
     }
-    //如果填写未完整,仅保存,状态修改待完善101
-    if (this.eduTextbook.get('status') == '102' && !isComplete) {
-      this.eduTextbook?.set('status', '101');
-    } else if (!this.eduTextbook.get('status')) {
-      this.eduTextbook?.set('status', '101');
+    try {
+      //如果填写未完整,仅保存,状态修改待完善101
+      let complete = await this.saveEduTextbookVolume();
+        isComplete = isComplete && complete;
+      if (this.eduTextbook.get('status') == '102' && !isComplete) {
+        this.eduTextbook?.set('status', '101');
+      }
+      if(this.eduTextbook.get('complete') && isComplete){
+        this.eduTextbook.set('complete', true)
+        this.eduTextbook.set('status', '102')
+      }
+      this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
+      this.eduTextbook?.set('company', {
+        __type: 'Pointer',
+        className: 'Company',
+        objectId: this.tbookSer.company,
+      });
+      params.selfResults &&
+        this.eduTextbook?.set('selfResults', params.selfResults);
+      // params.unitMaterial &&
+      //   this.eduTextbook?.set('unitMaterial', params.unitMaterial);
+      params.expertOpinion &&
+        this.eduTextbook?.set('expertOpinion', params.expertOpinion);
+      params.evidence && this.eduTextbook?.set('evidence', params.evidence);
+      params.cipProveFile &&
+        this.eduTextbook?.set('cipProveFile', params.cipProveFile);
+      params.moreMaterial &&
+        this.eduTextbook?.set('moreMaterial', params.moreMaterial);
+      // params.examine &&
+      //   this.eduTextbook?.set('examine', params.examine);
+      this.eduTextbook?.set('copyrightImgUrl', params.copyrightImgUrl);
+      this.eduTextbook?.set('CIPImgUrl', params.CIPImgUrl);
+      // this.eduTextbook?.set('authorList', params.authorList);
+      await this.eduTextbook?.save();
+      this.saveLoading = false;
+      if (!isComplete) {
+        this.msg.warning('保存成功,但存在未填写完成项');
+      }
+      return isComplete;
+    } catch (err) {
+      console.warn('保存错误:', err);
+      this.saveLoading = false;
+      this.msg.error('保存出错');
     }
-    this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
-    this.eduTextbook?.set('company', {
-      __type: 'Pointer',
-      className: 'Company',
-      objectId: this.tbookSer.company,
-    });
-    params.selfResults &&
-      this.eduTextbook?.set('selfResults', params.selfResults);
-    // params.unitMaterial &&
-    //   this.eduTextbook?.set('unitMaterial', params.unitMaterial);
-    params.expertOpinion &&
-      this.eduTextbook?.set('expertOpinion', params.expertOpinion);
-    params.evidence && this.eduTextbook?.set('evidence', params.evidence);
-    params.cipProveFile &&
-      this.eduTextbook?.set('cipProveFile', params.cipProveFile);
-    params.moreMaterial &&
-      this.eduTextbook?.set('moreMaterial', params.moreMaterial);
-    // params.examine &&
-    //   this.eduTextbook?.set('examine', params.examine);
-    this.eduTextbook?.set('copyrightImgUrl', params.copyrightImgUrl);
-    this.eduTextbook?.set('CIPImgUrl', params.CIPImgUrl);
-    this.eduTextbook?.set('authorList', params.authorList);
-    await this.eduTextbook?.save();
-    return;
+    this.saveLoading = false;
+    return isComplete;
   }
   upload(e: any, type: string, index?: any) {
     let file = e[(e?.length - 1) || 0];
@@ -346,7 +379,7 @@ export class AttachmentComponent implements OnInit {
     }else if(type == 'cipProveFile'){
       this[type] = [ { name: file.name, url: file.url }]
     }
-    console.log(this.authorList)
+    // console.log(this.authorList)
   }
 
 

+ 4 - 1
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.ts

@@ -188,7 +188,7 @@ export class BasicInComponent implements OnInit {
       this.eduTextbook?.set('childrens', eduTextbookVolumes.list);
       this.eduTextbook?.set('typeNumber', eduTextbookVolumes.list.length);
       
-      isComplete = eduTextbookVolumes?.isVrifly;
+      isComplete = isComplete && eduTextbookVolumes?.isVrifly;
       //如果填写未完整,仅保存,状态修改待完善101
       if (this.eduTextbook.get('status') == '102' && !isComplete) {
         this.eduTextbook?.set('status', '101');
@@ -196,6 +196,9 @@ export class BasicInComponent implements OnInit {
       } else if (!this.eduTextbook.get('status')) {
         this.eduTextbook?.set('status', '101');
       }
+      if(isComplete){
+        this.eduTextbook.set('complete', true)
+      }
       await this.eduTextbook?.save();
       this.saveLoading = false;
       if (!isComplete) {

+ 101 - 3
projects/textbook/src/modules/nav-author/components/create/author-file/author-file.component.html

@@ -1,3 +1,101 @@
-<p>
-  author-file works!
-</p>
+<nz-table
+  #basicTable
+  [nzData]="authorList"
+  [nzScroll]="{ x: (maxWidth || '1200') + 'px' }"
+>
+  <thead>
+    <tr>
+      <th nzWidth="80px" nzLeft nzAlign="right">序号</th>
+      <th nzWidth="160px" nzLeft>姓名</th>
+      <th nzWidth="160px">单位</th>
+      <th nzWidth="160px">出生年月</th>
+      <th nzWidth="160px">国籍</th>
+      <th nzWidth="160px">职务</th>
+      <th nzWidth="160px">职称</th>
+      <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>
+  <tbody>
+    @for (data of authorList; track data.mobile;let index = $index) {
+    <tr>
+      <td nzLeft nzAlign="right">{{ index + 1 }}</td>
+      <td nzLeft>
+        {{ data.name }}
+      </td>
+      <td>
+        {{ data.unit }}
+      </td>
+      <td>
+        {{ data.birth | date : "yyyy-MM" }}
+      </td>
+      <td>
+        {{ data.nationality }}
+      </td>
+      <td>
+        {{ data.job }}
+      </td>
+      <td>
+        {{ data.title }}
+      </td>
+      <td>
+        {{ data.mobile }}
+      </td>
+      <td>
+        {{ data.email }}
+      </td>
+      <td>
+        {{ data.work }}
+      </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
+          [type]="'pdf'"
+          (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> -->
+        @if (authorList.length > 1) {
+        <a (click)="onDel(index)"
+          ><span
+            nz-icon
+            style="font-size: 20px"
+            nzType="delete"
+            nzTheme="outline"
+          ></span
+        ></a>
+        }@else {
+        <span
+          nz-icon
+          style="font-size: 20px"
+          nzType="delete"
+          nzTheme="outline"
+        ></span>
+        }
+      </td>
+    </tr>
+    }
+  </tbody>
+</nz-table>

+ 109 - 6
projects/textbook/src/modules/nav-author/components/create/author-file/author-file.component.ts

@@ -1,14 +1,117 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
+import { CommonCompModule } from '../../../../../services/common.modules';
+import { NzSelectModule } from 'ng-zorro-antd/select';
+import { ReactiveFormsModule } from '@angular/forms';
+import { NzRadioModule } from 'ng-zorro-antd/radio';
+import { NzMessageService } from 'ng-zorro-antd/message';
+import { NzGridModule } from 'ng-zorro-antd/grid';
+import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
+import { NzTableModule } from 'ng-zorro-antd/table';
+import { NzModalService } from 'ng-zorro-antd/modal';
+import { CompUploadComponent } from '../../../../../app/comp-upload/comp-upload.component';
+import {
+  FormControl,
+  FormGroup,
+  NonNullableFormBuilder,
+  Validators,
+} from '@angular/forms';
+import Parse from 'parse';
+import { DatePipe } from '@angular/common';
 
+interface author {
+  name: string;
+  unit: string;
+  birth: Date | any;
+  nationality: string;
+  job: string;
+  title: string;
+  mobile: string;
+  email: string;
+  work: string;
+  signature?: string;
+  examine?: string;
+}
 @Component({
   selector: 'app-author-file',
   templateUrl: './author-file.component.html',
   styleUrls: ['./author-file.component.scss'],
+  imports: [
+    CommonCompModule,
+    ReactiveFormsModule,
+    NzSelectModule,
+    NzRadioModule,
+    NzGridModule,
+    NzCheckboxModule,
+    NzTableModule,
+    DatePipe,
+    CompUploadComponent,
+  ],
+  standalone: true,
+  providers: [DatePipe],
 })
-export class AuthorFileComponent  implements OnInit {
-
-  constructor() { }
-
-  ngOnInit() {}
+export class AuthorFileComponent implements OnInit {
+  @Input('eduTextbook') eduTextbook: Parse.Object | any;
+  @Input('maxWidth') maxWidth: number = 0;
+  @Input('eduTextbookVolume') eduTextbookVolume: Parse.Object | any;
 
+  //作者信息
+  authorList: Array<author> = [
+    {
+      name: '',
+      unit: '',
+      birth: new Date('December 1, 1975 00:00:00'),
+      nationality: '',
+      job: '',
+      title: '',
+      mobile: '',
+      email: '',
+      work: '',
+      signature: '',
+      examine: '',
+    },
+  ];
+  constructor(
+    private msg: NzMessageService
+  ) {}
+  ngOnInit() {
+    let id = this?.eduTextbookVolume?.id || this?.eduTextbookVolume?.objectId;
+    if (id) {
+      this.getEduTextbookVolume(id);
+    }
+  }
+  async getEduTextbookVolume(id: string) {
+    let query = new Parse.Query('EduTextbookVolume');
+    query.equalTo('objectId', id);
+    let r = await query.first();
+    this.eduTextbookVolume = r;
+    this.authorList =
+      this.eduTextbookVolume.get('authorList') || this.authorList;
+  }
+  upload(e: any, type: string, index?: any) {
+    let file = e[e?.length - 1 || 0];
+    if (type == 'signature' || type == 'examine') {
+      this.authorList[index][type] = file?.url;
+    }
+    console.log(this.authorList);
+  }
+  async submitForm(): Promise<boolean> {
+    let coursesVrifly = !this.authorList.some((item) =>
+      Object.values(item).some((val) => val == '' || val == undefined)
+    );
+    this.eduTextbookVolume?.set('authorList', this.authorList);
+    await this.eduTextbookVolume?.save();
+    return coursesVrifly;
+  }
+  openFile(url: string) {
+    console.log(url);
+    window.open(url);
+  }
+  //删除作者信息
+  onDel(idx: number) {
+    if (this.authorList.length <= 1) {
+      this.msg.warning('至少保留一项')
+      return;
+    }
+    this.authorList.splice(idx, 1);
+  }
 }

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

@@ -22,12 +22,10 @@ import {
   AbstractControl,
 } from '@angular/forms';
 import { textbookServer } from '../../../../services/textbook';
-import * as eduTextBook from '../../../../services/EduTextbook'
+import * as eduTextBook from '../../../../services/EduTextbook';
 import { HttpClient } from '@angular/common/http';
-import { Router } from '@angular/router'
-import { FormBuilder} from '@angular/forms';
-
-
+import { Router } from '@angular/router';
+import { FormBuilder } from '@angular/forms';
 
 @Component({
   imports: [
@@ -39,7 +37,8 @@ import { FormBuilder} from '@angular/forms';
     NzCheckboxModule,
     NzTableModule,
     NzUploadModule,
-    CompUploadComponent,DatePipe
+    CompUploadComponent,
+    DatePipe,
   ],
   standalone: true,
   selector: 'app-faith',
@@ -47,20 +46,17 @@ import { FormBuilder} from '@angular/forms';
   styleUrls: ['./faith.component.scss'],
   providers: [DatePipe],
 })
-export class FaithComponent  implements OnInit {
-
-
+export class FaithComponent implements OnInit {
   @Input('eduTextbook') eduTextbook: any;
   @Input('maxWidth') maxWidth: number = 0;
   @Output() state: EventEmitter<any> = new EventEmitter<any>();
   @Output() save: EventEmitter<any> = new EventEmitter<any>();
 
-  
   /**申报单位承诺意见 */
   unitMaterial: any = {
     name: '',
     url: '',
-  }
+  };
   constructor(
     public tbookSer: textbookServer,
     private msg: NzMessageService,
@@ -68,13 +64,11 @@ export class FaithComponent  implements OnInit {
     private http: HttpClient,
     private router: Router,
     private formBuilder: FormBuilder,
-    private fb: NonNullableFormBuilder,
-  ) { }
+    private fb: NonNullableFormBuilder
+  ) {}
   ngOnInit() {
     if (this.eduTextbook.id) {
-
-      this.value = this.eduTextbook.get('accept') || ''
-
+      this.value = this.eduTextbook.get('accept') || '';
 
       // this.validateForm = this.fb.group({
       //   // unitMaterial: [this.eduTextbook.get('unitMaterial')?.text||'' , [Validators.maxLength(200)]],
@@ -82,27 +76,30 @@ export class FaithComponent  implements OnInit {
       // });
     }
   }
-  value:string=''
-
+  value: string = '';
 
   async submitForm(event?: string): Promise<void> {
-    if(this.value!='本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'){
+    if (
+      this.value !=
+      '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'
+    ) {
       this.msg.error('诚信承诺输入错误,请正确输入(注意标点符号)');
       // return
     }
     // let params: any = this.validateForm.value;
     // console.log(params)
-    let params = {accept:this.value}
+    let params = { accept: this.value };
     await this.saveEduTextbook(params);
 
-    if (event == 'pre') {//上一步
+    if (event == 'pre') {
+      //上一步
       this.state.emit({ type: 'pre' });
       return;
     }
-    if(event == 'next'){//下一步
-      this.state.emit({type:'next',textBook:this.eduTextbook});
-    }
-    else if (event == 'save') {
+    if (event == 'next') {
+      //下一步
+      this.state.emit({ type: 'next', textBook: this.eduTextbook });
+    } else if (event == 'save') {
       this.modal.success({
         nzTitle: '保存成功',
         nzContent: '<p>已保存并且至空间</p>',
@@ -110,12 +107,9 @@ export class FaithComponent  implements OnInit {
       });
       return;
     }
-
-    
   }
 
   async saveEduTextbook(params: any) {
-    
     if (!this.eduTextbook) {
       this.msg.error('请先创建教材');
       return;
@@ -128,8 +122,23 @@ export class FaithComponent  implements OnInit {
     });
     // params.unitMaterial &&
     //   this.eduTextbook?.set('unitMaterial',{text:params.unitMaterial} );
-      params.accept &&
-      this.eduTextbook?.set('accept', params.accept);
+    params.accept && this.eduTextbook?.set('accept', params.accept);
+    if (
+      this.eduTextbook.get('status') == '102' &&
+      this.value !=
+        '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'
+    ) {
+      this.eduTextbook?.set('status', '101');
+      this.eduTextbook.set('complete', false);
+    } else if (!this.eduTextbook.get('status')) {
+      this.eduTextbook?.set('status', '101');
+    }
+    if (
+      this.value ==
+      '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'
+    ) {
+      this.eduTextbook.set('complete', true);
+    }
     await this.eduTextbook?.save();
     return;
   }
@@ -141,8 +150,6 @@ export class FaithComponent  implements OnInit {
   //   }
   // }
 
-
-
   // /**获取文件名 */
   // getFileName(url: string) {
   //   if (!url) return ''
@@ -171,7 +178,6 @@ export class FaithComponent  implements OnInit {
   //   window.open(url)
   // }
 
-
   // validateForm: FormGroup<{
   //   // unitMaterial: FormControl<string | null>;
   //   accept: FormControl<string | null>;
@@ -180,11 +186,11 @@ export class FaithComponent  implements OnInit {
   //   accept: ['', [Validators.maxLength(100)]]
 
   // });
-  changeAccept(){
-    console.log(this.value)
-    let str = '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'
-    if(str.indexOf(this.value)==-1){
-      this.msg.create('warning','请正确输入内容')
+  changeAccept() {
+    console.log(this.value);
+    let str = '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。';
+    if (str.indexOf(this.value) == -1) {
+      this.msg.create('warning', '请正确输入内容');
     }
   }
 }

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

@@ -229,7 +229,6 @@ export class TextbookContentComponent implements OnInit {
 
   /**上传分册数据 */
   async saveEduTextbookVolume() {
-    let arr = []; //存储返回的数组id
     let isVrifly = true; //默认都通过,若一项填写未完成,则不通过
     return Promise.all(
       this.children.map(async (comp: any) => {
@@ -264,6 +263,9 @@ export class TextbookContentComponent implements OnInit {
       } else if (!this.eduTextbook.get('status')) {
         this.eduTextbook?.set('status', '101');
       }
+      if(isComplete){
+        this.eduTextbook.set('complete', true)
+      }
       this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
       this.eduTextbook?.set('company', {
         __type: 'Pointer',

+ 3 - 0
projects/textbook/src/modules/nav-author/components/textbook-pertain/textbook-pertain.component.ts

@@ -411,6 +411,9 @@ export class TextbookPertainComponent implements OnInit {
       } else if (!this.eduTextbook.get('status')) {
         this.eduTextbook?.set('status', '101');
       }
+      if(isComplete){
+        this.eduTextbook.set('complete', true)
+      }
       this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
       this.eduTextbook?.set('company', {
         __type: 'Pointer',