更新A样式
This commit is contained in:
parent
89fe9988fc
commit
be8de4c00a
BIN
dist (2).zip
BIN
dist (2).zip
Binary file not shown.
@ -1,36 +1,49 @@
|
||||
<template>
|
||||
<div class="laser-card" :class="`status-${status.key}`" @click="$emit('click')">
|
||||
<div class="card-top">
|
||||
<span class="device-name">{{ device.name }} <span v-if="device.appName" class="app-tag">{{ device.appName }}</span></span>
|
||||
<div class="card-head">
|
||||
<div class="head-title">
|
||||
<span class="device-name">{{ device.name }}</span>
|
||||
<span v-if="device.appName" class="app-tag">{{ device.appName }}</span>
|
||||
</div>
|
||||
<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 v-if="device.machineData" class="stats-strip">
|
||||
<div class="stat-cell">
|
||||
<span class="stat-label">穿孔</span>
|
||||
<span class="stat-val green">{{ (device.machineData.pierceCount || 0).toLocaleString() }}<small>次</small></span>
|
||||
</div>
|
||||
<div class="stat-cell">
|
||||
<span class="stat-label">切割</span>
|
||||
<span class="stat-val cyan">{{ ((device.machineData.cutLength || 0) / 1000).toFixed(1) }}<small>m</small></span>
|
||||
</div>
|
||||
<div class="stat-cell">
|
||||
<span class="stat-label">开机率</span>
|
||||
<span class="stat-val">{{ device.machineData.startRate || '--' }}</span>
|
||||
</div>
|
||||
<div class="stat-cell">
|
||||
<span class="stat-label">切割率</span>
|
||||
<span class="stat-val">{{ device.machineData.cutRate || '--' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right-stats" v-if="device.machineData">
|
||||
<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 || 0) / 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 class="card-body">
|
||||
<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>
|
||||
@ -71,18 +84,74 @@ const statusColor = computed(() => STATUS_COLORS[status.value.key] || '#fff')
|
||||
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; }
|
||||
.card-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
.head-title {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
.device-name {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
max-width: 240px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.app-tag { font-size: 11px; color: #04b9ff; background: rgba(4,185,255,0.12); padding: 1px 6px; border-radius: 3px; }
|
||||
.status-badge {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/** 名称下方通栏:四项统计横向均分 */
|
||||
.stats-strip {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 6px 10px;
|
||||
padding: 8px 0 2px;
|
||||
margin-top: 2px;
|
||||
border-top: 1px dashed rgba(30, 58, 106, 0.65);
|
||||
}
|
||||
.stat-cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
.stat-cell .stat-label { font-size: 10px; color: #5a7a9a; }
|
||||
.stat-cell .stat-val {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #d0e8ff;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
.stat-cell .stat-val small { font-size: 10px; margin-left: 2px; opacity: 0.7; }
|
||||
|
||||
.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; }
|
||||
.card-body { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
|
||||
.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; }
|
||||
@ -93,11 +162,6 @@ const statusColor = computed(() => STATUS_COLORS[status.value.key] || '#fff')
|
||||
.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>
|
||||
|
||||
@ -14,11 +14,50 @@ const CNC_WORK_MODES = {
|
||||
'10': 'REMOTE'
|
||||
}
|
||||
|
||||
// A类激光 SysState 映射
|
||||
/**
|
||||
* A 类 `NcState.SysState`(机台状态接口 data 段字段字典)
|
||||
* 与魔盒/柏楚采集约定一致;未知编号仍走 `getLaserSysStateText` 兜底。
|
||||
*/
|
||||
const LASER_SYS_STATES = {
|
||||
0: '待机', 1: '模拟', 2: '点动', 3: '回零', 4: '回标记点',
|
||||
5: '回停靠点', 6: '回原点', 7: '走边框', 8: '加工中',
|
||||
9: '暂停', 10: '继续', 11: '前进', 12: '后退'
|
||||
0: '待机',
|
||||
1: '模拟',
|
||||
2: '点动',
|
||||
3: '回零',
|
||||
4: '回标记点',
|
||||
5: '回停靠点',
|
||||
6: '回原点',
|
||||
7: '走边框',
|
||||
8: '加工状态',
|
||||
9: '暂停',
|
||||
10: '继续',
|
||||
11: '前进',
|
||||
12: '后退',
|
||||
13: '定位',
|
||||
14: '进给',
|
||||
20: '执行 PLC 过程',
|
||||
21: '单点寻边',
|
||||
22: '绝对寻边',
|
||||
23: '相对寻边',
|
||||
24: '未使用',
|
||||
31: '红外单点寻边',
|
||||
32: '红外绝对寻边',
|
||||
33: '红外相对寻边'
|
||||
}
|
||||
|
||||
/**
|
||||
* A 类 `DeviceState.GasType` 数值 → 显示(0 / -1 为未知;上游若为字符串如 O2 则原样展示)
|
||||
*/
|
||||
const LASER_GAS_TYPES = {
|
||||
0: '未知',
|
||||
[-1]: '未知',
|
||||
1: '空气 (Air)',
|
||||
2: '氧气 (O₂)',
|
||||
3: '氮气 (N₂)',
|
||||
4: '高压空气 (HiAir)',
|
||||
5: '高压氧气 (HiO₂)',
|
||||
6: '高压氮气 (HiN₂)',
|
||||
81: '低压气 (GasLow)',
|
||||
82: '高压气 (GasHigh)'
|
||||
}
|
||||
|
||||
export function getCncWorkModeText(mode) {
|
||||
@ -26,7 +65,23 @@ export function getCncWorkModeText(mode) {
|
||||
}
|
||||
|
||||
export function getLaserSysStateText(state) {
|
||||
return LASER_SYS_STATES[state] || `状态 ${state ?? 0}`
|
||||
const n = Number(state)
|
||||
if (Number.isFinite(n) && Object.prototype.hasOwnProperty.call(LASER_SYS_STATES, n)) {
|
||||
return LASER_SYS_STATES[n]
|
||||
}
|
||||
return `状态 ${state ?? '-'}`
|
||||
}
|
||||
|
||||
export function getLaserGasTypeText(gasType) {
|
||||
if (gasType === null || gasType === undefined || gasType === '') return LASER_GAS_TYPES[0]
|
||||
if (typeof gasType === 'string' && !/^\s*-?\d+\s*$/.test(gasType)) {
|
||||
return gasType.trim() || LASER_GAS_TYPES[0]
|
||||
}
|
||||
const n = Number(gasType)
|
||||
if (!Number.isFinite(n)) return String(gasType)
|
||||
if (n === 0 || n === -1) return LASER_GAS_TYPES[0]
|
||||
if (Object.prototype.hasOwnProperty.call(LASER_GAS_TYPES, n)) return LASER_GAS_TYPES[n]
|
||||
return `气体 ${n}`
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,14 +103,18 @@ export function getCncStatus(statusInfo, alarmStatus) {
|
||||
return { key: 'idle', label: '待机' }
|
||||
}
|
||||
|
||||
/**
|
||||
* A 类卡片/总览状态:仅依据机台状态接口里的 `NcState.SysState`(不根据报警数量标为「报警」)。
|
||||
* `AlarmCount` 仍可在卡片上单独展示;有报警时边框/角标不出现 alarm 态。
|
||||
*/
|
||||
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: '待机' }
|
||||
const sys = Number(nc.SysState)
|
||||
const label = getLaserSysStateText(nc.SysState)
|
||||
/** 仅 SysState===8(加工状态)为 running,其余(含暂停/寻边等)均为 idle 角标颜色 */
|
||||
if (sys === 8) return { key: 'running', label }
|
||||
return { key: 'idle', label }
|
||||
}
|
||||
|
||||
export function getPowerStatus(machineData) {
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
*
|
||||
* - **仅 HTTP**:与 MQTT 无关;看板在 `VITE_LASER_BOX_URL` 已配置时应只展示本模块 `devices`。
|
||||
* - **近 7 日**:日统计与柱图对齐「今天往前 7 天(含今天)」,见 `getLast7DaysStatContext`。
|
||||
* - **机台状态**:`CutSystemState.NcState` 以机台状态接口为准;`SysState` 驱动卡片状态,`AlarmCount` 仅展示、不标报警态。
|
||||
* - **主页报警列**:`alarm/v2` 仅查「当前时刻往前 1 小时」,结果存 `_laser.alarmsLastHour`。
|
||||
*/
|
||||
import { reactive } from 'vue'
|
||||
import {
|
||||
@ -17,7 +19,7 @@ import {
|
||||
fetchDailyRunTime,
|
||||
isLaserBoxHttpLog
|
||||
} from './laserBoxClient.js'
|
||||
import { getLast7DaysStatContext } from '../utils/weekLabels.js'
|
||||
import { getLast7DaysStatContext, getLastHourAlarmQueryRange } from '../utils/weekLabels.js'
|
||||
|
||||
export const laserBoxRuntime = reactive({
|
||||
devices: [],
|
||||
@ -40,7 +42,9 @@ function pickCuttingAppName(appInfos) {
|
||||
return preferred?.appName || appInfos[0]?.appName || ''
|
||||
}
|
||||
|
||||
/** 将魔盒 CutState 粗映射到 NcState.SysState,供 getLaserStatus / 详情页展示 */
|
||||
/**
|
||||
* 仅当机台状态 JSON 未带 SysState 时,用 CutState 字符串兜底映射(优先以接口 SysState 为准)。
|
||||
*/
|
||||
function mapCutStateToSysState(cutState) {
|
||||
const s = String(cutState ?? '').toLowerCase()
|
||||
if (s.includes('pause') || s.includes('暂停')) return 9
|
||||
@ -48,22 +52,26 @@ function mapCutStateToSysState(cutState) {
|
||||
return 0
|
||||
}
|
||||
|
||||
function buildCutSystemState(cut, alarmList) {
|
||||
const rawNc = cut?.NcState ?? cut?.ncState
|
||||
const rawDev = cut?.DeviceState ?? cut?.deviceState
|
||||
/**
|
||||
* 机台状态 + 设备状态,均来自 cutSystemState;报警条数/文案不从此处合并历史报警接口。
|
||||
*
|
||||
* 不同魔盒/切割软件版本返回形状可能不同,常见两种:
|
||||
* - `{ NcState, DeviceState, CutState, ... }`
|
||||
* - `{ CutSystemState: { NcState, DeviceState }, CutState, ... }`
|
||||
*/
|
||||
function buildCutSystemState(cut) {
|
||||
const root = (cut && typeof cut === 'object') ? cut : {}
|
||||
const cs = root.CutSystemState && typeof root.CutSystemState === 'object' ? root.CutSystemState : null
|
||||
const source = cs || root
|
||||
|
||||
const rawNc = source?.NcState ?? source?.ncState
|
||||
const rawDev = source?.DeviceState ?? source?.deviceState
|
||||
const nc = typeof rawNc === 'object' && rawNc ? { ...rawNc } : {}
|
||||
const ds = typeof rawDev === 'object' && rawDev ? { ...rawDev } : {}
|
||||
if (cut && nc.SysState == null && cut.CutState != null) nc.SysState = mapCutStateToSysState(cut.CutState)
|
||||
|
||||
const list = Array.isArray(alarmList) ? alarmList : []
|
||||
const unresolved = list.filter((a) => !(a?.ClearTime || a?.clearTime) && a?.IsCleared !== true && a?.isCleared !== true)
|
||||
const useAlarms = unresolved.length ? unresolved : list
|
||||
if ((nc.AlarmCount == null || Number(nc.AlarmCount) === 0) && useAlarms.length) nc.AlarmCount = useAlarms.length
|
||||
const msgs = useAlarms
|
||||
.slice(0, 5)
|
||||
.map((a) => a?.AlarmDesc || a?.alarmDesc || a?.message || a?.msg || '')
|
||||
.filter(Boolean)
|
||||
if (msgs.length) nc.AlarmMsg = msgs.join(';')
|
||||
// 仅兜底:若上游没给 SysState,但给了 CutState,则粗映射
|
||||
if (nc.SysState == null && root.CutState != null) nc.SysState = mapCutStateToSysState(root.CutState)
|
||||
if (nc.SysState == null && source?.CutState != null) nc.SysState = mapCutStateToSysState(source.CutState)
|
||||
|
||||
return { NcState: nc, DeviceState: ds }
|
||||
}
|
||||
@ -88,8 +96,7 @@ function indexDailyRows(rows, keyStatDate = 'statDate') {
|
||||
|
||||
async function fetchOneMachine(baseUrl, ip, appName) {
|
||||
const win = getLast7DaysStatContext()
|
||||
const alarmStart = `${win.startYmd} 00:00:00`
|
||||
const alarmEnd = `${win.endYmd} 23:59:59`
|
||||
const alarmRange = getLastHourAlarmQueryRange()
|
||||
|
||||
const [
|
||||
cutRes,
|
||||
@ -102,7 +109,7 @@ async function fetchOneMachine(baseUrl, ip, appName) {
|
||||
runRes
|
||||
] = await Promise.allSettled([
|
||||
fetchCutSystemState(baseUrl, ip, appName),
|
||||
fetchAlarms(baseUrl, ip, appName, alarmStart, alarmEnd),
|
||||
fetchAlarms(baseUrl, ip, appName, alarmRange.startDate, alarmRange.endDate),
|
||||
fetchSummary(baseUrl, ip, appName, win.summaryStart, win.summaryEnd),
|
||||
fetchDailyLength(baseUrl, ip, appName, win.startYmd, win.endYmd),
|
||||
fetchDailyPierce(baseUrl, ip, appName, win.startYmd, win.endYmd),
|
||||
@ -137,9 +144,15 @@ async function fetchOneMachine(baseUrl, ip, appName) {
|
||||
|
||||
const cutTimeHours = laserTimeDaily.map((s) => Math.round((s / 3600) * 10) / 10)
|
||||
|
||||
/** 近 1 小时,供主页报警列展示(与机台状态里的 AlarmCount 无关) */
|
||||
const alarmList = Array.isArray(alarmsRaw) ? alarmsRaw : []
|
||||
const { labels } = win
|
||||
const cutSystemState = buildCutSystemState(cut || {}, alarmList)
|
||||
const cutSystemState = buildCutSystemState(cut || {})
|
||||
|
||||
// 诊断:如果 SysState 缺失,状态角标会显示“状态 -”
|
||||
if (isLaserBoxHttpLog() && (cutSystemState?.NcState?.SysState == null)) {
|
||||
console.warn('[LaserBox] cutSystemState 缺少 NcState.SysState', { ip, appName, cut })
|
||||
}
|
||||
|
||||
const id = laserRouteId(ip, appName)
|
||||
const ts = new Date().toLocaleString('zh-CN', { hour12: false })
|
||||
@ -170,7 +183,7 @@ async function fetchOneMachine(baseUrl, ip, appName) {
|
||||
gasTimeDaily,
|
||||
runTimeDaily
|
||||
},
|
||||
_laser: { ip, appName, alarms: alarmList }
|
||||
_laser: { ip, appName, alarmsLastHour: alarmList }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,18 @@ export function formatYmdHms(d) {
|
||||
return `${formatYmd(d)} ${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 魔盒 `alarm/v2` 查询区间:当前时刻往前 1 小时 → 当前时刻(主页报警列仅展示该窗口内数据)。
|
||||
*/
|
||||
export function getLastHourAlarmQueryRange(now = new Date()) {
|
||||
const end = new Date(now)
|
||||
const start = new Date(end.getTime() - 2 * 60 * 1000)
|
||||
return {
|
||||
startDate: formatYmdHms(start),
|
||||
endDate: formatYmdHms(end)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本周一~周日与魔盒 statistic/daily 的 statDate(整数 yyyymmdd)对齐。
|
||||
* 仅当业务仍按「自然周」拉日统计时使用;A 类魔盒采集请改用 `getLast7DaysStatContext`。
|
||||
|
||||
@ -133,30 +133,60 @@ const weeklyProduceTotal = computed(() => {
|
||||
return totals
|
||||
})
|
||||
|
||||
// 报警汇总
|
||||
/** 魔盒报警行上的发生时间(不同版本字段名不一,尽量兼容) */
|
||||
function laserAlarmOccurAt(a) {
|
||||
const raw =
|
||||
a?.AlarmTime ??
|
||||
a?.alarmTime ??
|
||||
a?.CreateTime ??
|
||||
a?.createTime ??
|
||||
a?.OccurTime ??
|
||||
a?.occurTime ??
|
||||
a?.Time ??
|
||||
a?.time
|
||||
if (raw == null || raw === '') return null
|
||||
const d = new Date(raw)
|
||||
return Number.isNaN(d.getTime()) ? null : d
|
||||
}
|
||||
|
||||
// 报警汇总:B/C 仍为「设备处于报警态」一条;A 类(魔盒)为近 1 小时 alarm/v2 多条,不按 AlarmCount 标设备报警态
|
||||
const alarms = computed(() => {
|
||||
const arr = []
|
||||
const rows = []
|
||||
const now = new Date()
|
||||
overviewDevices.value.forEach(d => {
|
||||
|
||||
overviewDevices.value.forEach((d) => {
|
||||
if (!d.online || !d.machineData) return
|
||||
if (d.type === 'laser') 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({
|
||||
const a = d.machineData.alarm
|
||||
const msg = a?.length ? a[0] : 'CNC系统报警'
|
||||
rows.push({
|
||||
at: now.getTime(),
|
||||
time: now.toLocaleTimeString('zh-CN', { hour12: false }),
|
||||
device: d.type === 'cnc' ? `CNC-${d.name}` : d.name,
|
||||
device: `CNC-${d.name}`,
|
||||
message: msg
|
||||
})
|
||||
})
|
||||
return arr
|
||||
|
||||
laserListForUi.value.forEach((d) => {
|
||||
if (!d.online || d.type !== 'laser') return
|
||||
const list = d._laser?.alarmsLastHour
|
||||
if (!Array.isArray(list) || !list.length) return
|
||||
list.forEach((a) => {
|
||||
const at = laserAlarmOccurAt(a) || now
|
||||
const msg = a?.AlarmDesc || a?.alarmDesc || a?.message || a?.msg || ''
|
||||
rows.push({
|
||||
at: at.getTime(),
|
||||
time: at.toLocaleTimeString('zh-CN', { hour12: false }),
|
||||
device: d.name,
|
||||
message: msg || '报警'
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
rows.sort((x, y) => y.at - x.at)
|
||||
return rows.map(({ at: _t, ...rest }) => rest)
|
||||
})
|
||||
|
||||
function goDetail(id) {
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
<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?.GasPressure || 0 }} Bar ({{ getLaserGasTypeText(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>
|
||||
@ -199,7 +199,7 @@ import * as echarts from 'echarts'
|
||||
import { mqttRuntime, findDeviceByRouteParam } from '../services/mqttDeviceStore.js'
|
||||
import { laserBoxRuntime, findLaserDeviceByRouteParam } from '../services/laserBoxSync.js'
|
||||
import { getLast7DaysChartInfo } from '../utils/weekLabels.js'
|
||||
import { getCncWorkModeText, getLaserSysStateText } from '../composables/useDeviceStatus.js'
|
||||
import { getCncWorkModeText, getLaserSysStateText, getLaserGasTypeText } from '../composables/useDeviceStatus.js'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user