Преглед на файлове

Merge branch 'bug5715' into custom

Karsa преди 2 месеца
родител
ревизия
11312776cf

+ 2 - 0
src/views/report_manage/reportV2/components/chapterEditWrapper.vue

@@ -485,6 +485,8 @@ export default {
 
     //选择章节 预览
     async chooseChapter(item) {
+      this.$emit('change',{ selectChapterId: 0,editChapterId:0 })
+      
       this.editChapterId && this.handleMarkOver(this.editChapterId);
 
       if(item.IsAuth) {

+ 16 - 8
src/views/report_manage/reportV2/normalReport/editReport.vue

@@ -255,15 +255,20 @@ export default {
 
 			//如果富文本中有未上传完成的图片,去除这个dom
 			$('.fr-element').find('img.fr-uploading').length&&$('.fr-element').find('img.fr-uploading').remove()
-			const res = await saveChapterReport({
-				ReportChapterId: this.reportInfo.ReportChapterId,
-				// Title: this.reportInfo.Title,
-				Content: $('.fr-element').html()
-			})
-			if(res.Ret !== 200) return 
 
-			this.lastsavetime = http.dateFormatter(new Date(), true);
-			type==='save' && this.$message.success(res.Msg);
+			return new Promise(async(resolve,reject) => {
+				const res = await saveChapterReport({
+					ReportChapterId: this.reportInfo.ReportChapterId,
+					// Title: this.reportInfo.Title,
+					Content: $('.fr-element').html()
+				})
+				if(res.Ret !== 200) return
+				resolve(true)
+	
+				this.lastsavetime = http.dateFormatter(new Date(), true);
+				type==='save' && this.$message.success(res.Msg);
+
+			})
 		},
 
 		/* 章节预览 */
@@ -284,6 +289,9 @@ export default {
 			//如果富文本中有未上传完成的图片,去除这个dom
 			$('.fr-element').find('img.fr-uploading').length&&$('.fr-element').find('img.fr-uploading').remove()
 
+			const saveRes = await this.handleAutoSaveChapter('auto');
+			if(!saveRes) return
+
 			const res = await publishChapterReport({
         ReportChapterId: this.reportInfo.ReportChapterId
       });

+ 13 - 14
src/views/report_manage/reportV2/smartReport/editReport.vue

@@ -465,15 +465,17 @@ export default {
             }
             
 			const htmlStr=document.getElementById('report-html-content').outerHTML.replace(/contenteditable="true"/g,'contenteditable="false"');
-			const res = await saveChapterReport({
-				ReportChapterId: this.reportInfo.ReportChapterId,
-				// Title: this.reportInfo.Title,
-				Content: htmlStr,
-                ContentStruct:this.formatContentListElData(),
-			})
-			if(res.Ret !== 200) return 
+            return new Promise(async(resolve,reject) => {
+                const res = await saveChapterReport({
+                    ReportChapterId: this.reportInfo.ReportChapterId,
+                    Content: htmlStr,
+                    ContentStruct:this.formatContentListElData(),
+                })
+                if(res.Ret !== 200) return 
+                resolve(true)
 
-			type==='save' && this.$message.success(res.Msg);
+                type==='save' && this.$message.success(res.Msg);
+            })
 		},
 
 		/* 章节预览 */
@@ -495,6 +497,9 @@ export default {
 
 		/* 单章节发布 */
 		async handlePublishChapter() {
+
+            const saveRes = await this.handleAutoSaveChapter('auto');
+			if(!saveRes) return
             
 			const res = await publishChapterReport({
                 ReportChapterId: this.reportInfo.ReportChapterId
@@ -503,12 +508,6 @@ export default {
                 this.$message.success(this.$t('MsgPrompt.submit_msg'))
 
                 this.$refs.chapterContRef&&this.$refs.chapterContRef.getChapterList()
-
-                // this.$refs.chapterContRef.handleMarkOver(this.reportInfo.ReportChapterId)
-                // setTimeout(() => {
-                //     this.timer && clearInterval(this.timer);
-                //     this.$router.replace({ path: '/reportNew' });
-                // }, 1000);
             }
 		},