大屏项目初始化
This commit is contained in:
937
screen-vue/package-lock.json
generated
937
screen-vue/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -7,19 +7,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="erp-section erp-upper-section">
|
<div class="erp-section erp-upper-section">
|
||||||
<div class="erp-col erp-col-1-3">
|
<div
|
||||||
|
v-for="item in getComponentsBySortRange(1, 3)"
|
||||||
|
:key="item.sort"
|
||||||
|
class="erp-col erp-col-1-3"
|
||||||
|
>
|
||||||
<div class="erp-card">
|
<div class="erp-card">
|
||||||
<ChartV01 :formParams="FormValues" />
|
<component
|
||||||
</div>
|
:is="componentMap[item.vueName]"
|
||||||
</div>
|
:formParams="FormValues"
|
||||||
<div class="erp-col erp-col-1-3">
|
v-if="componentMap[item.vueName]"
|
||||||
<div class="erp-card">
|
/>
|
||||||
<ChartV02 :formParams="FormValues" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="erp-col erp-col-1-3">
|
|
||||||
<div class="erp-card">
|
|
||||||
<ChartV03 :formParams="FormValues" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -27,21 +25,28 @@
|
|||||||
<div class="erp-section erp-middle-section">
|
<div class="erp-section erp-middle-section">
|
||||||
<div class="erp-col erp-col-1-2">
|
<div class="erp-col erp-col-1-2">
|
||||||
<div class="erp-inner-layout">
|
<div class="erp-inner-layout">
|
||||||
<div class="erp-col erp-col-1-2">
|
<div
|
||||||
|
v-for="item in getComponentsBySortRange(4, 5)"
|
||||||
|
:key="item.sort"
|
||||||
|
class="erp-col erp-col-1-2"
|
||||||
|
>
|
||||||
<div class="erp-card">
|
<div class="erp-card">
|
||||||
<ChartV04 :formParams="FormValues" />
|
<component
|
||||||
</div>
|
:is="componentMap[item.vueName]"
|
||||||
</div>
|
:formParams="FormValues"
|
||||||
<div class="erp-col erp-col-1-2">
|
v-if="componentMap[item.vueName]"
|
||||||
<div class="erp-card">
|
/>
|
||||||
<ChartV05 :formParams="FormValues" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="erp-col erp-col-1-2">
|
<div class="erp-col erp-col-1-2">
|
||||||
<div class="erp-card">
|
<div class="erp-card">
|
||||||
<ChartV06 :formParams="FormValues" />
|
<component
|
||||||
|
:is="componentMap[getComponentBySort(6)?.vueName]"
|
||||||
|
:formParams="FormValues"
|
||||||
|
v-if="getComponentBySort(6) && componentMap[getComponentBySort(6).vueName]"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,21 +54,28 @@
|
|||||||
<div class="erp-section erp-lower-section">
|
<div class="erp-section erp-lower-section">
|
||||||
<div class="erp-col erp-col-1-2">
|
<div class="erp-col erp-col-1-2">
|
||||||
<div class="erp-inner-layout">
|
<div class="erp-inner-layout">
|
||||||
<div class="erp-col erp-col-1-2">
|
<div
|
||||||
|
v-for="item in getComponentsBySortRange(7, 8)"
|
||||||
|
:key="item.sort"
|
||||||
|
class="erp-col erp-col-1-2"
|
||||||
|
>
|
||||||
<div class="erp-card">
|
<div class="erp-card">
|
||||||
<ChartV07 :formParams="FormValues" />
|
<component
|
||||||
</div>
|
:is="componentMap[item.vueName]"
|
||||||
</div>
|
:formParams="FormValues"
|
||||||
<div class="erp-col erp-col-1-2">
|
v-if="componentMap[item.vueName]"
|
||||||
<div class="erp-card">
|
/>
|
||||||
<ChartV08 :formParams="FormValues" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="erp-col erp-col-1-2">
|
<div class="erp-col erp-col-1-2">
|
||||||
<div class="erp-card">
|
<div class="erp-card">
|
||||||
<ChartV09 :formParams="FormValues" />
|
<component
|
||||||
|
:is="componentMap[getComponentBySort(9)?.vueName]"
|
||||||
|
:formParams="FormValues"
|
||||||
|
v-if="getComponentBySort(9) && componentMap[getComponentBySort(9).vueName]"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -71,18 +83,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch, onMounted, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import ChartTop from './components/ChartTop.vue'
|
import ChartTop from './components/ChartTop.vue';
|
||||||
import ChartV01 from './components/ChartV01.vue';
|
|
||||||
import ChartV02 from './components/ChartV02.vue';
|
|
||||||
import ChartV03 from './components/ChartV03.vue';
|
|
||||||
import ChartV04 from './components/ChartV04.vue';
|
|
||||||
import ChartV05 from './components/ChartV05.vue';
|
|
||||||
import ChartV06 from './components/ChartV06.vue';
|
|
||||||
import ChartV07 from './components/ChartV07.vue';
|
|
||||||
import ChartV08 from './components/ChartV08.vue';
|
|
||||||
import ChartV09 from './components/ChartV09.vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
@@ -93,13 +96,71 @@ const FormValues = ref({
|
|||||||
watch(
|
watch(
|
||||||
() => route.query.year,
|
() => route.query.year,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
FormValues.value.reqParam = newVal;
|
FormValues.value.reqParam = newVal;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const componentMap = ref({});
|
||||||
|
const chartData = ref([]);
|
||||||
|
|
||||||
|
const getComponentBySort = (sort) => {
|
||||||
|
return chartData.value.find(item => item.sort === sort);
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchChartData = async () => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const apiData = [
|
||||||
|
{ sort: 1, vueName: 'ChartV01' },
|
||||||
|
{ sort: 2, vueName: 'ChartV02' },
|
||||||
|
{ sort: 3, vueName: 'ChartV03' },
|
||||||
|
{ sort: 4, vueName: 'ChartV04' },
|
||||||
|
{ sort: 5, vueName: 'ChartV05' },
|
||||||
|
{ sort: 6, vueName: 'ChartV06' },
|
||||||
|
{ sort: 7, vueName: 'ChartV07' },
|
||||||
|
{ sort: 8, vueName: 'ChartV08' },
|
||||||
|
{ sort: 9, vueName: 'ChartV09' },
|
||||||
|
];
|
||||||
|
resolve(apiData);
|
||||||
|
}, 300);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
const data = await fetchChartData();
|
||||||
|
chartData.value = data.sort((a, b) => a.sort - b.sort);
|
||||||
|
const newComponentMap = {};
|
||||||
|
const uniqueComponents = [...new Set(data.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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -176,7 +237,6 @@ watch(
|
|||||||
|
|
||||||
.full-card {
|
.full-card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.erp-card:hover {
|
.erp-card:hover {
|
||||||
@@ -203,6 +263,15 @@ watch(
|
|||||||
line-height: 1.5;
|
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) {
|
@media (max-width: 1600px) {
|
||||||
.erp-layout-container {
|
.erp-layout-container {
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
|
|||||||
@@ -17,30 +17,45 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="work-section work-main-section">
|
<div class="work-section work-main-section">
|
||||||
|
<div v-if="activeMenu === 1" class="menu-content">
|
||||||
|
<HomeIndex />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="activeMenu === 2" class="menu-content">
|
||||||
|
<WorkIndex />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="activeMenu === 3" class="menu-content">
|
||||||
|
<ErpIndex />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="activeMenu === 4" class="menu-content">
|
||||||
|
<SysIndex />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import HomeIndex from './components/Home.vue'
|
||||||
|
import WorkIndex from './components/Work.vue'
|
||||||
|
import ErpIndex from './components/Erp.vue'
|
||||||
|
import SysIndex from './components/Sys.vue'
|
||||||
|
|
||||||
const menuList = ref([
|
const menuList = ref([
|
||||||
{ key: 1, label: '指标一' },
|
{ key: 1, label: '首页' },
|
||||||
{ key: 2, label: '指标二' },
|
{ key: 2, label: '工作' },
|
||||||
{ key: 3, label: '指标三' },
|
{ key: 3, label: '财务' },
|
||||||
{ key: 4, label: '指标四' },
|
{ key: 4, label: '系统' },
|
||||||
])
|
])
|
||||||
const activeMenu = ref(1)
|
const activeMenu = ref(1)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 你原来的全部样式 100% 保留,我只加左侧样式 */
|
|
||||||
.work-layout-container {
|
.work-layout-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row; /* 只改这一个字:column → row */
|
flex-direction: row;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
@@ -49,93 +64,6 @@ const activeMenu = ref(1)
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.work-section {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
gap: 6px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.work-top-header {
|
|
||||||
height: 10%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.work-main-section {
|
|
||||||
height: 100%;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.work-col {
|
|
||||||
height: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.work-col-1-3 {
|
|
||||||
width: calc((100% - 12px) / 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.work-left-col, .work-middle-col, .work-right-col {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.work-card-1-3 {
|
|
||||||
height: calc((100% - 12px) / 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.work-card-2-3 {
|
|
||||||
height: calc(2 * ((100% - 12px) / 3) + 6px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
.work-left-sidebar {
|
.work-left-sidebar {
|
||||||
width: 15%;
|
width: 15%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -143,135 +71,124 @@ const activeMenu = ref(1)
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
border: 1px solid rgba(26, 80, 139, 0.3);
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
backdrop-filter: blur(2px);
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-title {
|
.menu-title {
|
||||||
height: 10%;
|
width: 100%;
|
||||||
background: rgba(15, 52, 96, 0.1);
|
height: 40px;
|
||||||
border: 1px solid rgba(26, 80, 139, 0.3);
|
|
||||||
border-radius: 8px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #e0e6ff;
|
position: sticky;
|
||||||
backdrop-filter: blur(2px);
|
top: 0;
|
||||||
|
z-index: 10;
|
||||||
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-title h3 {
|
.menu-title h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 16px;
|
padding: 0 4px 8px 4px;
|
||||||
letter-spacing: 1px;
|
color: #e0e6ff;
|
||||||
background: #3c9cff;
|
font-size: 20px;
|
||||||
-webkit-background-clip: text;
|
border-bottom: 1px solid rgba(26, 80, 139, 0.5);
|
||||||
-webkit-text-fill-color: transparent;
|
line-height: 1;
|
||||||
font-weight: 600;
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-list {
|
.menu-list {
|
||||||
height: 90%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 6px;
|
gap: 8px;
|
||||||
|
padding: 4px 0;
|
||||||
|
margin-top: 0;
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list::-webkit-scrollbar-track {
|
||||||
|
background: rgba(26, 80, 139, 0.1);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(26, 80, 139, 0.5);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: rgba(26, 80, 139, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item {
|
.menu-item {
|
||||||
flex: 1;
|
height: 36px;
|
||||||
display: flex;
|
line-height: 36px;
|
||||||
align-items: center;
|
padding: 0 16px;
|
||||||
justify-content: center;
|
|
||||||
background: rgba(15, 52, 96, 0.1);
|
|
||||||
border: 1px solid rgba(26, 80, 139, 0.3);
|
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
color: #e0e6ff;
|
font-size: 16px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 14px;
|
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
|
background: rgba(26, 80, 139, 0.2);
|
||||||
|
color: #e0e6ff;
|
||||||
|
text-align: center;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item:hover {
|
||||||
|
background: rgba(26, 80, 139, 0.3);
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 2px 8px rgba(60, 156, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item.active {
|
.menu-item.active {
|
||||||
border-color: rgba(60, 156, 255, 0.6);
|
background: linear-gradient(90deg, rgba(26, 80, 139, 0.8), rgba(60, 156, 255, 0.8));
|
||||||
box-shadow: 0 4px 12px rgba(60, 156, 255, 0.2);
|
color: #fff;
|
||||||
background: rgba(60, 156, 255, 0.1);
|
font-weight: 500;
|
||||||
|
box-shadow: 0 2px 8px rgba(60, 156, 255, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 你原来的媒体查询我完全不动 */
|
.work-main-section {
|
||||||
@media (max-width: 1600px) {
|
height: 100%;
|
||||||
.work-layout-container {
|
width: 85%;
|
||||||
padding: 6px;
|
background: transparent;
|
||||||
gap: 4px;
|
border: 1px solid rgba(26, 80, 139, 0.3);
|
||||||
}
|
border-radius: 12px;
|
||||||
.work-section {
|
padding: 16px;
|
||||||
gap: 4px;
|
backdrop-filter: blur(2px);
|
||||||
}
|
overflow: auto;
|
||||||
.work-col-1-3 {
|
box-sizing: border-box;
|
||||||
width: calc((100% - 8px) / 3);
|
|
||||||
}
|
|
||||||
.work-card-1-3 {
|
|
||||||
height: calc((100% - 8px) / 3);
|
|
||||||
}
|
|
||||||
.work-card-2-3 {
|
|
||||||
height: calc(2 * ((100% - 8px) / 3) + 4px);
|
|
||||||
}
|
|
||||||
.work-card {
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
.work-card h3 {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.work-card p {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
.menu-content {
|
||||||
.work-layout-container {
|
padding: 0 4px;
|
||||||
flex-direction: column;
|
height: 100%;
|
||||||
height: auto;
|
box-sizing: border-box;
|
||||||
min-height: 100%;
|
color: #e0e6ff;
|
||||||
padding: 6px;
|
|
||||||
gap: 6px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
.work-section {
|
|
||||||
flex-direction: column;
|
|
||||||
height: auto !important;
|
|
||||||
min-height: 120px;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
.work-col-1-3 {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
.work-left-col, .work-middle-col, .work-right-col {
|
|
||||||
flex-direction: column;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
.work-card-1-3, .work-card-2-3 {
|
|
||||||
height: 120px;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
|
||||||
.work-card {
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-height: 900px) {
|
.menu-content h4 {
|
||||||
.work-layout-container {
|
margin: 0 0 16px 0;
|
||||||
padding: 6px;
|
color: #fff;
|
||||||
gap: 4px;
|
font-size: 20px;
|
||||||
}
|
border-bottom: 1px solid rgba(26, 80, 139, 0.5);
|
||||||
.work-section {
|
padding-bottom: 8px;
|
||||||
gap: 4px;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
.work-card {
|
|
||||||
padding: 8px;
|
.menu-content p {
|
||||||
}
|
margin: 0;
|
||||||
.work-card h3 {
|
color: #e0e6ff;
|
||||||
font-size: 14px;
|
line-height: 1.6;
|
||||||
margin-bottom: 6px;
|
font-size: 14px;
|
||||||
}
|
|
||||||
.work-card p {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -5,56 +5,65 @@
|
|||||||
<ChartTop />
|
<ChartTop />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="work-section work-main-section">
|
<div class="work-section work-main-section">
|
||||||
<div class="work-col work-col-1-3 work-left-col">
|
<div class="work-col work-col-1-3 work-left-col">
|
||||||
<div class="work-card work-card-1-3">
|
<div
|
||||||
<ChartV01 :formParams="FormValues" />
|
v-for="item in getComponentsBySortRange(1, 3)"
|
||||||
</div>
|
:key="item.sort"
|
||||||
<div class="work-card work-card-1-3">
|
class="work-card work-card-1-3"
|
||||||
<ChartV02 :formParams="FormValues" />
|
>
|
||||||
</div>
|
<component
|
||||||
<div class="work-card work-card-1-3">
|
:is="componentMap[item.vueName]"
|
||||||
<ChartV03 :formParams="FormValues" />
|
:formParams="FormValues"
|
||||||
</div>
|
v-if="componentMap[item.vueName]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="work-col work-col-1-3 work-middle-col">
|
<div class="work-col work-col-1-3 work-middle-col">
|
||||||
<div class="work-card work-card-2-3">
|
<div
|
||||||
<ChartV04 :formParams="FormValues" />
|
:key="getComponentBySort(4)?.sort"
|
||||||
</div>
|
class="work-card work-card-2-3"
|
||||||
<div class="work-card work-card-1-3">
|
v-if="getComponentBySort(4)"
|
||||||
<ChartV05 :formParams="FormValues" />
|
>
|
||||||
</div>
|
<component
|
||||||
|
:is="componentMap[getComponentBySort(4).vueName]"
|
||||||
|
:formParams="FormValues"
|
||||||
|
v-if="componentMap[getComponentBySort(4).vueName]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
:key="getComponentBySort(5)?.sort"
|
||||||
|
class="work-card work-card-1-3"
|
||||||
|
v-if="getComponentBySort(5)"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="componentMap[getComponentBySort(5).vueName]"
|
||||||
|
:formParams="FormValues"
|
||||||
|
v-if="componentMap[getComponentBySort(5).vueName]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="work-col work-col-1-3 work-right-col">
|
<div class="work-col work-col-1-3 work-right-col">
|
||||||
<div class="work-card work-card-1-3">
|
<div
|
||||||
<ChartV06 :formParams="FormValues" />
|
v-for="item in getComponentsBySortRange(6, 8)"
|
||||||
</div>
|
:key="item.sort"
|
||||||
<div class="work-card work-card-1-3">
|
class="work-card work-card-1-3"
|
||||||
<ChartV07 :formParams="FormValues" />
|
>
|
||||||
</div>
|
<component
|
||||||
<div class="work-card work-card-1-3">
|
:is="componentMap[item.vueName]"
|
||||||
<ChartV08 :formParams="FormValues" />
|
:formParams="FormValues"
|
||||||
</div>
|
v-if="componentMap[item.vueName]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch, onMounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import ChartTop from './components/ChartTop.vue'
|
import ChartTop from './components/ChartTop.vue';
|
||||||
import ChartV01 from './components/ChartV01.vue';
|
|
||||||
import ChartV02 from './components/ChartV02.vue';
|
|
||||||
import ChartV03 from './components/ChartV03.vue';
|
|
||||||
import ChartV04 from './components/ChartV04.vue';
|
|
||||||
import ChartV05 from './components/ChartV05.vue';
|
|
||||||
import ChartV06 from './components/ChartV06.vue';
|
|
||||||
import ChartV07 from './components/ChartV07.vue';
|
|
||||||
import ChartV08 from './components/ChartV08.vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
@@ -65,13 +74,70 @@ const FormValues = ref({
|
|||||||
watch(
|
watch(
|
||||||
() => route.query.year,
|
() => route.query.year,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
FormValues.value.reqParam = newVal;
|
FormValues.value.reqParam = newVal;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const componentMap = ref({});
|
||||||
|
const chartData = ref([]);
|
||||||
|
|
||||||
|
const getComponentBySort = (sort) => {
|
||||||
|
return chartData.value.find(item => item.sort === sort);
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchChartData = async () => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const apiData = [
|
||||||
|
{ sort: 1, vueName: 'ChartV01' },
|
||||||
|
{ sort: 2, vueName: 'ChartV02' },
|
||||||
|
{ sort: 3, vueName: 'ChartV03' },
|
||||||
|
{ sort: 4, vueName: 'ChartV04' },
|
||||||
|
{ sort: 5, vueName: 'ChartV05' },
|
||||||
|
{ sort: 6, vueName: 'ChartV06' },
|
||||||
|
{ sort: 7, vueName: 'ChartV07' },
|
||||||
|
{ sort: 8, vueName: 'ChartV08' },
|
||||||
|
];
|
||||||
|
resolve(apiData);
|
||||||
|
}, 300);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
const data = await fetchChartData();
|
||||||
|
chartData.value = data.sort((a, b) => a.sort - b.sort);
|
||||||
|
const newComponentMap = {};
|
||||||
|
const uniqueComponents = [...new Set(data.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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -174,6 +240,15 @@ watch(
|
|||||||
line-height: 1.5;
|
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) {
|
@media (max-width: 1600px) {
|
||||||
.work-layout-container {
|
.work-layout-container {
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
|
|||||||
Reference in New Issue
Block a user