Browse Source

需求:章节提交后不可编辑

shanbinzhang 1 day ago
parent
commit
b96e4b3c40

+ 9 - 0
src/api/report.js

@@ -374,6 +374,15 @@ export default {
         return post('/report/chapter/title/edit',params)
     },
 
+    /**
+	 * 撤销章节发布
+	 * @param {*} params ReportChapterId
+	 * @returns 
+	 */
+	cancelChapter: params => {
+		return post('/report/chapter/publish/cancel',params)
+	},
+
     /**
      * 获取报告图表刷新状态
      * @param {*} params 

+ 13 - 4
src/views/report/EditReport.vue

@@ -303,10 +303,19 @@ async function autoSaveReportChapter(type="auto"){
 
 /* 提交章节 */
 async function handlePublishChapter() {
-    const saveRes = await autoSaveReportChapter('auto');
-    if(!saveRes) return
-
-    handlePublishChapterApi(reportData.value.ReportChapterId)
+    showDialog({
+        title: '提示',
+        showCancelButton: true,
+        message: '章节提交后不可编辑,是否确认提交?',
+        confirmButtonText: '确认',
+        cancelButtonText: '取消', 
+    }).then( async() => {
+		const saveRes = await autoSaveReportChapter('auto');
+        if(!saveRes) return
+
+        handlePublishChapterApi(reportData.value.ReportChapterId)
+
+    }).catch(() =>{})
 }
 
 </script>

+ 28 - 3
src/views/report/chapter/List.vue

@@ -216,6 +216,30 @@ function handleDelChapter(item) {
 
 }
 
+/* 撤销章节 */
+function handleCancelChapter(item) {
+    showItemOpt.value = false
+    showDialog({
+        title: '提示',
+        showCancelButton: true,
+        message: '是否确认撤销该章节?',
+        confirmButtonText: '确认',
+        cancelButtonText: '取消', 
+    }).then( async() => {
+        const res = await apiReport.cancelChapter({
+            ReportChapterId: item.ReportChapterId
+        })
+
+        if(res.Ret!==200) return
+        showToast('撤销成功')
+        
+        let index = chapterList.value.findIndex(_=>_.ReportChapterId===item.ReportChapterId)
+        chapterList.value[index].PublishState = 1;
+
+    }).catch(() =>{})
+}
+
+
 /* 上传章节音频 */
 // 上传音频
 const showUploadAudio=ref(false)
@@ -358,7 +382,7 @@ function handleConfirmEditTrendTag(){
 // 跳转章节详情
 async function goChapterDetail(item){
 
-    if(item.IsAuth) {
+    if(item.IsAuth && item.PublishState===1) {
         //编辑前标记一下
         const res = await apiReport.reportMark({
             Status: 1,
@@ -512,7 +536,7 @@ async function handleConfirmSetLayout() {
                 <template #item="{element}">
                     <li class="item"  @click="goChapterDetail(element)">
                         <div class="item-top">
-                            <div class="type-name" v-if="element.TypeName">{{element.TypeName}}宏观</div>
+                            <div class="type-name" v-if="element.TypeName">{{element.TypeName}}</div>
                         </div>
 
                         <div class="content">
@@ -541,7 +565,7 @@ async function handleConfirmSetLayout() {
                             
                         </div>
                         
-                        <img src="@/assets/imgs/report/icon_drag.png" alt="" class="move-icon">
+                        <img src="@/assets/imgs/report/icon_drag.png" alt="" class="move-icon" v-if="isCreator">
                     </li>
                 </template>
             </draggable>
@@ -687,6 +711,7 @@ async function handleConfirmSetLayout() {
             <div class="title">{{activeItem.Title}}</div>
 
             <div class="item" @click="handleChapterInfo(activeItem)" v-if="isCreator">基础信息</div>
+            <div class="item" @click="handleCancelChapter(activeItem)" v-if="activeItem.IsAuth&&activeItem.PublishState===2">撤销</div>
             <div class="item" @click="handleDelChapter(activeItem)" v-if="isCreator">删除</div>
             <div class="item" @click="handleShowTrendTag(activeItem)" v-permission="reportManageBtn.reportMange_chapter_editTag">添加标签</div>
             <div class="item" @click="handleShowUploadAudio()">上传录音</div>

+ 13 - 3
src/views/report/smartReport/EditReport.vue

@@ -806,10 +806,20 @@ async function autoSaveReportChapter(type="auto"){
 
 /* 提交章节 */
 async function handlePublishChapter() {
-    const saveRes = await autoSaveReportChapter('auto');
-    if(!saveRes) return
+		showDialog({
+        title: '提示',
+        showCancelButton: true,
+        message: '章节提交后不可编辑,是否确认提交?',
+        confirmButtonText: '确认',
+        cancelButtonText: '取消', 
+    }).then( async() => {
+        
+			const saveRes = await autoSaveReportChapter('auto');
+			if(!saveRes) return
+
+			handlePublishChapterApi(reportInfo.value.ReportChapterId)
 
-    handlePublishChapterApi(reportInfo.value.ReportChapterId)
+    }).catch(() =>{})
 }
 
 const {