|
@@ -24,6 +24,9 @@ import {
|
|
|
import { textbookServer } from '../../../../services/textbook';
|
|
|
import * as eduTextBook from '../../../../services/EduTextbook'
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
+import { Router} from '@angular/router'
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-attachment',
|
|
@@ -94,7 +97,8 @@ export class AttachmentComponent implements OnInit {
|
|
|
public tbookSer: textbookServer,
|
|
|
private msg: NzMessageService,
|
|
|
private modal: NzModalService,
|
|
|
- private http: HttpClient
|
|
|
+ private http: HttpClient,
|
|
|
+ private router:Router
|
|
|
) { }
|
|
|
ngOnInit() {
|
|
|
if (this.eduTextbook.id) {
|
|
@@ -144,7 +148,7 @@ export class AttachmentComponent implements OnInit {
|
|
|
isNull = true
|
|
|
}
|
|
|
if (isNull) {
|
|
|
- this.msg.create('error', `请上传完整 ${msgList.join()}`)
|
|
|
+ // this.msg.create('error', `请上传完整 ${msgList.join()}`)
|
|
|
}
|
|
|
return isNull
|
|
|
}
|
|
@@ -153,32 +157,32 @@ export class AttachmentComponent implements OnInit {
|
|
|
isIgnoreFiledNull() {
|
|
|
let selectList = this.eduTextbook?.get('characteristic')
|
|
|
let check = false
|
|
|
- for(let i in selectList){
|
|
|
- if(selectList[i].label=='通识课'||selectList[i].label=='公共基础课'||selectList[i].label=='专业课'){
|
|
|
- if(selectList[i].checked) {
|
|
|
- check=true
|
|
|
+ for (let i in selectList) {
|
|
|
+ if (selectList[i].label == '通识课' || selectList[i].label == '公共基础课' || selectList[i].label == '专业课') {
|
|
|
+ if (selectList[i].checked) {
|
|
|
+ check = true
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(!check){
|
|
|
- this.msg.create('warning','请返回选择适用课程性质')
|
|
|
+ if (!check) {
|
|
|
+ // this.msg.create('warning', '请返回选择适用课程性质')
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
let eduColumn = eduTextBook.EduTextbook.fields
|
|
|
let ignoreFiled = [
|
|
|
- 'typeNumber', 'code','editionNumber', 'importantProjectOther',
|
|
|
+ 'typeNumber', 'code', 'editionNumber', 'importantProjectOther',
|
|
|
'textbookFiles', 'createdAt', 'updatedAt', 'copyright', 'authorSign',
|
|
|
'CIP', 'isDeleted', 'opinions', 'printNumber', 'printSum', 'render',
|
|
|
'importantProject', 'importantProjectOther', 'complete', 'links', 'recommend',
|
|
|
'printSun', 'discard', 'edition', 'eduProcess', 'authors', 'editor',
|
|
|
'copyrightImgUrl', 'CIPImgurl', 'selfResults', 'expertOpinion', 'evidence',
|
|
|
- 'moreMaterial', 'unitMaterial','approvedImgUrl','department'
|
|
|
+ 'moreMaterial', 'unitMaterial', 'approvedImgUrl', 'department'
|
|
|
] //非必填字段
|
|
|
let textBookJson = this.eduTextbook.toJSON()
|
|
|
|
|
|
-
|
|
|
+
|
|
|
let isVrifly = Object.keys(eduColumn).some((item: string) => {
|
|
|
if (!ignoreFiled.includes(item) && (textBookJson[item] === '' || textBookJson[item] === undefined || textBookJson[item] === null)) {
|
|
|
console.warn('字段未填写:' + item)
|
|
@@ -204,27 +208,26 @@ export class AttachmentComponent implements OnInit {
|
|
|
moreMaterial: this.moreMaterial,
|
|
|
unitMaterial: this.unitMaterial,
|
|
|
}
|
|
|
- await this.saveEduTextbook(params, true);
|
|
|
- if (event == 'pre') {//上一步
|
|
|
+ await this.saveEduTextbook(params, true);
|
|
|
+ if (event == 'pre') {//上一步
|
|
|
this.state.emit({ type: 'pre' });
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (event == 'complete') {
|
|
|
+ this.state.emit({ type: 'complete', textBook: this.eduTextbook });
|
|
|
+
|
|
|
let isPageNull = this.examineNull()//检查本页空项
|
|
|
- if (isPageNull) return
|
|
|
let isIgnoreFiled = this.isIgnoreFiledNull()//检查数据空项
|
|
|
- if (isIgnoreFiled) return
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- this.state.emit({ type: 'complete', textBook: this.eduTextbook });
|
|
|
- this.eduTextbook.set('complete', true)
|
|
|
- this.eduTextbook.set('status', '102')
|
|
|
- await this.eduTextbook.save()
|
|
|
- this.msg.success('已填写完成')
|
|
|
+ if (isPageNull || isIgnoreFiled) {
|
|
|
+ } else {
|
|
|
+ this.eduTextbook.set('complete', true)
|
|
|
+ this.eduTextbook.set('status', '102')
|
|
|
+ await this.eduTextbook.save()
|
|
|
+ this.msg.success('已填写完成')
|
|
|
+ }
|
|
|
+ this.router.navigate(['/nav-author/manage/space'])
|
|
|
} else if (event == 'save') {
|
|
|
this.modal.success({
|
|
|
nzTitle: '保存成功',
|
|
@@ -267,7 +270,7 @@ export class AttachmentComponent implements OnInit {
|
|
|
return;
|
|
|
}
|
|
|
upload(e: any, type: string) {
|
|
|
- let file = e[(e?.length-1)||0];
|
|
|
+ let file = e[(e?.length - 1) || 0];
|
|
|
if (type == 'copyrightImgUrl' || type == 'CIPImgUrl') {
|
|
|
this[type] = file?.url
|
|
|
} else if (type == 'selfResults' || type == 'expertOpinion' ||
|
|
@@ -275,7 +278,7 @@ export class AttachmentComponent implements OnInit {
|
|
|
this[type].url = file?.url
|
|
|
this[type].name = file?.name
|
|
|
} else if (type == 'moreMaterial') {
|
|
|
- this[type]=[...(this[type]||[]),{name:file.name,url:file.url}]
|
|
|
+ this[type] = [...(this[type] || []), { name: file.name, url: file.url }]
|
|
|
}
|
|
|
}
|
|
|
/**获取文件名 */
|
|
@@ -287,7 +290,7 @@ export class AttachmentComponent implements OnInit {
|
|
|
return result || '未知文件名'
|
|
|
}
|
|
|
|
|
|
- downloadFile(fileName:string){
|
|
|
+ downloadFile(fileName: string) {
|
|
|
// let fileName = '十四五”普通高等教育本科国家级规划教材第一次遴选推荐申报表.docx'
|
|
|
const fileUrl = `../../../../../public/file/${fileName}`;
|
|
|
this.http.get(fileUrl, { responseType: 'blob' }).subscribe((blob) => {
|
|
@@ -301,7 +304,7 @@ export class AttachmentComponent implements OnInit {
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
})
|
|
|
}
|
|
|
- openFile(url:string){
|
|
|
+ openFile(url: string) {
|
|
|
console.log(url);
|
|
|
window.open(url)
|
|
|
}
|