diff --git a/report-stat/backend/src/main/java/io/metersphere/reportstatistics/controller/ReportStatShareController.java b/report-stat/backend/src/main/java/io/metersphere/reportstatistics/controller/ReportStatShareController.java new file mode 100644 index 0000000000..028c680ee2 --- /dev/null +++ b/report-stat/backend/src/main/java/io/metersphere/reportstatistics/controller/ReportStatShareController.java @@ -0,0 +1,32 @@ +package io.metersphere.reportstatistics.controller; + +import io.metersphere.base.domain.ReportStatisticsWithBLOBs; +import io.metersphere.reportstatistics.dto.ReportStatisticsSaveRequest; +import io.metersphere.reportstatistics.service.ReportStatisticsService; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.annotation.Resource; + +@Controller +public class ReportStatShareController { + @GetMapping(value = "/chart-pic") + public String getChart() { + return "share-enterprise-report.html"; + } +} + +@RequestMapping(value = "/share/info") +class ShareInfoController { + @Resource + private ReportStatisticsService reportStatisticsService; + + @PostMapping("/selectHistoryReportById") + public ReportStatisticsWithBLOBs selectById(@RequestBody ReportStatisticsSaveRequest request) { + return reportStatisticsService.selectById(request.getId()); + } +} + diff --git a/report-stat/backend/src/main/java/io/metersphere/reportstatistics/service/ReportStatisticsService.java b/report-stat/backend/src/main/java/io/metersphere/reportstatistics/service/ReportStatisticsService.java index 803957b9c4..64b0c2abb2 100644 --- a/report-stat/backend/src/main/java/io/metersphere/reportstatistics/service/ReportStatisticsService.java +++ b/report-stat/backend/src/main/java/io/metersphere/reportstatistics/service/ReportStatisticsService.java @@ -278,12 +278,12 @@ public class ReportStatisticsService { Map urlMap = new HashMap<>(); for (ReportStatisticsWithBLOBs blob : reportRecordIdList) { - String url = platformUrl + "/echartPic?shareId=" + blob.getId(); + String url = platformUrl + "/report/chart-pic?shareId=" + blob.getId(); urlMap.put(blob.getId(), url); } headlessRequest.setUrlMap(urlMap); headlessRequest.setRemoteDriverUrl(remoteDriverUrl); - LogUtil.info("使用ChromeUtil来获取图片信息。 language:" + language + ",headlessRequest:" + JSON.toJSONString(headlessRequest)); + LogUtil.info("使用ChromeUtil来获取图片信息。url:" + JSON.toJSONString(urlMap) + "; language:" + language + ",headlessRequest:" + JSON.toJSONString(headlessRequest)); Map returnMap = chromeUtils.getImageInfo(headlessRequest, language); return returnMap; } diff --git a/report-stat/frontend/src/api/share.js b/report-stat/frontend/src/api/share.js new file mode 100644 index 0000000000..3178c5c6e1 --- /dev/null +++ b/report-stat/frontend/src/api/share.js @@ -0,0 +1,32 @@ +import {post} from "metersphere-frontend/src/plugins/request" + +let basePath = '/share/info'; + +export function selectShareReportById(param) { + return post(basePath + '/selectHistoryReportById', param) +} + +export function getShareId() { + let herfUrl = window.location.href; + if (herfUrl.indexOf('shareId=') > -1) { + let shareId = ''; + new URL(herfUrl).searchParams.forEach((value, key) => { + if (key === 'shareId') { + shareId = value; + } + }); + return shareId; + } else { + if (herfUrl.indexOf("?") > 0) { + let paramArr = herfUrl.split("?"); + if (paramArr.length > 1) { + let shareId = paramArr[1]; + if (shareId.indexOf("#") > 0) { + shareId = shareId.split("#")[0]; + } + return shareId; + } + } + } + return ""; +} diff --git a/report-stat/frontend/src/template/enterprise/share/ShareEnterpriseReportTemplate.vue b/report-stat/frontend/src/template/enterprise/share/ShareEnterpriseReportTemplate.vue new file mode 100644 index 0000000000..eb2af6f2b6 --- /dev/null +++ b/report-stat/frontend/src/template/enterprise/share/ShareEnterpriseReportTemplate.vue @@ -0,0 +1,109 @@ + + + + + diff --git a/report-stat/frontend/src/template/enterprise/share/share-enterprise-report.html b/report-stat/frontend/src/template/enterprise/share/share-enterprise-report.html new file mode 100644 index 0000000000..b3ec1c321f --- /dev/null +++ b/report-stat/frontend/src/template/enterprise/share/share-enterprise-report.html @@ -0,0 +1,13 @@ + + + + + + + + Enterprise Report + + +
+ + diff --git a/report-stat/frontend/src/template/enterprise/share/share-enterprise-report.js b/report-stat/frontend/src/template/enterprise/share/share-enterprise-report.js new file mode 100644 index 0000000000..a202d5c6ff --- /dev/null +++ b/report-stat/frontend/src/template/enterprise/share/share-enterprise-report.js @@ -0,0 +1,47 @@ +import ShareEnterpriseReportTemplate from "./ShareEnterpriseReportTemplate"; + +import Vue from 'vue'; +import ElementUI, {Button, Card, Col, Form, FormItem, Input, Main, Row, Table, TableColumn} from 'element-ui'; +import 'metersphere-frontend/src/assets/theme/index.css'; +import 'metersphere-frontend/src/styles/business/menu-header.css'; +import 'metersphere-frontend/src/styles/business/main.css'; +import directives from "metersphere-frontend/src/directive"; +import i18n from "@/i18n"; +import filters from "metersphere-frontend/src/filters"; +import icons from "metersphere-frontend/src/icons"; +import plugins from "metersphere-frontend/src/plugins"; +import JSONPathPicker from 'vue-jsonpath-picker'; +import VuePapaParse from 'vue-papa-parse' +import mavonEditor from 'mavon-editor' +import chart from "metersphere-frontend/src/chart"; + +Vue.use(ElementUI, { + i18n: (key, value) => i18n.t(key, value) +}); +Vue.use(Row); +Vue.use(Col); +Vue.use(Form); +Vue.use(FormItem); +Vue.use(Input); +Vue.use(Button); +Vue.use(JSONPathPicker); +Vue.use(VuePapaParse); +Vue.use(mavonEditor); +Vue.use(filters); +Vue.use(directives); +Vue.use(icons); +Vue.use(plugins); +Vue.use(chart); +Vue.use(Main); +Vue.use(Card); +Vue.use(TableColumn); +Vue.use(Table); +Vue.use(filters); + + +new Vue({ + el: '#shareEnterpriseReport', + i18n, + render: h => h(ShareEnterpriseReportTemplate) +}); + diff --git a/report-stat/frontend/vue.config.js b/report-stat/frontend/vue.config.js index 3a6df1da40..4624ddef01 100644 --- a/report-stat/frontend/vue.config.js +++ b/report-stat/frontend/vue.config.js @@ -29,6 +29,13 @@ module.exports = { 'Access-Control-Allow-Origin': '*', }, }, + pages: { + shareEnterpriseReport: { + entry: "src/template/enterprise/share/share-enterprise-report.js", + template: "src/template/enterprise/share/share-enterprise-report.html", + filename: "share-enterprise-report.html", + }, + }, configureWebpack: { devtool: 'cheap-module-source-map', resolve: {