feat(calibration): 调整标定页面样式
This commit is contained in:
parent
57cf6523ef
commit
16c8adc1f4
|
@ -23,8 +23,8 @@ app.commandLine.appendSwitch('disable-web-security');
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const mainWindow = new BrowserWindow({
|
const mainWindow = new BrowserWindow({
|
||||||
width: 1100,
|
width: 1280,
|
||||||
height: 700,
|
height: 1024,
|
||||||
show: false,
|
show: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
icon,
|
icon,
|
||||||
|
|
|
@ -19,10 +19,11 @@
|
||||||
|
|
||||||
<el-main class="calibration-main">
|
<el-main class="calibration-main">
|
||||||
<div class="device-grid">
|
<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>
|
<template #header>
|
||||||
<div class="device-card-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">
|
<el-tag :type="device.status === 'connected' ? 'success' : 'info'" size="small">
|
||||||
{{ device.status === 'connected' ? '已连接' : '未连接' }}
|
{{ device.status === 'connected' ? '已连接' : '未连接' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
|
@ -41,10 +42,26 @@
|
||||||
</el-main>
|
</el-main>
|
||||||
|
|
||||||
<el-footer class="calibration-footer">
|
<el-footer class="calibration-footer">
|
||||||
<div class="log-output">
|
<div id="log-box-main" class="log-box-main">
|
||||||
<pre v-for="(log, index) in logs" :key="index">{{ log }}</pre>
|
<div class="log-list">
|
||||||
|
<div v-for="(item, index) in logs" :key="index" class="log-item">
|
||||||
|
{{ item }}
|
||||||
|
</div>
|
||||||
|
</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>
|
</el-footer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -56,6 +73,7 @@ import { ElMessage } from 'element-plus';
|
||||||
const selectedScheme = ref('scheme1');
|
const selectedScheme = ref('scheme1');
|
||||||
const playState = ref(false);
|
const playState = ref(false);
|
||||||
const devices = ref([]);
|
const devices = ref([]);
|
||||||
|
const isScroll = ref(true);
|
||||||
const schemes = ref([
|
const schemes = ref([
|
||||||
{
|
{
|
||||||
value: 'scheme1',
|
value: 'scheme1',
|
||||||
|
@ -84,19 +102,66 @@ const generateMockDevices = () => {
|
||||||
devices.value = mockDevices;
|
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(() => {
|
onMounted(() => {
|
||||||
generateMockDevices();
|
generateMockDevices();
|
||||||
|
setInterval(()=>{
|
||||||
|
generateLogs()
|
||||||
|
},1500)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const toggleIsScroll = () => {
|
||||||
|
isScroll.value = !isScroll.value;
|
||||||
|
};
|
||||||
|
|
||||||
const startExecution = () => {
|
const startExecution = () => {
|
||||||
ElMessage.info('开始执行');
|
ElMessage.info('开始执行');
|
||||||
playState.value = true;
|
playState.value = true;
|
||||||
// Add actual start logic here
|
// Add actual start logic here
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopExecution = () => {
|
const stopExecution = () => {
|
||||||
ElMessage.info('停止执行');
|
ElMessage.info('停止执行');
|
||||||
playState.value = false;
|
playState.value = false;
|
||||||
// Add actual stop logic here
|
// Add actual stop logic here
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -173,7 +238,6 @@ const openSettings = () => {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.color-green {
|
.color-green {
|
||||||
color: #67c23a; /* Green for connected */
|
color: #67c23a; /* Green for connected */
|
||||||
}
|
}
|
||||||
|
@ -207,12 +271,46 @@ const openSettings = () => {
|
||||||
margin: 2px 0;
|
margin: 2px 0;
|
||||||
color: #dcdcdc;
|
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 {
|
.version-info {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
font-size: 12px;
|
color: #888;
|
||||||
padding-top: 5px;
|
|
||||||
color: #888;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Element Plus component overrides if needed */
|
/* Element Plus component overrides if needed */
|
||||||
|
@ -247,11 +345,11 @@ const openSettings = () => {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
:deep(.device-grid .el-card__header) {
|
:deep(.device-grid .el-card__header) {
|
||||||
padding: 10px;
|
padding: 10px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.device-grid .el-card__body) {
|
:deep(.device-grid .el-card__body) {
|
||||||
padding: 10px;
|
padding: 10px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure select dropdowns are also styled if needed */
|
/* Ensure select dropdowns are also styled if needed */
|
||||||
|
|
Loading…
Reference in New Issue