fix
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
<script setup>
|
||||
// 接收 props
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
})
|
||||
|
||||
const titleClass = computed(() => {
|
||||
// 统一使用主题色
|
||||
return 'bg-primary'
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative">
|
||||
<!-- 标题部分 -->
|
||||
<div :class="titleClass" class="inline-block rounded-lg px-2 py-1 text-white font-bold shadow-md">
|
||||
{{ title }}
|
||||
</div>
|
||||
|
||||
<!-- 左上角修饰 -->
|
||||
<div
|
||||
class="absolute left-0 top-0 h-4 w-4 transform rounded-full bg-white shadow-md -translate-x-2 -translate-y-2" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
9745
src/example.json
9745
src/example.json
File diff suppressed because it is too large
Load Diff
35
src/main.js
35
src/main.js
@@ -1,31 +1,20 @@
|
||||
import './assets/main.css'
|
||||
import { createApp } from 'vue'
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import App from './App.vue'
|
||||
import "./assets/main.css";
|
||||
import { createApp } from "vue";
|
||||
import { createRouter, createWebHistory } from "vue-router";
|
||||
import App from "./App.vue";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Report',
|
||||
component: () => import('./views/Report.vue')
|
||||
path: "/",
|
||||
name: "Report",
|
||||
component: () => import("./views/Report.vue"),
|
||||
},
|
||||
{
|
||||
path: '/report',
|
||||
name: 'ReportView',
|
||||
component: () => import('./views/Report.vue')
|
||||
},
|
||||
{
|
||||
path: '/report-pdf',
|
||||
name: 'ReportPDF',
|
||||
component: () => import('./views/ReportPDF.vue')
|
||||
}
|
||||
]
|
||||
})
|
||||
],
|
||||
});
|
||||
|
||||
const app = createApp(App)
|
||||
app.use(router)
|
||||
|
||||
app.mount('#app')
|
||||
const app = createApp(App);
|
||||
app.use(router);
|
||||
|
||||
app.mount("#app");
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,129 +0,0 @@
|
||||
<template>
|
||||
<div class="pdf-page">
|
||||
<div v-if="isLoading" class="loading-container">
|
||||
<div class="loading-spinner"></div>
|
||||
<p>加载中,请稍候...</p>
|
||||
</div>
|
||||
<div v-else-if="reportData" class="pdf-content">
|
||||
<CDWBG8B4DPDF :data="reportData" />
|
||||
</div>
|
||||
<div v-else class="error-container">
|
||||
<p>未找到报告数据</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import CDWBG8B4DPDF from '@/ui/CDWBG8B4D/CDWBG8B4D-PDF.vue'
|
||||
|
||||
const isLoading = ref(true)
|
||||
const reportData = ref(null)
|
||||
|
||||
onMounted(async () => {
|
||||
await loadReportData()
|
||||
})
|
||||
|
||||
const loadReportData = async () => {
|
||||
try {
|
||||
// 从 public 目录加载示例数据
|
||||
const response = await fetch('/example.json')
|
||||
const data = await response.json()
|
||||
|
||||
if (Array.isArray(data) && data.length > 0) {
|
||||
// 查找 DWBG8B4D 的数据
|
||||
const cdwbg8b4dItem = data.find(item =>
|
||||
item.data?.apiID === 'DWBG8B4D' || item.data?.apiID === 'CDWBG8B4D'
|
||||
)
|
||||
|
||||
if (cdwbg8b4dItem && cdwbg8b4dItem.data?.data) {
|
||||
reportData.value = cdwbg8b4dItem.data.data
|
||||
} else {
|
||||
console.warn('未找到 DWBG8B4D 数据')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载报告数据失败:', error)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pdf-page {
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf0 100%);
|
||||
padding: 32px 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pdf-content {
|
||||
width: 100%;
|
||||
max-width: 794px;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 4px solid #f3f3f3;
|
||||
border-top: 4px solid #3498db;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.loading-container p {
|
||||
color: #666;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.error-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.error-container p {
|
||||
color: #e74c3c;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* 打印样式 */
|
||||
@media print {
|
||||
.pdf-page {
|
||||
padding: 0;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.pdf-content {
|
||||
box-shadow: none;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user