feat(calibration): 调整标定页面样式
This commit is contained in:
parent
22dcfbcbcc
commit
e2c6de8117
|
@ -23,8 +23,8 @@ app.commandLine.appendSwitch('disable-web-security');
|
|||
function createWindow() {
|
||||
// Create the browser window.
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 1100,
|
||||
height: 700,
|
||||
width: 1280,
|
||||
height: 1024,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
icon,
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
|
||||
<el-main class="calibration-main">
|
||||
<div class="device-grid">
|
||||
<el-card v-for="device in devices" :key="device.id" class="device-card">
|
||||
<el-card v-for="(device,index) in devices" :key="device.id" class="device-card">
|
||||
<template #header>
|
||||
<div class="device-card-header">
|
||||
<span>{{ device.code }}</span>
|
||||
<!-- <span>{{ device.code }}</span>-->
|
||||
<span>设备{{ index + 1 }}</span>
|
||||
<el-tag :type="device.status === 'connected' ? 'success' : 'info'" size="small">
|
||||
{{ device.status === 'connected' ? '已连接' : '未连接' }}
|
||||
</el-tag>
|
||||
|
@ -41,10 +42,26 @@
|
|||
</el-main>
|
||||
|
||||
<el-footer class="calibration-footer">
|
||||
<div class="log-output">
|
||||
<pre v-for="(log, index) in logs" :key="index">{{ log }}</pre>
|
||||
<div id="log-box-main" class="log-box-main">
|
||||
<div class="log-list">
|
||||
<div v-for="(item, index) in logs" :key="index" class="log-item">
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="version-info">{{ version }}</div>
|
||||
<div class="calibration-footer-btn">
|
||||
<div class="btn-box">
|
||||
<view class="log-box-operate-item" @click="toggleIsScroll">
|
||||
<el-tooltip v-if="isScroll" class="box-item" content="关闭滚动" effect="dark" placement="bottom">
|
||||
<span class="iconfont icon-unlock"></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip v-else class="box-item" content="开启滚动" effect="dark" placement="bottom">
|
||||
<span class="iconfont icon-icon_suoding"></span>
|
||||
</el-tooltip>
|
||||
</view>
|
||||
</div>
|
||||
<div class="version-info">{{ version }}</div>
|
||||
</div>
|
||||
</el-footer>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -56,6 +73,7 @@ import { ElMessage } from 'element-plus';
|
|||
const selectedScheme = ref('scheme1');
|
||||
const playState = ref(false);
|
||||
const devices = ref([]);
|
||||
const isScroll = ref(true);
|
||||
const schemes = ref([
|
||||
{
|
||||
value: 'scheme1',
|
||||
|
@ -84,19 +102,66 @@ const generateMockDevices = () => {
|
|||
devices.value = mockDevices;
|
||||
};
|
||||
|
||||
const generateRandomLog = () => {
|
||||
// 获取当前时间 HH:MM:SS.ms
|
||||
const now = new Date();
|
||||
const hours = now.getHours().toString().padStart(2, '0');
|
||||
const minutes = now.getMinutes().toString().padStart(2, '0');
|
||||
const seconds = now.getSeconds().toString().padStart(2, '0');
|
||||
const milliseconds = now.getMilliseconds().toString().padStart(3, '0');
|
||||
const time = `${hours}:${minutes}:${seconds}.${milliseconds}`;
|
||||
|
||||
// 生成10到50个随机字符
|
||||
const length = Math.floor(Math.random() * 41) + 10; // 10-50
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 条码添加删除更新扫描验证';
|
||||
let randomText = '';
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
randomText += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
}
|
||||
|
||||
// 组合成日志
|
||||
return `${time} ${randomText}`;
|
||||
}
|
||||
|
||||
const generateLogs = () => {
|
||||
// const logCount = Math.floor(Math.random() * 10) + 1; // 1-10 logs
|
||||
// for (let i = 0; i < logCount; i++) {
|
||||
//
|
||||
// }
|
||||
if (logs.value.length > 1000) {
|
||||
logs.value.shift();
|
||||
}
|
||||
logs.value.push(generateRandomLog());
|
||||
if (isScroll.value) {
|
||||
setTimeout(() => {
|
||||
let div = document.querySelector('#log-box-main');
|
||||
div.scrollTop = div.scrollHeight;
|
||||
}, 200);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
generateMockDevices();
|
||||
setInterval(()=>{
|
||||
generateLogs()
|
||||
},1500)
|
||||
});
|
||||
|
||||
const toggleIsScroll = () => {
|
||||
isScroll.value = !isScroll.value;
|
||||
};
|
||||
|
||||
const startExecution = () => {
|
||||
ElMessage.info('开始执行');
|
||||
playState.value = true;
|
||||
playState.value = true;
|
||||
// Add actual start logic here
|
||||
};
|
||||
|
||||
const stopExecution = () => {
|
||||
ElMessage.info('停止执行');
|
||||
playState.value = false;
|
||||
playState.value = false;
|
||||
// Add actual stop logic here
|
||||
};
|
||||
|
||||
|
@ -173,7 +238,6 @@ const openSettings = () => {
|
|||
color: #999;
|
||||
}
|
||||
|
||||
|
||||
.color-green {
|
||||
color: #67c23a; /* Green for connected */
|
||||
}
|
||||
|
@ -207,12 +271,46 @@ const openSettings = () => {
|
|||
margin: 2px 0;
|
||||
color: #dcdcdc;
|
||||
}
|
||||
|
||||
.log-box-main {
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
padding: 5px;
|
||||
font-size: 10px;
|
||||
white-space: pre-wrap;
|
||||
flex-grow: 1;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #555;
|
||||
background-color: #202020;
|
||||
color: #dcdcdc;
|
||||
scroll-behavior: smooth;
|
||||
.log-item {
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
font-size: 12px;
|
||||
user-select: text;
|
||||
line-height: 18px;
|
||||
font-weight: 500;
|
||||
margin-left: 8px;
|
||||
.iconfont {
|
||||
&.icon-icon_fuzhi {
|
||||
line-height: 26px;
|
||||
margin-left: 8px;
|
||||
font-size: 16px;
|
||||
color: #0066cc;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.calibration-footer-btn{
|
||||
font-size: 12px;
|
||||
padding-top: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.version-info {
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
padding-top: 5px;
|
||||
color: #888;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
/* Element Plus component overrides if needed */
|
||||
|
@ -247,11 +345,11 @@ const openSettings = () => {
|
|||
//}
|
||||
|
||||
:deep(.device-grid .el-card__header) {
|
||||
padding: 10px;
|
||||
padding: 10px 5px;
|
||||
}
|
||||
|
||||
:deep(.device-grid .el-card__body) {
|
||||
padding: 10px;
|
||||
padding: 10px 5px;
|
||||
}
|
||||
|
||||
/* Ensure select dropdowns are also styled if needed */
|
||||
|
|
Loading…
Reference in New Issue