feat: 工厂设备智能监控平台初始版本 - 包含 A/B/C 三类设备看板、单设备明细页、mock 数据、Vue Router 路由
Made-with: Cursor
This commit is contained in:
commit
b583feb2a4
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
node_modules
|
||||
dist
|
||||
.vite
|
||||
*.local
|
||||
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
2368
B类设备信息核对.md
Normal file
2368
B类设备信息核对.md
Normal file
File diff suppressed because it is too large
Load Diff
5
README.md
Normal file
5
README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Vue 3 + Vite
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||
|
||||
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
|
||||
23
index.html
Normal file
23
index.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, initial-scale=1.0" />
|
||||
<title>工厂设备智能监控平台</title>
|
||||
<meta name="description" content="工厂设备实时监控大屏,展示激光切割、CNC加工中心、电力监测设备状态" />
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
background: #020c20;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
1835
package-lock.json
generated
Normal file
1835
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
package.json
Normal file
23
package.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "factory-dashboard",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kjgl77/datav-vue3": "^1.7.4",
|
||||
"axios": "^1.13.6",
|
||||
"echarts": "^6.0.0",
|
||||
"vue": "^3.5.25",
|
||||
"vue-echarts": "^8.0.1",
|
||||
"vue-router": "^4.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^6.0.2",
|
||||
"vite": "^7.3.1"
|
||||
}
|
||||
}
|
||||
1
public/vite.svg
Normal file
1
public/vite.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
13
src/App.vue
Normal file
13
src/App.vue
Normal file
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
background: #020c20;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
1
src/assets/vue.svg
Normal file
1
src/assets/vue.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 496 B |
62
src/components/AlarmPanel.vue
Normal file
62
src/components/AlarmPanel.vue
Normal file
@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<div class="alarm-panel">
|
||||
<div class="panel-title">
|
||||
<dv-decoration-3 class="deco" />
|
||||
<span>报警信息</span>
|
||||
<dv-decoration-3 class="deco flip" />
|
||||
</div>
|
||||
|
||||
<div class="alarm-count-row" v-if="alarms.length">
|
||||
<span class="alarm-count-badge">{{ alarms.length }} 条报警</span>
|
||||
</div>
|
||||
<div class="no-alarm" v-if="!alarms.length">
|
||||
<span class="no-alarm-icon">✓</span>
|
||||
<span>全部设备运行正常</span>
|
||||
</div>
|
||||
|
||||
<dv-scroll-board v-if="alarms.length" class="scroll-board" :config="scrollConfig" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
alarms: { type: Array, default: () => [] }
|
||||
})
|
||||
|
||||
const scrollConfig = computed(() => ({
|
||||
header: ['时间', '设备', '报警信息'],
|
||||
data: props.alarms.map(a => [
|
||||
`<span style="color:#8eb8d8;font-size:11px">${a.time}</span>`,
|
||||
`<span style="color:#04b9ff;font-weight:600;font-size:11px">${a.device}</span>`,
|
||||
`<span style="color:#ffb1b1;font-size:11px">${a.message}</span>`
|
||||
]),
|
||||
index: false,
|
||||
columnWidth: [62, 70, 130],
|
||||
align: ['center', 'center', 'left'],
|
||||
rowNum: 8,
|
||||
headerBGC: 'rgba(4,27,70,0.8)',
|
||||
oddRowBGC: 'rgba(4,20,55,0.5)',
|
||||
evenRowBGC: 'rgba(8,30,70,0.35)',
|
||||
headerHeight: 30,
|
||||
carousel: 'single',
|
||||
waitTime: 3000
|
||||
}))
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.alarm-panel { height: 100%; display: flex; flex-direction: column; }
|
||||
|
||||
.panel-title { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: #04b9ff; letter-spacing: 2px; margin-bottom: 8px; text-shadow: 0 0 8px #04b9ff44; }
|
||||
.deco { width: 40px; height: 18px; flex-shrink: 0; }
|
||||
.flip { transform: scaleX(-1); }
|
||||
|
||||
.alarm-count-row { margin-bottom: 6px; }
|
||||
.alarm-count-badge { font-size: 12px; color: #ff4444; font-weight: 700; background: rgba(255,68,68,0.1); padding: 2px 10px; border-radius: 4px; border: 1px solid rgba(255,68,68,0.3); }
|
||||
|
||||
.no-alarm { display: flex; align-items: center; gap: 6px; color: #00e676; font-size: 13px; font-weight: 600; padding: 12px 0; }
|
||||
.no-alarm-icon { font-size: 16px; }
|
||||
|
||||
.scroll-board { flex: 1; min-height: 0; }
|
||||
</style>
|
||||
104
src/components/CncCard.vue
Normal file
104
src/components/CncCard.vue
Normal file
@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div class="cnc-card" :class="`status-${status.key}`" @click="$emit('click')">
|
||||
<!-- 设备名 + 型号 -->
|
||||
<div class="card-header">
|
||||
<span class="dev-name">{{ device.name }}</span>
|
||||
<span class="dev-type">{{ cncType }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 状态行 -->
|
||||
<div class="status-row">
|
||||
<span class="status-dot" :class="`dot-${status.key}`"></span>
|
||||
<span class="status-label" :style="{ color: statusColor }">{{ status.label }}</span>
|
||||
<span class="mode-tag" v-if="device.online">{{ modeText }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 离线提示 -->
|
||||
<template v-if="!device.online">
|
||||
<div class="offline-info">{{ device.offlineReason }}</div>
|
||||
</template>
|
||||
|
||||
<!-- 在线数据 -->
|
||||
<template v-else>
|
||||
<div class="produce-row">
|
||||
<span class="produce-label">加工件数</span>
|
||||
<span class="produce-val">{{ md.currentProduceCount?.toLocaleString() }}<small>件</small></span>
|
||||
</div>
|
||||
<div class="time-rows">
|
||||
<div class="time-item"><span class="t-label">切削</span><span class="t-val">{{ formatTime(md.cuttime) }}</span></div>
|
||||
<div class="time-item"><span class="t-label">运行</span><span class="t-val">{{ formatTime(md.runtime) }}</span></div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { getCncStatus, getCncWorkModeText, formatFanucTimeShort, STATUS_COLORS } from '../composables/useDeviceStatus.js'
|
||||
|
||||
const props = defineProps({ device: { type: Object, required: true } })
|
||||
defineEmits(['click'])
|
||||
|
||||
const md = computed(() => props.device.machineData || {})
|
||||
const status = computed(() => {
|
||||
if (!props.device.online) return { key: 'offline', label: '离线' }
|
||||
return getCncStatus(md.value.statusInfo, md.value.alarmStatus)
|
||||
})
|
||||
const statusColor = computed(() => STATUS_COLORS[status.value.key] || '#555')
|
||||
const modeText = computed(() => getCncWorkModeText(md.value.statusInfo?.WorkMode))
|
||||
const cncType = computed(() => {
|
||||
if (props.device.online) return props.device.machineData?.sysInfo?.cncType || 'CNC'
|
||||
return props.device.sysInfo?.cncType || 'CNC'
|
||||
})
|
||||
|
||||
function formatTime(str) { return formatFanucTimeShort(str) }
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cnc-card {
|
||||
background: linear-gradient(135deg, #0d1b35, #050f24);
|
||||
border: 1px solid #1e3a6a;
|
||||
border-radius: 10px;
|
||||
padding: 12px 14px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
height: 100%;
|
||||
}
|
||||
.cnc-card:hover { border-color: #04b9ff; box-shadow: 0 0 14px rgba(4,185,255,0.15); }
|
||||
.cnc-card.status-running { border-color: rgba(0,230,118,0.5); background: linear-gradient(135deg, #0e2d2e, #040d21); }
|
||||
.cnc-card.status-alarm { border-color: #ff5252; animation: alarm-pulse 1.5s infinite; }
|
||||
.cnc-card.status-offline { border-color: #333; opacity: 0.6; }
|
||||
@keyframes alarm-pulse {
|
||||
0%,100% { box-shadow: 0 0 4px rgba(255,82,82,0.4); }
|
||||
50% { box-shadow: 0 0 14px rgba(255,82,82,0.7); }
|
||||
}
|
||||
|
||||
.card-header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid rgba(4,185,255,0.15); padding-bottom: 5px; }
|
||||
.dev-name { font-size: 18px; font-weight: 800; color: #fff; letter-spacing: 1px; }
|
||||
.dev-type { font-size: 10px; color: #5a7a9a; }
|
||||
|
||||
.status-row { display: flex; align-items: center; gap: 6px; }
|
||||
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
|
||||
.dot-running { background: #00e676; box-shadow: 0 0 6px #00e676; }
|
||||
.dot-idle { background: #ffca28; }
|
||||
.dot-alarm { background: #ff4444; animation: blink 0.6s infinite alternate; }
|
||||
.dot-offline { background: #555; }
|
||||
@keyframes blink { 0%{opacity:1}100%{opacity:0.3} }
|
||||
.status-label { font-size: 13px; font-weight: 700; }
|
||||
.mode-tag { margin-left: auto; font-size: 11px; padding: 1px 8px; background: rgba(4,185,255,0.12); color: #04b9ff; border: 1px solid rgba(4,185,255,0.25); border-radius: 3px; font-weight: 700; }
|
||||
|
||||
.offline-info { font-size: 11px; color: #666; line-height: 1.5; flex: 1; display: flex; align-items: center; }
|
||||
|
||||
.produce-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; }
|
||||
.produce-label { font-size: 11px; color: #5a7a9a; font-weight: 600; }
|
||||
.produce-val { font-size: 20px; font-weight: 800; color: #00e676; text-shadow: 0 0 8px rgba(0,230,118,0.3); }
|
||||
.produce-val small { font-size: 11px; margin-left: 3px; opacity: 0.7; }
|
||||
|
||||
.time-rows { display: flex; gap: 10px; margin-top: auto; }
|
||||
.time-item { flex: 1; background: rgba(0,0,0,0.2); padding: 4px 8px; border-radius: 4px; display: flex; justify-content: space-between; }
|
||||
.t-label { font-size: 10px; color: #5a7a9a; font-weight: 600; }
|
||||
.t-val { font-size: 11px; color: #8eb8d8; font-family: 'Consolas', monospace; }
|
||||
</style>
|
||||
128
src/components/HeaderBar.vue
Normal file
128
src/components/HeaderBar.vue
Normal file
@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<div class="header-bar">
|
||||
<div class="header-left">
|
||||
<dv-decoration-10 class="header-deco-left" />
|
||||
</div>
|
||||
<div class="header-center">
|
||||
<dv-decoration-8 class="header-deco-8-left" :color="['#04b9ff', '#04b9ff']" />
|
||||
<div class="header-title">
|
||||
<span class="title-icon">⚙</span>
|
||||
工厂设备智能监控平台
|
||||
<span class="title-icon">⚙</span>
|
||||
</div>
|
||||
<dv-decoration-8 class="header-deco-8-right" :color="['#04b9ff', '#04b9ff']" :reverse="true" />
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<dv-decoration-10 class="header-deco-right" :reverse="true" />
|
||||
</div>
|
||||
|
||||
<!-- Time display moved to the left -->
|
||||
<div class="time-display">
|
||||
<div class="date">{{ currentDate }}</div>
|
||||
<div class="time">{{ currentTime }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
|
||||
const currentTime = ref('')
|
||||
const currentDate = ref('')
|
||||
|
||||
function updateTime() {
|
||||
const now = new Date()
|
||||
currentTime.value = now.toLocaleTimeString('zh-CN', { hour12: false })
|
||||
currentDate.value = now.toLocaleDateString('zh-CN', {
|
||||
year: 'numeric', month: '2-digit', day: '2-digit', weekday: 'short'
|
||||
})
|
||||
}
|
||||
|
||||
let timer = null
|
||||
onMounted(() => {
|
||||
updateTime()
|
||||
timer = setInterval(updateTime, 1000)
|
||||
})
|
||||
onUnmounted(() => clearInterval(timer))
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.header-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 70px;
|
||||
background: linear-gradient(to bottom, #040b1c, #0d1b3e);
|
||||
border-bottom: 2px solid #04b9ff44;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-left, .header-right {
|
||||
flex: 0 0 340px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-deco-left, .header-deco-right {
|
||||
width: 300px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.header-deco-right {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.header-center {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.header-deco-8-left, .header-deco-8-right {
|
||||
width: 150px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 6px;
|
||||
color: #fff;
|
||||
text-shadow: 0 0 20px #04b9ff, 0 0 40px #04b9ff55;
|
||||
padding: 0 20px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.title-icon {
|
||||
color: #04b9ff;
|
||||
margin: 0 8px;
|
||||
animation: spin 8s linear infinite;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.time-display {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
left: 330px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.date {
|
||||
font-size: 13px;
|
||||
color: #8eb8d8;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
color: #04b9ff;
|
||||
letter-spacing: 3px;
|
||||
text-shadow: 0 0 10px #04b9ff88;
|
||||
}
|
||||
</style>
|
||||
100
src/components/LaserCard.vue
Normal file
100
src/components/LaserCard.vue
Normal file
@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<div class="laser-card" :class="`status-${status.key}`" @click="$emit('click')">
|
||||
<div class="card-top">
|
||||
<span class="device-name">{{ device.name }} <span class="app-tag">{{ device.appName }}</span></span>
|
||||
<span class="status-badge" :style="{ color: statusColor }">
|
||||
<span class="status-dot" :class="`dot-${status.key}`"></span>
|
||||
{{ status.label }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="left-info">
|
||||
<div class="task-name" v-if="nc?.TaskName">
|
||||
<span class="label">当前图纸</span>
|
||||
<span class="value">{{ nc.TaskName }}</span>
|
||||
</div>
|
||||
<div class="progress-row" v-if="nc?.SysState === 8">
|
||||
<div class="progress-bg">
|
||||
<div class="progress-fill" :style="{ width: (nc.CutPercent || 0) + '%' }"></div>
|
||||
</div>
|
||||
<span class="pct">{{ (nc.CutPercent || 0).toFixed(1) }}%</span>
|
||||
</div>
|
||||
<div class="alarm-row" v-if="(nc?.AlarmCount || 0) > 0">
|
||||
<span class="alarm-icon">⚠</span>
|
||||
<span class="alarm-text">报警 {{ nc.AlarmCount }} 个</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right-stats">
|
||||
<div class="stat"><span class="stat-label">穿孔</span><span class="stat-val green">{{ (device.machineData.pierceCount || 0).toLocaleString() }}<small>次</small></span></div>
|
||||
<div class="stat"><span class="stat-label">切割</span><span class="stat-val cyan">{{ (device.machineData.cutLength / 1000).toFixed(1) }}<small>m</small></span></div>
|
||||
<div class="stat"><span class="stat-label">开机率</span><span class="stat-val">{{ device.machineData.startRate }}</span></div>
|
||||
<div class="stat"><span class="stat-label">切割率</span><span class="stat-val">{{ device.machineData.cutRate }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { getLaserStatus, STATUS_COLORS } from '../composables/useDeviceStatus.js'
|
||||
|
||||
const props = defineProps({ device: { type: Object, required: true } })
|
||||
defineEmits(['click'])
|
||||
|
||||
const nc = computed(() => props.device.machineData?.CutSystemState?.NcState)
|
||||
const status = computed(() => getLaserStatus(props.device.machineData))
|
||||
const statusColor = computed(() => STATUS_COLORS[status.value.key] || '#fff')
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.laser-card {
|
||||
background: linear-gradient(135deg, #0d1b35, #050f24);
|
||||
border: 1px solid #1e3a6a;
|
||||
border-radius: 10px;
|
||||
padding: 14px 18px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.laser-card:hover { border-color: #04b9ff; box-shadow: 0 0 16px rgba(4,185,255,0.2); }
|
||||
.laser-card.status-running { border-color: rgba(0,230,118,0.5); box-shadow: inset 0 0 20px rgba(0,230,118,0.06); }
|
||||
.laser-card.status-alarm { border-color: #ff5252; animation: alarm-pulse 1.5s infinite; }
|
||||
@keyframes alarm-pulse {
|
||||
0%,100% { box-shadow: 0 0 5px rgba(255,82,82,0.4); }
|
||||
50% { box-shadow: 0 0 16px rgba(255,82,82,0.8); }
|
||||
}
|
||||
|
||||
.card-top { display: flex; justify-content: space-between; align-items: center; }
|
||||
.device-name { font-size: 16px; font-weight: 700; color: #fff; }
|
||||
.app-tag { font-size: 11px; color: #04b9ff; background: rgba(4,185,255,0.12); padding: 1px 6px; border-radius: 3px; margin-left: 6px; }
|
||||
.status-badge { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; }
|
||||
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
|
||||
.dot-running { background: #00e676; box-shadow: 0 0 6px #00e676; }
|
||||
.dot-idle { background: #ffca28; }
|
||||
.dot-alarm { background: #ff4444; animation: blink 0.6s infinite alternate; }
|
||||
@keyframes blink { 0% { opacity:1; } 100% { opacity:0.3; } }
|
||||
|
||||
.card-body { display: flex; gap: 20px; }
|
||||
.left-info { flex: 1; display: flex; flex-direction: column; gap: 6px; }
|
||||
.label { font-size: 11px; color: #5a7a9a; }
|
||||
.task-name .value { font-size: 13px; color: #00e5ff; font-weight: 600; margin-left: 6px; }
|
||||
.progress-row { display: flex; align-items: center; gap: 8px; }
|
||||
.progress-bg { flex: 1; height: 8px; background: #0d2654; border-radius: 4px; overflow: hidden; }
|
||||
.progress-fill { height: 100%; background: linear-gradient(90deg, #00e5ff, #0070ff); transition: width 0.5s; }
|
||||
.pct { font-size: 13px; color: #00e5ff; font-weight: 700; width: 50px; text-align: right; }
|
||||
.alarm-row { display: flex; align-items: center; gap: 4px; }
|
||||
.alarm-icon { color: #ff4444; font-size: 14px; }
|
||||
.alarm-text { color: #ff8a80; font-size: 12px; font-weight: 600; }
|
||||
|
||||
.right-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
|
||||
.stat { display: flex; flex-direction: column; }
|
||||
.stat-label { font-size: 10px; color: #5a7a9a; }
|
||||
.stat-val { font-size: 15px; font-weight: 700; color: #d0e8ff; }
|
||||
.stat-val small { font-size: 10px; margin-left: 2px; opacity: 0.7; }
|
||||
.green { color: #00e676; }
|
||||
.cyan { color: #00e5ff; }
|
||||
</style>
|
||||
69
src/components/PowerCard.vue
Normal file
69
src/components/PowerCard.vue
Normal file
@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<div class="power-card" @click="$emit('click')">
|
||||
<div class="card-top">
|
||||
<span class="dev-name">{{ device.name }}</span>
|
||||
<span class="status-badge" :style="{ color: statusColor }">
|
||||
<span class="status-dot" :class="`dot-${status.key}`"></span>
|
||||
{{ status.label }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="phases" v-if="device.online">
|
||||
<div class="phase" v-for="(item, idx) in phases" :key="idx">
|
||||
<span class="phase-label">{{ item.label }}</span>
|
||||
<span class="phase-val" :class="{ warn: item.warn }">{{ item.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offline-msg" v-else>设备离线</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { getPowerStatus, STATUS_COLORS } from '../composables/useDeviceStatus.js'
|
||||
|
||||
const props = defineProps({ device: { type: Object, required: true } })
|
||||
defineEmits(['click'])
|
||||
|
||||
const status = computed(() => getPowerStatus(props.device.machineData))
|
||||
const statusColor = computed(() => STATUS_COLORS[status.value.key] || '#555')
|
||||
|
||||
const phases = computed(() => {
|
||||
const s = props.device.machineData?.slave1
|
||||
if (!s) return []
|
||||
return [
|
||||
{ label: 'A相', value: s.current1, warn: parseFloat(s.current1) > 16 },
|
||||
{ label: 'B相', value: s.current2, warn: parseFloat(s.current2) > 16 },
|
||||
{ label: 'C相', value: s.current3, warn: parseFloat(s.current3) > 16 }
|
||||
]
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.power-card {
|
||||
background: linear-gradient(135deg, #0d1b35, #050f24);
|
||||
border: 1px solid #1e3a6a;
|
||||
border-radius: 10px;
|
||||
padding: 12px 18px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.power-card:hover { border-color: #04b9ff; box-shadow: 0 0 14px rgba(4,185,255,0.15); }
|
||||
|
||||
.card-top { display: flex; justify-content: space-between; align-items: center; }
|
||||
.dev-name { font-size: 14px; font-weight: 700; color: #fff; }
|
||||
.status-badge { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
|
||||
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
|
||||
.dot-normal { background: #00e676; box-shadow: 0 0 5px #00e676; }
|
||||
.dot-alarm { background: #ff4444; }
|
||||
.dot-offline { background: #555; }
|
||||
|
||||
.phases { display: flex; gap: 20px; }
|
||||
.phase { display: flex; flex-direction: column; flex: 1; }
|
||||
.phase-label { font-size: 10px; color: #5a7a9a; }
|
||||
.phase-val { font-size: 18px; font-weight: 700; color: #00e5ff; font-family: 'Consolas', monospace; }
|
||||
.phase-val.warn { color: #ff4444; }
|
||||
.offline-msg { font-size: 12px; color: #555; }
|
||||
</style>
|
||||
156
src/components/StatusSummary.vue
Normal file
156
src/components/StatusSummary.vue
Normal file
@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<div class="status-summary">
|
||||
<!-- 标题 -->
|
||||
<div class="panel-title">
|
||||
<dv-decoration-3 class="deco" />
|
||||
<span>设备总览</span>
|
||||
<dv-decoration-3 class="deco flip" />
|
||||
</div>
|
||||
|
||||
<!-- 状态计数 2x2 -->
|
||||
<div class="stat-grid">
|
||||
<div class="stat-item st-running">
|
||||
<div class="stat-num">{{ counts.running }}</div>
|
||||
<div class="stat-name">运行中</div>
|
||||
</div>
|
||||
<div class="stat-item st-idle">
|
||||
<div class="stat-num">{{ counts.idle }}</div>
|
||||
<div class="stat-name">待机</div>
|
||||
</div>
|
||||
<div class="stat-item st-alarm">
|
||||
<div class="stat-num">{{ counts.alarm }}</div>
|
||||
<div class="stat-name">报警</div>
|
||||
</div>
|
||||
<div class="stat-item st-offline">
|
||||
<div class="stat-num">{{ counts.offline }}</div>
|
||||
<div class="stat-name">离线</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 水位图 -->
|
||||
<div class="water-waves">
|
||||
<div class="wave-item">
|
||||
<dv-water-level-pond class="water-pond"
|
||||
:config="{ data: [availabilityPct], shape: 'roundRect', colors: ['#00e676','#04b9ff'], waveNum: 3, waveHeight: 10, waveOpacity: 0.4 }" />
|
||||
<div class="wave-label">设备可用率</div>
|
||||
</div>
|
||||
<div class="wave-item">
|
||||
<dv-water-level-pond class="water-pond"
|
||||
:config="{ data: [runningPct], shape: 'roundRect', colors: ['#04b9ff','#7c4dff'], waveNum: 3, waveHeight: 10, waveOpacity: 0.4 }" />
|
||||
<div class="wave-label">运行率</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 今日总产出 -->
|
||||
<div class="today-total">
|
||||
<div class="total-title">CNC 总加工件数</div>
|
||||
<dv-digital-flop class="digital-flop" :config="flopConfig" />
|
||||
</div>
|
||||
|
||||
<!-- 本周趋势 -->
|
||||
<div class="panel-title mt12">
|
||||
<dv-decoration-3 class="deco" />
|
||||
<span>本周产能趋势</span>
|
||||
<dv-decoration-3 class="deco flip" />
|
||||
</div>
|
||||
<div class="bar-chart" v-if="weeklyProduce.length">
|
||||
<div v-for="(val, i) in weeklyProduce" :key="i" class="bar-group">
|
||||
<div class="bar-value">{{ val > 1000 ? (Math.round(val / 100) / 10) + 'k' : val }}</div>
|
||||
<div class="bar-wrap">
|
||||
<div class="bar-fill" :class="{ today: i === todayIdx }" :style="{ height: barH(val) + '%' }"></div>
|
||||
</div>
|
||||
<div class="bar-label">{{ weeklyLabels[i] }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { getDeviceStatus } from '../composables/useDeviceStatus.js'
|
||||
|
||||
const props = defineProps({
|
||||
devices: { type: Array, default: () => [] },
|
||||
weeklyLabels: { type: Array, default: () => [] },
|
||||
weeklyProduce: { type: Array, default: () => [] },
|
||||
todayIdx: { type: Number, default: 0 }
|
||||
})
|
||||
|
||||
const counts = computed(() => {
|
||||
const c = { running: 0, idle: 0, alarm: 0, offline: 0 }
|
||||
props.devices.forEach(d => {
|
||||
const s = getDeviceStatus(d)
|
||||
if (s.key === 'running') c.running++
|
||||
else if (s.key === 'alarm') c.alarm++
|
||||
else if (s.key === 'offline') c.offline++
|
||||
else if (s.key === 'normal') c.running++ // C类正常算运行
|
||||
else c.idle++
|
||||
})
|
||||
return c
|
||||
})
|
||||
|
||||
const total = computed(() => props.devices.length)
|
||||
const availabilityPct = computed(() => {
|
||||
if (!total.value) return 0
|
||||
return Math.round(((total.value - counts.value.offline) / total.value) * 100)
|
||||
})
|
||||
const runningPct = computed(() => {
|
||||
if (!total.value) return 0
|
||||
return Math.round((counts.value.running / total.value) * 100)
|
||||
})
|
||||
|
||||
const totalProduceCount = computed(() => {
|
||||
return props.devices
|
||||
.filter(d => d.type === 'cnc' && d.online)
|
||||
.reduce((s, d) => s + (d.machineData?.currentProduceCount || 0), 0)
|
||||
})
|
||||
|
||||
const flopConfig = computed(() => ({
|
||||
number: [totalProduceCount.value],
|
||||
content: '{nt}',
|
||||
style: { fontSize: 30, fill: '#04b9ff', fontWeight: 'bold' },
|
||||
formatter: n => n.toLocaleString()
|
||||
}))
|
||||
|
||||
const maxProduce = computed(() => Math.max(...props.weeklyProduce, 1))
|
||||
function barH(val) { return Math.max(6, (val / maxProduce.value) * 88) }
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.status-summary { height: 100%; display: flex; flex-direction: column; }
|
||||
|
||||
.panel-title { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: #04b9ff; letter-spacing: 2px; margin-bottom: 8px; text-shadow: 0 0 8px #04b9ff44; }
|
||||
.deco { width: 40px; height: 18px; flex-shrink: 0; }
|
||||
.flip { transform: scaleX(-1); }
|
||||
.mt12 { margin-top: 12px; }
|
||||
|
||||
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
|
||||
.stat-item { text-align: center; padding: 8px 2px; border-radius: 6px; border: 1px solid; }
|
||||
.st-running { background: rgba(0,230,118,0.06); border-color: rgba(0,230,118,0.25); }
|
||||
.st-idle { background: rgba(255,202,40,0.06); border-color: rgba(255,202,40,0.25); }
|
||||
.st-alarm { background: rgba(255,68,68,0.06); border-color: rgba(255,68,68,0.25); }
|
||||
.st-offline { background: rgba(100,100,100,0.06); border-color: rgba(100,100,100,0.25); }
|
||||
.stat-num { font-size: 26px; font-weight: 700; line-height: 1; }
|
||||
.st-running .stat-num { color: #00e676; }
|
||||
.st-idle .stat-num { color: #ffca28; }
|
||||
.st-alarm .stat-num { color: #ff4444; }
|
||||
.st-offline .stat-num { color: #666; }
|
||||
.stat-name { font-size: 10px; color: #5a7a9a; margin-top: 2px; }
|
||||
|
||||
.water-waves { display: flex; gap: 8px; margin-bottom: 10px; }
|
||||
.wave-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
|
||||
.water-pond { width: 85px; height: 70px; }
|
||||
.wave-label { font-size: 10px; color: #5a7a9a; }
|
||||
|
||||
.today-total { text-align: center; padding: 8px; background: rgba(4,185,255,0.05); border: 1px solid rgba(4,185,255,0.15); border-radius: 6px; margin-bottom: 4px; }
|
||||
.total-title { font-size: 11px; color: #5a7a9a; letter-spacing: 1px; margin-bottom: 2px; }
|
||||
.digital-flop { height: 42px; }
|
||||
|
||||
.bar-chart { display: flex; gap: 3px; align-items: flex-end; height: 100px; flex: 1; min-height: 80px; }
|
||||
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
|
||||
.bar-value { font-size: 8px; color: #5a7a9a; margin-bottom: 2px; line-height: 1; }
|
||||
.bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; background: rgba(4,185,255,0.04); border-radius: 2px 2px 0 0; }
|
||||
.bar-fill { width: 100%; border-radius: 2px 2px 0 0; background: linear-gradient(to top, #1a5a9a, #04b9ff66); transition: height 0.5s; min-height: 3px; }
|
||||
.bar-fill.today { background: linear-gradient(to top, #00e676, #04b9ff); }
|
||||
.bar-label { font-size: 8px; color: #4a6a8a; margin-top: 2px; white-space: nowrap; }
|
||||
</style>
|
||||
102
src/composables/useDeviceStatus.js
Normal file
102
src/composables/useDeviceStatus.js
Normal file
@ -0,0 +1,102 @@
|
||||
// B类 CNC WorkMode 映射(数字字符串 → 显示文本)
|
||||
// 来源:FANUC FOCAS aut 参数定义
|
||||
const CNC_WORK_MODES = {
|
||||
'0': 'MDI',
|
||||
'1': 'AUTO',
|
||||
'2': 'ERR',
|
||||
'3': 'EDIT',
|
||||
'4': 'HANDLE',
|
||||
'5': 'JOG',
|
||||
'6': 'T-JOG',
|
||||
'7': 'T-HNDL',
|
||||
'8': 'INC',
|
||||
'9': 'REF',
|
||||
'10': 'REMOTE'
|
||||
}
|
||||
|
||||
// A类激光 SysState 映射
|
||||
const LASER_SYS_STATES = {
|
||||
0: '待机', 1: '模拟', 2: '点动', 3: '回零', 4: '回标记点',
|
||||
5: '回停靠点', 6: '回原点', 7: '走边框', 8: '加工中',
|
||||
9: '暂停', 10: '继续', 11: '前进', 12: '后退'
|
||||
}
|
||||
|
||||
export function getCncWorkModeText(mode) {
|
||||
return CNC_WORK_MODES[String(mode)] || `MODE ${mode}`
|
||||
}
|
||||
|
||||
export function getLaserSysStateText(state) {
|
||||
return LASER_SYS_STATES[state] || `状态 ${state ?? 0}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断 CNC 设备综合运行状态
|
||||
* 基于真实采集数据规律:
|
||||
* RunStatus="3" + Motion=1 → 正在切削
|
||||
* RunStatus="2" 或 MSTB=1 → 执行中(等待M代码)
|
||||
* Alarm>0 或 Emergency>0 → 报警
|
||||
* 其余 → 待机
|
||||
*/
|
||||
export function getCncStatus(statusInfo, alarmStatus) {
|
||||
if (!statusInfo) return { key: 'offline', label: '离线' }
|
||||
if (alarmStatus > 0 || statusInfo.Alarm > 0 || statusInfo.Emergency > 0)
|
||||
return { key: 'alarm', label: '报警' }
|
||||
if (statusInfo.RunStatus === '3' && statusInfo.Motion === 1)
|
||||
return { key: 'running', label: '运行中' }
|
||||
if (statusInfo.RunStatus === '2' || statusInfo.MSTB === 1)
|
||||
return { key: 'running', label: '运行中' }
|
||||
return { key: 'idle', label: '待机' }
|
||||
}
|
||||
|
||||
export function getLaserStatus(machineData) {
|
||||
const nc = machineData?.CutSystemState?.NcState
|
||||
if (!nc) return { key: 'offline', label: '离线' }
|
||||
if ((nc.AlarmCount || 0) > 0)
|
||||
return { key: 'alarm', label: '报警' }
|
||||
if (nc.SysState === 8)
|
||||
return { key: 'running', label: '加工中' }
|
||||
return { key: 'idle', label: '待机' }
|
||||
}
|
||||
|
||||
export function getPowerStatus(machineData) {
|
||||
if (!machineData) return { key: 'offline', label: '离线' }
|
||||
const vals = [machineData.slave1?.current1, machineData.slave1?.current2, machineData.slave1?.current3]
|
||||
const hasInvalid = vals.some(v => v === 'invalid')
|
||||
if (hasInvalid) return { key: 'alarm', label: '异常' }
|
||||
return { key: 'normal', label: '正常' }
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一获取任意设备的状态
|
||||
*/
|
||||
export function getDeviceStatus(device) {
|
||||
if (!device.online) return { key: 'offline', label: '离线' }
|
||||
if (device.type === 'cnc') return getCncStatus(device.machineData?.statusInfo, device.machineData?.alarmStatus)
|
||||
if (device.type === 'laser') return getLaserStatus(device.machineData)
|
||||
if (device.type === 'power') return getPowerStatus(device.machineData)
|
||||
return { key: 'offline', label: '未知' }
|
||||
}
|
||||
|
||||
export function parseFanucTime(timeStr) {
|
||||
if (!timeStr) return { hours: 0, minutes: 0, seconds: 0, totalMinutes: 0 }
|
||||
const match = timeStr.match(/(\d+)\s*H\s*(\d+)\s*M\s*(\d+)\s*S/)
|
||||
if (match) {
|
||||
const h = parseInt(match[1]), m = parseInt(match[2]), s = parseInt(match[3])
|
||||
return { hours: h, minutes: m, seconds: s, totalMinutes: h * 60 + m }
|
||||
}
|
||||
return { hours: 0, minutes: 0, seconds: 0, totalMinutes: 0 }
|
||||
}
|
||||
|
||||
export function formatFanucTimeShort(timeStr) {
|
||||
const { hours, minutes } = parseFanucTime(timeStr)
|
||||
return `${hours}H ${minutes}M`
|
||||
}
|
||||
|
||||
export const STATUS_COLORS = {
|
||||
running: '#00e676',
|
||||
idle: '#ffca28',
|
||||
alarm: '#ff4444',
|
||||
offline: '#555555',
|
||||
normal: '#00e676',
|
||||
maintenance: '#42a5f5'
|
||||
}
|
||||
10
src/main.js
Normal file
10
src/main.js
Normal file
@ -0,0 +1,10 @@
|
||||
import { createApp } from 'vue'
|
||||
import dataV from '@kjgl77/datav-vue3'
|
||||
import router from './router/index.js'
|
||||
import App from './App.vue'
|
||||
import './style.css'
|
||||
|
||||
const app = createApp(App)
|
||||
app.use(dataV)
|
||||
app.use(router)
|
||||
app.mount('#app')
|
||||
13
src/router/index.js
Normal file
13
src/router/index.js
Normal file
@ -0,0 +1,13 @@
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import Dashboard from '../views/Dashboard.vue'
|
||||
import DeviceDetail from '../views/DeviceDetail.vue'
|
||||
|
||||
const routes = [
|
||||
{ path: '/', name: 'Dashboard', component: Dashboard },
|
||||
{ path: '/device/:id', name: 'DeviceDetail', component: DeviceDetail, props: true }
|
||||
]
|
||||
|
||||
export default createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes
|
||||
})
|
||||
333
src/services/mockData.js
Normal file
333
src/services/mockData.js
Normal file
@ -0,0 +1,333 @@
|
||||
/**
|
||||
* Mock 数据模块
|
||||
* 数据格式严格对齐真实 API 返回结构,方便后续切换到真实数据源
|
||||
*
|
||||
* A类 = 激光切割设备(柏楚系统,通过魔盒采集)
|
||||
* B类 = CNC加工中心(发那科系统,FOCAS协议采集)
|
||||
* C类 = 电力监测设备(电流采集模块)
|
||||
*/
|
||||
|
||||
// ==================== 生成本周日期标签 ====================
|
||||
function getWeeklyLabels() {
|
||||
const today = new Date()
|
||||
const todayIdx = (today.getDay() + 6) % 7
|
||||
const monday = new Date(today)
|
||||
monday.setDate(today.getDate() - todayIdx)
|
||||
const labels = []
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const d = new Date(monday)
|
||||
d.setDate(monday.getDate() + i)
|
||||
labels.push(`${(d.getMonth() + 1).toString().padStart(2, '0')}/${d.getDate().toString().padStart(2, '0')}`)
|
||||
}
|
||||
return { labels, todayIdx }
|
||||
}
|
||||
|
||||
// ==================== A类 激光切割设备 ====================
|
||||
const laserDevicesBase = [
|
||||
{
|
||||
id: 'A-001', name: '激光 #1', type: 'laser', online: true,
|
||||
appName: 'HypCut', ip: '192.168.1.101',
|
||||
machineData: {
|
||||
gasTime: 74438, moveLength: 7271764.2, startRate: '3.62%', cutRate: '24.45%',
|
||||
workTime: 77340, laserTime: 1722, idleTime: 238980,
|
||||
pierceCount: 3728, cutLength: 537221.81,
|
||||
timestamp: '2026-04-06 22:15:00',
|
||||
CutSystemState: {
|
||||
NcState: {
|
||||
AxisX: 12.5, AxisY: 25.4, WorkSpeed: 500, FeedRate: 100,
|
||||
AlarmCount: 0, RunningTimeStr: '1分15秒', WorkTimeStr: '00:00:15.000',
|
||||
CutPercent: 12.5, SysState: 8, TaskName: '20180814001.lxds',
|
||||
LaserPower: 1000, AlarmMsg: ''
|
||||
},
|
||||
DeviceState: {
|
||||
PwmFreq: 5000, GasPressure: 4.5, GasType: 'Oxygen',
|
||||
CurrentZ: 85, CurrentH: 15, IsLaserOn: true, IsGasOn: true,
|
||||
PwmRatio: 0.5, DiodeCurrent: 80
|
||||
}
|
||||
}
|
||||
},
|
||||
weeklyStats: {
|
||||
produce: [3500, 3600, 3728, 3800, 3650, 0, 0],
|
||||
cuttime: [0.4, 0.45, 0.48, 0.5, 0.47, 0, 0]
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'A-002', name: '激光 #2', type: 'laser', online: true,
|
||||
appName: 'TubePro', ip: '192.168.1.102',
|
||||
machineData: {
|
||||
gasTime: 82100, moveLength: 8105000.5, startRate: '5.10%', cutRate: '30.15%',
|
||||
workTime: 85000, laserTime: 2100, idleTime: 150000,
|
||||
pierceCount: 4120, cutLength: 680000.2,
|
||||
timestamp: '2026-04-06 22:15:00',
|
||||
CutSystemState: {
|
||||
NcState: {
|
||||
AxisX: 0, AxisY: 0, WorkSpeed: 0, FeedRate: 100,
|
||||
AlarmCount: 0, RunningTimeStr: '5分00秒', WorkTimeStr: '00:00:00.000',
|
||||
CutPercent: 0, SysState: 0, TaskName: '20201010002.lxds',
|
||||
LaserPower: 2000, AlarmMsg: ''
|
||||
},
|
||||
DeviceState: {
|
||||
PwmFreq: 5000, GasPressure: 0, GasType: 'Nitrogen',
|
||||
CurrentZ: 120, CurrentH: 0, IsLaserOn: false, IsGasOn: false,
|
||||
PwmRatio: 0, DiodeCurrent: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
weeklyStats: {
|
||||
produce: [4100, 4200, 4000, 4300, 4150, 0, 0],
|
||||
cuttime: [0.55, 0.6, 0.5, 0.65, 0.52, 0, 0]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
// ==================== B类 CNC加工中心 ====================
|
||||
// 数据直接来自 B类设备信息核对.md 真实采集结果(已裁剪非展示字段)
|
||||
const cncDevicesBase = [
|
||||
{
|
||||
id: 'B-001', name: '001', type: 'cnc', online: true,
|
||||
machineData: {
|
||||
alarm: [], alarmStatus: 0,
|
||||
allCoors: { absolute: [377.25, 0, 0], machine: [-74.969, -402.777, 0], relative: [300.74, -91.9, 220.19] },
|
||||
axisLoad: [-6, 5, 19], axisNames: ['X', 'Y', 'Z'],
|
||||
boottime: '5609 H 40 M 0 S', runtime: '320 H 13 M 25 S',
|
||||
cuttime: '2029 H 22 M 15 S', cycletime: '0 H 34 M 30 S',
|
||||
currentProduceCount: 405,
|
||||
programCurrent: { name: 'O2168', number: 2168 },
|
||||
peratorMessage: [{ data: '91G28Y0.\nT24M6\nM3S500\n\n\nM30\n%', number: -1, type: 0 }],
|
||||
setFeedRate: 100, setSpindleSpeed: 100,
|
||||
spindleSpeedAndFeedRate: { feedRate: 0, speed: 0 },
|
||||
statusInfo: { Alarm: 0, Dummy: 0, Edit: 0, Emergency: 0, MSTB: 1, Motion: 0, RunStatus: '2', TMMode: 0, WorkMode: '1' },
|
||||
sysInfo: { axes: 3, cncType: 'Series 0i-MF', mtType: 'Machining center' },
|
||||
timestamp: '2026-03-31 10:54:29'
|
||||
},
|
||||
weeklyStats: { produce: [390, 410, 400, 380, 405, 0, 0], cuttime: [8, 8.5, 8.2, 7.5, 9, 0, 0] }
|
||||
},
|
||||
{
|
||||
id: 'B-002', name: '002', type: 'cnc', online: true,
|
||||
machineData: {
|
||||
alarm: [], alarmStatus: 0,
|
||||
allCoors: { absolute: [7.276, 45.473, -0.173], machine: [-899.974, -911.997, -0.173], relative: [0, 0, 0] },
|
||||
axisLoad: [0, 0, 54], axisNames: ['X', 'Y', 'Z'],
|
||||
boottime: '16266 H 26 M 0 S', runtime: '1276 H 59 M 12 S',
|
||||
cuttime: '7155 H 53 M 3 S', cycletime: '0 H 0 M 0 S',
|
||||
currentProduceCount: 1920,
|
||||
programCurrent: { name: 'O2321', number: 2321 },
|
||||
peratorMessage: [{ data: 'G90G54G0Y0.X140.\nG43H6Z50.\nM3S500\nZ10.M8\nG1Z4.F2500\nX260.F500', number: -1, type: 0 }],
|
||||
setFeedRate: 100, setSpindleSpeed: 100,
|
||||
spindleSpeedAndFeedRate: { feedRate: 0, speed: 0 },
|
||||
statusInfo: { Alarm: 0, Dummy: 0, Edit: 0, Emergency: 0, MSTB: 0, Motion: 0, RunStatus: '0', TMMode: 0, WorkMode: '5' },
|
||||
sysInfo: { axes: 3, cncType: 'Series 0i-MF', mtType: 'Machining center' },
|
||||
timestamp: '2026-03-31 11:23:25'
|
||||
},
|
||||
weeklyStats: { produce: [1800, 1900, 1850, 1950, 1920, 0, 0], cuttime: [14, 15, 14.5, 15.5, 15, 0, 0] }
|
||||
},
|
||||
{
|
||||
id: 'B-003', name: '003', type: 'cnc', online: true,
|
||||
machineData: {
|
||||
alarm: [], alarmStatus: 0,
|
||||
allCoors: { absolute: [-103.801, 395.393, -0.013], machine: [-600.001, -0.007, -0.013], relative: [0, 0, 0] },
|
||||
axisLoad: [0, -3, 58], axisNames: ['X', 'Y', 'Z'],
|
||||
boottime: '12015 H 43 M 0 S', runtime: '2713 H 25 M 11 S',
|
||||
cuttime: '5510 H 44 M 49 S', cycletime: '0 H 0 M 0 S',
|
||||
currentProduceCount: 227,
|
||||
programCurrent: { name: 'O', number: 0 },
|
||||
peratorMessage: [{ data: 'M01\nG90G54G0X0.Y0.\nG43H7Z50.\nM3S450\nZ3.\nG01Z0.0F2500\nX190.F350', number: -1, type: 0 }],
|
||||
setFeedRate: 100, setSpindleSpeed: 100,
|
||||
spindleSpeedAndFeedRate: { feedRate: 0, speed: 0 },
|
||||
statusInfo: { Alarm: 0, Dummy: 0, Edit: 0, Emergency: 0, MSTB: 0, Motion: 0, RunStatus: '0', TMMode: 0, WorkMode: '1' },
|
||||
sysInfo: { axes: 3, cncType: 'Series 0i-MF', mtType: 'Machining center' },
|
||||
timestamp: '2026-03-31 11:18:14'
|
||||
},
|
||||
weeklyStats: { produce: [210, 220, 230, 225, 227, 0, 0], cuttime: [7, 7.5, 8, 7.8, 8, 0, 0] }
|
||||
},
|
||||
{
|
||||
id: 'B-004', name: '004', type: 'cnc', online: true,
|
||||
machineData: {
|
||||
alarm: [], alarmStatus: 0,
|
||||
allCoors: { absolute: [3354.191, -413, 783.8], machine: [-230.4, -419.2, -112], relative: [116.444, 261.72, 844.059] },
|
||||
axisLoad: [-4, -4, -28], axisNames: ['X', 'Y', 'Z'],
|
||||
boottime: '59975 H 54 M 0 S', runtime: '884 H 33 M 39 S',
|
||||
cuttime: '22125 H 24 M 5 S', cycletime: '0 H 0 M 0 S',
|
||||
currentProduceCount: 1140,
|
||||
programCurrent: { name: 'O101', number: 101 },
|
||||
peratorMessage: [{ data: '', number: -1, type: 0 }],
|
||||
setFeedRate: 100, setSpindleSpeed: 100,
|
||||
spindleSpeedAndFeedRate: { feedRate: 0, speed: 0 },
|
||||
statusInfo: { Alarm: 0, Dummy: 0, Edit: 0, Emergency: 0, MSTB: 0, Motion: 0, RunStatus: '0', TMMode: 0, WorkMode: '5' },
|
||||
sysInfo: { axes: 3, cncType: 'Series 0i-MD', mtType: 'Machining center' },
|
||||
timestamp: '2026-03-31 11:31:50'
|
||||
},
|
||||
weeklyStats: { produce: [1100, 1150, 1120, 1160, 1140, 0, 0], cuttime: [10, 11, 10.5, 11.2, 11, 0, 0] }
|
||||
},
|
||||
{
|
||||
id: 'B-005', name: '005', type: 'cnc', online: true,
|
||||
machineData: {
|
||||
alarm: [], alarmStatus: 0,
|
||||
allCoors: { absolute: [-20, 0, -3.35, 0], machine: [-333.63, -268.57, -176.15, 26.912], relative: [446.37, -268.564, -176.142, 359.999] },
|
||||
axisLoad: [8, -7, 58, -8], axisNames: ['X', 'Y', 'Z', 'A'],
|
||||
boottime: '6447 H 53 M 0 S', runtime: '3321 H 31 M 27 S',
|
||||
cuttime: '2859 H 9 M 44 S', cycletime: '0 H 0 M 39 S',
|
||||
currentProduceCount: 14349,
|
||||
programCurrent: { name: 'O9001', number: 9001 },
|
||||
peratorMessage: [{ data: 'Z-8.500 R3.000 Q2.000 F40.\nG80 G15\nM9\nM5\nG91 G28 Z0.000\nM01', number: -1, type: 0 }],
|
||||
setFeedRate: 100, setSpindleSpeed: 100,
|
||||
spindleSpeedAndFeedRate: { feedRate: 0, speed: 0 },
|
||||
statusInfo: { Alarm: 0, Dummy: 0, Edit: 16, Emergency: 0, MSTB: 0, Motion: 1, RunStatus: '3', TMMode: 0, WorkMode: '1' },
|
||||
sysInfo: { axes: 4, cncType: 'Series 0i-MF', mtType: 'Machining center' },
|
||||
timestamp: '2026-04-01 09:34:20'
|
||||
},
|
||||
weeklyStats: { produce: [14000, 14200, 14100, 14500, 14349, 0, 0], cuttime: [18, 18.5, 18.2, 19, 18.8, 0, 0] }
|
||||
},
|
||||
{
|
||||
id: 'B-006', name: '006', type: 'cnc', online: true,
|
||||
machineData: {
|
||||
alarm: [], alarmStatus: 0,
|
||||
allCoors: { absolute: [341.401, 241.19, -14.01], machine: [-599.999, -0.01, -14.01], relative: [0, 0, 0] },
|
||||
axisLoad: [0, 0, 57], axisNames: ['X', 'Y', 'Z'],
|
||||
boottime: '23927 H 42 M 0 S', runtime: '4190 H 53 M 43 S',
|
||||
cuttime: '10484 H 5 M 53 S', cycletime: '0 H 0 M 0 S',
|
||||
currentProduceCount: 11720,
|
||||
programCurrent: { name: 'O', number: 0 },
|
||||
peratorMessage: [{ data: 'M01T7\nG90G58G0X47.5Y-48.\nG43H6Z100.M8\nM3S800\nG98G81Z-3.R3.F60', number: -1, type: 0 }],
|
||||
setFeedRate: 100, setSpindleSpeed: 100,
|
||||
spindleSpeedAndFeedRate: { feedRate: 0, speed: 0 },
|
||||
statusInfo: { Alarm: 0, Dummy: 0, Edit: 0, Emergency: 0, MSTB: 0, Motion: 0, RunStatus: '0', TMMode: 0, WorkMode: '4' },
|
||||
sysInfo: { axes: 3, cncType: 'Series 0i-MF', mtType: 'Machining center' },
|
||||
timestamp: '2026-04-01 09:38:32'
|
||||
},
|
||||
weeklyStats: { produce: [11500, 11600, 11400, 11800, 11720, 0, 0], cuttime: [16, 16.5, 15.8, 17, 16.5, 0, 0] }
|
||||
},
|
||||
{
|
||||
id: 'B-007', name: '007', type: 'cnc', online: true,
|
||||
machineData: {
|
||||
alarm: [], alarmStatus: 0,
|
||||
allCoors: { absolute: [28.26, 293.93, 918.1, 0], machine: [-500, -205.537, -20.619, 0], relative: [73.36, 458.95, 408.16, 0] },
|
||||
axisLoad: [3, 37, -1, 0], axisNames: ['X', 'Y', 'Z', 'B'],
|
||||
boottime: '5196 H 22 M 0 S', runtime: '2 H 37 M 1 S',
|
||||
cuttime: '1972 H 36 M 27 S', cycletime: '0 H 0 M 30 S',
|
||||
currentProduceCount: 2033,
|
||||
programCurrent: { name: 'O59', number: 59 },
|
||||
peratorMessage: [{ data: '#100=-530.490(X HUI ZHUAN ZHONG XIN)\n#101=-1032.040\nG90G10L2P1X-528.260', number: -1, type: 0 }],
|
||||
setFeedRate: 100, setSpindleSpeed: 100,
|
||||
spindleSpeedAndFeedRate: { feedRate: 0, speed: 0 },
|
||||
statusInfo: { Alarm: 0, Dummy: 0, Edit: 0, Emergency: 0, MSTB: 0, Motion: 0, RunStatus: '0', TMMode: 0, WorkMode: '1' },
|
||||
sysInfo: { axes: 4, cncType: 'Series 0i-MF', mtType: 'Machining center' },
|
||||
timestamp: '2026-04-01 09:42:30'
|
||||
},
|
||||
weeklyStats: { produce: [2000, 2050, 1950, 2100, 2033, 0, 0], cuttime: [10, 10.5, 9.5, 11, 10.2, 0, 0] }
|
||||
},
|
||||
{
|
||||
id: 'B-008', name: '008', type: 'cnc', online: true,
|
||||
machineData: {
|
||||
alarm: [], alarmStatus: 0,
|
||||
allCoors: { absolute: [282.061, 8.842, -23.5, 180], machine: [-297.639, -634.758, -817.64, 180], relative: [250.161, -21.258, -119.14, 180] },
|
||||
axisLoad: [10, 26, 6, 0], axisNames: ['X', 'Y', 'Z', 'B'],
|
||||
boottime: '5390 H 6 M 0 S', runtime: '81 H 53 M 53 S',
|
||||
cuttime: '2289 H 3 M 23 S', cycletime: '0 H 14 M 16 S',
|
||||
currentProduceCount: 1466,
|
||||
programCurrent: { name: 'O93', number: 93 },
|
||||
peratorMessage: [{ data: 'G90 G00 Z-28.\nM5\nM19\nG91 Y35.000 F500.\nM1\nT1M6\nG91G28X0.Y0.', number: -1, type: 0 }],
|
||||
setFeedRate: 100, setSpindleSpeed: 100,
|
||||
spindleSpeedAndFeedRate: { feedRate: 100, speed: 300 },
|
||||
statusInfo: { Alarm: 0, Dummy: 0, Edit: 16, Emergency: 0, MSTB: 0, Motion: 1, RunStatus: '3', TMMode: 0, WorkMode: '1' },
|
||||
sysInfo: { axes: 4, cncType: 'Series 0i-MF', mtType: 'Machining center' },
|
||||
timestamp: '2026-04-01 09:46:58'
|
||||
},
|
||||
weeklyStats: { produce: [1400, 1450, 1350, 1500, 1466, 0, 0], cuttime: [9, 9.5, 8.5, 10, 9.5, 0, 0] }
|
||||
},
|
||||
// 以下3台设备离线,无法采集数据
|
||||
{
|
||||
id: 'B-009', name: '009', type: 'cnc', online: false,
|
||||
offlineReason: 'Mate-TD · MAC地址为空,无法建立连接',
|
||||
machineData: null,
|
||||
sysInfo: { cncType: 'Mate-TD' },
|
||||
weeklyStats: null
|
||||
},
|
||||
{
|
||||
id: 'B-010', name: '010', type: 'cnc', online: false,
|
||||
offlineReason: 'Mate-TD · MAC地址为空,无法建立连接',
|
||||
machineData: null,
|
||||
sysInfo: { cncType: 'Mate-TD' },
|
||||
weeklyStats: null
|
||||
},
|
||||
{
|
||||
id: 'B-011', name: '011', type: 'cnc', online: false,
|
||||
offlineReason: '0i-MF · 只找到USB口,没有找到网口',
|
||||
machineData: null,
|
||||
sysInfo: { cncType: 'Series 0i-MF' },
|
||||
weeklyStats: null
|
||||
}
|
||||
]
|
||||
|
||||
// ==================== C类 电力监测设备 ====================
|
||||
const powerDevicesBase = [
|
||||
{
|
||||
id: 'C-001', name: '配电柜 #1', type: 'power', online: true,
|
||||
machineData: {
|
||||
client_id: 'rbiot-c01-001',
|
||||
slave1: { current1: '12.5A', current2: '11.8A', current3: '13.1A' },
|
||||
timestamp: '2026-04-06 22:15:00'
|
||||
},
|
||||
weeklyStats: null
|
||||
},
|
||||
{
|
||||
id: 'C-002', name: '配电柜 #2', type: 'power', online: true,
|
||||
machineData: {
|
||||
client_id: 'rbiot-c01-002',
|
||||
slave1: { current1: '0.0A', current2: '0.5A', current3: '1.0A' },
|
||||
timestamp: '2026-04-06 22:15:00'
|
||||
},
|
||||
weeklyStats: null
|
||||
}
|
||||
]
|
||||
|
||||
// ==================== 导出 ====================
|
||||
|
||||
export const baseDevices = [...laserDevicesBase, ...cncDevicesBase, ...powerDevicesBase]
|
||||
|
||||
export function getWeeklyInfo() {
|
||||
return getWeeklyLabels()
|
||||
}
|
||||
|
||||
/**
|
||||
* 对 reactive 设备数组施加微小随机波动,让 demo 看起来"活的"
|
||||
*/
|
||||
export function applyMutations(devices) {
|
||||
const now = new Date()
|
||||
const ts = now.getFullYear() + '-' +
|
||||
String(now.getMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(now.getDate()).padStart(2, '0') + ' ' +
|
||||
String(now.getHours()).padStart(2, '0') + ':' +
|
||||
String(now.getMinutes()).padStart(2, '0') + ':' +
|
||||
String(now.getSeconds()).padStart(2, '0')
|
||||
|
||||
devices.forEach(d => {
|
||||
if (!d.online || !d.machineData) return
|
||||
|
||||
d.machineData.timestamp = ts
|
||||
|
||||
if (d.type === 'cnc') {
|
||||
// CNC: 运行中的设备产量缓慢增长
|
||||
const si = d.machineData.statusInfo
|
||||
if (si && (si.RunStatus === '3' || si.MSTB === 1)) {
|
||||
d.machineData.currentProduceCount += Math.floor(Math.random() * 3)
|
||||
}
|
||||
}
|
||||
|
||||
if (d.type === 'laser') {
|
||||
const nc = d.machineData.CutSystemState?.NcState
|
||||
if (nc && nc.SysState === 8) {
|
||||
nc.CutPercent = Math.min(99.9, nc.CutPercent + Math.random() * 0.5)
|
||||
d.machineData.pierceCount += Math.floor(Math.random() * 2)
|
||||
d.machineData.cutLength += Math.random() * 50
|
||||
}
|
||||
}
|
||||
|
||||
if (d.type === 'power') {
|
||||
const s = d.machineData.slave1
|
||||
s.current1 = (8 + Math.random() * 8).toFixed(1) + 'A'
|
||||
s.current2 = (7 + Math.random() * 8).toFixed(1) + 'A'
|
||||
s.current3 = (9 + Math.random() * 8).toFixed(1) + 'A'
|
||||
}
|
||||
})
|
||||
}
|
||||
34
src/style.css
Normal file
34
src/style.css
Normal file
@ -0,0 +1,34 @@
|
||||
/* ===== Global Reset ===== */
|
||||
@import url('https://fonts.loli.net/css2?family=Noto+Sans+SC:wght@400;600;700&display=swap');
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #020c20;
|
||||
font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color: #d0e8ff;
|
||||
}
|
||||
|
||||
#app {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ===== Scrollbar ===== */
|
||||
::-webkit-scrollbar { width: 4px; }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
::-webkit-scrollbar-thumb { background: #1a3a6a; border-radius: 2px; }
|
||||
|
||||
/* ===== DataV overrides ===== */
|
||||
.dv-scroll-board .header { font-size: 11px !important; letter-spacing: 1px; }
|
||||
.dv-scroll-board .rows .row-item { font-size: 11px !important; }
|
||||
261
src/views/Dashboard.vue
Normal file
261
src/views/Dashboard.vue
Normal file
@ -0,0 +1,261 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
<HeaderBar />
|
||||
|
||||
<div class="main-content">
|
||||
<!-- ===== 左侧面板 ===== -->
|
||||
<div class="left-panel panel-box">
|
||||
<StatusSummary
|
||||
:devices="devices"
|
||||
:weeklyLabels="weeklyLabels"
|
||||
:weeklyProduce="weeklyProduceTotal"
|
||||
:todayIdx="todayIdx"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- ===== 中央区域 ===== -->
|
||||
<div class="center-panel">
|
||||
|
||||
<!-- A类 · 激光切割设备 -->
|
||||
<div class="section">
|
||||
<div class="section-header">
|
||||
<dv-decoration-6 class="section-deco" :color="['#ff4444','#ff8a80']" />
|
||||
<span class="section-title">A类 · 激光切割设备</span>
|
||||
<dv-decoration-6 class="section-deco flip" :color="['#ff4444','#ff8a80']" />
|
||||
</div>
|
||||
<div class="laser-grid">
|
||||
<LaserCard v-for="d in laserDevices" :key="d.id" :device="d" @click="goDetail(d.id)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- B类 · CNC加工中心 -->
|
||||
<div class="section section-grow">
|
||||
<div class="section-header">
|
||||
<dv-decoration-6 class="section-deco" :color="['#04b9ff','#00e676']" />
|
||||
<span class="section-title">B类 · CNC加工中心</span>
|
||||
<dv-decoration-6 class="section-deco flip" :color="['#04b9ff','#00e676']" />
|
||||
</div>
|
||||
<div class="cnc-grid">
|
||||
<CncCard v-for="d in cncDevices" :key="d.id" :device="d" @click="goDetail(d.id)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- C类 · 电力监测设备 -->
|
||||
<div class="section">
|
||||
<div class="section-header">
|
||||
<dv-decoration-6 class="section-deco" :color="['#ffca28','#ff9800']" />
|
||||
<span class="section-title">C类 · 电力监测设备</span>
|
||||
<dv-decoration-6 class="section-deco flip" :color="['#ffca28','#ff9800']" />
|
||||
</div>
|
||||
<div class="power-grid">
|
||||
<PowerCard v-for="d in powerDevices" :key="d.id" :device="d" @click="goDetail(d.id)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===== 右侧面板 ===== -->
|
||||
<div class="right-panel panel-box">
|
||||
<AlarmPanel :alarms="alarms" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部状态栏 -->
|
||||
<div class="refresh-indicator">
|
||||
<span class="refresh-dot" :class="{ pulse: refreshing }"></span>
|
||||
数据刷新间隔:{{ REFRESH_SEC }}s | 上次刷新:{{ lastRefresh }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import HeaderBar from '../components/HeaderBar.vue'
|
||||
import LaserCard from '../components/LaserCard.vue'
|
||||
import CncCard from '../components/CncCard.vue'
|
||||
import PowerCard from '../components/PowerCard.vue'
|
||||
import StatusSummary from '../components/StatusSummary.vue'
|
||||
import AlarmPanel from '../components/AlarmPanel.vue'
|
||||
import { baseDevices, applyMutations, getWeeklyInfo } from '../services/mockData.js'
|
||||
import { getDeviceStatus } from '../composables/useDeviceStatus.js'
|
||||
|
||||
const router = useRouter()
|
||||
const REFRESH_SEC = 5
|
||||
const refreshing = ref(false)
|
||||
const lastRefresh = ref('--')
|
||||
|
||||
// 创建 reactive 设备数据(基于真实格式的深拷贝)
|
||||
const devices = reactive(JSON.parse(JSON.stringify(baseDevices)))
|
||||
|
||||
// 按类型过滤
|
||||
const laserDevices = computed(() => devices.filter(d => d.type === 'laser'))
|
||||
const cncDevices = computed(() => devices.filter(d => d.type === 'cnc'))
|
||||
const powerDevices = computed(() => devices.filter(d => d.type === 'power'))
|
||||
|
||||
// 周报表
|
||||
const { labels: weeklyLabels, todayIdx } = getWeeklyInfo()
|
||||
|
||||
const weeklyProduceTotal = computed(() => {
|
||||
const totals = [0, 0, 0, 0, 0, 0, 0]
|
||||
devices.forEach(d => {
|
||||
if (d.weeklyStats?.produce) {
|
||||
d.weeklyStats.produce.forEach((v, i) => {
|
||||
if (i <= todayIdx) totals[i] += v
|
||||
})
|
||||
}
|
||||
})
|
||||
return totals
|
||||
})
|
||||
|
||||
// 报警汇总
|
||||
const alarms = computed(() => {
|
||||
const arr = []
|
||||
const now = new Date()
|
||||
devices.forEach(d => {
|
||||
if (!d.online || !d.machineData) return
|
||||
const status = getDeviceStatus(d)
|
||||
if (status.key !== 'alarm') return
|
||||
|
||||
let msg = ''
|
||||
if (d.type === 'cnc') {
|
||||
const a = d.machineData.alarm
|
||||
msg = a?.length ? a[0] : 'CNC系统报警'
|
||||
} else if (d.type === 'laser') {
|
||||
const nc = d.machineData.CutSystemState?.NcState
|
||||
msg = nc?.AlarmMsg || `报警 ${nc?.AlarmCount || 0} 个`
|
||||
}
|
||||
arr.push({
|
||||
time: now.toLocaleTimeString('zh-CN', { hour12: false }),
|
||||
device: d.type === 'cnc' ? `CNC-${d.name}` : d.name,
|
||||
message: msg
|
||||
})
|
||||
})
|
||||
return arr
|
||||
})
|
||||
|
||||
function goDetail(id) {
|
||||
router.push({ name: 'DeviceDetail', params: { id } })
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
refreshing.value = true
|
||||
applyMutations(devices)
|
||||
lastRefresh.value = new Date().toLocaleTimeString('zh-CN', { hour12: false })
|
||||
setTimeout(() => { refreshing.value = false }, 400)
|
||||
}
|
||||
|
||||
let timer = null
|
||||
onMounted(() => {
|
||||
refresh()
|
||||
timer = setInterval(refresh, REFRESH_SEC * 1000)
|
||||
})
|
||||
onUnmounted(() => clearInterval(timer))
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dashboard {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #020c20;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 8px 12px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* 左右面板 */
|
||||
.left-panel { flex: 0 0 258px; }
|
||||
.right-panel { flex: 0 0 258px; }
|
||||
.panel-box {
|
||||
background: rgba(4, 20, 55, 0.55);
|
||||
border: 1px solid rgba(4, 185, 255, 0.15);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
backdrop-filter: blur(4px);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* 中央区域 */
|
||||
.center-panel {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.section { flex: 0 0 auto; }
|
||||
.section-grow { flex: 1; display: flex; flex-direction: column; min-height: 0; }
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.section-deco { width: 80px; height: 20px; }
|
||||
.section-deco.flip { transform: scaleX(-1); }
|
||||
.section-title {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: #8eb8d8;
|
||||
letter-spacing: 3px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* A类 激光网格:2列 */
|
||||
.laser-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* B类 CNC网格:4列,自适应行 */
|
||||
.cnc-grid {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-template-rows: repeat(3, 1fr);
|
||||
gap: 8px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* C类 电力网格:2列 */
|
||||
.power-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* 底部刷新指示 */
|
||||
.refresh-indicator {
|
||||
height: 22px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding-right: 16px;
|
||||
font-size: 11px;
|
||||
color: #304a6a;
|
||||
letter-spacing: 0.5px;
|
||||
border-top: 1px solid rgba(4,185,255,0.08);
|
||||
gap: 6px;
|
||||
}
|
||||
.refresh-dot {
|
||||
width: 6px; height: 6px; border-radius: 50%;
|
||||
background: #304a6a; display: inline-block; transition: background 0.3s;
|
||||
}
|
||||
.refresh-dot.pulse {
|
||||
background: #00e676; box-shadow: 0 0 6px #00e676;
|
||||
animation: pulse-dot 0.4s ease-in-out;
|
||||
}
|
||||
@keyframes pulse-dot { 0%{transform:scale(1)} 50%{transform:scale(1.6)} 100%{transform:scale(1)} }
|
||||
</style>
|
||||
404
src/views/DeviceDetail.vue
Normal file
404
src/views/DeviceDetail.vue
Normal file
@ -0,0 +1,404 @@
|
||||
<template>
|
||||
<div class="detail-page">
|
||||
<!-- 顶部导航 -->
|
||||
<div class="detail-header">
|
||||
<div class="header-left">
|
||||
<button class="back-btn" @click="goBack">← 返回全景看板</button>
|
||||
<select v-model="selectedId" @change="switchDevice" class="device-select">
|
||||
<option v-for="d in allDevices" :key="d.id" :value="d.id">
|
||||
{{ d.id }} · {{ d.name }} ({{ typeLabel(d.type) }})
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<span class="ts">更新时间: {{ device?.machineData?.timestamp || '--' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 离线设备 -->
|
||||
<div class="offline-page" v-if="!device?.online">
|
||||
<div class="offline-box">
|
||||
<div class="offline-icon">⚠</div>
|
||||
<div class="offline-title">设备离线</div>
|
||||
<div class="offline-reason">{{ device?.offlineReason || '无法连接到设备' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===== CNC 明细 ===== -->
|
||||
<div class="detail-content" v-else-if="device.type === 'cnc'">
|
||||
<div class="cards-row">
|
||||
<!-- 基本状态 -->
|
||||
<div class="detail-card">
|
||||
<div class="card-title">基本状态信息</div>
|
||||
<div class="metric-list">
|
||||
<div class="metric"><span class="m-label">报警状态</span>
|
||||
<span class="m-value" :class="md.alarmStatus > 0 ? 'text-red' : 'text-green'">
|
||||
<span class="led" :class="md.alarmStatus > 0 ? 'led-red' : 'led-green'"></span>
|
||||
{{ md.alarmStatus > 0 ? '报警中' : '正常' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="metric"><span class="m-label">工作模式</span><span class="m-value mode-badge">{{ getCncWorkModeText(md.statusInfo?.WorkMode) }}</span></div>
|
||||
<div class="metric"><span class="m-label">机床型号</span><span class="m-value">{{ md.sysInfo?.cncType }} · {{ md.sysInfo?.axes }}轴</span></div>
|
||||
<div class="metric"><span class="m-label">开机时长</span><span class="m-value mono">{{ md.boottime }}</span></div>
|
||||
<div class="metric"><span class="m-label">运行时长</span><span class="m-value mono">{{ md.runtime }}</span></div>
|
||||
<div class="metric"><span class="m-label">切削时长</span><span class="m-value mono">{{ md.cuttime }}</span></div>
|
||||
<div class="metric"><span class="m-label">循环时间</span><span class="m-value mono">{{ md.cycletime }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 生产与程序 -->
|
||||
<div class="detail-card">
|
||||
<div class="card-title">生产与程序信息</div>
|
||||
<div class="metric-list">
|
||||
<div class="metric"><span class="m-label">加工件数</span><span class="m-value text-green" style="font-size:22px;">{{ md.currentProduceCount?.toLocaleString() }}<small> 件</small></span></div>
|
||||
<div class="metric"><span class="m-label">当前程序</span><span class="m-value mode-badge">{{ md.programCurrent?.name }}</span></div>
|
||||
</div>
|
||||
<div class="code-preview" v-if="md.peratorMessage?.[0]?.data">
|
||||
<pre>{{ md.peratorMessage[0].data }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 实时参数与负载 -->
|
||||
<div class="detail-card">
|
||||
<div class="card-title">实时参数与负载</div>
|
||||
<div class="param-grid">
|
||||
<div class="param-item"><span class="p-label">主轴倍率</span><span class="p-val">{{ md.setSpindleSpeed }}%</span></div>
|
||||
<div class="param-item"><span class="p-label">进给倍率</span><span class="p-val">{{ md.setFeedRate }}%</span></div>
|
||||
<div class="param-item"><span class="p-label">实际转速</span><span class="p-val text-cyan">{{ md.spindleSpeedAndFeedRate?.speed || 0 }} RPM</span></div>
|
||||
<div class="param-item"><span class="p-label">实际进给</span><span class="p-val text-cyan">{{ md.spindleSpeedAndFeedRate?.feedRate || 0 }} mm/m</span></div>
|
||||
</div>
|
||||
<div class="load-bars">
|
||||
<div class="axis-load" v-for="(name, idx) in md.axisNames" :key="name">
|
||||
<span class="ax-name">{{ name }}轴</span>
|
||||
<div class="load-bg"><div class="load-fill" :class="loadClass(md.axisLoad?.[idx])" :style="{ width: Math.min(Math.abs(md.axisLoad?.[idx] || 0), 100) + '%' }"></div></div>
|
||||
<span class="ax-val" :class="loadClass(md.axisLoad?.[idx])">{{ md.axisLoad?.[idx] }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coords-box">
|
||||
<div class="coords-title">绝对坐标</div>
|
||||
<div class="coords-vals">
|
||||
<span class="coord" v-for="(name, idx) in md.axisNames" :key="name">{{ name }}: <span class="mono text-cyan">{{ (md.allCoors?.absolute[idx] || 0).toFixed(3) }}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 趋势图 -->
|
||||
<div class="detail-card chart-card">
|
||||
<div class="card-title">近7日产量与切削时长趋势</div>
|
||||
<div class="chart-container" ref="chartRef"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===== 激光明细 ===== -->
|
||||
<div class="detail-content" v-else-if="device.type === 'laser'">
|
||||
<div class="cards-row">
|
||||
<div class="detail-card">
|
||||
<div class="card-title">系统状态与作业</div>
|
||||
<div class="metric-list">
|
||||
<div class="metric"><span class="m-label">运行状态</span><span class="m-value mode-badge">{{ getLaserSysStateText(nc?.SysState) }}</span></div>
|
||||
<div class="metric"><span class="m-label">报警数量</span>
|
||||
<span class="m-value" :class="(nc?.AlarmCount||0)>0 ? 'text-red' : 'text-green'">
|
||||
<span class="led" :class="(nc?.AlarmCount||0)>0 ? 'led-red' : 'led-green'"></span>
|
||||
{{ nc?.AlarmCount || 0 }} 个
|
||||
</span>
|
||||
</div>
|
||||
<div class="metric"><span class="m-label">加工图纸</span><span class="m-value mono text-cyan">{{ nc?.TaskName || '无' }}</span></div>
|
||||
<div class="metric"><span class="m-label">加工时长</span><span class="m-value mono">{{ nc?.WorkTimeStr || '--' }}</span></div>
|
||||
</div>
|
||||
<div class="progress-section" v-if="nc?.SysState === 8">
|
||||
<div class="prog-row"><span>加工进度</span><span class="text-cyan">{{ (nc.CutPercent || 0).toFixed(1) }}%</span></div>
|
||||
<div class="progress-bg"><div class="progress-fill" :style="{ width: (nc.CutPercent||0) + '%' }"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-card">
|
||||
<div class="card-title">实时参数与控制器</div>
|
||||
<div class="param-grid">
|
||||
<div class="param-item"><span class="p-label">激光功率</span><span class="p-val text-red">{{ nc?.LaserPower || 0 }} W</span></div>
|
||||
<div class="param-item"><span class="p-label">加工速度</span><span class="p-val">{{ nc?.WorkSpeed || 0 }}</span></div>
|
||||
<div class="param-item"><span class="p-label">进给率</span><span class="p-val text-cyan">{{ nc?.FeedRate || 100 }}%</span></div>
|
||||
<div class="param-item"><span class="p-label">气压 / 气体</span><span class="p-val">{{ ds?.GasPressure || 0 }} Bar ({{ ds?.GasType || '-' }})</span></div>
|
||||
<div class="param-item"><span class="p-label">占空比</span><span class="p-val">{{ ((ds?.PwmRatio || 0) * 100).toFixed(0) }}%</span></div>
|
||||
<div class="param-item"><span class="p-label">频率</span><span class="p-val">{{ ds?.PwmFreq || 0 }} Hz</span></div>
|
||||
</div>
|
||||
<div class="metric-list" style="margin-top:10px;">
|
||||
<div class="metric"><span class="m-label">组件状态</span>
|
||||
<span class="m-value" style="display:flex;gap:10px;font-size:12px;">
|
||||
<span class="mode-badge" :class="ds?.IsLaserOn?'text-red':''">激光: {{ ds?.IsLaserOn ? 'ON' : 'OFF' }}</span>
|
||||
<span class="mode-badge" :class="ds?.IsGasOn?'text-cyan':''">吹气: {{ ds?.IsGasOn ? 'ON' : 'OFF' }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-card">
|
||||
<div class="card-title">累积统计与位置</div>
|
||||
<div class="coords-box" style="margin-bottom:10px;">
|
||||
<div class="coords-title">当前位置</div>
|
||||
<div class="coords-vals">
|
||||
<span class="coord">X: <span class="mono text-cyan">{{ (nc?.AxisX || 0).toFixed(3) }}</span></span>
|
||||
<span class="coord">Y: <span class="mono text-cyan">{{ (nc?.AxisY || 0).toFixed(3) }}</span></span>
|
||||
<span class="coord">Z/H: <span class="mono text-cyan">{{ ds?.CurrentZ || 0 }} / {{ ds?.CurrentH || 0 }}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metric-list">
|
||||
<div class="metric"><span class="m-label">开机率 / 切割率</span><span class="m-value"><span class="text-cyan">{{ lmd.startRate }}</span> / <span class="text-green">{{ lmd.cutRate }}</span></span></div>
|
||||
<div class="metric"><span class="m-label">穿孔次数</span><span class="m-value text-green">{{ (lmd.pierceCount||0).toLocaleString() }} 次</span></div>
|
||||
<div class="metric"><span class="m-label">切割距离</span><span class="m-value">{{ ((lmd.cutLength||0)/1000).toFixed(1) }} m</span></div>
|
||||
<div class="metric"><span class="m-label">空移距离</span><span class="m-value">{{ ((lmd.moveLength||0)/1000).toFixed(1) }} m</span></div>
|
||||
<div class="metric"><span class="m-label">总运行</span><span class="m-value mono">{{ formatSec(lmd.workTime) }}</span></div>
|
||||
<div class="metric"><span class="m-label">总激光</span><span class="m-value mono">{{ formatSec(lmd.laserTime) }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-card chart-card">
|
||||
<div class="card-title">近7日穿孔次数与激光时长趋势</div>
|
||||
<div class="chart-container" ref="chartRef"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===== 电力明细 ===== -->
|
||||
<div class="detail-content" v-else-if="device.type === 'power'">
|
||||
<div class="cards-row">
|
||||
<div class="detail-card" style="flex:0 0 50%;">
|
||||
<div class="card-title">实时三相电流</div>
|
||||
<div class="power-display">
|
||||
<div class="phase-big" v-for="(item, idx) in powerPhases" :key="idx">
|
||||
<div class="phase-label">{{ item.label }}</div>
|
||||
<div class="phase-value" :class="{ warn: item.warn }">{{ item.value }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted, nextTick, watch } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import * as echarts from 'echarts'
|
||||
import { baseDevices } from '../services/mockData.js'
|
||||
import { getCncWorkModeText, getLaserSysStateText } from '../composables/useDeviceStatus.js'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const allDevices = baseDevices
|
||||
const selectedId = ref(route.params.id || allDevices[0]?.id)
|
||||
const device = computed(() => allDevices.find(d => d.id === selectedId.value))
|
||||
const md = computed(() => device.value?.machineData || {})
|
||||
const nc = computed(() => md.value?.CutSystemState?.NcState)
|
||||
const ds = computed(() => md.value?.CutSystemState?.DeviceState)
|
||||
const lmd = computed(() => md.value || {})
|
||||
|
||||
const powerPhases = computed(() => {
|
||||
const s = md.value?.slave1
|
||||
if (!s) return []
|
||||
return [
|
||||
{ label: 'A相电流', value: s.current1, warn: parseFloat(s.current1) > 16 },
|
||||
{ label: 'B相电流', value: s.current2, warn: parseFloat(s.current2) > 16 },
|
||||
{ label: 'C相电流', value: s.current3, warn: parseFloat(s.current3) > 16 }
|
||||
]
|
||||
})
|
||||
|
||||
function typeLabel(t) {
|
||||
return { laser: '激光', cnc: 'CNC', power: '电力' }[t] || t
|
||||
}
|
||||
|
||||
function goBack() { router.push({ name: 'Dashboard' }) }
|
||||
function switchDevice() { router.replace({ name: 'DeviceDetail', params: { id: selectedId.value } }) }
|
||||
|
||||
function loadClass(v) {
|
||||
const a = Math.abs(v || 0)
|
||||
if (a > 85) return 'ld-danger'
|
||||
if (a > 60) return 'ld-warning'
|
||||
return 'ld-normal'
|
||||
}
|
||||
|
||||
function formatSec(sec) {
|
||||
if (!sec) return '0H 0M'
|
||||
const h = Math.floor(sec / 3600)
|
||||
const m = Math.floor((sec % 3600) / 60)
|
||||
return `${h}H ${m}M`
|
||||
}
|
||||
|
||||
// ====== ECharts ======
|
||||
const chartRef = ref(null)
|
||||
let chartInstance = null
|
||||
|
||||
function initChart() {
|
||||
if (!chartRef.value || !device.value?.weeklyStats) return
|
||||
chartInstance = echarts.init(chartRef.value)
|
||||
updateChart()
|
||||
window.addEventListener('resize', () => chartInstance?.resize())
|
||||
}
|
||||
|
||||
function updateChart() {
|
||||
if (!chartInstance || !device.value?.weeklyStats) return
|
||||
const stats = device.value.weeklyStats
|
||||
const isLaser = device.value.type === 'laser'
|
||||
|
||||
const option = {
|
||||
backgroundColor: 'transparent',
|
||||
tooltip: { trigger: 'axis', axisPointer: { type: 'cross' } },
|
||||
legend: {
|
||||
data: [isLaser ? '穿孔数 (次)' : '产量 (件)', isLaser ? '激光时长 (h)' : '切削时长 (h)'],
|
||||
textStyle: { color: '#a0c0d0' }, top: 0
|
||||
},
|
||||
grid: { left: '3%', right: '4%', bottom: '3%', top: '40px', containLabel: true },
|
||||
xAxis: {
|
||||
type: 'category', data: stats.dates || ['周一','周二','周三','周四','周五','周六','周日'],
|
||||
axisLabel: { color: '#6a8a9a' }, axisLine: { lineStyle: { color: '#1a3a6a' } }
|
||||
},
|
||||
yAxis: [
|
||||
{ type: 'value', name: isLaser ? '次数' : '件', nameTextStyle: { color: '#6a8a9a' }, axisLabel: { color: '#6a8a9a' }, splitLine: { lineStyle: { color: 'rgba(26,58,106,0.3)' } } },
|
||||
{ type: 'value', name: '小时', nameTextStyle: { color: '#6a8a9a' }, axisLabel: { color: '#6a8a9a' }, splitLine: { show: false } }
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: isLaser ? '穿孔数 (次)' : '产量 (件)', type: 'bar', barWidth: '30%',
|
||||
itemStyle: { color: new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:'#00e5ff'},{offset:1,color:'#0070ff'}]), borderRadius: [4,4,0,0] },
|
||||
data: stats.produce
|
||||
},
|
||||
{
|
||||
name: isLaser ? '激光时长 (h)' : '切削时长 (h)', type: 'line', yAxisIndex: 1, smooth: true,
|
||||
symbol: 'circle', symbolSize: 8,
|
||||
itemStyle: { color: isLaser ? '#ff4444' : '#00e676' },
|
||||
lineStyle: { width: 3, shadowColor: isLaser ? 'rgba(255,68,68,0.4)' : 'rgba(0,230,118,0.4)', shadowBlur: 10 },
|
||||
areaStyle: { color: new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:isLaser?'rgba(255,68,68,0.25)':'rgba(0,230,118,0.25)'},{offset:1,color:'transparent'}]) },
|
||||
data: stats.cuttime
|
||||
}
|
||||
]
|
||||
}
|
||||
chartInstance.setOption(option, true)
|
||||
}
|
||||
|
||||
watch(selectedId, () => {
|
||||
nextTick(() => {
|
||||
if (chartInstance) { chartInstance.dispose(); chartInstance = null }
|
||||
initChart()
|
||||
})
|
||||
})
|
||||
|
||||
onMounted(() => { nextTick(initChart) })
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', () => chartInstance?.resize())
|
||||
chartInstance?.dispose()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.detail-page {
|
||||
width: 1920px; height: 1080px;
|
||||
background: #020917; color: #e0f0ff;
|
||||
display: flex; flex-direction: column; overflow: hidden;
|
||||
font-family: 'PingFang SC','Microsoft YaHei','Noto Sans SC',sans-serif;
|
||||
}
|
||||
|
||||
/* ===== Header ===== */
|
||||
.detail-header {
|
||||
display: flex; justify-content: space-between; align-items: center;
|
||||
padding: 14px 20px; border-bottom: 1px solid #1a3a6a; flex-shrink: 0;
|
||||
}
|
||||
.header-left { display: flex; align-items: center; gap: 16px; }
|
||||
.back-btn {
|
||||
background: rgba(0,229,255,0.08); border: 1px solid #00e5ff;
|
||||
color: #00e5ff; padding: 7px 16px; border-radius: 4px; cursor: pointer;
|
||||
font-size: 13px; transition: all 0.3s;
|
||||
}
|
||||
.back-btn:hover { background: rgba(0,229,255,0.18); box-shadow: 0 0 10px rgba(0,229,255,0.3); }
|
||||
.device-select {
|
||||
padding: 7px 12px; background: #0d2654; border: 1px solid rgba(0,229,255,0.4);
|
||||
color: #fff; border-radius: 4px; font-size: 14px; outline: none; cursor: pointer;
|
||||
}
|
||||
.ts { font-size: 13px; color: #5a7a9a; }
|
||||
|
||||
/* ===== Content ===== */
|
||||
.detail-content { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 14px 20px; min-height: 0; }
|
||||
.cards-row { display: flex; gap: 14px; }
|
||||
.cards-row > .detail-card { flex: 1; }
|
||||
|
||||
.detail-card {
|
||||
background: linear-gradient(135deg, #0a1931, #040f21);
|
||||
border: 1px solid #1a3a6a; border-radius: 8px; padding: 14px;
|
||||
display: flex; flex-direction: column;
|
||||
}
|
||||
.card-title {
|
||||
font-size: 14px; font-weight: 700; color: #00e5ff;
|
||||
margin-bottom: 12px; padding-left: 8px; border-left: 3px solid #00e5ff;
|
||||
}
|
||||
|
||||
.metric-list { display: flex; flex-direction: column; gap: 8px; }
|
||||
.metric { display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; border-bottom: 1px dashed rgba(26,58,106,0.4); }
|
||||
.metric:last-child { border-bottom: none; }
|
||||
.m-label { color: #5a7a9a; font-size: 13px; }
|
||||
.m-value { font-size: 15px; font-weight: 700; }
|
||||
|
||||
.mode-badge { background: rgba(4,185,255,0.12); border: 1px solid rgba(4,185,255,0.3); padding: 1px 8px; border-radius: 4px; color: #04b9ff; font-size: 13px; }
|
||||
.led { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 4px; }
|
||||
.led-green { background: #00e676; box-shadow: 0 0 6px #00e676; }
|
||||
.led-red { background: #ff4444; box-shadow: 0 0 8px #ff4444; animation: blink 0.8s infinite alternate; }
|
||||
@keyframes blink { 0%{opacity:1}100%{opacity:0.4} }
|
||||
|
||||
.text-red { color: #ff4444; }
|
||||
.text-green { color: #00e676; }
|
||||
.text-cyan { color: #00e5ff; }
|
||||
.mono { font-family: 'Consolas','Courier New',monospace; }
|
||||
|
||||
/* Params */
|
||||
.param-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
|
||||
.param-item { background: #0d2654; padding: 8px 10px; border-radius: 4px; display: flex; flex-direction: column; gap: 4px; }
|
||||
.p-label { font-size: 11px; color: #5a7a9a; }
|
||||
.p-val { font-size: 14px; font-weight: 700; }
|
||||
|
||||
/* Loads */
|
||||
.load-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
|
||||
.axis-load { display: flex; align-items: center; gap: 8px; }
|
||||
.ax-name { font-size: 12px; color: #8eb8d8; width: 30px; font-weight: 600; }
|
||||
.load-bg { flex: 1; height: 7px; background: #0d2654; border-radius: 4px; overflow: hidden; }
|
||||
.load-fill { height: 100%; transition: width 0.5s; }
|
||||
.load-fill.ld-normal { background: #00e676; }
|
||||
.load-fill.ld-warning { background: #ffca28; }
|
||||
.load-fill.ld-danger { background: #ff4444; }
|
||||
.ax-val { width: 36px; text-align: right; font-size: 12px; font-weight: 700; }
|
||||
.ax-val.ld-normal { color: #00e676; }
|
||||
.ax-val.ld-warning { color: #ffca28; }
|
||||
.ax-val.ld-danger { color: #ff4444; }
|
||||
|
||||
/* Coords */
|
||||
.coords-box { background: #020917; border: 1px solid #1a3a6a; padding: 8px 10px; border-radius: 4px; }
|
||||
.coords-title { font-size: 11px; color: #5a7a9a; margin-bottom: 4px; }
|
||||
.coords-vals { display: flex; gap: 14px; flex-wrap: wrap; }
|
||||
.coord { font-size: 13px; color: #00e5ff; }
|
||||
|
||||
/* Code preview */
|
||||
.code-preview { flex: 1; background: #020917; border: 1px solid #1a3a6a; padding: 8px; border-radius: 4px; overflow-y: auto; max-height: 160px; margin-top: 8px; }
|
||||
.code-preview pre { margin: 0; font-family: 'Consolas',monospace; font-size: 11px; color: #00e5ff; white-space: pre-wrap; }
|
||||
|
||||
/* Progress */
|
||||
.progress-section { margin-top: 10px; }
|
||||
.prog-row { display: flex; justify-content: space-between; font-size: 13px; color: #8eb8d8; margin-bottom: 6px; }
|
||||
.progress-bg { width: 100%; height: 10px; background: #0d2654; border-radius: 5px; overflow: hidden; }
|
||||
.progress-fill { height: 100%; background: linear-gradient(90deg, #00e5ff, #0070ff); transition: width 0.5s; }
|
||||
|
||||
/* Chart */
|
||||
.chart-card { flex: 1; min-height: 220px; }
|
||||
.chart-container { width: 100%; height: 100%; min-height: 200px; }
|
||||
|
||||
/* Offline */
|
||||
.offline-page { flex: 1; display: flex; align-items: center; justify-content: center; }
|
||||
.offline-box { text-align: center; }
|
||||
.offline-icon { font-size: 60px; margin-bottom: 16px; }
|
||||
.offline-title { font-size: 24px; color: #666; font-weight: 700; margin-bottom: 8px; }
|
||||
.offline-reason { font-size: 14px; color: #555; }
|
||||
|
||||
/* Power detail */
|
||||
.power-display { display: flex; gap: 30px; padding: 20px 0; }
|
||||
.phase-big { flex: 1; text-align: center; }
|
||||
.phase-label { font-size: 14px; color: #5a7a9a; margin-bottom: 8px; }
|
||||
.phase-value { font-size: 42px; font-weight: 800; color: #00e5ff; font-family: 'Consolas',monospace; }
|
||||
.phase-value.warn { color: #ff4444; }
|
||||
</style>
|
||||
7
vite.config.js
Normal file
7
vite.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
})
|
||||
BIN
激光魔盒接口文档V2.0(柏楚系统数据采集接口文档).pdf
Normal file
BIN
激光魔盒接口文档V2.0(柏楚系统数据采集接口文档).pdf
Normal file
Binary file not shown.
1146
设备信息示例(包含ABC类).md
Normal file
1146
设备信息示例(包含ABC类).md
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user