|
@@ -1,4 +1,5 @@
|
|
|
import { reportadd, reportedit, messagePushPost,dataBaseInterface,reportMessageSend } from "@/api/api.js";
|
|
|
+import * as sheetInterface from '@/api/modules/sheetApi.js';
|
|
|
import { getUrlParams } from '@/utils/common'
|
|
|
export default {
|
|
|
data() {
|
|
@@ -84,50 +85,71 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- //刷报告中的所有图表
|
|
|
+ //刷报告中的所有图表和表格
|
|
|
refreshReport: _.debounce ( async function() {
|
|
|
let code_arr = [];
|
|
|
+ let sheet_code_arr = []
|
|
|
$('iframe').each((k,i) => {
|
|
|
try {
|
|
|
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) {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- 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) {
|
|
|
+ const fromPage = this.$route.path === "/reportEnEditor" ? "english_report" : "report";
|
|
|
+ if(this.$route.query.id&&code_arr.length) {
|
|
|
let res = await dataBaseInterface.getReportrefreshStatus({
|
|
|
- Source: 'report',
|
|
|
+ Source: fromPage,
|
|
|
ReportId: Number(this.$route.query.id),
|
|
|
ReportChapterId: 0
|
|
|
});
|
|
|
|
|
|
if(!res.Data.RefreshResult) return this.$message.warning('图表正在刷新中,请勿重复操作')
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- // 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'))
|
|
|
- });
|
|
|
- this.$message.success(Msg);
|
|
|
+ if(this.$route.query.id&&sheet_code_arr.length){
|
|
|
+ //获取刷新结果
|
|
|
+ let res = await sheetInterface.getRefreshResult({
|
|
|
+ Source: fromPage,
|
|
|
+ ReportId: Number(this.$route.query.id),
|
|
|
+ ReportChapterId: 0
|
|
|
+ });
|
|
|
+ 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),
|
|
|
},
|
|
|
};
|