style(ui): 更新组件颜色主题为浅色模式

修改多个组件的颜色变量和背景色,从深色主题调整为浅色主题
更新图表组件背景色和文本颜色,优化Y轴范围计算
调整主页标题样式和卡片组件颜色
This commit is contained in:
砂糖
2025-11-04 15:37:22 +08:00
parent 9fcbad1f8e
commit 157bf7559c
6 changed files with 110 additions and 44 deletions

View File

@@ -113,22 +113,27 @@ export default {
// 根据当前图表类型获取配置
getChartOption() {
// 计算Y轴的合适范围使数据变化更明显
const yAxisRange = this.calculateYAxisRange();
const baseOption = {
backgroundColor: 'transparent',
backgroundColor: '#ffffff', // 图表背景色改为白色
tooltip: { trigger: 'axis' },
grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
xAxis: {
type: 'category',
boundaryGap: false,
data: this.chartData[this.currentChart].time,
axisLine: { lineStyle: { color: '#666' } },
axisLabel: { color: '#b0b0b0' }
axisLine: { lineStyle: { color: '#999' } },
axisLabel: { color: '#666' }
},
yAxis: {
type: 'value',
axisLine: { lineStyle: { color: '#666' } },
axisLabel: { color: '#b0b0b0' },
splitLine: { lineStyle: { color: 'rgba(255, 255, 255, 0.1)' } }
min: yAxisRange.min,
max: yAxisRange.max,
axisLine: { lineStyle: { color: '#999' } },
axisLabel: { color: '#666' },
splitLine: { lineStyle: { color: 'rgba(0, 0, 0, 0.05)' } }
}
};
@@ -139,7 +144,7 @@ export default {
...baseOption,
legend: {
data: ['入口张力1', '入口张力2', '入口张力3', '带钢速度'],
textStyle: { color: '#e0e0e0' }
textStyle: { color: '#333' }
},
series: [
{ name: '入口张力1', type: 'line', data: this.chartData.entry.tensionPorBr1, smooth: true, lineStyle: { width: 2 } },
@@ -154,7 +159,7 @@ export default {
...baseOption,
legend: {
data: ['PH炉实际温度', 'NOF1炉实际温度', 'NOF1炉设定温度'],
textStyle: { color: '#e0e0e0' }
textStyle: { color: '#333' }
},
series: [
{ name: 'PH炉实际温度', type: 'line', data: this.chartData.furnace.phFurnaceTemperatureActual, smooth: true, lineStyle: { width: 2 } },
@@ -168,7 +173,7 @@ export default {
...baseOption,
legend: {
data: ['顶部平均涂层重量', '底部平均涂层重量', '气刀压力', '出口速度'],
textStyle: { color: '#e0e0e0' }
textStyle: { color: '#333' }
},
series: [
{ name: '顶部平均涂层重量', type: 'line', data: this.chartData.coat.avrCoatingWeightTop, smooth: true, lineStyle: { width: 2 } },
@@ -183,7 +188,7 @@ export default {
...baseOption,
legend: {
data: ['出口张力1', '出口张力2', '出口速度'],
textStyle: { color: '#e0e0e0' }
textStyle: { color: '#333' }
},
series: [
{ name: '出口张力1', type: 'line', data: this.chartData.exit.tensionBr8Br9, smooth: true, lineStyle: { width: 2 } },
@@ -197,6 +202,46 @@ export default {
}
},
// 计算Y轴的合适范围避免从0开始导致变化不明显
calculateYAxisRange() {
const chartData = this.chartData[this.currentChart];
let allValues = [];
// 收集当前图表类型的所有数据点
Object.keys(chartData).forEach(key => {
if (key !== 'time' && Array.isArray(chartData[key])) {
allValues = allValues.concat(chartData[key].filter(val => val !== null && val !== undefined));
}
});
// 如果没有数据,使用默认范围
if (allValues.length === 0) {
return { min: 0, max: 100 };
}
// 计算数据的最小值和最大值
const minVal = Math.min(...allValues);
const maxVal = Math.max(...allValues);
// 计算数据范围
const range = maxVal - minVal;
// 如果所有值都相同,添加一些范围使图表可见
if (range === 0) {
return {
min: minVal - 10,
max: maxVal + 10
};
}
// 添加10%的边距,使图表更美观
const padding = range * 0.1;
return {
min: minVal - padding,
max: maxVal + padding
};
},
// 处理窗口大小变化
handleWindowResize() {
if (this.chartInstance) {
@@ -350,8 +395,15 @@ export default {
// 更新当前显示的图表
updateCurrentChart() {
if (this.chartInstance) {
// 重新计算Y轴范围
const yAxisRange = this.calculateYAxisRange();
this.chartInstance.setOption({
xAxis: { data: this.chartData[this.currentChart].time },
yAxis: {
min: yAxisRange.min,
max: yAxisRange.max
},
series: this.getSeriesData()
});
}
@@ -402,8 +454,8 @@ export default {
.process-monitor {
padding: 20px;
font-family: Arial, sans-serif;
background-color: #3f4449;
color: #e0e0e0;
background-color: #ffffff; /* 根容器背景改为白色 */
color: #333333; /* 文本颜色改为深色 */
}
.control-bar {
@@ -412,11 +464,13 @@ export default {
gap: 20px;
margin-bottom: 20px;
flex-wrap: wrap;
padding-bottom: 10px;
border-bottom: 1px solid #eeeeee; /* 添加分隔线 */
}
.chart-selector {
padding: 10px;
background-color: #4a4f55;
background-color: #f8f8f8; /* 选择器背景改为浅灰 */
border-radius: 4px;
display: flex;
align-items: center;
@@ -424,49 +478,58 @@ export default {
.chart-selector label {
margin-right: 10px;
color: #e0e0e0;
color: #555555; /* 标签颜色改为深灰 */
font-weight: 500;
}
.chart-selector select {
padding: 5px 10px;
border: 1px solid #5d6268;
padding: 6px 12px;
border: 1px solid #dddddd; /* 边框改为浅灰 */
border-radius: 4px;
background-color: #555a60;
color: #e0e0e0;
background-color: #ffffff; /* 选择框背景改为白色 */
color: #333333; /* 选择框文本改为深色 */
cursor: pointer;
transition: border-color 0.2s;
}
.chart-selector select:focus {
outline: none;
border-color: #999999; /* 聚焦时边框加深 */
}
.connection-status {
padding: 8px 10px;
padding: 8px 12px;
border-radius: 4px;
background-color: #4a4f55;
color: #ffd700;
background-color: #f8f8f8; /* 状态背景改为浅灰 */
color: #e6a23c; /* 连接中颜色(橙色系) */
margin-left: auto;
font-size: 14px;
}
.connection-status.connected {
color: #32cd32;
color: #67c23a; /* 已连接颜色(绿色系) */
}
.chart-container {
background-color: #4a4f55;
background-color: #ffffff; /* 图表容器背景改为白色 */
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
padding: 15px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* 阴影变浅 */
padding: 20px;
}
.chart-title {
margin-top: 0;
color: #f0f0f0;
color: #333333; /* 标题颜色改为深色 */
font-size: 18px;
border-bottom: 1px solid #5d6268;
border-bottom: 1px solid #eeeeee; /* 分隔线改为浅灰 */
padding-bottom: 10px;
margin-bottom: 15px;
font-weight: 600;
}
.chart {
width: 100%;
height: 400px; /* 增大图表高度提升可读性 */
height: 400px; /* 保持图表高度 */
}
/* 响应式调整 */

View File

@@ -52,12 +52,12 @@ export default {
<style scoped lang="scss">
// 主题色变量(建议提取为全局变量,此处暂与父页面保持一致)
$theme-primary: #a7acb4;
$theme-text-gray: #c9cdcf;
$theme-text-gray: #a1a6af;
// 仅维护组件自身样式,无定位属性
.current-time {
padding: 1.2vw 1.8vw;
background: rgba(26, 29, 33, 0.6);
background: white;
backdrop-filter: blur(8px);
border: 1px solid rgba(167, 172, 180, 0.3);
border-radius: 8px;

View File

@@ -4,11 +4,11 @@
<div class="header-section">
<div class="tech-logo">
<div class="logo-shape"></div>
<h1>KLP <span class="highlight">VISION</span></h1>
<h1><span class="highlight">KLP VISION</span></h1>
</div>
<div class="main-title">
<h2>探索生产与信息的无限可能</h2>
<p>探索生产与信息的无限可能</p>
<p class="subtitle">创新 · 科技 · 未来</p>
</div>
</div>
@@ -26,7 +26,7 @@
<svg-icon :icon-class="card.icon"></svg-icon>
</div>
<div class="card-info">
<h3>{{ card.title }}</h3>
<h4>{{ card.title }}</h4>
<!-- <p>{{ card.desc }}</p> -->
</div>
<div class="card-glow"></div>
@@ -56,8 +56,8 @@ export default {
<style scoped lang="scss">
// 主题色变量
$theme-primary: #a7acb4;
$theme-light: rgba(167, 172, 180, 0.8);
$theme-dark: rgba(140, 145, 153, 0.8);
$theme-light: #a7acb4;
$theme-dark: #a7acb4;
$theme-text-light: #f0f0f0;
$theme-text-gray: #c9cdcf;
@@ -160,7 +160,7 @@ $theme-text-gray: #c9cdcf;
position: relative;
flex: 1;
padding: 10px 12px;
background: rgba(26, 29, 33, 0.5);
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(6px);
border: 1px solid rgba(167, 172, 180, 0.2);
border-radius: 6px;
@@ -172,10 +172,11 @@ $theme-text-gray: #c9cdcf;
align-items: center;
gap: 10px;
cursor: pointer;
color: #111;
&:hover {
transform: translateY(-3px);
background: rgba(26, 29, 33, 0.7);
// background: rgba(26, 29, 33, 0.7);
box-shadow: 0 4px 12px rgba(167, 172, 180, 0.3);
}
@@ -191,12 +192,14 @@ $theme-text-gray: #c9cdcf;
i {
font-size: 16px;
color: $theme-primary;
// color: $theme-primary;
color: #111;
}
}
.card-info {
flex-grow: 1;
color: #111;
overflow: hidden;
}

View File

@@ -59,7 +59,7 @@ export default {
cellStyle() {
return {
'font-size': '12px',
'color': '#fff',
'color': '#111',
'background': 'transparent',
'border-bottom': '1px solid rgba(255, 255, 255, 0.1)',
'white-space': 'nowrap',
@@ -71,7 +71,7 @@ export default {
headerCellStyle() {
return {
'font-size': '12px',
'color': '#fff',
'color': '#111',
'font-weight': '500',
'background': 'rgba(255, 255, 255, 0.05)',
'border-bottom': '1px solid rgba(255, 255, 255, 0.1)',

View File

@@ -94,14 +94,14 @@ export default {
.card-title {
font-size: 13px;
color: rgba(255, 255, 255, 0.8);
color: #000;
margin-bottom: 6px;
}
.card-value {
font-size: 20px;
font-weight: bold;
color: #ffffff;
color: #111;
margin-bottom: 3px;
}

View File

@@ -5,7 +5,7 @@
<knova-stage @rectClick="selectCard" :matMapList="matMapList"></knova-stage>
</el-col>
<el-col :span="8">
<div style="border: 1px solid #000; padding: 10px; border-radius: 10px; color: white; margin-bottom: 10px;">
<div style="border: 1px solid #000; padding: 10px; border-radius: 10px; color: black; margin-bottom: 10px;">
<!-- 调整工具选择两个位置两个下拉选分别双向绑定 -->
<el-form :model="adjustForm" ref="adjustForm" label-width="80px">
<el-form-item label="当前位置" prop="current">
@@ -22,7 +22,7 @@
<el-button type="primary" :disabled="!adjustForm.current || !adjustForm.target" @click="handleConfirmAdjust">确认调整</el-button>
</div>
<div style="border: 1px solid #000; padding: 10px; border-radius: 10px; color: white; margin-bottom: 10px;">
<div style="border: 1px solid #000; padding: 10px; border-radius: 10px; color: black; margin-bottom: 10px;">
<el-row v-if="selectedCard">
<el-col :span="12">
<div class="detail-item">