|
@@ -21,14 +21,8 @@ import {
|
|
|
ValidatorFn,
|
|
|
AbstractControl,
|
|
|
} from '@angular/forms';
|
|
|
-interface opinionType {
|
|
|
- name: string;
|
|
|
- unit: string;
|
|
|
- birth: Date | any;
|
|
|
- nationality: string;
|
|
|
- reviewFile: string | object;
|
|
|
-}
|
|
|
import { textbookServer } from '../../../../services/textbook';
|
|
|
+
|
|
|
@Component({
|
|
|
selector: 'app-attachment',
|
|
|
imports: [
|
|
@@ -65,371 +59,166 @@ export class AttachmentComponent implements OnInit {
|
|
|
return {};
|
|
|
};
|
|
|
|
|
|
- validateForm: FormGroup<{
|
|
|
- // textbookTypes: FormControl<Array<string> | any>; //教材电子版
|
|
|
- // textbookFiles: FormControl<Array<string> | any>; //上传教材文件
|
|
|
- // links: FormControl<string>; //教材数字内容链接地址、账号
|
|
|
- selfResults: FormControl<object | any>; //图书编校质量自查结果记录表
|
|
|
- expertOpinion: FormControl<object | any>; //专家审核意见表
|
|
|
- evidence: FormControl<object | any>; //教材使用情况证明材料
|
|
|
- moreMaterial: FormControl<Array<any> | any>; //其他材料
|
|
|
- unitMaterial: FormControl<object | any>; //申报单位承诺意见材料
|
|
|
- // accept: FormControl<string>; //填写诚信承诺
|
|
|
- copyrightImgUrl: FormControl<string>; //版权页截图
|
|
|
- CIPImgUrl: FormControl<string>; //中国版本图书馆CIP查询截图
|
|
|
- }> = this.fb.group({
|
|
|
- // textbookTypes: [''],
|
|
|
- // textbookFiles: [
|
|
|
- // [
|
|
|
- // {
|
|
|
- // url: '',
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // [Validators.required]
|
|
|
- // ],
|
|
|
- // links: ['', [Validators.required]],
|
|
|
- selfResults: [
|
|
|
- {
|
|
|
- name: '自查表.pdf',
|
|
|
- url: '',
|
|
|
- },
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- expertOpinion: [
|
|
|
- {
|
|
|
- name: '自查表.pdf',
|
|
|
- url: '',
|
|
|
- },
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- evidence: ['',
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- moreMaterial: [
|
|
|
- [
|
|
|
- {
|
|
|
- name: '材料1.pdf',
|
|
|
- url: '',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '材料2.pdf',
|
|
|
- url: '',
|
|
|
- },
|
|
|
- ],
|
|
|
- ],
|
|
|
- unitMaterial: [
|
|
|
- {
|
|
|
- name: '承诺意见表.pdf',
|
|
|
- url: '',
|
|
|
- },
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- // accept: ['', [Validators.required, this.confirmationValidator]],
|
|
|
- copyrightImgUrl: [''],
|
|
|
- CIPImgUrl: [''],
|
|
|
- });
|
|
|
- checkOptionsOne = [
|
|
|
- { label: '纸质教材', value: '纸质教材', checked: true },
|
|
|
- { label: '电子教材 / 资源', value: '电子教材 / 资源', checked: true },
|
|
|
- ];
|
|
|
- // //所有作者政治审查意见
|
|
|
- // opinions: Array<opinionType> = [
|
|
|
- // {
|
|
|
- // name: '', //作者
|
|
|
- // unit: '', //单位
|
|
|
- // birth: '', //出生年月
|
|
|
- // nationality: '', //国籍
|
|
|
- // reviewFile: {
|
|
|
- // name: '自查表.pdf',
|
|
|
- // url: '',
|
|
|
- // }, //作者政治审查表/作者签名
|
|
|
- // },
|
|
|
- // ];
|
|
|
- // //所有作者签名
|
|
|
- // authorSign: Array<opinionType> = [
|
|
|
- // {
|
|
|
- // name: '', //作者
|
|
|
- // unit: '', //单位
|
|
|
- // birth: '', //出生年月
|
|
|
- // nationality: '', //国籍
|
|
|
- // reviewFile: {
|
|
|
- // name: '审查表.pdf',
|
|
|
- // url: '',
|
|
|
- // }, //作者政治审查表/作者签名
|
|
|
- // },
|
|
|
- // ];
|
|
|
+
|
|
|
+ /** 版权页截图*/
|
|
|
+ copyrightImgUrl: string = ''
|
|
|
+ /** 中国版本图书馆CIP查询截图*/
|
|
|
+ CIPImgUrl: string = ''
|
|
|
+ /**图书编校质量自查结果记录表 */
|
|
|
+ selfResults: any = {
|
|
|
+ name: '',
|
|
|
+ url: '',
|
|
|
+ }
|
|
|
+ /** 专家审核意见表*/
|
|
|
+ expertOpinion: any = {
|
|
|
+ name: '',
|
|
|
+ url: '',
|
|
|
+ }
|
|
|
+ /** 教材使用情况证明材料*/
|
|
|
+ evidence: any = {
|
|
|
+ name: '',
|
|
|
+ url: '',
|
|
|
+ }
|
|
|
+ /**其他材料 {name: '',url: '',} */
|
|
|
+ moreMaterial: Array<any> = []
|
|
|
+
|
|
|
+ /**申报单位承诺意见 */
|
|
|
+ unitMaterial: any = {
|
|
|
+ name: '',
|
|
|
+ url: '',
|
|
|
+ }
|
|
|
+
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
|
- private fb: NonNullableFormBuilder,
|
|
|
private msg: NzMessageService,
|
|
|
private modal: NzModalService
|
|
|
) { }
|
|
|
- ngOnInit() {
|
|
|
+ ngOnInit() {
|
|
|
if (this.eduTextbook.id) {
|
|
|
- this.validateForm = this.fb.group({
|
|
|
- // textbookTypes: [
|
|
|
- // this.eduTextbook.get('textbookTypes'),
|
|
|
- // ],
|
|
|
- // textbookFiles: [
|
|
|
- // this.eduTextbook.get('textbookFiles') ||
|
|
|
- // this.validateForm.value.textbookFiles,
|
|
|
- // [Validators.required]
|
|
|
- // ],
|
|
|
- // links: [
|
|
|
- // this.eduTextbook.get('links')?.join('\n') || '',
|
|
|
- // [Validators.required]
|
|
|
- // ],
|
|
|
- selfResults: [
|
|
|
- this.eduTextbook.get('selfResults') ||
|
|
|
- this.validateForm.value.selfResults,
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- expertOpinion: [
|
|
|
- this.eduTextbook.get('expertOpinion') ||
|
|
|
- this.validateForm.value.expertOpinion,
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- evidence: [
|
|
|
- this.eduTextbook.get('evidence') || this.validateForm.value.evidence,
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- moreMaterial: [''],
|
|
|
- unitMaterial: [
|
|
|
- this.eduTextbook.get('unitMaterial') ||
|
|
|
- this.validateForm.value.unitMaterial,
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- // accept: [
|
|
|
- // this.eduTextbook.get('accept') || '',
|
|
|
- // [Validators.required, this.confirmationValidator]
|
|
|
- // ],
|
|
|
- copyrightImgUrl: [
|
|
|
- this.eduTextbook.get('copyrightImgUrl') || '',
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- CIPImgUrl: [
|
|
|
- this.eduTextbook.get('CIPImgUrl') || '',
|
|
|
- [Validators.required]
|
|
|
- ],
|
|
|
- });
|
|
|
- // this.opinions = this.eduTextbook.get('opinions') || this.opinions
|
|
|
- // this.authorSign = this.eduTextbook.get('authorSign') || this.authorSign
|
|
|
+ this.copyrightImgUrl = this.eduTextbook?.get('copyrightImgUrl') || this.copyrightImgUrl
|
|
|
+ this.CIPImgUrl = this.eduTextbook?.get('CIPImgUrl') || this.CIPImgUrl
|
|
|
+ this.selfResults = this.eduTextbook?.get('selfResults') || this.selfResults
|
|
|
+ this.expertOpinion = this.eduTextbook?.get('expertOpinion') || this.expertOpinion
|
|
|
+ this.evidence = this.eduTextbook?.get('evidence') || this.evidence
|
|
|
+ this.moreMaterial = this.eduTextbook?.get('moreMaterial') || this.moreMaterial
|
|
|
+ this.unitMaterial = this.eduTextbook?.get('unitMaterial') || this.unitMaterial
|
|
|
}
|
|
|
+ console.log(
|
|
|
+ 'copyrightImgUrl',this.copyrightImgUrl,
|
|
|
+ 'CIPImgUrl',this.CIPImgUrl,
|
|
|
+ 'selfResults',this.selfResults,
|
|
|
+ 'expertOpinion',this.expertOpinion,
|
|
|
+ 'evidence',this.evidence,
|
|
|
+ 'moreMaterial',this.moreMaterial,
|
|
|
+ 'unitMaterial',this.unitMaterial)
|
|
|
}
|
|
|
- async submitForm(event?: string): Promise<void> {
|
|
|
- if (event == 'pre') {
|
|
|
- this.state.emit({ type: 'pre' });
|
|
|
- return;
|
|
|
+
|
|
|
+ /**本页必填是否存在空项 */
|
|
|
+ examineNull() {
|
|
|
+ let isNull = false
|
|
|
+ let msgList = []
|
|
|
+ if (this.copyrightImgUrl == '' || !this.copyrightImgUrl) {
|
|
|
+ msgList.push('版权页截图')
|
|
|
+ isNull = true
|
|
|
}
|
|
|
- console.log(this.validateForm.value);
|
|
|
- // let opinionsVrifly = !this.opinions.some((item) =>
|
|
|
- // Object.values(item).some((val) => val == '' || val == undefined)
|
|
|
- // );
|
|
|
- // let authorSignVrifly = !this.authorSign.some((item) =>
|
|
|
- // Object.values(item).some((val) => val == '' || val == undefined)
|
|
|
- // );
|
|
|
- let params: any = this.validateForm.value;
|
|
|
- console.log(this.validateForm)
|
|
|
- if (this.validateForm.valid) {
|
|
|
- console.log(this.validateForm.value);
|
|
|
- if (event == 'complete') {
|
|
|
- // if (!opinionsVrifly) {
|
|
|
- // this.msg.warning('所有作者政治审查意见填写不完整');
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (!authorSignVrifly) {
|
|
|
- // this.msg.warning('上传所有作者签名填写不完整');
|
|
|
- // return;
|
|
|
- // }
|
|
|
- await this.saveEduTextbook(params, true);
|
|
|
- let textBookJson = this.eduTextbook.toJSON()
|
|
|
- let ignoreFiled = [
|
|
|
- 'typeNumber',
|
|
|
- 'editionNumber',
|
|
|
- 'importantProjectOther',
|
|
|
- 'textbookFiles',
|
|
|
- 'createdAt',
|
|
|
- 'updatedAt',
|
|
|
- 'copyright',
|
|
|
- 'authorSign',
|
|
|
- 'CIP',
|
|
|
- 'isDeleted',
|
|
|
- 'opinions',
|
|
|
- 'printNumber',
|
|
|
- 'printSum',
|
|
|
- 'render',
|
|
|
- 'importantProject',
|
|
|
- 'importantProjectOther',
|
|
|
- 'complete',
|
|
|
- 'links',
|
|
|
- 'recommend',
|
|
|
- 'printSun',
|
|
|
- 'discard',
|
|
|
- 'edition',
|
|
|
- 'eduProcess',
|
|
|
- 'authors',
|
|
|
- 'editor',
|
|
|
- ] //非必填字段
|
|
|
- console.log(textBookJson);
|
|
|
- let isVrifly = Object.keys(textBookJson).some((item: string) => {
|
|
|
- if (!ignoreFiled.includes(item) && (textBookJson[item] === '' || textBookJson[item] === undefined || textBookJson[item] === null)) {
|
|
|
- console.warn('字段未填写:' + item);
|
|
|
- return true
|
|
|
- }
|
|
|
- return
|
|
|
- })
|
|
|
- if (isVrifly) {
|
|
|
- this.msg.warning('存在未填项')
|
|
|
- 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('已填写完成')
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (event == 'save') {
|
|
|
- // await this.saveEduTextbook(params, this.validateForm.valid && opinionsVrifly && authorSignVrifly);
|
|
|
- await this.saveEduTextbook(params, this.validateForm.valid);
|
|
|
- this.modal.success({
|
|
|
- nzTitle: '保存成功',
|
|
|
- nzContent: '<p>已保存并且至空间</p>',
|
|
|
- nzOnOk: () => console.log('Info OK'),
|
|
|
- });
|
|
|
- return;
|
|
|
+ if (this.CIPImgUrl == '' || !this.CIPImgUrl) {
|
|
|
+ msgList.push('CIP查询截图')
|
|
|
+ isNull = true
|
|
|
+ }
|
|
|
+ if (this.selfResults.url == '' || !this.selfResults.url) {
|
|
|
+ msgList.push('自查结果记录表')
|
|
|
+ isNull = true
|
|
|
+ }
|
|
|
+ if (this.expertOpinion.url == '' || !this.expertOpinion.url) {
|
|
|
+ msgList.push('专家审核意见表')
|
|
|
+ isNull = true
|
|
|
+ }
|
|
|
+ if (this.evidence.url == '' || !this.evidence.url) {
|
|
|
+ msgList.push('证明材料')
|
|
|
+ isNull = true
|
|
|
+ }
|
|
|
+ if (this.moreMaterial?.length > 0) {
|
|
|
+ let isExist = this.moreMaterial.every(item => item?.url == '' || !item?.url)
|
|
|
+ if (isExist) {
|
|
|
+ msgList.push('其他材料')
|
|
|
+ isNull = true
|
|
|
}
|
|
|
+ }
|
|
|
+ if (this.unitMaterial.url == '' || !this.unitMaterial.url) {
|
|
|
+ msgList.push('申报单位承诺意见')
|
|
|
+ isNull = true
|
|
|
+ }
|
|
|
+ if (isNull) {
|
|
|
+ this.msg.create('error', `请上传完整 ${msgList.join()}`)
|
|
|
+ }
|
|
|
+ return isNull
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- console.log(this.validateForm.value);
|
|
|
- if (event == 'complete') {
|
|
|
- await this.saveEduTextbook(params, true);
|
|
|
- let textBookJson = this.eduTextbook.toJSON()
|
|
|
- let ignoreFiled = ['typeNumber', 'importantProjectOther', 'createdAt', 'updatedAt'] //非必填字段
|
|
|
- console.log(textBookJson);
|
|
|
- let isVrifly = Object.keys(textBookJson).some((item: string) => {
|
|
|
- if (!ignoreFiled.includes(item) && (textBookJson[item] === '' || textBookJson[item] === undefined || textBookJson[item] === null)) {
|
|
|
- console.warn('字段未填写:' + item);
|
|
|
- return true
|
|
|
- }
|
|
|
- return
|
|
|
- })
|
|
|
- if (isVrifly) {
|
|
|
- this.msg.warning('存在未填项')
|
|
|
- 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('已填写完成')
|
|
|
+ /**判断是否存在未填字段 */
|
|
|
+ isIgnoreFiledNull() {
|
|
|
+ let ignoreFiled = [
|
|
|
+ 'typeNumber', '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'
|
|
|
+ ] //非必填字段
|
|
|
+ let textBookJson = this.eduTextbook.toJSON()
|
|
|
+ let isVrifly = Object.keys(textBookJson).some((item: string) => {
|
|
|
+ if (!ignoreFiled.includes(item) && (textBookJson[item] === '' || textBookJson[item] === undefined || textBookJson[item] === null)) {
|
|
|
+ console.warn('字段未填写:' + item);
|
|
|
+ return true
|
|
|
}
|
|
|
+ return
|
|
|
+ })
|
|
|
+ if (isVrifly) {
|
|
|
+ this.msg.warning('存在未填项')
|
|
|
+ return true
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ async submitForm(event?: string): Promise<void> {
|
|
|
+ let params = {
|
|
|
+ copyrightImgUrl: this.copyrightImgUrl,
|
|
|
+ CIPImgUrl: this.CIPImgUrl,
|
|
|
+ selfResults: this.selfResults,
|
|
|
+ expertOpinion: this.expertOpinion,
|
|
|
+ evidence: this.evidence,
|
|
|
+ moreMaterial: this.moreMaterial,
|
|
|
+ unitMaterial: this.unitMaterial,
|
|
|
+ }
|
|
|
+ await this.saveEduTextbook(params, true);
|
|
|
+ if (event == 'pre') {//上一步
|
|
|
+ this.state.emit({ type: 'pre' });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (event == 'complete') {
|
|
|
+ let isPageNull = this.examineNull()//检查本页空项
|
|
|
+ if (isPageNull) return
|
|
|
+ let isIgnoreFiled = this.isIgnoreFiledNull()//检查数据空项
|
|
|
+ if (isIgnoreFiled) return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // Object.values(this.validateForm.controls).forEach((control) => {
|
|
|
- // if (control.invalid) {
|
|
|
- // control.markAsDirty();
|
|
|
- // control.updateValueAndValidity({ onlySelf: true });
|
|
|
- // }
|
|
|
- // });
|
|
|
- // this.msg.warning('请填写完整信息');
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
- if (event == 'save') {
|
|
|
- // await this.saveEduTextbook(params, this.validateForm.valid && opinionsVrifly && authorSignVrifly);
|
|
|
- await this.saveEduTextbook(params, this.validateForm.valid);
|
|
|
+ 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('已填写完成')
|
|
|
+ } else if (event == 'save') {
|
|
|
this.modal.success({
|
|
|
- nzTitle: '您已填写完成',
|
|
|
+ nzTitle: '保存成功',
|
|
|
nzContent: '<p>已保存并且至空间</p>',
|
|
|
nzOnOk: () => console.log('Info OK'),
|
|
|
});
|
|
|
- }
|
|
|
- }
|
|
|
- changeCode() { }
|
|
|
- getCode(e: any) { }
|
|
|
- // //添加作者信息
|
|
|
- // onPush(type: string, idx: number) {
|
|
|
- // switch (type) {
|
|
|
- // case 'opinions':
|
|
|
- // this.opinions.splice(idx + 1, 0, {
|
|
|
- // name: '', //作者
|
|
|
- // unit: '', //单位
|
|
|
- // birth: '', //出生年月
|
|
|
- // nationality: '', //国籍
|
|
|
- // reviewFile: '', //作者政治审查表/作者签名
|
|
|
- // });
|
|
|
- // break;
|
|
|
- // case 'authorSign':
|
|
|
- // this.authorSign.splice(idx + 1, 0, {
|
|
|
- // name: '', //作者
|
|
|
- // unit: '', //单位
|
|
|
- // birth: '', //出生年月
|
|
|
- // nationality: '', //国籍
|
|
|
- // reviewFile: '', //作者政治审查表/作者签名
|
|
|
- // });
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // //删除作者信息
|
|
|
- // onDel(type: string, idx: number) {
|
|
|
- // switch (type) {
|
|
|
- // case 'opinions':
|
|
|
- // if (this.opinions.length <= 1) {
|
|
|
- // this.opinions = [
|
|
|
- // {
|
|
|
- // name: '', //作者
|
|
|
- // unit: '', //单位
|
|
|
- // birth: '', //出生年月
|
|
|
- // nationality: '', //国籍
|
|
|
- // reviewFile: '', //作者政治审查表/作者签名
|
|
|
- // },
|
|
|
- // ];
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // this.opinions.splice(idx, 1);
|
|
|
- // break;
|
|
|
- // case 'authorSign':
|
|
|
- // if (this.authorSign.length <= 1) {
|
|
|
- // this.authorSign = [
|
|
|
- // {
|
|
|
- // name: '', //作者
|
|
|
- // unit: '', //单位
|
|
|
- // birth: '', //出生年月
|
|
|
- // nationality: '', //国籍
|
|
|
- // reviewFile: '', //作者政治审查表/作者签名
|
|
|
- // },
|
|
|
- // ];
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // this.authorSign.splice(idx, 1);
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- handleChange(info: NzUploadChangeParam): void {
|
|
|
- if (info.file.status !== 'uploading') {
|
|
|
- console.log(info.file, info.fileList);
|
|
|
- }
|
|
|
- if (info.file.status === 'done') {
|
|
|
- this.msg.success(`${info.file.name} file uploaded successfully`);
|
|
|
- } else if (info.file.status === 'error') {
|
|
|
- this.msg.error(`${info.file.name} file upload failed.`);
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -451,12 +240,6 @@ export class AttachmentComponent implements OnInit {
|
|
|
className: 'Company',
|
|
|
objectId: this.tbookSer.company,
|
|
|
});
|
|
|
- // params.textbookTypes &&
|
|
|
- // this.eduTextbook?.set('textbookTypes', params.textbookTypes);
|
|
|
- // params.textbookFiles &&
|
|
|
- // this.eduTextbook?.set('textbookFiles', params.textbookFiles);
|
|
|
- // let links = params.links.split(/[(\r\n)\r\n]+/);
|
|
|
- // links && this.eduTextbook?.set('links', links);
|
|
|
params.selfResults &&
|
|
|
this.eduTextbook?.set('selfResults', params.selfResults);
|
|
|
params.unitMaterial &&
|
|
@@ -466,11 +249,8 @@ export class AttachmentComponent implements OnInit {
|
|
|
params.evidence && this.eduTextbook?.set('evidence', params.evidence);
|
|
|
params.moreMaterial &&
|
|
|
this.eduTextbook?.set('moreMaterial', params.moreMaterial);
|
|
|
- // params.accept && this.eduTextbook?.set('accept', params.accept);
|
|
|
this.eduTextbook?.set('copyrightImgUrl', params.copyrightImgUrl);
|
|
|
this.eduTextbook?.set('CIPImgUrl', params.CIPImgUrl);
|
|
|
- // this.opinions && this.eduTextbook?.set('opinions', this.opinions);
|
|
|
- // this.authorSign && this.eduTextbook?.set('authorSign', this.authorSign);
|
|
|
await this.eduTextbook?.save();
|
|
|
return;
|
|
|
}
|
|
@@ -478,15 +258,24 @@ export class AttachmentComponent implements OnInit {
|
|
|
console.log(e);
|
|
|
let file = e[0];
|
|
|
if (type == 'copyrightImgUrl' || type == 'CIPImgUrl') {
|
|
|
- this.validateForm.value[type] = file
|
|
|
- }else if(type == 'moreMaterial'){
|
|
|
- this.validateForm.value[type]=e
|
|
|
-
|
|
|
- // if(this.validateForm.value[type]){
|
|
|
- // this.validateForm.value[type].push(file)
|
|
|
- // }else{
|
|
|
- // this.validateForm.value[type]=[file]
|
|
|
- // }
|
|
|
+ this[type] = file
|
|
|
+ } else if (type == 'selfResults' || type == 'expertOpinion' ||
|
|
|
+ type == 'evidence' || type == 'unitMaterial') {
|
|
|
+ this[type].url = file
|
|
|
+ this[type].name = this.getFileName(file)
|
|
|
+ } else if (type == 'moreMaterial') {
|
|
|
+ let newList = e.map((item: any) => {
|
|
|
+ return { name: this.getFileName(item), url: item }
|
|
|
+ })
|
|
|
+ this[type]=newList
|
|
|
}
|
|
|
}
|
|
|
+ /**获取文件名 */
|
|
|
+ getFileName(url: string) {
|
|
|
+ if (!url) return ''
|
|
|
+ let str = url?.split('/')[5]
|
|
|
+ let index = str?.indexOf('-')
|
|
|
+ let result = decodeURIComponent(str?.substring(index + 1))
|
|
|
+ return result || '未知文件名'
|
|
|
+ }
|
|
|
}
|