瀏覽代碼

Merge branch 'smartReport-refresh'

cxmo 1 年之前
父節點
當前提交
c8556519ee
共有 1 個文件被更改,包括 46 次插入23 次删除
  1. 46 23
      src/views/smartReport/editReport.vue

+ 46 - 23
src/views/smartReport/editReport.vue

@@ -243,6 +243,7 @@ import { getPublicSettingsApi } from '@/api/modules/oldApi';
 import { dataBaseInterface } from "@/api/api.js";
 import { dataBaseInterface } from "@/api/api.js";
 import {apiSmartReport}  from '@/api/modules/smartReport'
 import {apiSmartReport}  from '@/api/modules/smartReport'
 import {approveInterence} from '@/api/modules/approve.js';
 import {approveInterence} from '@/api/modules/approve.js';
+import * as sheetInterface from '@/api/modules/sheetApi.js';
 import BaseInfo from './components/BaseInfo.vue'
 import BaseInfo from './components/BaseInfo.vue'
 import StatisticAnalysis from './components/StatisticAnalysis.vue'
 import StatisticAnalysis from './components/StatisticAnalysis.vue'
 import ETAPriceChart from './components/ETAPriceChart.vue'
 import ETAPriceChart from './components/ETAPriceChart.vue'
@@ -844,47 +845,69 @@ export default {
             })
             })
         },
         },
 
 
-        // 刷新所有图表
+        // 刷新所有图表和表格
         handleRefreshAllChart: _.debounce ( async function() {
         handleRefreshAllChart: _.debounce ( async function() {
             let code_arr = [];
             let code_arr = [];
+            let sheet_code_arr = []
             $('iframe').each((k,i) => {
             $('iframe').each((k,i) => {
                 try {
                 try {
                     let href = $(i).attr('src');
                     let href = $(i).attr('src');
-                    code_arr.push(getUrlParams(href,'code'));
+                    if(href.includes('chartshow')){
+                        code_arr.push(getUrlParams(href,'code'));
+                    }
+                    if(href.includes('sheetshow')){
+                        sheet_code_arr.push(getUrlParams(href,'code'))
+                    }
                 } catch (err) {
                 } catch (err) {
                 }
                 }
             });
             });
 
 
-            if(!code_arr.length) return this.$message.warning('请插入图表');
+            if(!code_arr.length&&!sheet_code_arr.length) return this.$message.warning('请插入图表或表格');
 
 
-            if(this.$route.query.id) {
+            if(this.$route.query.id&&code_arr.length) {
                 let res = await dataBaseInterface.getReportrefreshStatus({
                 let res = await dataBaseInterface.getReportrefreshStatus({
-                Source: 'report',
+                Source: 'smart_report',
                 ReportId: Number(this.$route.query.id),
                 ReportId: Number(this.$route.query.id),
                 ReportChapterId: 0
                 ReportChapterId: 0
                 });
                 });
                 
                 
                 if(!res.Data.RefreshResult) return this.$message.warning('图表正在刷新中,请勿重复操作')
                 if(!res.Data.RefreshResult) return this.$message.warning('图表正在刷新中,请勿重复操作')
-            }
 
 
-            // const loading = this.$loading({
-            //     lock: true,
-            //     text: '刷新中..',
-            //     spinner: 'el-icon-loading',
-            //     background: 'rgba(0, 0, 0, 0.02)'
-            // });
-
-            const { Ret,Msg } = await dataBaseInterface.reportRefresh({
-                ChartInfoCode: code_arr
-            })
-        
-            // loading.close();
-            
-            if(Ret === 200) {
-                $('iframe').each((k,i) => {
-                    $(i).attr('src',$(i).attr('src'))
+                const { Ret,Msg } = await dataBaseInterface.reportRefresh({
+                    ChartInfoCode: code_arr
+                })
+                
+                if(Ret === 200) {
+                    $('iframe').each((k,i) => {
+                        let href = $(i).attr('src');
+                        if(href.includes('chartshow')){
+                            $(i).attr('src',$(i).attr('src'))
+                        }
+                    });
+                    this.$message.success(Msg);
+                }
+            }
+            if(this.$route.query.id&&sheet_code_arr.length){
+                //获取刷新结果
+                let res = await sheetInterface.getRefreshResult({
+                    Source: 'smart_report',
+                    ReportId: Number(this.$route.query.id),
+                    ReportChapterId: 0
                 });
                 });
-                this.$message.success(Msg);
+                if(!res.Data.RefreshResult) return this.$message.warning('表格正在刷新中,请勿重复操作')
+                const { Ret,Msg } = await sheetInterface.refreshSheet({
+                    ExcelCodes: sheet_code_arr
+                })
+                
+                if(Ret === 200) {
+                    $('iframe').each((k,i) => {
+                        let href = $(i).attr('src');
+                        if(href.includes('sheetshow')){
+                            $(i).attr('src',$(i).attr('src'))
+                        }
+                    });
+                    this.$message.success(Msg);
+                }
             }
             }
 
 
         },1000),
         },1000),