大屏页面初始化

This commit is contained in:
2026-02-28 17:06:42 +08:00
parent 3548359387
commit ee9569953d
3 changed files with 763 additions and 80 deletions

View File

@@ -41,7 +41,6 @@ service.interceptors.response.use(
},
(error) => {
console.error('【响应拦截器错误】', error);
if (isLoginExpiredError(error)) {
handleLoginExpired();
return Promise.reject(new Error('登录状态已失效,请重新登录'));
@@ -49,7 +48,9 @@ service.interceptors.response.use(
if (!error.response) {
if (error.message.includes('Network Error') || error.message.includes('timeout')) {
ElMessage.error('网络异常,请检查网络连接或稍后重试');
router.push("/login").catch(err => {
console.warn('路由跳转失败', err);
});
} else {
ElMessage.error('请求失败,请稍后重试');
}
@@ -84,10 +85,9 @@ function handleLoginExpired() {
if (router.currentRoute.path !== '/login') {
const redirect = encodeURIComponent(router.currentRoute.fullPath);
router.push(`/login?redirect=${redirect}`).catch(err => {
router.push("/login").catch(err => {
console.warn('路由跳转失败', err);
});
ElMessage.error('登录状态已失效,请重新登录');
}
}

View File

@@ -0,0 +1,528 @@
<template>
<div class="data-container">
<div class="search-border-container">
<el-form :model="searchForm" class="search-form">
<div class="form-items-wrapper">
<el-form-item label="交易名称:" class="form-item">
<el-input
v-model="searchForm.flowName"
placeholder="请输入交易名称"
clearable
/>
</el-form-item>
<el-form-item label="交易类型:" class="form-item">
<el-select
v-model="searchForm.transactionType"
placeholder="请选择交易类型"
clearable
class="custom-select"
popper-class="theme-select-popper"
>
<el-option label="收入" value="2" />
<el-option label="支出" value="1" />
</el-select>
</el-form-item>
<el-form-item label="交易分类:" class="form-item">
<el-select
v-model="searchForm.categoryId"
placeholder="请选择交易分类"
clearable
class="custom-select"
popper-class="theme-select-popper"
>
<el-option
v-for="item in categoryList"
:key="item.categoryId"
:label="item.categoryName"
:value="item.categoryId"
/>
</el-select>
</el-form-item>
</div>
<el-form-item class="form-btn-group">
<el-button type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>
查询
</el-button>
<el-button type="default" @click="handleReset" class="reset-btn">
<el-icon><Refresh /></el-icon>
重置
</el-button>
</el-form-item>
</el-form>
</div>
<div class="main-content-container">
<div class="table-toolbar">
<el-button type="primary" @click="handleAdd">
<el-icon><Plus /></el-icon>
新增
</el-button>
</div>
<div class="table-wrapper">
<el-table
:data="tableData"
stripe
style="width: 100%; height: 100%"
empty-text="暂无相关数据"
class="data-table"
v-loading="loading"
:header-cell-style="{
background: 'rgba(10, 30, 60, 0.8)',
color: '#a0cfff',
border: 'none',
borderBottom: '1px solid rgba(64, 158, 255, 0.3)'
}"
:row-style="{
background: 'transparent',
color: '#a0cfff',
border: 'none'
}"
:cell-style="{
border: 'none',
borderBottom: '1px solid rgba(64, 158, 255, 0.2)'
}"
>
<el-table-column prop="flowId" label="交易编号" />
<el-table-column prop="flowName" label="交易名称" />
<el-table-column prop="categoryName" label="交易分类" />
<el-table-column prop="tranType" label="交易类型" />
<el-table-column prop="amount" label="交易金额">
<template #default="scope">
¥{{ scope.row.amount }}
</template>
</el-table-column>
<el-table-column prop="remark" label="交易备注" />
<el-table-column prop="transactionTime" label="交易时间" />
</el-table>
</div>
<div class="pagination-wrapper">
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[20, 50, 99]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
class="custom-pagination"
popper-class="theme-pagination-popper"
:teleported="false"
/>
</div>
</div>
</div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { Plus, Search, Refresh } from '@element-plus/icons-vue'
const props = defineProps({
formParams: {
type: Object,
default: () => ({})
}
})
const loading = ref(false)
const categoryList = ref([])
const searchForm = reactive({
flowName: '',
transactionType: '',
categoryId: ''
})
const tableData = ref([])
const currentPage = ref(1)
const pageSize = ref(20)
const total = ref(0)
const handleAdd = () => {
console.log('点击新增按钮')
}
const handleSearch = () => {
}
const handleReset = () => {
Object.assign(searchForm, {
flowName: '',
transactionType: '',
categoryId: ''
})
currentPage.value = 1
}
const handleSizeChange = (val) => {
pageSize.value = val
}
const handleCurrentChange = (val) => {
currentPage.value = val
}
</script>
<style scoped>
.data-container {
width: 100%;
height: 100vh;
min-height: 500px;
border-radius: 8px;
padding: 16px;
background-color: rgba(10, 30, 60, 0.05);
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
backdrop-filter: blur(2px);
}
.search-border-container {
border: 1px solid rgba(64, 158, 255, 0.15);
border-radius: 8px;
padding: 16px;
background-color: rgba(10, 30, 60, 0.08);
flex-shrink: 0;
backdrop-filter: blur(2px);
}
.search-form {
display: flex;
align-items: center;
width: 100%;
flex-wrap: wrap;
}
.form-items-wrapper {
display: flex;
flex: 1;
gap: 20px;
min-width: 0;
flex-wrap: wrap;
}
.form-item {
flex: 1;
margin-bottom: 0 !important;
min-width: 180px;
}
.form-btn-group {
margin-left: 20px;
margin-bottom: 0 !important;
flex-shrink: 0;
display: flex;
gap: 10px;
}
.main-content-container {
border: 1px solid rgba(64, 158, 255, 0.15);
border-radius: 8px;
padding: 16px;
background-color: rgba(10, 30, 60, 0.08);
display: flex;
flex-direction: column;
gap: 12px;
flex: 1;
overflow: hidden;
backdrop-filter: blur(2px);
}
.table-toolbar {
display: flex;
justify-content: flex-start;
padding: 0;
margin: 0;
flex-shrink: 0;
}
.table-wrapper {
flex: 1;
overflow: auto;
min-height: 200px;
}
.data-table {
width: 100%;
height: 100%;
}
.pagination-wrapper {
display: flex;
justify-content: flex-end;
align-items: center;
padding-top: 8px;
border-top: 1px solid rgba(64, 158, 255, 0.1);
background-color: transparent !important;
flex-shrink: 0;
margin: 0;
position: relative;
}
:deep(.el-form-item__label) {
color: #e0e6ff !important;
font-size: 14px;
}
:deep(.el-input__wrapper),
:deep(.el-select__wrapper),
:deep(.el-input__wrapper:hover),
:deep(.el-select__wrapper:hover),
:deep(.el-input__wrapper.is-focus),
:deep(.el-select__wrapper.is-focus),
:deep(.el-input__wrapper:focus-within),
:deep(.el-select__wrapper:focus-within),
:deep(.el-input__wrapper:not(.is-focus)),
:deep(.el-select__wrapper:not(.is-focus)),
:deep(.el-input__wrapper:not(:focus-within)),
:deep(.el-select__wrapper:not(:focus-within)) {
background-color: rgba(10, 30, 60, 0.6) !important;
border: 1px solid rgba(64, 158, 255, 0.3) !important;
box-shadow: none !important;
border-radius: 4px !important;
background-image: none !important;
opacity: 1 !important;
transition: none !important;
--el-input-bg-color: transparent !important;
--el-select-bg-color: transparent !important;
}
:deep(.el-select),
:deep(.el-select .el-input),
:deep(.el-select .el-input__wrapper),
:deep(.el-input),
:deep(.el-input__inner),
:deep(.el-select__inner),
:deep(.el-select-v2__inner),
:deep(.el-input__inner:focus),
:deep(.el-input__inner:not(:focus)),
:deep(.el-select__inner:focus),
:deep(.el-select__inner:not(:focus)) {
background-color: transparent !important;
color: #e0e6ff !important;
box-shadow: none !important;
outline: none !important;
border: none !important;
}
:deep(.el-input__placeholder),
:deep(.el-select__placeholder) {
color: rgba(224, 230, 255, 0.6) !important;
}
:deep(.el-select__suffix-inner>.el-icon),
:deep(.el-input__suffix-inner>.el-icon),
:deep(.el-input__clear),
:deep(.el-select__clear) {
color: #e0e6ff !important;
background-color: transparent !important;
}
:deep(.custom-pagination) {
--el-pagination-text-color: #e0e6ff;
--el-pagination-button-color: #e0e6ff;
--el-pagination-button-hover-color: #409EFF;
--el-pagination-button-active-color: #409EFF;
--el-pagination-border-color: #409EFF;
--el-pagination-bg-color: transparent !important;
background-color: transparent !important;
}
:deep(.el-pagination) {
--el-pagination-hover-border-color: #409EFF !important;
--el-pagination-active-border-color: #409EFF !important;
}
:deep(.el-pagination button) {
background-color: rgba(10, 30, 60, 0.6) !important;
border: 1px solid rgba(64, 158, 255, 0.3) !important;
color: #e0e6ff !important;
outline: none !important;
box-shadow: none !important;
}
:deep(.el-pagination .el-pager li) {
color: #e0e6ff !important;
}
:deep(.el-pagination .el-pager li.active) {
color: #409EFF !important;
font-weight: bold;
}
:deep(.theme-pagination-popper) {
background-color: rgba(10, 30, 60, 0.85) !important;
border: 1px solid rgba(64, 158, 255, 0.3) !important;
color: #e0e6ff !important;
z-index: 99999 !important;
position: absolute !important;
top: auto !important;
bottom: calc(100% + 8px) !important;
right: 0 !important;
left: auto !important;
margin: 0 !important;
transform: none !important;
width: auto !important;
min-width: 80px !important;
outline: none !important;
box-shadow: none !important;
border-radius: 4px !important;
box-sizing: border-box !important;
backdrop-filter: blur(4px);
}
:deep(.theme-pagination-popper * ) {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
:deep(.theme-pagination-popper .el-pagination__sizes-option) {
color: #e0e6ff !important;
padding: 6px 12px !important;
background-color: transparent !important;
}
:deep(.theme-pagination-popper .el-pagination__sizes-option:hover) {
background-color: rgba(64, 158, 255, 0.2) !important;
color: #fff !important;
}
:deep(.el-table) {
--el-table-text-color: #a0cfff;
--el-table-header-text-color: #a0cfff;
--el-table-row-hover-bg-color: rgba(64, 158, 255, 0.2);
--el-table-border-color: transparent !important;
--el-table-stripe-row-bg-color: rgba(10, 30, 60, 0.3);
background-color: transparent !important;
border: none !important;
}
:deep(.el-table th) {
border: none !important;
border-bottom: 1px solid rgba(64, 158, 255, 0.3) !important;
background-color: rgba(10, 30, 60, 0.8) !important;
color: #a0cfff !important;
}
:deep(.el-table td) {
border: none !important;
border-bottom: 1px solid rgba(64, 158, 255, 0.2) !important;
background-color: transparent !important;
color: #a0cfff !important;
}
:deep(.el-table--striped .el-table__row--striped td) {
background-color: rgba(10, 30, 60, 0.3) !important;
}
:deep(.el-table__row:hover > td) {
background-color: rgba(64, 158, 255, 0.2) !important;
}
:deep(.el-table tr:last-child td) {
border-bottom: none !important;
}
:deep(.el-table-empty-text) {
color: #a0cfff !important;
}
:deep(.el-button) {
--el-button-text-color: #e0e6ff !important;
--el-button-border-color: rgba(64, 158, 255, 0.3) !important;
--el-button-hover-text-color: #fff !important;
--el-button-hover-border-color: #409EFF !important;
--el-button-hover-bg-color: rgba(64, 158, 255, 0.2) !important;
height: 32px;
padding: 0 16px;
outline: none !important;
box-shadow: none !important;
border-radius: 4px !important;
transition: all 0.2s ease !important;
}
:deep(.el-button .el-icon) {
margin-right: 6px;
font-size: 14px;
}
:deep(.el-button--primary) {
--el-button-text-color: #fff !important;
--el-button-bg-color: rgba(64, 158, 255, 0.6) !important;
--el-button-border-color: rgba(64, 158, 255, 0.4) !important;
--el-button-hover-bg-color: #409EFF !important;
}
:deep(.reset-btn) {
background-color: rgba(10, 30, 60, 0.6) !important;
border: 1px solid rgba(64, 158, 255, 0.3) !important;
color: #e0e6ff !important;
--el-button-hover-bg-color: rgba(64, 158, 255, 0.2) !important;
--el-button-hover-border-color: #409EFF !important;
--el-button-hover-text-color: #fff !important;
}
.data-container::-webkit-scrollbar,
:deep(.el-table__body-wrapper)::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar {
width: 6px;
height: 6px;
}
.data-container::-webkit-scrollbar-track,
:deep(.el-table__body-wrapper)::-webkit-scrollbar-track,
.table-wrapper::-webkit-scrollbar-track {
background: rgba(10, 30, 60, 0.1);
border-radius: 6px;
}
.data-container::-webkit-scrollbar-thumb,
:deep(.el-table__body-wrapper)::-webkit-scrollbar-thumb,
.table-wrapper::-webkit-scrollbar-thumb {
background: rgba(64, 158, 255, 0.4);
border-radius: 6px;
}
</style>
<style>
.theme-select-popper {
background-color: rgba(10, 30, 60, 0.85) !important;
border: 1px solid rgba(64, 158, 255, 0.3) !important;
color: #e0e6ff !important;
z-index: 99999 !important;
outline: none !important;
box-shadow: none !important;
border-radius: 4px !important;
backdrop-filter: blur(4px);
}
.theme-select-popper * {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
.theme-select-popper .el-select-dropdown__item {
color: #e0e6ff !important;
background-color: transparent !important;
}
.theme-select-popper .el-select-dropdown__item:hover {
background-color: rgba(64, 158, 255, 0.2) !important;
color: #fff !important;
}
.theme-select-popper .el-select-dropdown__item.selected {
background-color: rgba(64, 158, 255, 0.3) !important;
color: #fff !important;
}
</style>

View File

@@ -1,16 +1,51 @@
<template>
<div class="layout-container">
<div class="left-panel">
<div class="panel-content">
<h2>左侧区域 (20%)</h2>
<p>可放置侧边栏筛选条件导航等内容</p>
<div class="panel-header">
<h3 class="panel-title">功能菜单</h3>
</div>
<div class="menu-wrap">
<div class="menu-container">
<div
class="menu-item"
v-for="menu in menuList"
:key="menu.id"
:class="{ active: activeMenuId === menu.id }"
@click="switchMenu(menu.id)"
>
<component :is="menu.icon" class="menu-icon" />
<span class="menu-text">{{ menu.name }}</span>
</div>
</div>
</div>
</div>
<div class="right-panel">
<div class="panel-content">
<h2>右侧区域 (80%)</h2>
<p>可放置主要内容图表大屏展示等内容</p>
<div class="content-container">
<!-- 核心修改给content-item添加full-height类 -->
<div v-if="activeMenuId === 1" class="content-item full-height">
<UserIndex :formParams="formParams" />
</div>
<div v-else-if="activeMenuId === 2" class="content-item default-content">
<h2>业务分析</h2>
<p>这里展示各业务线详细数据业务流程异常预警等内容支持按维度筛选和查看</p>
</div>
<div v-else-if="activeMenuId === 3" class="content-item default-content">
<h2>用户管理</h2>
<p>这里展示用户列表权限配置操作日志用户画像等用户相关管理内容</p>
</div>
<div v-else-if="activeMenuId === 4" class="content-item default-content">
<h2>系统设置</h2>
<p>这里展示参数配置模板管理备份恢复系统日志等系统级配置内容</p>
</div>
<div v-else-if="activeMenuId === 5" class="content-item default-content">
<h2>数据报表</h2>
<p>这里展示各类数据报表导出打印等功能支持自定义报表模板</p>
</div>
<div v-else class="content-item default-content">
<h2>欢迎使用数字化管理平台</h2>
<p>请点击左侧菜单查看对应的功能模块内容</p>
</div>
</div>
</div>
</div>
@@ -18,6 +53,8 @@
<script setup>
import { ref, watch } from 'vue';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import UserIndex from './components/user/index.vue';
const props = defineProps({
formParams: {
@@ -26,8 +63,26 @@ const props = defineProps({
}
});
const menuList = ref([
{ id: 1, name: '用户管理', icon: ElementPlusIconsVue.User },
{ id: 2, name: '系统设置', icon: ElementPlusIconsVue.Setting },
{ id: 3, name: '数据报表', icon: ElementPlusIconsVue.Document },
{ id: 4, name: '日志管理', icon: ElementPlusIconsVue.Files },
{ id: 5, name: '权限配置', icon: ElementPlusIconsVue.Lock },
]);
const activeMenuId = ref(0);
const switchMenu = (id) => {
activeMenuId.value = id;
console.log(`切换到菜单:${menuList.value.find(item => item.id === id)?.name}`);
};
watch(
() => props.formParams,
(newVal) => {
console.log('表单参数更新:', newVal);
},
{
deep: true,
immediate: true
@@ -44,98 +99,195 @@ watch(
flex-direction: row;
overflow: hidden;
box-sizing: border-box;
flex-wrap: nowrap;
}
/* 左侧15%面板 */
.left-panel {
width: 20%;
width: 15%;
height: 100%;
background-color: rgba(15, 52, 96, 0.9);
border-right: 1px solid #1a508b;
border-radius: 11px 0 0 11px;
padding: 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 12px;
}
.left-panel::-webkit-scrollbar {
display: none;
}
.panel-header {
padding: 12px;
border: 1px solid #1a508b;
border-radius: 8px;
background-color: rgba(21, 69, 128, 0.6);
position: sticky;
top: 0;
z-index: 10;
}
.panel-title {
font-size: 20px;
font-weight: 600;
color: #3c9cff;
text-align: center;
letter-spacing: 1px;
margin: 0;
text-shadow: 0 0 8px rgba(60, 156, 255, 0.3);
}
.menu-wrap {
flex: 1;
border: 1px solid #1a508b;
border-radius: 8px;
padding: 8px;
background-color: rgba(15, 52, 96, 0.5);
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #3c9cff rgba(15, 52, 96, 0.5);
}
.left-panel::-webkit-scrollbar {
.menu-wrap::-webkit-scrollbar {
width: 6px;
}
.left-panel::-webkit-scrollbar-track {
.menu-wrap::-webkit-scrollbar-track {
background: rgba(15, 52, 96, 0.5);
border-radius: 3px;
}
.left-panel::-webkit-scrollbar-thumb {
.menu-wrap::-webkit-scrollbar-thumb {
background-color: #3c9cff;
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.menu-container {
display: flex;
flex-direction: column;
gap: 8px;
}
.menu-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
background-color: rgba(21, 69, 128, 0.5);
color: #e0e6ff;
font-size: 16px;
letter-spacing: 0.5px;
}
.menu-item:hover {
background-color: rgba(21, 69, 128, 0.8);
box-shadow: 0 2px 6px rgba(60, 156, 255, 0.2);
}
.menu-item.active {
background: linear-gradient(90deg, #1a508b, #3c9cff);
color: #fff;
font-weight: 500;
box-shadow: 0 2px 8px rgba(60, 156, 255, 0.4);
}
.menu-icon {
font-size: 18px;
width: 24px;
text-align: center;
color: inherit;
}
.menu-text {
flex: 1;
}
.right-panel {
width: 80%;
width: 85%;
height: 100%;
background-color: rgba(15, 52, 96, 0.9);
border-left: 1px solid #1a508b;
border-radius: 0 11px 11px 0;
padding: 16px;
padding: 0;
box-sizing: border-box;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #3c9cff rgba(15, 52, 96, 0.5);
overflow: hidden;
}
.right-panel::-webkit-scrollbar {
width: 6px;
display: none;
}
.right-panel::-webkit-scrollbar-track {
background: rgba(15, 52, 96, 0.5);
border-radius: 3px;
}
.right-panel::-webkit-scrollbar-thumb {
background-color: #3c9cff;
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.1);
.content-container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
color: #e0e6ff;
padding: 0;
margin: 0;
}
.panel-content {
color: #e0e6ff;
text-align: center;
.full-height {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.default-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 16px;
text-align: center;
max-width: 80%;
margin: 0 auto;
}
.panel-content h2 {
font-size: 22px;
.default-content h2 {
font-size: 28px;
opacity: 0.95;
letter-spacing: 1px;
font-weight: 600;
margin: 0;
margin: 0 0 20px 0;
background: linear-gradient(90deg, #3c9cff, #82b9ff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.panel-content p {
font-size: 16px;
.default-content p {
font-size: 18px;
opacity: 0.75;
color: #b4c7e7;
max-width: 80%;
line-height: 1.6;
line-height: 1.8;
}
/* 响应式适配 */
@media (max-width: 1600px) {
.left-panel, .right-panel {
.left-panel {
padding: 12px;
}
.panel-content h2 {
font-size: 20px;
.panel-title {
font-size: 18px;
}
.panel-content p {
.menu-item {
padding: 10px 14px;
font-size: 14px;
}
.menu-icon {
font-size: 16px;
}
.default-content h2 {
font-size: 24px;
}
.default-content p {
font-size: 16px;
}
}
@media (max-width: 768px) {
@@ -144,52 +296,55 @@ watch(
}
.left-panel {
width: 100%;
height: 20%;
height: 30%;
border-right: none;
border-bottom: 1px solid #1a508b;
border-radius: 11px 11px 0 0;
flex-direction: row;
align-items: stretch;
gap: 8px;
padding: 8px;
}
.panel-header {
width: 20%;
display: flex;
align-items: center;
justify-content: center;
padding: 8px;
}
.panel-title {
font-size: 16px;
white-space: nowrap;
}
.menu-wrap {
flex: 1;
padding: 4px;
}
.menu-container {
flex-direction: row;
flex-wrap: wrap;
gap: 4px;
}
.menu-item {
padding: 6px 10px;
font-size: 13px;
gap: 6px;
flex: 0 0 calc(33.33% - 4px);
justify-content: center;
}
.right-panel {
width: 100%;
height: 80%;
height: 70%;
border-left: none;
border-top: 1px solid #1a508b;
border-radius: 0 0 11px 11px;
}
.panel-content h2 {
font-size: 18px;
.default-content h2 {
font-size: 20px;
}
.panel-content p {
font-size: 13px;
.default-content p {
font-size: 14px;
max-width: 90%;
}
}
@media (max-height: 900px) {
.left-panel, .right-panel {
padding: 10px;
}
.panel-content {
gap: 12px;
}
.panel-content h2 {
font-size: 18px;
}
.panel-content p {
font-size: 14px;
}
}
@media (max-height: 600px) {
.panel-content {
justify-content: flex-start;
padding-top: 20px;
}
.panel-content h2 {
font-size: 16px;
}
.panel-content p {
font-size: 12px;
}
}
</style>