Bläddra i källkod

版本恢复-ppt完成

chenlei 1 månad sedan
förälder
incheckning
a82f492a83

+ 38 - 2
src/api/modules/pptApi.js

@@ -316,8 +316,44 @@ export default{
      */
     getAuthPPtList: params => {
         return http.get('pptv2/report/auth_list',params)
-    }
-
+    },
 
+    /**
+     * 获取版本列表
+     * @param {*} params 
+     * PptId
+     * @returns 
+     */
+    getPptHistoryList: params => {
+        return http.get('ppt_history/list',params)
+    },
 
+    /**
+     * 获取版本详情
+     * @param {*} params 
+     * Id
+     * @returns 
+     */
+    getPptHistoryDetail: params => {
+        return http.get('ppt_history/detail',params)
+    },
+    /**
+     * 恢复到版本
+     * @param {*} params 
+     * Id
+     * @returns 
+     */
+    getPptHistoryRevert: params => {
+        return http.post('ppt_history/revert',params)
+    },
+    
+    /**
+     * 删除版本
+     * @param {*} params 
+     * Id
+     * @returns 
+     */
+    getPptHistoryDel: params => {
+        return http.post('ppt_history/del',params)
+    },
 }

+ 2 - 0
src/lang/modules/Slides/pptPresent.js

@@ -16,6 +16,7 @@ export const presentEn = {
   update_chart_btn: "Update chart",
   paste_element_btn: "Paste element",
   layer_editing: "Layer editing",
+  version_history: "Version history",
   keyword_search: "Keyword search",
   eta_chart_gallery: "Chart Gallery",
   commodity_price_curve: "Commodity Price Curve",
@@ -121,6 +122,7 @@ export const presentZh = {
   update_chart_btn: "更新图表",
   paste_element_btn: "粘贴元素",
   layer_editing: "图层编辑",
+  version_history: "版本记录",
   keyword_search: "关键字查找",
   eta_chart_gallery: "图库",
   commodity_price_curve: "商品价格曲线",

+ 2 - 0
src/utils/buttonConfig.js

@@ -42,6 +42,7 @@ export const reportManageBtn={
     reportMange_chapter_sort: 'reportMange:chapter:sort',//章节排序
     reportMange_chapter_share: 'reportMange:chapter:share',//章节分享
     reportMange_chapter_editTag: 'reportMange:chapter:editTag',//章节添加标签
+    reportMange_history: 'reportManage:history',//历史记录
 }
 /*
  *--------智能研报列表----------- 
@@ -194,6 +195,7 @@ export const pptPermission ={
     ppt_addCatalog:'ppt:addCatalog',//添加我的目录
     ppt_setShare:'ppt:setShare',//设置共享
     ppt_visible:'ppt:visible',//可见权限
+    ppt_history:'ppt:history',//添加我的目录
 }
 /*
 *--------英文PPT---------- 

+ 1 - 1
src/views/ppt_manage/mixins/layerMixins.js

@@ -21,6 +21,7 @@ export default {
   methods:{
     //改变编辑模式
     handleChangeEditModal(){
+      this.isVersionHistory = false
       //判断当前ppt是否添加了页面
       if(this.pageList.length===0){
         this.$message.warning(this.$t('Slides.msg_page_at_least_one'))
@@ -33,7 +34,6 @@ export default {
       if(this.isEditLayer){
         //进入图层编辑模式,需要退出其他模式
         this.isEditTitle = false
-        
         //如果当前活跃图层没有layers,加上
         if(!this.currentItem.layers){
           this.refleshLayerEl([])

+ 4 - 0
src/views/ppt_manage/mixins/pptEditorMixins.js

@@ -112,6 +112,7 @@ export default{
     },
     exitEditTitle(e){
         this.isEditTitle = false
+        this.isVersionHistory = false
     },
     //切换标题编辑模式
     handleEditTitle(item){
@@ -126,6 +127,7 @@ export default{
             this.isEditLayer = false
             this.activeLayerEl = {}
             this.isEditTitle = false
+            this.isVersionHistory = false
             
             this.pageList.map((item,index)=>{
                 if(item.id===id){
@@ -143,10 +145,12 @@ export default{
             })
         }
         this.isEditTitle = true
+        this.isVersionHistory = false
         if(this.isEditTitle){
             //进入标题编辑模式,需要退出其他模式
             this.isEditLayer = false
             this.activeLayerEl = {}
+            this.isVersionHistory = false
             
             //初始化该页标题的数据
             if(!this.currentItem.titleDetail){

+ 10 - 3
src/views/ppt_manage/mixins/pptMixins.js

@@ -201,9 +201,16 @@ export default {
     },
     //获取ppt详情
     async getpptDataById(id){
-      const res = this.currentLang!=='en'?await pptInterface.getpptDetail({
-        PptId:id
-      }):await pptEnInterface.getpptDetail({PptId:id})
+      let res = null
+      if (this.$route.query.isVersionRecord === 'true') {
+        res = await pptInterface.getPptHistoryDetail({
+          Id:id
+        })
+      } else {
+        res = this.currentLang!=='en'?await pptInterface.getpptDetail({
+          PptId:id
+        }):await pptEnInterface.getpptDetail({PptId:id})
+      }
       if(res.Ret===200){
         const {
             Content,

+ 202 - 0
src/views/ppt_manage/newVersion/components/layer/VersionRecord.vue

@@ -0,0 +1,202 @@
+<template>
+  <div class="statistic-analysis-wrap">
+      <div class="top-box">
+          <div class="right">
+            版本记录
+          </div>
+          <div class="left">
+              <div class="search-box">
+                  <el-switch
+                    v-model="OnlyMine"
+                    @change="handleChangeIsOnlyMine"
+                    active-text="仅显示我保存的版本">
+                  </el-switch>
+              </div>
+          </div>
+      </div>
+      <div class="main-box">
+          <div class="list-wrap" v-infinite-scroll="handleLoadMore" :infinite-scroll-immediate="true">
+              <div class="chart-item" v-for="item in list" :key="item.Id"  @mouseenter="showOperation(item.Id)"
+              @mouseleave="hideOperation">
+                  <div class="top">
+                    <div class="title">{{ item.Title }}</div>
+                    <div class="time">{{ item.CreateTime }}</div>
+                  </div>
+                  <div class="bottom">
+                    <div class="name">{{item.AdminRealName}}</div>
+                    <div class="operation" v-show="item.showOperations">
+                      <span @click="preview(item.Id)">预览</span>
+                      <span @click="$emit('handleRestore', item.Id)">恢复</span>
+                      <span class="delete" @click="deleteVersionRecord(item.Id)">删除</span>
+                    </div>
+                  </div>
+              </div>
+              <tableNoData :text="$t('Table.prompt_slogan')" style="width: 100%;" size="mini" v-if="list.length===0&&finished"/>
+          </div>
+      </div>
+  </div>
+</template>
+
+<script>
+import {pptInterface} from '@/api/api.js';
+export default {
+  data() {
+      return {
+          list:[],
+          page:1,
+          pageSize:10,
+          finished:false,
+          loading:false,
+          OnlyMine:false,      
+      }
+  },
+  created(){
+      this.getSandBoxList()
+  },
+  methods: {
+      /* 搜索版本记录分页 */
+      async getSandBoxList() {
+        const {id} = this.$route.query
+          let params = {
+              CurrentIndex: this.page,
+              PageSize: this.pageSize,
+              PptId:id,
+              IsShowMe: this.OnlyMine,
+          };
+          this.loading=true
+          let res = await pptInterface.getPptHistoryList(params);
+          this.loading=false
+          if (res.Ret !== 200) return;
+          const arr = (res.Data.List || []).map(item => ({
+            ...item,
+            showOperations: false, // 初始时隐藏操作栏
+          }));
+          this.list =
+              this.page === 1
+              ? arr
+              : [...this.list, ...arr];
+          this.finished =  res.Data.Paging.IsEnd;
+      },
+      // 是否仅显示我保存的版本
+      handleChangeIsOnlyMine(val) {
+          this.page = 1;
+          this.list = [];
+          this.getSandBoxList();
+      },
+      handleLoadMore(){
+          if(this.finished||this.loading) return
+          this.page++
+          this.getSandBoxList()
+      },
+      // 预览
+      preview(id){
+        this.$router.push({path:'/pptpublish', query:{id, isVersionRecord:'true'}})
+      },
+      // 删除弹窗
+      deleteVersionRecord(Id){
+          this.$confirm('删除后不可恢复,是否确认删除该版本?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }).then(() => {
+              this.deleteItem(Id)
+          }).catch(() => {
+          });
+      },
+      deleteItem(Id) {
+          pptInterface.getPptHistoryDel({
+              Id
+          }).then((res) => {
+              if(res.Ret !== 200) return
+              this.$message.success('删除成功!');
+              this.getSandBoxList();
+          });
+      },
+      showOperation(itemId) {
+        const item = this.list.find(i => i.Id === itemId);
+        if (item) {
+          this.$set(item, 'showOperations', true); // 使用 $set 以确保响应性
+        }
+      },
+      hideOperation() {
+        this.list.forEach(item => {
+          this.$set(item, 'showOperations', false); // 隐藏所有操作栏
+        });
+      },
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+div{
+  box-sizing: border-box;
+}
+.statistic-analysis-wrap{
+  margin-top: 10px;
+  border: 1px solid var(--gary-gy-5-line, #C8CDD9);
+  background: #FFF;
+  .top-box{
+      padding: 20px 20px 0 20px;
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+  }
+  .main-box{
+      padding: 20px;
+      height: calc(100vh - 180px);
+      border-radius: 4px;
+      display: flex;
+      flex-direction: column;
+      .list-wrap{
+          flex: 1;
+          overflow-y: auto;
+          // display: flex;
+          // flex-wrap: wrap;
+          gap: 0 20px;
+
+      }
+  }
+}
+.chart-item {
+  width: 100%;
+  max-height: 100px;
+  margin: 10px 0;
+  padding: 10px;
+  border: 1px solid #eaeaea;
+  border-radius: 10px;
+  font-size: 14px;
+  text-align: center;
+  .top {
+    display: flex;
+    justify-content: space-between;
+    .title {
+      max-width: 100px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      line-height: 20px;
+      font-size: 16px;
+      color: #333333;
+    }
+    .time {
+      line-height: 20px;
+      color: #666666;
+    }
+  }
+  .bottom {
+    margin-top: 10px;
+    display: flex;
+    justify-content: space-between;
+    .name {
+      color: #333333;
+    }
+    .operation {
+      cursor: pointer;
+      color: #0052D9;
+      .delete {
+        color: #D54941;
+      }
+    }
+  }
+}
+</style>

+ 24 - 2
src/views/ppt_manage/newVersion/pptEditor.vue

@@ -160,6 +160,7 @@
                  type="primary" @click="handlePublish">{{ result.ReportSource===1?'去发布':'去提交' }}</el-button>
                 <el-button @click="handleSave('save')">{{$t('Slides.operations_save')}}</el-button>
                 <el-button type="text" @click="handleChangeEditModal"><i class="el-icon-sort" style="transform: rotate(90deg);margin-right:5px;"></i>{{isEditLayer? $t('Slides.ppt_edit_btn'):$t('Slides.layer_editing')}}</el-button>
+                <el-button type="text" v-permission="permissionBtn.pptPermission.ppt_history" @click="handleVersionHistory"><i class="el-icon-time" style="margin-right:5px;"></i>{{$t('Slides.version_history')}}</el-button>
             </div>
             <div class="richtext-tool"></div>
             <!-- 防止el-tabs未渲染时触发scrollToActiveTab 报错,v-if改为v-show-->
@@ -278,6 +279,10 @@
                     @textChange="handleTextChange"
                     @applyToAll="changeSettingAll"/>
             </div>
+            <!-- 历史记录编辑 -->
+             <div class="history-edit-box" v-if="isVersionHistory">
+                <VersionRecord :PptId="PptId" @handleRestore="handleRestore"/>
+             </div>
           </div>
     </div>
 
@@ -347,6 +352,7 @@ import {pptInterface} from '@/api/api.js';
 import * as sheetInterface from '@/api/modules/sheetApi.js';
 import ShapePreview from './components/layer/shapePreview.vue';
 import LayerEditTool from './components/layer/layerEditTool.vue';
+import VersionRecord from './components/layer/VersionRecord.vue';
 import DeletePageDialog from './components/editor/DeletePageDialog.vue';
 import ChangeFormatDialog from './components/editor/ChangeFormatDialog.vue';
 import InsertPageDialog from './components/editor/InsertPageDialog.vue';
@@ -365,7 +371,7 @@ export default {
   components: {
     IndexItem, ChooseCover, AddFormat, ShapePreview,
     LayerEditTool, DeletePageDialog, ChangeFormatDialog, InsertPageDialog, addMyClassifyDia, InsertCharts, ContextMenu, InsertSemantics,
-    ChooseCoverNew,TitleEditorTool
+    ChooseCoverNew, TitleEditorTool, VersionRecord
 },
   data() {
     return {
@@ -423,7 +429,8 @@ export default {
         search_have_more: true,
 
         chart_source: 1,//图表来源 1 eta 2 商品价格
-        isShowMe: false
+        isShowMe: false,
+        isVersionHistory: false,//是否显示版本历史
     };
   },
   computed:{
@@ -778,10 +785,12 @@ export default {
           this.activeLayerEl = {}
           
           this.isEditTitle = false
+          this.isVersionHistory = false
         }
         //点击当前页时,退出标题编辑模式
         if(this.currentItem&&this.currentItem.id===id){
             this.isEditTitle = false
+            this.isVersionHistory = false
             return 
         }
         this.pageList.map((item,index)=>{
@@ -1032,6 +1041,19 @@ export default {
       el.push(temp);
       return el;
     },
+    // 版本记录列表
+    handleVersionHistory(item) {
+      this.isVersionHistory = true;
+    },
+    // 
+    async handleRestore(Id) {
+      let res = await pptInterface.getPptHistoryRevert({
+        Id
+      });
+      if (res.Ret !== 200) return;
+      this.$message.success('恢复成功!');
+      this.init()
+    },
     //更新ppt页元素(数据)
     refleshElements(els){
         this.currentItem.elements = els;

+ 2 - 2
src/views/ppt_manage/newVersion/pptPublish.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="publish-page-wrap page-wrap">
-      <div class="pub-btn-list">
+      <div class="pub-btn-list" v-if="this.$route.query.isVersionRecord !== 'true'">
         <el-button  type="primary" plain style="width:182px;height:40px;" @click="$router.push({path:'/pptlist'})">{{$t('Slides.return_to_list')}}</el-button>
 
         <!-- 下载配置 -->
@@ -32,7 +32,7 @@
           <!-- 内容 -->
           <div class="ppt-item" v-for="(item,index) in pageList" :key="item.id">
             <!-- 自定义标题 -->
-            <div class="custom-title-wrap content" 
+            <div class="custom-title-wrap content"
                 :style="item.titleDetail?{
                     left:(item.titleDetail.baseLeft||90)*contentScale+'px',
                     top:(item.titleDetail.baseTop||40.9)*contentScale+'px',

+ 1 - 0
src/views/report_manage/reportV2/components/reportEditHeader.vue

@@ -15,6 +15,7 @@
           <li 
             class="action-item" 
             @click="$emit('handleVersionRecord')"
+            v-permission="permissionBtn.reportManageBtn.reportMange_history"
             >
               <img src="~@/assets/img/smartReport/icon01.png" alt="">
               <span>{{$t('ReportManage.ReportList.version_record')}}</span>

+ 21 - 4
src/views/report_manage/reportV2/normalReport/components/VersionRecord.vue

@@ -16,14 +16,15 @@
       </div>
       <div class="main-box">
           <div class="list-wrap" v-infinite-scroll="handleLoadMore" :infinite-scroll-immediate="true">
-              <div class="chart-item" v-for="item in list" :key="item.SandboxId">
+              <div class="chart-item" v-for="item in list" :key="item.SandboxId" @mouseenter="showOperation(item.Id)"
+              @mouseleave="hideOperation">
                   <div class="top">
                     <div class="title">{{ item.Title }}</div>
                     <div class="time">{{ item.CreateTime }}</div>
                   </div>
                   <div class="bottom">
                     <div class="name">{{item.AdminName}}</div>
-                    <div class="operation">
+                    <div class="operation" v-show="item.showOperations">
                       <span @click="preview(item.Id)">预览</span>
                       <span @click="$emit('handleRestore', item.Id)">恢复</span>
                       <span class="delete" @click="deleteVersionRecord(item.Id)">删除</span>
@@ -65,6 +66,7 @@ export default {
           let params = {
               CurrentIndex: this.page,
               PageSize: this.pageSize,
+              IsShowMe: this.OnlyMine,
           };
           if (this.$route.query.coopType == '1') {
               params.ReportId = this.$route.query.id;
@@ -125,6 +127,17 @@ export default {
               this.getSandBoxList();
           });
       },
+      showOperation(itemId) {
+        const item = this.list.find(i => i.Id === itemId);
+        if (item) {
+          this.$set(item, 'showOperations', true); // 使用 $set 以确保响应性
+        }
+      },
+      hideOperation() {
+        this.list.forEach(item => {
+          this.$set(item, 'showOperations', false); // 隐藏所有操作栏
+        });
+      },
   },
 }
 </script>
@@ -166,14 +179,18 @@ div{
   padding: 20px;
   border: 1px solid #eaeaea;
   border-radius: 10px;
-  font-size: 16px;
+  font-size: 14px;
   text-align: center;
   .top {
     display: flex;
     justify-content: space-between;
     .title {
+      max-width: 250px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
       line-height: 20px;
-      font-size: 18px;
+      font-size: 16px;
       color: #333333;
     }
     .time {

+ 3 - 0
src/views/report_manage/reportV2/normalReport/components/insertContent.vue

@@ -35,6 +35,9 @@ export default {
   props: {
     actTab: {
       type: String
+    },
+    selectChapterId: {
+      type: Number
     }
   },
   components: {ETAChart,ETASheet,StatisticAnalysis,ETAPriceChart,ETASandBox,SemanticAnalysis,VersionRecord},

+ 5 - 6
src/views/report_manage/reportV2/normalReport/editReport.vue

@@ -76,6 +76,7 @@
 						<insertContent
 							v-show="activeTab"
 							:actTab="activeTab"
+							:selectChapterId="selectChapterId"
 							@slide="activeTab=''"
 							@insertHtml="insertHtml"
 							@handleImportMyChart="handleImportMyChart"
@@ -588,16 +589,14 @@ export default {
         },
         /* 恢复版本报告请求 */
         async reportHistoryRevert(Id) {
-			const _this = this;
             const res = await reportV2Interface.reportHistoryRevert({Id})
 			if(res.Ret !== 200) return
-			_this.$message.success('恢复成功!');
-			if (_this.$route.query.coopType === '1') {
-				_this.getReportDetail()
+			this.$message.success('恢复成功!');
+			if (this.$route.query.coopType === '1') {
+				this.getreportdetail()
 				console.log(44555);
 			} else {
-				console.log(2222);
-				_this.getChapterDetail()
+				this.getChapterDetail()
 			}
         },
 

+ 21 - 4
src/views/report_manage/reportV2/smartReport/components/VersionRecord.vue

@@ -16,14 +16,15 @@
       </div>
       <div class="main-box">
           <div class="list-wrap" v-infinite-scroll="handleLoadMore" :infinite-scroll-immediate="true">
-              <div class="chart-item" v-for="item in list" :key="item.SandboxId">
+              <div class="chart-item" v-for="item in list" :key="item.SandboxId" @mouseenter="showOperation(item.Id)"
+              @mouseleave="hideOperation">
                   <div class="top">
                     <div class="title">{{ item.Title }}</div>
                     <div class="time">{{ item.CreateTime }}</div>
                   </div>
                   <div class="bottom">
                     <div class="name">{{item.AdminName}}</div>
-                    <div class="operation">
+                    <div class="operation" v-show="item.showOperations">
                       <span @click="preview(item.Id)">预览</span>
                       <span @click="$emit('handleRestore', item.Id)">恢复</span>
                       <span class="delete" @click="deleteVersionRecord(item.Id)">删除</span>
@@ -65,6 +66,7 @@ export default {
           let params = {
               CurrentIndex: this.page,
               PageSize: this.pageSize,
+              IsShowMe: this.OnlyMine,
           };
           if (this.$route.query.coopType == '1') {
               params.ReportId = this.$route.query.id;
@@ -125,6 +127,17 @@ export default {
               this.getSandBoxList();
           });
       },
+      showOperation(itemId) {
+        const item = this.list.find(i => i.Id === itemId);
+        if (item) {
+          this.$set(item, 'showOperations', true); // 使用 $set 以确保响应性
+        }
+      },
+      hideOperation() {
+        this.list.forEach(item => {
+          this.$set(item, 'showOperations', false); // 隐藏所有操作栏
+        });
+      },
   },
 }
 </script>
@@ -166,14 +179,18 @@ div{
   padding: 20px;
   border: 1px solid #eaeaea;
   border-radius: 10px;
-  font-size: 16px;
+  font-size: 14px;
   text-align: center;
   .top {
     display: flex;
     justify-content: space-between;
     .title {
+      max-width: 250px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
       line-height: 20px;
-      font-size: 18px;
+      font-size: 16px;
       color: #333333;
     }
     .time {

+ 0 - 1
src/views/report_manage/reportV2/smartReport/editReport.vue

@@ -53,7 +53,6 @@
                     @update="()=>{$refs.chapterContRef&&$refs.chapterContRef.getChapterList()}"
                     @handleVersionRecord="handleVersionRecord()"
                 />
-
                 <div class="main-wrap">
                     <div class="report-action-wrap">
                         <ul class="top-type-list">