Files
klp-oa/klp-ui/src/views/index.vue

361 lines
6.4 KiB
Vue
Raw Normal View History

2025-07-22 15:30:55 +08:00
<!-- 代码已包含 CSS使用 TailwindCSS , 安装 TailwindCSS 后方可看到布局样式效果 -->
<template>
2025-07-22 15:30:55 +08:00
<div class="dashboard-root">
2025-08-22 14:28:10 +08:00
<!-- 第一行头像+欢迎语 -->
2025-07-22 16:28:43 +08:00
<div class="user-greeting-row">
<img :src="avatar" class="user-avatar" alt="头像" />
<div class="greeting-text">
<div class="greeting-title">{{ greeting }}{{ name }}</div>
<div class="greeting-desc">愿你天黑有灯下雨有伞</div>
</div>
</div>
<!-- 全部应用 -->
2025-08-22 14:28:10 +08:00
<el-row>
<AllApplications />
</el-row>
<el-row>
<el-col :span="12">
2025-08-22 17:34:33 +08:00
<FlowTable />
2025-08-22 14:28:10 +08:00
</el-col>
<el-col :span="12">
<OrderDashboard />
</el-col>
</el-row>
2025-07-22 15:30:55 +08:00
<!-- 数据概览区 -->
<!-- <div class="data-overview">
2025-07-22 15:30:55 +08:00
<div v-for="(card, index) in dataCards" :key="index"
class="data-card">
<div class="data-card-header">
<div>
<h3 class="data-card-title">{{ card.title }}</h3>
<p class="data-card-value">{{ card.value }}</p>
</div>
<i :class="['data-card-icon', card.icon, getIconColor(card.color)]"></i>
</div>
<div class="data-card-chart">
<div ref="charts" class="chart-inner"></div>
</div>
</div>
</div> -->
2025-07-22 15:30:55 +08:00
<!-- 业务功能区 -->
<!-- <div class="business-modules">
2025-07-22 15:30:55 +08:00
<div v-for="(module, index) in businessModules" :key="index"
2025-07-22 16:28:43 +08:00
class="business-module" @click="handleLink(module.link)">
<div :class="['business-module-icon', getModuleBg(module.bgColor)]">
<i :class="module.icon"></i>
2025-07-22 15:30:55 +08:00
</div>
2025-07-22 16:28:43 +08:00
<h3 class="business-module-title">{{ module.title }}</h3>
2025-07-22 15:30:55 +08:00
</div>
</div> -->
</div>
</template>
<script>
2025-07-22 15:30:55 +08:00
import * as echarts from 'echarts';
2025-07-22 16:28:43 +08:00
import AllApplications from '@/views/components/AllApplications.vue';
2025-08-22 14:28:10 +08:00
import OrderDashboard from '@/views/components/OrderDashboard.vue';
2025-08-22 17:34:33 +08:00
import FlowTable from '@/views/components/FlowTable.vue';
2025-07-22 15:30:55 +08:00
export default {
2025-07-22 16:28:43 +08:00
components: {
2025-08-22 14:28:10 +08:00
AllApplications,
2025-08-22 17:34:33 +08:00
OrderDashboard,
FlowTable
2025-07-22 16:28:43 +08:00
},
data() {
return {
2025-07-22 16:28:43 +08:00
avatar: '',
name: '',
greeting: '',
};
},
2025-07-22 15:30:55 +08:00
mounted() {
2025-07-22 16:28:43 +08:00
this.avatar = this.$store.getters.avatar;
this.name = this.$store.getters.name;
this.greeting = this.getGreeting();
2025-07-22 15:30:55 +08:00
},
methods: {
2025-07-22 16:28:43 +08:00
getGreeting() {
const hour = new Date().getHours();
if (hour < 6) return '凌晨好';
if (hour < 9) return '早上好';
if (hour < 12) return '上午好';
if (hour < 14) return '中午好';
if (hour < 18) return '下午好';
if (hour < 21) return '晚上好';
return '夜深了';
},
2025-07-22 15:30:55 +08:00
}
};
</script>
2025-07-22 15:30:55 +08:00
<style scoped>
.dashboard-root {
min-height: 100vh;
background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
padding: 32px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.data-overview {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24px;
margin-bottom: 32px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.data-card {
padding: 24px;
border-radius: 16px;
backdrop-filter: blur(4px);
2025-08-22 14:28:10 +08:00
background: rgba(255, 255, 255, 0.8);
box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.06);
border: 1px solid rgba(255, 255, 255, 0.2);
2025-07-22 15:30:55 +08:00
transition: transform 0.2s;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.data-card:hover {
transform: scale(1.02);
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.data-card-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 16px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.data-card-title {
color: #6b7280;
font-size: 14px;
margin-bottom: 4px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.data-card-value {
font-size: 24px;
font-weight: 600;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.data-card-icon {
font-size: 24px;
}
2025-08-22 14:28:10 +08:00
.icon-blue {
color: #3b82f6;
}
.icon-green {
color: #22c55e;
}
.icon-yellow {
color: #eab308;
}
.icon-purple {
color: #a855f7;
}
2025-07-22 15:30:55 +08:00
.data-card-chart {
height: 48px;
width: 100%;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.chart-inner {
width: 100%;
height: 100%;
}
2025-07-22 15:30:55 +08:00
.business-modules {
display: grid;
2025-07-22 16:28:43 +08:00
grid-template-columns: repeat(6, 1fr);
2025-07-22 15:30:55 +08:00
gap: 24px;
margin-bottom: 32px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.business-module {
2025-07-22 16:28:43 +08:00
display: flex;
align-items: center;
padding: 16px;
border-radius: 12px;
background: #fff;
2025-08-22 14:28:10 +08:00
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
2025-07-22 16:28:43 +08:00
transition: all 0.2s;
2025-07-22 15:30:55 +08:00
cursor: pointer;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.business-module:hover {
2025-08-22 14:28:10 +08:00
box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1);
2025-07-22 16:28:43 +08:00
transform: translateY(-2px);
2025-07-22 15:30:55 +08:00
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.business-module-icon {
2025-07-22 16:28:43 +08:00
width: 40px;
height: 40px;
border-radius: 8px;
2025-07-22 15:30:55 +08:00
display: flex;
align-items: center;
justify-content: center;
2025-07-22 16:28:43 +08:00
flex-shrink: 0;
margin-right: 12px;
2025-07-22 15:30:55 +08:00
}
2025-08-22 14:28:10 +08:00
2025-07-22 16:28:43 +08:00
.business-module-icon i {
font-size: 20px;
2025-07-22 15:30:55 +08:00
color: #fff;
}
2025-08-22 14:28:10 +08:00
.bg-blue {
background: #3b82f6;
}
.bg-green {
background: #22c55e;
}
.bg-yellow {
background: #eab308;
}
.bg-purple {
background: #a855f7;
}
.bg-red {
background: #ef4444;
}
.bg-indigo {
background: #6366f1;
}
.bg-teal {
background: #14b8a6;
}
2025-07-22 15:30:55 +08:00
.business-module-title {
2025-07-22 16:28:43 +08:00
font-size: 16px;
2025-07-22 15:30:55 +08:00
font-weight: 500;
2025-07-22 16:28:43 +08:00
color: #303133;
2025-07-22 15:30:55 +08:00
}
2025-07-22 15:30:55 +08:00
.monitor-panel {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 24px;
}
2025-08-22 14:28:10 +08:00
.monitor-resource,
.monitor-records {
2025-07-22 15:30:55 +08:00
padding: 24px;
border-radius: 16px;
background: #fff;
2025-08-22 14:28:10 +08:00
box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.06);
2025-07-22 15:30:55 +08:00
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-title {
font-size: 18px;
font-weight: 500;
margin-bottom: 24px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-resource-charts {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 16px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-resource-chart {
height: 160px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-records-list {
display: flex;
flex-direction: column;
gap: 16px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-record-item {
display: flex;
align-items: center;
padding: 12px;
border-radius: 12px;
transition: background 0.2s;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-record-item:hover {
background: #f9fafb;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-record-icon {
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 16px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-record-icon-inner {
font-size: 14px;
color: #fff;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-record-action {
font-size: 14px;
font-weight: 500;
}
2025-08-22 14:28:10 +08:00
2025-07-22 15:30:55 +08:00
.monitor-record-time {
font-size: 12px;
color: #6b7280;
}
2025-08-22 14:28:10 +08:00
2025-07-22 16:28:43 +08:00
.user-greeting-row {
display: flex;
align-items: center;
gap: 24px;
margin-bottom: 24px;
}
2025-08-22 14:28:10 +08:00
2025-07-22 16:28:43 +08:00
.user-avatar {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #e0e0e0;
background: #fff;
}
2025-08-22 14:28:10 +08:00
2025-07-22 16:28:43 +08:00
.greeting-text {
display: flex;
flex-direction: column;
justify-content: center;
}
2025-08-22 14:28:10 +08:00
2025-07-22 16:28:43 +08:00
.greeting-title {
font-size: 28px;
font-weight: 600;
color: #333;
}
2025-08-22 14:28:10 +08:00
2025-07-22 16:28:43 +08:00
.greeting-desc {
font-size: 16px;
color: #888;
margin-top: 4px;
}
</style>
<style>
.business-module-header,
.business-module-icon-inner,
.business-module-desc {
display: none;
}
</style>