大屏页面初始化

This commit is contained in:
2026-03-13 14:40:01 +08:00
parent 30ac9fa3ee
commit 51b2de579e
25 changed files with 2511 additions and 6 deletions

View File

@@ -0,0 +1,214 @@
<template>
<div class="chart-top-container">
<div class="card-item" v-for="(item, index) in cardList" :key="index">
<div class="card-left">
<div class="icon-box">
<img
:src="item.iconImg"
class="icon-img"
:style="{ filter: item.iconFilter }"
>
</div>
<div class="card-text">
<div class="module-name">{{ item.module }}</div>
<div class="desc-text">{{ item.title }}</div>
</div>
</div>
<div class="card-right">
<div class="num-value">{{ item.value }}</div>
<div class="num-label">{{ item.label }}</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, watch } from 'vue'
import { getIndexInfoList } from '@/api/bizApi'
const cardList = ref()
async function getList() {
try {
const reqParams = {
indexCode: "workIndex"
}
const res = await getIndexInfoList(reqParams)
cardList.value = res || []
} catch (error) {
console.error('获取数据失败:', error)
cardList.value = []
}
}
const resizeHandler = () => {
const container = document.querySelector('.chart-top-container')
if (container) {
const height = container.parentElement.clientHeight
container.style.height = `${height}px`
}
}
onMounted(() => {
getList()
})
watch(
() => {},
() => {
window.removeEventListener('resize', resizeHandler)
},
{ once: true }
)
</script>
<style scoped>
.chart-top-container {
width: 100%;
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
gap: 4px;
padding: 2px 4px;
box-sizing: border-box;
flex-wrap: wrap;
background: transparent;
}
.card-item {
flex: 1;
min-width: 160px;
height: 85%;
background: rgba(15, 52, 96, 0.1);
border: 1px solid rgba(26, 80, 139, 0.3);
border-radius: 8px;
padding: 0 8px;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
position: relative;
overflow: hidden;
transition: all 0.3s ease;
backdrop-filter: blur(2px);
}
.card-item:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(60, 156, 255, 0.2);
border-color: rgba(60, 156, 255, 0.6);
}
.card-left {
display: flex;
align-items: center;
gap: 6px;
}
.icon-box {
width: 40px;
height: 40px;
background: transparent;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid rgba(224, 230, 255, 0.1);
border-radius: 8px;
box-sizing: border-box;
}
.icon-img {
width: 100%;
height: 100%;
object-fit: contain;
opacity: 0.9;
transition: all 0.2s ease;
}
.icon-box:hover .icon-img {
opacity: 1;
transform: scale(1.05);
filter: brightness(1.1) contrast(1.2);
}
.card-text {
color: #e0e6ff;
}
.module-name {
font-size: 15px;
font-weight: 600;
line-height: 1.2;
}
.desc-text {
font-size: 11px;
opacity: 0.7;
margin-top: 2px;
}
.card-right {
text-align: right;
color: #e0e6ff;
}
.num-value {
font-size: 24px;
font-weight: 700;
line-height: 1;
background: linear-gradient(to right, #3c9cff, #7472fe);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.num-label {
font-size: 11px;
opacity: 0.7;
margin-top: 4px;
}
@media (max-width: 1600px) {
.card-item {
min-width: 140px;
padding: 0 6px;
}
.icon-box {
width: 36px;
height: 36px;
}
.module-name {
font-size: 14px;
}
.num-value {
font-size: 22px;
}
}
@media (max-width: 768px) {
.chart-top-container {
flex-direction: column;
height: auto !important;
gap: 4px;
padding: 2px;
}
.card-item {
width: 100%;
height: 80px;
min-width: unset;
padding: 0 8px;
}
}
@media (max-height: 900px) {
.card-item {
height: 80%;
}
.icon-box {
width: 32px;
height: 32px;
}
.num-value {
font-size: 20px;
}
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">1</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/desck3.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">2</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/desck3.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">3</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/desck3.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">4</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/k2style.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">5</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/k2style.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">6</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/k2style.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">7</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/k2style.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">8</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/k2style.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">9</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/k2style.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div class="chart-card">
<div class="chart-card-header">
<span class="chart-card-title">10</span>
</div>
<div class="bar-line-chart-container" ref="chartRef"></div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { getItemInfoList } from '@/api/bizApi'
</script>
<style scoped>
.chart-card {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
background: rgba(0, 0, 0, 0.1) url("@/assets/images/k2style.png") no-repeat;
background-size: 100% 100%;
}
.chart-card-header {
height: 40px;
line-height: 40px;
padding: 0 16px;
background-color: rgba(26, 80, 139, 0.5);
border-bottom: 1px solid #1a508b;
display: flex;
align-items: center;
}
.chart-card-title {
font-size: 16px;
font-weight: 600;
color: #409EFF;
letter-spacing: 0.5px;
}
.bar-line-chart-container {
flex: 1;
width: 100%;
height: calc(100% - 40px);
}
</style>

View File

@@ -1,8 +1,281 @@
<template>
<div class="work-layout-container">
<div class="work-section work-top-header">
<div class="work-card full-card">
<ChartTop />
</div>
</div>
<div class="work-section work-main-section">
<div class="work-row work-row-1-3">
<div
v-for="item in getComponentsBySortRange(1, 3)"
:key="item.sort"
class="work-card work-card-1-3"
>
<component
:is="componentMap[item.vueName]"
:formParams="FormValues"
v-if="componentMap[item.vueName]"
/>
</div>
</div>
<div class="work-row work-row-1-3">
<div
v-for="item in getComponentsBySortRange(4, 5)"
:key="item.sort"
class="work-card work-card-1-2"
>
<component
:is="componentMap[item.vueName]"
:formParams="FormValues"
v-if="componentMap[item.vueName]"
/>
</div>
</div>
<div class="work-row work-row-1-3">
<div
v-for="item in getComponentsBySortRange(6, 7)"
:key="item.sort"
class="work-card work-card-1-2"
>
<component
:is="componentMap[item.vueName]"
:formParams="FormValues"
v-if="componentMap[item.vueName]"
/>
</div>
</div>
</div>
</div>
</template>
<script>
<script setup>
import { ref, watch, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import ChartTop from './components/ChartTop.vue';
import { getChartListAll } from '@/api/bizChart'
const route = useRoute();
const FormValues = ref({
reqParam: route.query.year
});
watch(
() => route.query.year,
(newVal) => {
FormValues.value.reqParam = newVal;
},
{
deep: true,
immediate: true
}
);
const componentMap = ref({});
const chartData = ref([]);
const getComponentsBySortRange = (start, end) => {
return chartData.value.filter(item => item.sort >= start && item.sort <= end);
};
const loadComponent = async (vueName) => {
try {
const module = await import(`./components/${vueName}.vue`);
return module.default;
} catch (error) {
console.error('加载组件失败', error);
return null;
}
};
async function getChartList(){
try {
const reqParams = {
chartCode: 'home'
}
const res = await getChartListAll(reqParams)
chartData.value = res || []
} catch (error) {
console.error('获取数据失败:', error);
chartData.value = []
}
}
onMounted(async () => {
try {
await getChartList();
chartData.value = chartData.value.sort((a, b) => a.sort - b.sort);
const newComponentMap = {};
const uniqueComponents = [...new Set(chartData.value.map(item => item.vueName))];
for (const vueName of uniqueComponents) {
const component = await loadComponent(vueName);
if (component) {
newComponentMap[vueName] = component;
}
}
componentMap.value = newComponentMap;
} catch (error) {
console.error('加载图表数据失败:', error);
}
});
</script>
<style>
<style scoped>
.work-layout-container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
gap: 2px;
padding: 2px;
margin: 0 !important;
box-sizing: border-box;
background-color: transparent;
overflow: hidden;
}
.work-section {
width: 100%;
display: flex;
gap: 2px;
box-sizing: border-box;
overflow: hidden;
}
.work-top-header {
height: 10%;
}
.work-main-section {
height: 90%;
flex-direction: column;
}
/* 行样式 */
.work-row {
width: 100%;
display: flex;
gap: 2px;
box-sizing: border-box;
overflow: hidden;
}
.work-row-1-3 {
height: calc((100% - 4px) / 3);
}
/* 一行 3 个时的卡片宽度 */
.work-card-1-3 {
width: calc((100% - 4px) / 3);
height: 100%;
}
/* 一行 2 个时的卡片宽度 */
.work-card-1-2 {
width: calc((100% - 2px) / 2);
height: 100%;
}
.work-card {
width: 100%;
background-color: rgba(15, 52, 96, 0.1);
border: 1px solid rgba(26, 80, 139, 0.3);
border-radius: 8px;
padding: 2px;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #e0e6ff;
backdrop-filter: blur(2px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
min-height: 0;
margin: 0;
}
.full-card {
width: 100%;
height: 100%;
}
.work-card:hover {
box-shadow: 0 4px 12px rgba(60, 156, 255, 0.2);
border-color: rgba(60, 156, 255, 0.6);
transition: all 0.3s ease;
}
.work-card h3 {
font-size: 16px;
margin-bottom: 8px;
letter-spacing: 1px;
background: #3c9cff;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 600;
}
.work-card p {
font-size: 13px;
opacity: 0.75;
color: #b4c7e7;
text-align: center;
line-height: 1.5;
}
.empty-card {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
color: #88a0c2;
font-size: 14px;
}
@media (max-width: 1600px) {
.work-card h3 {
font-size: 14px;
}
.work-card p {
font-size: 12px;
}
}
@media (max-width: 768px) {
.work-layout-container {
flex-direction: column;
height: auto;
min-height: 100%;
overflow-y: auto;
}
.work-section {
flex-direction: column;
height: auto !important;
min-height: 120px;
}
.work-row-1-3 {
height: auto;
flex-direction: column;
}
.work-card-1-3,
.work-card-1-2 {
width: 100%;
height: 120px;
margin-bottom: 2px;
}
}
@media (max-height: 900px) {
.work-card h3 {
font-size: 14px;
margin-bottom: 6px;
}
.work-card p {
font-size: 12px;
}
}
</style>