|
@@ -52,11 +52,24 @@ export class FaithComponent implements OnInit {
|
|
|
@Output() state: EventEmitter<any> = new EventEmitter<any>();
|
|
|
@Output() save: EventEmitter<any> = new EventEmitter<any>();
|
|
|
|
|
|
+ value: string = '';
|
|
|
+
|
|
|
+ /**上传签名页 */
|
|
|
+ authorSignPDF: any = {
|
|
|
+ name: '',
|
|
|
+ url: '',
|
|
|
+ };
|
|
|
+
|
|
|
/**申报单位承诺意见 */
|
|
|
unitMaterial: any = {
|
|
|
name: '',
|
|
|
url: '',
|
|
|
};
|
|
|
+
|
|
|
+ get authStatus():boolean{
|
|
|
+ return this.value == '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'
|
|
|
+ }
|
|
|
+
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
|
private msg: NzMessageService,
|
|
@@ -69,28 +82,19 @@ export class FaithComponent implements OnInit {
|
|
|
ngOnInit() {
|
|
|
if (this.eduTextbook.id) {
|
|
|
this.value = this.eduTextbook.get('accept') || '';
|
|
|
-
|
|
|
- // this.validateForm = this.fb.group({
|
|
|
- // // unitMaterial: [this.eduTextbook.get('unitMaterial')?.text||'' , [Validators.maxLength(200)]],
|
|
|
- // accept: [this.eduTextbook.get('accept') || '', [Validators.required]],
|
|
|
- // });
|
|
|
+ this.authorSignPDF = this.eduTextbook.get('authorSignPDF') || {
|
|
|
+ name: '',
|
|
|
+ url: '',
|
|
|
+ };
|
|
|
+ this.unitMaterial = this.eduTextbook.get('unitMaterial') || {
|
|
|
+ name: '',
|
|
|
+ url: '',
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
- value: string = '';
|
|
|
|
|
|
async submitForm(event?: string): Promise<void> {
|
|
|
- if (
|
|
|
- this.value !=
|
|
|
- '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'
|
|
|
- ) {
|
|
|
- this.msg.error('诚信承诺输入错误,请正确输入(注意标点符号)');
|
|
|
- // return
|
|
|
- }
|
|
|
- // let params: any = this.validateForm.value;
|
|
|
- // console.log(params)
|
|
|
- let params = { accept: this.value };
|
|
|
- await this.saveEduTextbook(params);
|
|
|
-
|
|
|
+ await this.saveEduTextbook();
|
|
|
if (event == 'pre') {
|
|
|
//上一步
|
|
|
this.state.emit({ type: 'pre' });
|
|
@@ -109,11 +113,14 @@ export class FaithComponent implements OnInit {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async saveEduTextbook(params: any) {
|
|
|
+ async saveEduTextbook() {
|
|
|
if (!this.eduTextbook) {
|
|
|
this.msg.error('请先创建教材');
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ let isComplete = this.verify()
|
|
|
+
|
|
|
this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
|
|
|
this.eduTextbook?.set('company', {
|
|
|
__type: 'Pointer',
|
|
@@ -122,33 +129,47 @@ export class FaithComponent implements OnInit {
|
|
|
});
|
|
|
// params.unitMaterial &&
|
|
|
// this.eduTextbook?.set('unitMaterial',{text:params.unitMaterial} );
|
|
|
- params.accept && this.eduTextbook?.set('accept', params.accept);
|
|
|
+ this.value && this.eduTextbook?.set('accept', this.value);
|
|
|
+ this.authorSignPDF && this.eduTextbook?.set('authorSignPDF', this.authorSignPDF);
|
|
|
+ this.unitMaterial && this.eduTextbook?.set('unitMaterial', this.unitMaterial);
|
|
|
+
|
|
|
if (
|
|
|
- this.eduTextbook.get('status') == '102' &&
|
|
|
- this.value !=
|
|
|
- '本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'
|
|
|
+ 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');
|
|
|
}
|
|
|
+ if(isComplete){
|
|
|
+ this.eduTextbook.set('complete', true)
|
|
|
+ }else{
|
|
|
+ this.msg.warning('保存成功,但存在未填写完成项');
|
|
|
+ }
|
|
|
+ await this.eduTextbook?.save();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ verify():boolean{
|
|
|
if (
|
|
|
- this.value ==
|
|
|
+ this.value !=
|
|
|
'本人自愿参加此次申报,已认真填写并检查以上材料,保证内容真实。'
|
|
|
) {
|
|
|
- this.eduTextbook.set('complete', true);
|
|
|
+ this.msg.error('诚信承诺输入错误,请正确输入(注意标点符号)');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(!this.authorSignPDF?.url || !this.unitMaterial?.url){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ upload(e: any, type: string) {
|
|
|
+ console.log(e);
|
|
|
+ let file = e[e?.length - 1 || 0];
|
|
|
+ if (type == 'unitMaterial' || type == 'authorSignPDF') {
|
|
|
+ this[type].url = file?.url;
|
|
|
+ this[type].name = file?.name;
|
|
|
}
|
|
|
- await this.eduTextbook?.save();
|
|
|
- return;
|
|
|
}
|
|
|
- // upload(e: any, type: string, index?: any) {
|
|
|
- // let file = e[(e?.length - 1) || 0];
|
|
|
- // if(type=='unitMaterial'){
|
|
|
- // this[type].url = file?.url
|
|
|
- // this[type].name = file?.name
|
|
|
- // }
|
|
|
- // }
|
|
|
|
|
|
// /**获取文件名 */
|
|
|
// getFileName(url: string) {
|
|
@@ -175,22 +196,14 @@ export class FaithComponent implements OnInit {
|
|
|
// }
|
|
|
// openFile(url: string) {
|
|
|
// console.log(url);
|
|
|
- // window.open(url)
|
|
|
+ // window.open(url);
|
|
|
// }
|
|
|
|
|
|
- // validateForm: FormGroup<{
|
|
|
- // // unitMaterial: FormControl<string | null>;
|
|
|
- // accept: FormControl<string | null>;
|
|
|
- // }> = this.formBuilder.group({
|
|
|
- // // unitMaterial: ['', [Validators.maxLength(200)]],
|
|
|
- // 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', '请正确输入内容');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|