update code

main
lijun 2024-12-21 12:53:01 +08:00
parent d5f9911e17
commit c7d4946bee
7 changed files with 687 additions and 617 deletions

View File

@ -59,6 +59,7 @@
"js-md5": "^0.8.3",
"json-editor-vue3": "^1.1.1",
"lodash-es": "^4.17.21",
"mitt": "^3.0.1",
"net": "^1.0.2",
"nprogress": "^0.2.0",
"path-browserify": "^1.0.1",

View File

@ -168,5 +168,14 @@ html.dark {
}
}
}
.jv-container.jv-light{
background: #263445;
}
.add-report .row-norm .el-form-item__content{
background: #263445;
}
.add-report .div-nav-header{
color:#fff;
}
}
</style>

View File

@ -54,6 +54,7 @@ import defaultSettings from "@/settings";
import UserAPI from "@/api/myUser";
import { DeviceEnum } from "@/enums/DeviceEnum";
import { ThemeEnum } from "@/enums/ThemeEnum";
const appStore = useAppStore();
const tagsViewStore = useTagsViewStore();
// Stores

View File

@ -1,7 +1,7 @@
import defaultSettings from "@/settings";
import { ThemeEnum } from "@/enums/ThemeEnum";
import Color from "color";
import eventBus from '@/utils/eventBus.js'
type SettingsValue = boolean | string;
export const useSettingsStore = defineStore("setting", () => {
@ -89,6 +89,7 @@ export const useSettingsStore = defineStore("setting", () => {
*/
function changeTheme(val: string) {
theme.value = val;
eventBus.emit("changeTheme",val)
}
/**

View File

@ -0,0 +1,4 @@
// eventBus.js
import mitt from 'mitt';
const bus = mitt();
export default bus;

View File

@ -1,6 +1,6 @@
<template>
<div class="app-container simulation-report-desc" v-loading="loading">
<div style="background-color: #fff;padding:20px;margin-bottom: 60px;" id="print_simulation_report_desc">
<div style="padding:20px;margin-bottom: 60px;" id="print_simulation_report_desc">
<div class="report-name">{{ info.report.report_name }}</div>
<div class="report-info">
<el-row>
@ -106,8 +106,8 @@
</template>
</el-table-column>
</el-table>
<div style="margin-top:20px;">
<charts id="reportChart3-robustness" width="100%" height="400px" :render="renderChar3">
<div style="margin-top:20px;" :key="info.chartKey">
<charts :key="info.chartKey" id="reportChart3-robustness" width="100%" height="400px" :render="renderChar3">
</charts>
</div>
</template>
@ -214,10 +214,18 @@
</template>
<script setup>
import {
useSettingsStore,
} from "@/store";
import ReportApi from '@/api/report'
import charts from './components/charts.vue'
import html2canvas from 'html2canvas';
import { useDateFormat } from "@vueuse/core";
import { ThemeEnum } from "@/enums/ThemeEnum";
import eventBus from '@/utils/eventBus.js'
const settingsStore = useSettingsStore();
const isDark = ref(settingsStore.theme === ThemeEnum.DARK);
const route = useRoute()
const router = useRouter();
const info = reactive({
@ -232,6 +240,8 @@ const info = reactive({
horizontal_comparison: [],
isPrint: false,
elPrint: 0,
theme:settingsStore.theme,
chartKey:0,
})
const loading = ref(false)
const calcChartHeight = it => {
@ -353,13 +363,19 @@ function renderChar4() {
}
let opt = {
title: {
text: '硬件横向对比测试图'
text: '硬件横向对比测试图',
textStyle:{
color:isDark.value? "#fff":"#333"
}
},
legend: {
x: 'left',
top: 40,
orient: 'vertical',
data: datas.map((d, idx) => idx + 1 + "-" + d.device_name)
data: datas.map((d, idx) => idx + 1 + "-" + d.device_name),
textStyle:{
color:isDark.value? "#fff":"#333"
}
},
tooltip: {
trigger: 'axis'
@ -455,13 +471,19 @@ function renderChar3() {
}
let opt = {
title: {
text: '推理结果比对图'
text: '推理结果比对图',
textStyle:{
color:isDark.value? "#fff":"#333"
}
},
legend: {
x: 'left',
top: 40,
orient: 'vertical',
data: legendDatas
data: legendDatas,
textStyle:{
color:isDark.value? "#fff":"#333"
}
},
tooltip: {
trigger: 'axis'
@ -498,16 +520,25 @@ function renderChart1(data, type) {
let opt = {
legend: {
left: '10%', right: '20%',
data: chartInfo.names
data: chartInfo.names,
textStyle:{
color:isDark.value? "#fff":"#333"
}
},
grid: { top: gridTop, },
xAxis: [{
type: 'category', // type
data: chartInfo.labels, // x
textStyle:{
color:isDark.value? "#fff":"#333"
}
}],
yAxis: [{
type: 'value',
name: type == 'roc' ? "ROC曲线" : "RP曲线"
name: type == 'roc' ? "ROC曲线" : "RP曲线",
textStyle:{
color:isDark.value? "#fff":"#333"
}
}],
tooltip: {
trigger: 'axis'
@ -546,7 +577,17 @@ function initTaskChart(it) {
rocs, rps, names, labels
}
}
onUnmounted(()=>{
eventBus.off("changeTheme");
});
function loadData() {
eventBus.on("changeTheme",d=>{
info.theme=d;
info.chartKey++;
isDark.value=d== ThemeEnum.DARK;
});
let id = route.query.id;
ReportApi.getReport(id).then(d => {
info.report = d.data.data || {};
@ -592,6 +633,10 @@ onMounted(loadData);
font-size: 12px;
#print_simulation_report_desc {
background: #fff;
}
.report-name {
font-size: 20px;
text-align: center;
@ -699,3 +744,12 @@ html.report-print {
margin: 20px;
}
</style>
<style lang="scss">
html.dark {
.simulation-report-desc {
#print_simulation_report_desc {
background: #304156;
}
}
}
</style>

View File

@ -6525,7 +6525,7 @@ minimist@^1.2.0, minimist@^1.2.6:
mitt@^3.0.1:
version "3.0.1"
resolved "https://registry.npmmirror.com/mitt/-/mitt-3.0.1.tgz"
resolved "https://registry.npmmirror.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1"
integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==
mixin-deep@^1.2.0: