agentworkshop 0.7.22 → 0.7.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/0jKrzLuM.js +19 -0
- package/.output/public/_nuxt/{Cor9siSf.js → 6PZPfFcO.js} +1 -1
- package/.output/public/_nuxt/BAfp6tmu.js +14 -0
- package/.output/public/_nuxt/{B-xskWta.js → BCJFMBQ6.js} +1 -1
- package/.output/public/_nuxt/{DNxVTfhe.js → BMb80_tm.js} +1 -1
- package/.output/public/_nuxt/{n3vMFfrv.js → Bc-_IsBP.js} +3 -3
- package/.output/public/_nuxt/BvNJUu3s.js +1 -0
- package/.output/public/_nuxt/C1CSiSBN.js +1 -0
- package/.output/public/_nuxt/CAGL7TNK.js +1 -0
- package/.output/public/_nuxt/{ed5qX-x5.js → CDLv-n51.js} +1 -1
- package/.output/public/_nuxt/CJviSvm-.js +1 -0
- package/.output/public/_nuxt/CLZWFhZC.js +1 -0
- package/.output/public/_nuxt/{Cr9DkD1d.js → CYzpZzB_.js} +1 -1
- package/.output/public/_nuxt/Cb3SnTM8.js +1 -0
- package/.output/public/_nuxt/CjXIpPMR.js +1 -0
- package/.output/public/_nuxt/CmHzfVc5.js +3 -0
- package/.output/public/_nuxt/Cn3J3NXR.js +23 -0
- package/.output/public/_nuxt/Coik560n.js +1 -0
- package/.output/public/_nuxt/{DA4lxCWC2.js → Ct68Z0232.js} +1 -1
- package/.output/public/_nuxt/CuVGPuP1.js +1 -0
- package/.output/public/_nuxt/CxY6LfeN.js +1 -0
- package/.output/public/_nuxt/{CfVAr2nf.js → Cz9gD2Yo.js} +1 -1
- package/.output/public/_nuxt/D6HDb-vN2.js +1 -0
- package/.output/public/_nuxt/{E88a-JCG.js → DGAOugLt.js} +1 -1
- package/.output/public/_nuxt/DKHcFE1i.js +1 -0
- package/.output/public/_nuxt/{BxtpDtzC.js → DNQF_TXX.js} +1 -1
- package/.output/public/_nuxt/DSa2O56y.js +1 -0
- package/.output/public/_nuxt/DUToq-k_.js +1 -0
- package/.output/public/_nuxt/Dfe8vXdG.js +1 -0
- package/.output/public/_nuxt/{0exC4jVL.js → Djir5rSD.js} +2 -2
- package/.output/public/_nuxt/DjtE7AYt.js +1 -0
- package/.output/public/_nuxt/{BBwMH_hG.js → DoAlYsiF.js} +1 -1
- package/.output/public/_nuxt/{DWcEk1ur2.js → DvgKXPgu2.js} +1 -1
- package/.output/public/_nuxt/JOwsShod.js +2 -0
- package/.output/public/_nuxt/X6IraCTB.js +1 -0
- package/.output/public/_nuxt/_id_.C-YXjn8Q.css +1 -0
- package/.output/public/_nuxt/_id_.MbzdFygI.css +1 -0
- package/.output/public/_nuxt/_wsId_.BqWBlY7X.css +1 -0
- package/.output/public/_nuxt/{CYBq3kS7.js → b50gYVZl.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/024de5f7-6a10-4f53-82ab-bc65f3ec9e35.json +1 -0
- package/.output/public/_nuxt/daq.3OKj58HH.css +1 -0
- package/.output/public/_nuxt/dcw.rXH2fc2Z.css +1 -0
- package/.output/public/_nuxt/entry.AZM1Culo.css +1 -0
- package/.output/public/_nuxt/logs.DMOM-iHe.css +1 -0
- package/.output/public/_nuxt/monitor.B--1dPzs.css +1 -0
- package/.output/public/_nuxt/permissions.B1pjGChZ.css +1 -0
- package/.output/public/_nuxt/plugins.DpCuwaJt.css +1 -0
- package/.output/public/_nuxt/tokens.xRb1fSPU.css +1 -0
- package/.output/public/_nuxt/users.DuAt_Zwf.css +1 -0
- package/.output/public/_nuxt/workshop.BJg84pOK.css +1 -0
- package/.output/server/chunks/_/nitro.mjs +777 -798
- package/.output/server/chunks/build/{OmpTerminalPanel-Ban3yJZ4.mjs → OmpTerminalPanel-Cw_Vw9oO.mjs} +3 -3
- package/.output/server/chunks/build/{OmpTerminalPanel-Ban3yJZ4.mjs.map → OmpTerminalPanel-Cw_Vw9oO.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-B9RvEQFC.mjs → _id_-DQDqj-cZ.mjs} +31 -31
- package/.output/server/chunks/build/{_id_-B9RvEQFC.mjs.map → _id_-DQDqj-cZ.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-CqF0R5W5.mjs → _id_-DY6v6sqB.mjs} +135 -135
- package/.output/server/chunks/build/{_id_-CqF0R5W5.mjs.map → _id_-DY6v6sqB.mjs.map} +1 -1
- package/.output/server/chunks/build/{_wsId_-YC2t_fRt.mjs → _wsId_-D38Vx6Ky.mjs} +11 -13
- package/.output/server/chunks/build/{_wsId_-YC2t_fRt.mjs.map → _wsId_-D38Vx6Ky.mjs.map} +1 -1
- package/.output/server/chunks/build/{agents--6bzGtES.mjs → agents-GnmUGZir.mjs} +6 -8
- package/.output/server/chunks/build/agents-GnmUGZir.mjs.map +1 -0
- package/.output/server/chunks/build/button-DEcZFcqN.mjs +1 -1
- package/.output/server/chunks/build/{card-CCPQoKlh.mjs → card-Dipvaykh.mjs} +4 -4
- package/.output/server/chunks/build/{card-CCPQoKlh.mjs.map → card-Dipvaykh.mjs.map} +1 -1
- package/.output/server/chunks/build/{channel-templates-C1Bb-U75.mjs → channel-templates-B4z6v8Z5.mjs} +4 -6
- package/.output/server/chunks/build/channel-templates-B4z6v8Z5.mjs.map +1 -0
- package/.output/server/chunks/build/{checkbox-Dv1kjaUZ.mjs → checkbox-dzcpU_Cd.mjs} +2 -2
- package/.output/server/chunks/build/{checkbox-Dv1kjaUZ.mjs.map → checkbox-dzcpU_Cd.mjs.map} +1 -1
- package/.output/server/chunks/build/{daq-Bhwwz9vp.mjs → daq-B-3xCp_2.mjs} +103 -103
- package/.output/server/chunks/build/{daq-Bhwwz9vp.mjs.map → daq-B-3xCp_2.mjs.map} +1 -1
- package/.output/server/chunks/build/{dcw-CBPaFj2f.mjs → dcw-BL2dhuz7.mjs} +43 -43
- package/.output/server/chunks/build/{dcw-CBPaFj2f.mjs.map → dcw-BL2dhuz7.mjs.map} +1 -1
- package/.output/server/chunks/build/{default-DdV642BY.mjs → default-CLf5m0NE.mjs} +2 -3
- package/.output/server/chunks/build/{default-DdV642BY.mjs.map → default-CLf5m0NE.mjs.map} +1 -1
- package/.output/server/chunks/build/dropdown-vhn1NPFs.mjs +1 -1
- package/.output/server/chunks/build/{input-number-CZ3ZrCsy.mjs → input-number-Bd55elNN.mjs} +3 -3
- package/.output/server/chunks/build/{input-number-CZ3ZrCsy.mjs.map → input-number-Bd55elNN.mjs.map} +1 -1
- package/.output/server/chunks/build/{input-DxDqeyQW.mjs → input-sf_BT6o6.mjs} +553 -5
- package/.output/server/chunks/build/input-sf_BT6o6.mjs.map +1 -0
- package/.output/server/chunks/build/{logs-Bz1p6x_5.mjs → logs-Dto_umFY.mjs} +44 -38
- package/.output/server/chunks/build/logs-Dto_umFY.mjs.map +1 -0
- package/.output/server/chunks/build/menu-WCrlpYVh.mjs +2 -2
- package/.output/server/chunks/build/modal-yvUquPj5.mjs +2 -2
- package/.output/server/chunks/build/{monitor-miqq9xHB.mjs → monitor-Cp4V-H2n.mjs} +70 -192
- package/.output/server/chunks/build/monitor-Cp4V-H2n.mjs.map +1 -0
- package/.output/server/chunks/build/{pages-D9tOoJsf.mjs → pages-Dc2H1QFu.mjs} +2 -3
- package/.output/server/chunks/build/pages-Dc2H1QFu.mjs.map +1 -0
- package/.output/server/chunks/build/{permissions-CxEgXic0.mjs → permissions-BTRW2CVd.mjs} +288 -194
- package/.output/server/chunks/build/permissions-BTRW2CVd.mjs.map +1 -0
- package/.output/server/chunks/build/{plugins-wLIKHcIE.mjs → plugins-DZR0T4Mh.mjs} +17 -17
- package/.output/server/chunks/build/{plugins-wLIKHcIE.mjs.map → plugins-DZR0T4Mh.mjs.map} +1 -1
- package/.output/server/chunks/build/popconfirm-CRaHcz5O.mjs +1 -1
- package/.output/server/chunks/build/{segmented-ChmQZwz6.mjs → segmented-LPPREMtZ.mjs} +336 -5
- package/.output/server/chunks/build/{segmented-ChmQZwz6.mjs.map → segmented-LPPREMtZ.mjs.map} +1 -1
- package/.output/server/chunks/build/{settings-BPBll_7K.mjs → settings-UfGyDgM7.mjs} +6 -8
- package/.output/server/chunks/build/settings-UfGyDgM7.mjs.map +1 -0
- package/.output/server/chunks/build/space-CCBYAkXt.mjs +1 -1
- package/.output/server/chunks/build/switch-CelRXpcy.mjs +1 -1
- package/.output/server/chunks/build/{table-BtksyDlQ.mjs → table-Cswq-l2r.mjs} +5 -5
- package/.output/server/chunks/build/{table-BtksyDlQ.mjs.map → table-Cswq-l2r.mjs.map} +1 -1
- package/.output/server/chunks/build/{tabs-DQv-_-R6.mjs → tabs-BM3tAh_J.mjs} +2 -2
- package/.output/server/chunks/build/{tabs-DQv-_-R6.mjs.map → tabs-BM3tAh_J.mjs.map} +1 -1
- package/.output/server/chunks/build/{tag-A0tZ2Ouq.mjs → tag-NO9jEqKy.mjs} +3 -3
- package/.output/server/chunks/build/{tag-A0tZ2Ouq.mjs.map → tag-NO9jEqKy.mjs.map} +1 -1
- package/.output/server/chunks/build/{teams-DD8ZXTKL.mjs → teams-Cbg27MWW.mjs} +4 -6
- package/.output/server/chunks/build/teams-Cbg27MWW.mjs.map +1 -0
- package/.output/server/chunks/build/{tokens-Dxnuw96_.mjs → tokens-Bmm6rDfj.mjs} +296 -200
- package/.output/server/chunks/build/tokens-Bmm6rDfj.mjs.map +1 -0
- package/.output/server/chunks/build/{users-D6RNylrW.mjs → users-B50HHrfi.mjs} +12 -13
- package/.output/server/chunks/build/users-B50HHrfi.mjs.map +1 -0
- package/.output/server/chunks/build/{workshop-CTcYDq2i.mjs → workshop-81xhz368.mjs} +21 -22
- package/.output/server/chunks/build/workshop-81xhz368.mjs.map +1 -0
- package/.output/server/chunks/routes/renderer.mjs +2 -2
- package/.output/server/chunks/virtual/entry.mjs +53 -21
- package/.output/server/chunks/virtual/entry.mjs.map +1 -1
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/app/app.vue +7 -0
- package/app/assets/css/main.css +318 -162
- package/app/components/workshop/blocks/ClusterArtifact.vue +0 -16
- package/app/pages/daq/[id].vue +919 -938
- package/app/pages/daq/index.vue +1 -22
- package/app/pages/dcw/[id].vue +1 -4
- package/app/pages/dcw/index.vue +1 -30
- package/app/pages/logs/index.vue +99 -87
- package/app/pages/monitor.vue +56 -68
- package/app/pages/permissions/index.vue +86 -82
- package/app/pages/plugins/index.vue +12 -7
- package/app/pages/tokens.vue +94 -96
- package/app/pages/users.vue +10 -18
- package/app/pages/workshop/index.vue +34 -5
- package/i18n/locales/en.ts +4 -1
- package/i18n/locales/zh-CN.ts +6 -1
- package/package.json +1 -1
- package/scripts/_dbg-logs-ui-e2e.py +126 -0
- package/scripts/_dbg-ui-survey.py +52 -0
- package/server/data/daqs.json +101 -101
- package/server/data/dcw-lines.json +7 -0
- package/server/data/dcw-products.json +7 -0
- package/server/data/dcw-recipes.json +22 -0
- package/server/data/dcw-rollback.json +84 -10
- package/server/data/dcw-runs.json +52 -54
- package/server/data/dcw-writes.json +36 -0
- package/server/data/dcws.json +533 -216
- package/server/data/line-runs.json +18 -18
- package/.output/public/_nuxt/BAbAEW0D.js +0 -1
- package/.output/public/_nuxt/BWC4HQHQ.js +0 -1
- package/.output/public/_nuxt/BbZAzXjZ2.js +0 -1
- package/.output/public/_nuxt/BgOhoDTI.js +0 -1
- package/.output/public/_nuxt/BuiGDfMB.js +0 -1
- package/.output/public/_nuxt/BxPPAkGA.js +0 -3
- package/.output/public/_nuxt/C_2bTK0C.js +0 -1
- package/.output/public/_nuxt/CcwJ2mrD2.js +0 -1
- package/.output/public/_nuxt/Ci0uX4c4.js +0 -1
- package/.output/public/_nuxt/D6B0xnjk.js +0 -1
- package/.output/public/_nuxt/DTYBfjRY.js +0 -1
- package/.output/public/_nuxt/DVoWWlUW.js +0 -1
- package/.output/public/_nuxt/Dhqra7NB.js +0 -1
- package/.output/public/_nuxt/DlRO_q5L.js +0 -1
- package/.output/public/_nuxt/DsUUYP292.js +0 -1
- package/.output/public/_nuxt/Dsdy4Ua-.js +0 -1
- package/.output/public/_nuxt/QT54MQV9.js +0 -1
- package/.output/public/_nuxt/RzXYI9FM.js +0 -23
- package/.output/public/_nuxt/UtviM1bg.js +0 -1
- package/.output/public/_nuxt/_id_.C2VHq_vT.css +0 -1
- package/.output/public/_nuxt/_id_.Dswy2p0I.css +0 -1
- package/.output/public/_nuxt/_wsId_.BFyCuUwS.css +0 -1
- package/.output/public/_nuxt/bAFueD6a.js +0 -1
- package/.output/public/_nuxt/builds/meta/e2341fc0-6f3f-4680-abf8-935a7c9fb912.json +0 -1
- package/.output/public/_nuxt/c3mwkHWP.js +0 -14
- package/.output/public/_nuxt/daq.BTdEun-8.css +0 -1
- package/.output/public/_nuxt/dbi5bHkY.js +0 -2
- package/.output/public/_nuxt/dcw.rpqpOYQ8.css +0 -1
- package/.output/public/_nuxt/eHYnGew0.js +0 -19
- package/.output/public/_nuxt/entry.DRUzDwmX.css +0 -1
- package/.output/public/_nuxt/jyQyulh-.js +0 -1
- package/.output/public/_nuxt/logs.BarkrvUp.css +0 -1
- package/.output/public/_nuxt/monitor.CmwpEUCI.css +0 -1
- package/.output/public/_nuxt/permissions.DTRtZeTw.css +0 -1
- package/.output/public/_nuxt/plugins.BcSEwwGb.css +0 -1
- package/.output/public/_nuxt/tokens.BVXU1jOK.css +0 -1
- package/.output/public/_nuxt/users.D8lcLE62.css +0 -1
- package/.output/public/_nuxt/workshop.CbymC2LY.css +0 -1
- package/.output/public/_nuxt/zVkqCZ78.js +0 -1
- package/.output/server/chunks/build/Col-biaNnEPf.mjs +0 -338
- package/.output/server/chunks/build/Col-biaNnEPf.mjs.map +0 -1
- package/.output/server/chunks/build/agents--6bzGtES.mjs.map +0 -1
- package/.output/server/chunks/build/channel-templates-C1Bb-U75.mjs.map +0 -1
- package/.output/server/chunks/build/hasIn-vQ9LWt-J.mjs +0 -554
- package/.output/server/chunks/build/hasIn-vQ9LWt-J.mjs.map +0 -1
- package/.output/server/chunks/build/input-DxDqeyQW.mjs.map +0 -1
- package/.output/server/chunks/build/logs-Bz1p6x_5.mjs.map +0 -1
- package/.output/server/chunks/build/monitor-miqq9xHB.mjs.map +0 -1
- package/.output/server/chunks/build/pages-D9tOoJsf.mjs.map +0 -1
- package/.output/server/chunks/build/permissions-CxEgXic0.mjs.map +0 -1
- package/.output/server/chunks/build/settings-BPBll_7K.mjs.map +0 -1
- package/.output/server/chunks/build/teams-DD8ZXTKL.mjs.map +0 -1
- package/.output/server/chunks/build/tokens-Dxnuw96_.mjs.map +0 -1
- package/.output/server/chunks/build/useSiteConfig-DJe_KMVr.mjs +0 -27
- package/.output/server/chunks/build/useSiteConfig-DJe_KMVr.mjs.map +0 -1
- package/.output/server/chunks/build/users-D6RNylrW.mjs.map +0 -1
- package/.output/server/chunks/build/workshop-CTcYDq2i.mjs.map +0 -1
- /package/.output/public/_nuxt/{CNs_Ozdc.js → CNs_Ozdc2.js} +0 -0
- /package/.output/public/_nuxt/{Cno6kYiO.js → Cno6kYiO2.js} +0 -0
- /package/.output/public/_nuxt/{DAR70Lf5.js → DAR70Lf52.js} +0 -0
- /package/.output/public/_nuxt/{ORt9oDIy2.js → ORt9oDIy.js} +0 -0
package/app/pages/daq/[id].vue
CHANGED
|
@@ -1,938 +1,919 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* 数采节点控制台(/daq/[id])—— 单节点专业控制面。
|
|
4
|
-
* 实时值 + live 趋势(WS 流);参数控制(server DaqNode 单点参数:启停/周期/
|
|
5
|
-
* 驱动/量程/预警带);设备绑定;时序库历史查询(降采样桶选择)。
|
|
6
|
-
*/
|
|
7
|
-
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
|
|
8
|
-
import { useRoute } from 'vue-router'
|
|
9
|
-
import { useDcwStream } from '@/app/composables/workshop/useDcwStream'
|
|
10
|
-
import { useDaqStream, type DaqFrameLive } from '@/app/composables/workshop/useDaqStream'
|
|
11
|
-
import { useDeviceTwins } from '@/app/composables/workshop/useDeviceTwins'
|
|
12
|
-
import { daqKeyFromRef, DAQ_DRIVERS, type DaqDriverKind, type DaqNodeState, type DriverConfigField, type DriverTestResult as DaqDriverTestResult } from '#shared/daq-protocol'
|
|
13
|
-
|
|
14
|
-
const { t } = useI18n()
|
|
15
|
-
|
|
16
|
-
definePageMeta({ layout: 'default' })
|
|
17
|
-
|
|
18
|
-
const route = useRoute()
|
|
19
|
-
const nodeId = computed(() => String(route.params.id ?? ''))
|
|
20
|
-
const daq = useDaqStream()
|
|
21
|
-
const dcw = useDcwStream()
|
|
22
|
-
void dcw.load()
|
|
23
|
-
const deviceTwins = useDeviceTwins()
|
|
24
|
-
|
|
25
|
-
const node = computed(() => daq.nodeById(nodeId.value) ?? null)
|
|
26
|
-
// server 模板目录为唯一事实源:模板被删除时降级显示 key 原文,不再回退到
|
|
27
|
-
// 打包内置常量(那会渲染过期语义)
|
|
28
|
-
const tpl = computed(() => {
|
|
29
|
-
const key = node.value ? daqKeyFromRef(node.value.templateRef) : ''
|
|
30
|
-
return daq.templates.find(t => t.key === key) ?? null
|
|
31
|
-
})
|
|
32
|
-
const stateLabel: Record<DaqNodeState, string> = { ok: t('daqDetail.k41k5c026'), warn: t('daqDetail.k49z8v027'), alarm: t('daqDetail.k3xmid028'), offline: t('daqDetail.k44c2n029') }
|
|
33
|
-
const effectiveState = (): DaqNodeState => {
|
|
34
|
-
const n = node.value
|
|
35
|
-
if (!n) return 'offline'
|
|
36
|
-
if (!daq.controller.running || !n.enabled) return 'offline'
|
|
37
|
-
return n.state
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let unsub: (() => void) | null = null
|
|
41
|
-
onMounted(() => {
|
|
42
|
-
unsub = daq.ensureWsFeed()
|
|
43
|
-
void daq.load()
|
|
44
|
-
void deviceTwins.load()
|
|
45
|
-
if (isFrameNode.value) void loadFrames()
|
|
46
|
-
})
|
|
47
|
-
onBeforeUnmount(() => unsub?.())
|
|
48
|
-
|
|
49
|
-
// ---------- 帧视图(v2 多形态信号:向量轮廓 / 图像画廊;scalar 节点不渲染) ----------
|
|
50
|
-
|
|
51
|
-
const signalKind = computed(() => tpl.value?.signalKind ?? 'scalar')
|
|
52
|
-
const isFrameNode = computed(() => signalKind.value !== 'scalar')
|
|
53
|
-
const frames = computed(() => daq.framesOf(nodeId.value))
|
|
54
|
-
|
|
55
|
-
async function loadFrames(): Promise<void> {
|
|
56
|
-
if (!nodeId.value) return
|
|
57
|
-
await daq.fetchFrames(nodeId.value, { limit: 24 }).catch(() => {})
|
|
58
|
-
}
|
|
59
|
-
watch(nodeId, () => {
|
|
60
|
-
if (isFrameNode.value) void loadFrames()
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
const timeOf = (at: number): string => new Date(at).toLocaleTimeString('zh-CN', { hour12: false })
|
|
64
|
-
const metricsBrief = (f: DaqFrameLive): string =>
|
|
65
|
-
Object.entries(f.metrics ?? {}).slice(0, 3).map(([k, v]) => `${k}=${v}`).join(' ')
|
|
66
|
-
|
|
67
|
-
/* 向量轮廓(最近一帧预览;SVG polyline,免 canvas 绘制循环) */
|
|
68
|
-
const VEC_W = 320
|
|
69
|
-
const VEC_H = 84
|
|
70
|
-
const latestVector = computed(() => frames.value.find(f => f.kind === 'vector' && f.points?.length))
|
|
71
|
-
const vecPath = computed(() => {
|
|
72
|
-
const pts = latestVector.value?.points ?? []
|
|
73
|
-
if (pts.length < 2) return ''
|
|
74
|
-
const min = Math.min(...pts)
|
|
75
|
-
const max = Math.max(...pts)
|
|
76
|
-
const span = max - min || 1
|
|
77
|
-
return pts
|
|
78
|
-
.map((p, i) => `${((i / (pts.length - 1)) * VEC_W).toFixed(1)},${(VEC_H - 6 - ((p - min) / span) * (VEC_H - 12)).toFixed(1)}`)
|
|
79
|
-
.join(' ')
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
/* 图像大图查看(点击缩略图;contentUrl 同源 cookie 鉴权直出) */
|
|
83
|
-
const fullFrame = ref<DaqFrameLive | null>(null)
|
|
84
|
-
|
|
85
|
-
/** WS 下发节拍展示(null=跟随全局;0=每帧;>0 独立间隔) */
|
|
86
|
-
function publishLabel(v: number | null): string {
|
|
87
|
-
if (v == null) return t('daqDetail.k9vnp9h053', { p0: daq.controller.defaultPublishIntervalMs })
|
|
88
|
-
if (v === 0) return t('daqDetail.k1m1zwux030')
|
|
89
|
-
return `${v}ms`
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// ---------- 参数表单(server 单点控制;变更经 PATCH 落库,node.changed 帧回灌) ----------
|
|
93
|
-
const form = reactive({
|
|
94
|
-
enabled: true,
|
|
95
|
-
driver: 'mock' as DaqDriverKind,
|
|
96
|
-
lineId: '',
|
|
97
|
-
followGlobal: true,
|
|
98
|
-
intervalMs: 5000,
|
|
99
|
-
calKind: 'none' as 'none' | 'linear',
|
|
100
|
-
calScale: 1,
|
|
101
|
-
calOffset: 0,
|
|
102
|
-
publishFollow: true,
|
|
103
|
-
publishEveryFrame: false,
|
|
104
|
-
publishMs: 1000,
|
|
105
|
-
unit: '',
|
|
106
|
-
decimals: 1,
|
|
107
|
-
min: 0,
|
|
108
|
-
max: 100,
|
|
109
|
-
warnLow: null as number | null,
|
|
110
|
-
warnHigh: null as number | null,
|
|
111
|
-
})
|
|
112
|
-
watch(node, (n) => {
|
|
113
|
-
if (!n) return
|
|
114
|
-
form.enabled = n.enabled
|
|
115
|
-
form.lineId = n.lineId ?? ''
|
|
116
|
-
form.driver = n.driver
|
|
117
|
-
form.followGlobal = n.intervalMs == null
|
|
118
|
-
form.intervalMs = n.intervalMs ?? daq.controller.defaultIntervalMs
|
|
119
|
-
// WS 下发节拍:null=跟随全局;0=每帧;>0 独立间隔
|
|
120
|
-
form.publishFollow = n.publishIntervalMs == null
|
|
121
|
-
form.publishEveryFrame = n.publishIntervalMs === 0
|
|
122
|
-
form.publishMs = n.publishIntervalMs == null ? daq.controller.defaultPublishIntervalMs : n.publishIntervalMs
|
|
123
|
-
form.unit = n.unit
|
|
124
|
-
form.decimals = n.decimals
|
|
125
|
-
form.min = n.min
|
|
126
|
-
form.max = n.max
|
|
127
|
-
form.warnLow = n.warnLow
|
|
128
|
-
form.warnHigh = n.warnHigh
|
|
129
|
-
}, { immediate: true })
|
|
130
|
-
|
|
131
|
-
// 驱动连接参数编辑(真实协议:host/register/endpoint...;schema 驱动渲染)
|
|
132
|
-
const driverCfg = ref<Record<string, string | number>>({})
|
|
133
|
-
const driverFields = computed<DriverConfigField[]>(() =>
|
|
134
|
-
DAQ_DRIVERS.find(d => d.kind === form.driver)?.configFields ?? [])
|
|
135
|
-
watch(node, (n) => {
|
|
136
|
-
if (n) driverCfg.value = { ...(n.driverConfig as Record<string, string | number>) }
|
|
137
|
-
}, { immediate: true })
|
|
138
|
-
watch(() => form.driver, () => {
|
|
139
|
-
// 切换协议且目标无参数 → 填 schema 缺省
|
|
140
|
-
if (driverFields.value.length && Object.keys(driverCfg.value).length === 0) {
|
|
141
|
-
const cfg: Record<string, string | number> = {}
|
|
142
|
-
for (const f of driverFields.value) if (f.default !== undefined) cfg[f.key] = f.default as string | number
|
|
143
|
-
driverCfg.value = cfg
|
|
144
|
-
}
|
|
145
|
-
}, { immediate: true })
|
|
146
|
-
const testing = ref(false)
|
|
147
|
-
const testResult = ref<DaqDriverTestResult | null>(null)
|
|
148
|
-
async function doTest(): Promise<void> {
|
|
149
|
-
testing.value = true
|
|
150
|
-
testResult.value = null
|
|
151
|
-
try {
|
|
152
|
-
// 先保存当前驱动与参数,再测(测存量节点 = 测已落库配置)
|
|
153
|
-
await daq.patchNode(nodeId.value, { driver: form.driver, driverConfig: { ...driverCfg.value } })
|
|
154
|
-
testResult.value = await daq.testNode(nodeId.value)
|
|
155
|
-
}
|
|
156
|
-
catch (err) {
|
|
157
|
-
testResult.value = { ok: false, message: apiErrorMessage(err) }
|
|
158
|
-
}
|
|
159
|
-
finally {
|
|
160
|
-
testing.value = false
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const saving = ref(false)
|
|
165
|
-
async function saveParams(): Promise<void> {
|
|
166
|
-
const n = node.value
|
|
167
|
-
if (!n || saving.value) return
|
|
168
|
-
saving.value = true
|
|
169
|
-
try {
|
|
170
|
-
await daq.patchNode(n.id, {
|
|
171
|
-
enabled: form.enabled,
|
|
172
|
-
driver: form.driver,
|
|
173
|
-
lineId: form.lineId,
|
|
174
|
-
driverConfig: { ...driverCfg.value },
|
|
175
|
-
intervalMs: form.followGlobal ? null : Math.max(1000, Math.min(60_000, Math.round(form.intervalMs))),
|
|
176
|
-
publishIntervalMs: form.publishFollow
|
|
177
|
-
? null
|
|
178
|
-
: (form.publishEveryFrame ? 0 : Math.max(0, Math.min(60_000, Math.round(form.publishMs)))),
|
|
179
|
-
unit: form.unit,
|
|
180
|
-
decimals: Math.max(0, Math.min(6, Math.round(form.decimals))),
|
|
181
|
-
min: form.min,
|
|
182
|
-
max: form.max,
|
|
183
|
-
warnLow: form.warnLow,
|
|
184
|
-
warnHigh: form.warnHigh,
|
|
185
|
-
})
|
|
186
|
-
}
|
|
187
|
-
finally {
|
|
188
|
-
saving.value = false
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/** 驱动是否为预留协议(meta status=planned) */
|
|
193
|
-
function driverPlanned(kind: string): boolean {
|
|
194
|
-
return daq.meta.drivers.find(d => d.kind === kind)?.status === 'planned'
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// ---------- 设备绑定 ----------
|
|
198
|
-
const bindDeviceId = ref('')
|
|
199
|
-
const boundDeviceName = computed(() => {
|
|
200
|
-
const ids = node.value?.deviceIds ?? (node.value?.deviceBindingId ? [node.value.deviceBindingId] : [])
|
|
201
|
-
return ids
|
|
202
|
-
.map(id => deviceTwins.twins.find(t => t.id === id)?.name ?? `${id.slice(0, 8)}…`)
|
|
203
|
-
.join(' / ')
|
|
204
|
-
})
|
|
205
|
-
function onBindToggle(): void {
|
|
206
|
-
void daq.bindNode(nodeId.value, node.value?.deviceBindingId ? null : (bindDeviceId.value || null))
|
|
207
|
-
}
|
|
208
|
-
const availableDevices = computed(() =>
|
|
209
|
-
deviceTwins.twins.filter(t => t.kind !== 'daq' && t.id !== node.value?.id),
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
// ---------- 历史(时序库) ----------
|
|
213
|
-
type ChartRow = { at: number, value?: number, avg?: number, min?: number, max?: number }
|
|
214
|
-
const historyPoints = ref<ChartRow[]>([])
|
|
215
|
-
const bucketMs = ref<number>(15000)
|
|
216
|
-
const histLoading = ref(false)
|
|
217
|
-
const BUCKETS = [
|
|
218
|
-
{ label: '1s 桶', ms: 1000 },
|
|
219
|
-
{ label: '5s 桶', ms: 5000 },
|
|
220
|
-
{ label: '15s 桶(默认)', ms: 15000 },
|
|
221
|
-
{ label: '30s 桶', ms: 30000 },
|
|
222
|
-
{ label: '1min 桶', ms: 60000 },
|
|
223
|
-
]
|
|
224
|
-
async function loadHistory(): Promise<void> {
|
|
225
|
-
if (!nodeId.value) return
|
|
226
|
-
histLoading.value = true
|
|
227
|
-
try {
|
|
228
|
-
const pts = await daq.samplesOf(nodeId.value, {
|
|
229
|
-
toMs: Date.now(),
|
|
230
|
-
bucketMs: bucketMs.value || undefined,
|
|
231
|
-
limit: 400,
|
|
232
|
-
})
|
|
233
|
-
// 接口 DESC 返回 → 图表时间正序
|
|
234
|
-
historyPoints.value = [...pts].reverse() as ChartRow[]
|
|
235
|
-
}
|
|
236
|
-
finally {
|
|
237
|
-
histLoading.value = false
|
|
238
|
-
drawChart()
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const chartCanvas = ref<HTMLCanvasElement | null>(null)
|
|
243
|
-
const trendColor = '#35e0a0'
|
|
244
|
-
const gridColor = 'rgba(120,135,160,0.18)'
|
|
245
|
-
const inkColor = 'rgba(140,155,175,0.8)'
|
|
246
|
-
function drawChart(): void {
|
|
247
|
-
const cv = chartCanvas.value
|
|
248
|
-
if (!cv) return
|
|
249
|
-
const dpr = Math.min(window.devicePixelRatio || 1, 2)
|
|
250
|
-
const w = cv.clientWidth
|
|
251
|
-
const h = cv.clientHeight
|
|
252
|
-
if (cv.width !== w * dpr || cv.height !== h * dpr) {
|
|
253
|
-
cv.width = w * dpr
|
|
254
|
-
cv.height = h * dpr
|
|
255
|
-
}
|
|
256
|
-
const ctx = cv.getContext('2d')
|
|
257
|
-
if (!ctx) return
|
|
258
|
-
ctx.setTransform(dpr, 0, 0, dpr, 0, 0)
|
|
259
|
-
ctx.clearRect(0, 0, w, h)
|
|
260
|
-
for (let i = 1; i < 4; i++) {
|
|
261
|
-
ctx.strokeStyle = gridColor
|
|
262
|
-
ctx.beginPath()
|
|
263
|
-
ctx.moveTo(0, (h / 4) * i)
|
|
264
|
-
ctx.lineTo(w, (h / 4) * i)
|
|
265
|
-
ctx.stroke()
|
|
266
|
-
}
|
|
267
|
-
const rows = historyPoints.value
|
|
268
|
-
if (rows.length < 2) return
|
|
269
|
-
let lo = Number.POSITIVE_INFINITY
|
|
270
|
-
let hi = Number.NEGATIVE_INFINITY
|
|
271
|
-
for (const r of rows) {
|
|
272
|
-
const v = r.value ?? r.avg ?? r.min ?? 0
|
|
273
|
-
lo = Math.min(lo, v)
|
|
274
|
-
hi = Math.max(hi, v)
|
|
275
|
-
}
|
|
276
|
-
const span = Math.max(hi - lo, 1e-9)
|
|
277
|
-
ctx.strokeStyle = inkColor
|
|
278
|
-
ctx.font = '10px monospace'
|
|
279
|
-
ctx.fillStyle = inkColor
|
|
280
|
-
ctx.fillText(hi.toFixed(2), 4, 11)
|
|
281
|
-
ctx.fillText(lo.toFixed(2), 4, h - 4)
|
|
282
|
-
ctx.strokeStyle = trendColor
|
|
283
|
-
ctx.lineWidth = 1.6
|
|
284
|
-
ctx.beginPath()
|
|
285
|
-
rows.forEach((r, i) => {
|
|
286
|
-
const x = (i / (rows.length - 1)) * w
|
|
287
|
-
const y = h - (((r.value ?? r.avg ?? 0) - lo) / span) * (h - 16) - 8
|
|
288
|
-
if (i === 0) ctx.moveTo(x, y)
|
|
289
|
-
else ctx.lineTo(x, y)
|
|
290
|
-
})
|
|
291
|
-
ctx.stroke()
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/** live 趋势(WS hist 环形缓冲;独立小画布,与历史图互补) */
|
|
295
|
-
const liveCanvas = ref<HTMLCanvasElement | null>(null)
|
|
296
|
-
let uiTimer: ReturnType<typeof setInterval> | null = null
|
|
297
|
-
function drawLive(): void {
|
|
298
|
-
const cv = liveCanvas.value
|
|
299
|
-
const n = node.value
|
|
300
|
-
if (!cv || !n || n.hist.length < 2) return
|
|
301
|
-
const dpr = Math.min(window.devicePixelRatio || 1, 2)
|
|
302
|
-
const w = cv.clientWidth
|
|
303
|
-
const h = cv.clientHeight
|
|
304
|
-
if (cv.width !== w * dpr || cv.height !== h * dpr) {
|
|
305
|
-
cv.width = w * dpr
|
|
306
|
-
cv.height = h * dpr
|
|
307
|
-
}
|
|
308
|
-
const ctx = cv.getContext('2d')
|
|
309
|
-
if (!ctx) return
|
|
310
|
-
ctx.setTransform(dpr, 0, 0, dpr, 0, 0)
|
|
311
|
-
ctx.clearRect(0, 0, w, h)
|
|
312
|
-
const hi = Math.max(...n.hist)
|
|
313
|
-
const lo = Math.min(...n.hist)
|
|
314
|
-
const span = Math.max(hi - lo, 1e-9)
|
|
315
|
-
ctx.strokeStyle = 'rgba(65,200,244,0.9)'
|
|
316
|
-
ctx.lineWidth = 1.5
|
|
317
|
-
ctx.beginPath()
|
|
318
|
-
n.hist.forEach((v, i) => {
|
|
319
|
-
const x = (i / (n.hist.length - 1)) * w
|
|
320
|
-
const y = h - ((v - lo) / span) * (h - 6) - 3
|
|
321
|
-
if (i === 0) ctx.moveTo(x, y)
|
|
322
|
-
else ctx.lineTo(x, y)
|
|
323
|
-
})
|
|
324
|
-
ctx.stroke()
|
|
325
|
-
}
|
|
326
|
-
onMounted(() => {
|
|
327
|
-
void loadHistory()
|
|
328
|
-
// live 趋势重绘循环(仅浏览器;SSR 安全)
|
|
329
|
-
uiTimer = setInterval(() => {
|
|
330
|
-
drawLive()
|
|
331
|
-
}, 800)
|
|
332
|
-
})
|
|
333
|
-
onBeforeUnmount(() => {
|
|
334
|
-
if (uiTimer) clearInterval(uiTimer)
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
watch(bucketMs, () => void loadHistory())
|
|
338
|
-
</script>
|
|
339
|
-
|
|
340
|
-
<template>
|
|
341
|
-
<div class="page">
|
|
342
|
-
<p class="aw-kicker">
|
|
343
|
-
<NuxtLink
|
|
344
|
-
to="/daq"
|
|
345
|
-
class="back"
|
|
346
|
-
>{{ $t('daqDetail.k1emg364001') }}</NuxtLink> / NODE {{ nodeId.slice(0, 8).toUpperCase() }}
|
|
347
|
-
</p>
|
|
348
|
-
<div class="aw-page-head">
|
|
349
|
-
<h1>{{ node?.name ?? nodeId }}</h1>
|
|
350
|
-
<span
|
|
351
|
-
class="st-pill"
|
|
352
|
-
:class="[effectiveState()]"
|
|
353
|
-
>{{ stateLabel[effectiveState()] }}</span>
|
|
354
|
-
</div>
|
|
355
|
-
|
|
356
|
-
<p
|
|
357
|
-
v-if="!node && daq.error"
|
|
358
|
-
class="err"
|
|
359
|
-
>
|
|
360
|
-
{{ daq.error }}(<NuxtLink to="/workshop">{{ $t('daqDetail.k1bhhheq002') }}</NuxtLink>)
|
|
361
|
-
</p>
|
|
362
|
-
|
|
363
|
-
<div
|
|
364
|
-
v-if="node"
|
|
365
|
-
class="grid"
|
|
366
|
-
>
|
|
367
|
-
<!-- 左列:实时状态卡 -->
|
|
368
|
-
<section class="col-live">
|
|
369
|
-
<div class="aw-tile value-card">
|
|
370
|
-
<p class="aw-kicker">
|
|
371
|
-
{{ $t('daqDetail.k1fx2vik032') }} {{ tpl?.ch ?? '-' }}
|
|
372
|
-
</p>
|
|
373
|
-
<div class="big-val mono">
|
|
374
|
-
{{ node.value != null ? node.value.toFixed(node.decimals) : '--' }}<small>{{ node.unit }}</small>
|
|
375
|
-
</div>
|
|
376
|
-
<canvas
|
|
377
|
-
ref="liveCanvas"
|
|
378
|
-
class="live-canvas"
|
|
379
|
-
/>
|
|
380
|
-
<dl class="facts mono">
|
|
381
|
-
<div>
|
|
382
|
-
<dt>{{ $t('daqDetail.k4a0la003') }}</dt>
|
|
383
|
-
<dd>{{ node.driver }}{{ driverPlanned(node.driver) ? $t('daqDetail.kz8zr9v035') : '' }}</dd>
|
|
384
|
-
</div>
|
|
385
|
-
<div>
|
|
386
|
-
<dt>{{ $t('daqDetail.k3xg3w004') }}</dt>
|
|
387
|
-
<dd>{{ node.intervalMs ?? $t('daqDetail.k9vnp9h053', { p0: daq.controller.defaultIntervalMs }) }}</dd>
|
|
388
|
-
</div>
|
|
389
|
-
<div>
|
|
390
|
-
<dt>{{ $t('daqDetail.k3w6td005') }}</dt>
|
|
391
|
-
<dd>{{ publishLabel(node.publishIntervalMs) }}</dd>
|
|
392
|
-
</div>
|
|
393
|
-
<div>
|
|
394
|
-
<dt>{{ $t('daqDetail.k3x5tpx006') }}</dt>
|
|
395
|
-
<dd>{{ node.warnLow ?? '-∞' }} ~ {{ node.warnHigh ?? '+∞' }}</dd>
|
|
396
|
-
</div>
|
|
397
|
-
<div>
|
|
398
|
-
<dt>{{ $t('daqDetail.k1hjj0jf007') }}</dt>
|
|
399
|
-
<dd>{{ node.min }} ~ {{ node.max }}</dd>
|
|
400
|
-
</div>
|
|
401
|
-
<div>
|
|
402
|
-
<dt>{{ $t('daqDetail.k1i8rtqt008') }}</dt>
|
|
403
|
-
<dd>{{ boundDeviceName || $t('daqDetail.k3own4q036') }}</dd>
|
|
404
|
-
</div>
|
|
405
|
-
</dl>
|
|
406
|
-
</div>
|
|
407
|
-
</section>
|
|
408
|
-
|
|
409
|
-
<!-- 中列:参数控制 -->
|
|
410
|
-
<section class="col-form aw-tile pad">
|
|
411
|
-
<h3 class="sec">
|
|
412
|
-
{{ $t('daqDetail.kd9d69j009') }}
|
|
413
|
-
</h3>
|
|
414
|
-
<form
|
|
415
|
-
class="form-grid"
|
|
416
|
-
@submit.prevent="saveParams"
|
|
417
|
-
>
|
|
418
|
-
<label class="field">
|
|
419
|
-
<span>{{ $t('daqDetail.k1iw7tbf010') }}</span>
|
|
420
|
-
<button
|
|
421
|
-
type="button"
|
|
422
|
-
class="toggle"
|
|
423
|
-
:class="{ on: form.enabled }"
|
|
424
|
-
@click="form.enabled = !form.enabled"
|
|
425
|
-
>
|
|
426
|
-
{{ form.enabled ? $t('daqDetail.k3w3j8f037') : $t('daqDetail.k3n5aaj045') }}
|
|
427
|
-
</button>
|
|
428
|
-
</label>
|
|
429
|
-
<label class="field">
|
|
430
|
-
<span>{{ $t('daqDetail.k12k23od011') }}</span>
|
|
431
|
-
<select
|
|
432
|
-
v-model="form.lineId"
|
|
433
|
-
class="input"
|
|
434
|
-
>
|
|
435
|
-
<option value="">
|
|
436
|
-
{{ $t('daqDetail.k3ootr6012') }}
|
|
437
|
-
</option>
|
|
438
|
-
<option
|
|
439
|
-
v-for="l in dcw.lines"
|
|
440
|
-
:key="l.id"
|
|
441
|
-
:value="l.id"
|
|
442
|
-
>
|
|
443
|
-
{{ l.name }}
|
|
444
|
-
</option>
|
|
445
|
-
</select>
|
|
446
|
-
</label>
|
|
447
|
-
<label class="field">
|
|
448
|
-
<span>{{ $t('daqDetail.k1l6smxo013') }}</span>
|
|
449
|
-
<select
|
|
450
|
-
v-model="form.driver"
|
|
451
|
-
class="input"
|
|
452
|
-
>
|
|
453
|
-
<option
|
|
454
|
-
v-for="d in DAQ_DRIVERS"
|
|
455
|
-
:key="d.kind"
|
|
456
|
-
:value="d.kind"
|
|
457
|
-
:disabled="d.status === 'planned'"
|
|
458
|
-
>
|
|
459
|
-
{{ d.label }}{{ d.status === 'planned' ? $t('daqDetail.kz8zr9v035') : '' }}
|
|
460
|
-
</option>
|
|
461
|
-
</select>
|
|
462
|
-
</label>
|
|
463
|
-
<label class="field row">
|
|
464
|
-
<button
|
|
465
|
-
type="button"
|
|
466
|
-
class="toggle slim"
|
|
467
|
-
:class="{ on: form.followGlobal }"
|
|
468
|
-
@click="form.followGlobal = !form.followGlobal"
|
|
469
|
-
>
|
|
470
|
-
{{ form.followGlobal ? $t('daqDetail.k1k2ueyq038') : $t('daqDetail.k1cgi8fy046') }}
|
|
471
|
-
</button>
|
|
472
|
-
<input
|
|
473
|
-
v-model.number="form.intervalMs"
|
|
474
|
-
type="number"
|
|
475
|
-
min="1000"
|
|
476
|
-
max="60000"
|
|
477
|
-
step="500"
|
|
478
|
-
class="input"
|
|
479
|
-
:disabled="form.followGlobal"
|
|
480
|
-
><small>ms</small>
|
|
481
|
-
</label>
|
|
482
|
-
<label class="field row">
|
|
483
|
-
<button
|
|
484
|
-
type="button"
|
|
485
|
-
class="toggle slim"
|
|
486
|
-
:class="{ on: form.calKind === 'linear' }"
|
|
487
|
-
title="采集标定 decoder:物理值 = scale × PLC采集值 + offset"
|
|
488
|
-
@click="form.calKind = form.calKind === 'linear' ? 'none' : 'linear'"
|
|
489
|
-
>
|
|
490
|
-
{{ form.calKind === 'linear' ? $t('daqDetail.k1eru4r1039') : $t('daqDetail.k3oktae047') }}
|
|
491
|
-
</button>
|
|
492
|
-
<input
|
|
493
|
-
v-model.number="form.calScale"
|
|
494
|
-
type="number"
|
|
495
|
-
step="0.1"
|
|
496
|
-
class="input"
|
|
497
|
-
:disabled="form.calKind !== 'linear'"
|
|
498
|
-
title="decode 斜率(≠0)"
|
|
499
|
-
>
|
|
500
|
-
<input
|
|
501
|
-
v-model.number="form.calOffset"
|
|
502
|
-
type="number"
|
|
503
|
-
step="0.1"
|
|
504
|
-
class="input"
|
|
505
|
-
:disabled="form.calKind !== 'linear'"
|
|
506
|
-
title="decode 截距"
|
|
507
|
-
><small>decoder</small>
|
|
508
|
-
</label>
|
|
509
|
-
<label class="field row">
|
|
510
|
-
<button
|
|
511
|
-
type="button"
|
|
512
|
-
class="toggle slim"
|
|
513
|
-
:class="{ on: form.publishFollow }"
|
|
514
|
-
@click="form.publishFollow = !form.publishFollow"
|
|
515
|
-
>
|
|
516
|
-
{{ form.publishFollow ? $t('daqDetail.k1k2t5o7040') : $t('daqDetail.k1cggz5f048') }}
|
|
517
|
-
</button>
|
|
518
|
-
<span
|
|
519
|
-
class="toggle slim"
|
|
520
|
-
:class="{ on: form.publishEveryFrame }"
|
|
521
|
-
style="cursor: pointer;"
|
|
522
|
-
@click="form.publishEveryFrame = !form.publishEveryFrame"
|
|
523
|
-
>{{ form.publishEveryFrame ? $t('daqDetail.k41mvv041') : $t('daqDetail.k3n42dj049') }}</span>
|
|
524
|
-
<input
|
|
525
|
-
v-model.number="form.publishMs"
|
|
526
|
-
type="number"
|
|
527
|
-
min="0"
|
|
528
|
-
max="60000"
|
|
529
|
-
step="100"
|
|
530
|
-
class="input"
|
|
531
|
-
:disabled="form.publishFollow || form.publishEveryFrame"
|
|
532
|
-
><small>ms</small>
|
|
533
|
-
</label>
|
|
534
|
-
<label class="field">
|
|
535
|
-
<span>{{ $t('daqDetail.k3x4ef014') }}</span>
|
|
536
|
-
<input
|
|
537
|
-
v-model="form.unit"
|
|
538
|
-
class="input"
|
|
539
|
-
>
|
|
540
|
-
</label>
|
|
541
|
-
<label class="field">
|
|
542
|
-
<span>{{ $t('daqDetail.k3mxmcx015') }}</span>
|
|
543
|
-
<input
|
|
544
|
-
v-model.number="form.decimals"
|
|
545
|
-
type="number"
|
|
546
|
-
min="0"
|
|
547
|
-
max="6"
|
|
548
|
-
class="input"
|
|
549
|
-
>
|
|
550
|
-
</label>
|
|
551
|
-
<div class="field-row">
|
|
552
|
-
<label class="field">
|
|
553
|
-
<span>{{ $t('daqDetail.k1l9jv5m016') }}</span>
|
|
554
|
-
<input
|
|
555
|
-
v-model.number="form.min"
|
|
556
|
-
type="number"
|
|
557
|
-
step="any"
|
|
558
|
-
class="input"
|
|
559
|
-
>
|
|
560
|
-
</label>
|
|
561
|
-
<label class="field">
|
|
562
|
-
<span>{{ $t('daqDetail.k1md63hm017') }}</span>
|
|
563
|
-
<input
|
|
564
|
-
v-model.number="form.warnLow"
|
|
565
|
-
type="number"
|
|
566
|
-
step="any"
|
|
567
|
-
class="input"
|
|
568
|
-
>
|
|
569
|
-
</label>
|
|
570
|
-
<label class="field">
|
|
571
|
-
<span>{{ $t('daqDetail.k1md63gp018') }}</span>
|
|
572
|
-
<input
|
|
573
|
-
v-model.number="form.warnHigh"
|
|
574
|
-
type="number"
|
|
575
|
-
step="any"
|
|
576
|
-
class="input"
|
|
577
|
-
>
|
|
578
|
-
</label>
|
|
579
|
-
<label class="field">
|
|
580
|
-
<span>{{ $t('daqDetail.k1l9jv4p019') }}</span>
|
|
581
|
-
<input
|
|
582
|
-
v-model.number="form.max"
|
|
583
|
-
type="number"
|
|
584
|
-
step="any"
|
|
585
|
-
class="input"
|
|
586
|
-
>
|
|
587
|
-
</label>
|
|
588
|
-
</div>
|
|
589
|
-
<button
|
|
590
|
-
class="aw-pill"
|
|
591
|
-
type="submit"
|
|
592
|
-
:disabled="saving"
|
|
593
|
-
>
|
|
594
|
-
{{ saving ? $t('daqDetail.k1as0g50042') : $t('daqDetail.ksn9cgo050') }}
|
|
595
|
-
</button>
|
|
596
|
-
</form>
|
|
597
|
-
|
|
598
|
-
<!-- 驱动连接参数(mock 空;真实协议 schema 动态表单 + 测试连接) -->
|
|
599
|
-
<template v-if="driverFields.length">
|
|
600
|
-
<h3 class="sec mt">
|
|
601
|
-
{{ $t('daqDetail.k1p9gioa033') }} {{ DAQ_DRIVERS.find(d => d.kind === form.driver)?.label }}
|
|
602
|
-
</h3>
|
|
603
|
-
<div class="driver-grid">
|
|
604
|
-
<label
|
|
605
|
-
v-for="f in driverFields"
|
|
606
|
-
:key="f.key"
|
|
607
|
-
class="field"
|
|
608
|
-
>
|
|
609
|
-
<span>{{ f.label }}<em v-if="f.required">*</em></span>
|
|
610
|
-
<select
|
|
611
|
-
v-if="f.type === 'select'"
|
|
612
|
-
v-model="driverCfg[f.key]"
|
|
613
|
-
class="input"
|
|
614
|
-
>
|
|
615
|
-
<option
|
|
616
|
-
v-for="o in f.options"
|
|
617
|
-
:key="o.value"
|
|
618
|
-
:value="o.value"
|
|
619
|
-
>
|
|
620
|
-
{{ o.label }}
|
|
621
|
-
</option>
|
|
622
|
-
</select>
|
|
623
|
-
<input
|
|
624
|
-
v-else
|
|
625
|
-
v-model="driverCfg[f.key]"
|
|
626
|
-
:type="f.type === 'number' ? 'number' : 'text'"
|
|
627
|
-
:placeholder="f.placeholder"
|
|
628
|
-
class="input"
|
|
629
|
-
>
|
|
630
|
-
</label>
|
|
631
|
-
</div>
|
|
632
|
-
<div class="test-row">
|
|
633
|
-
<button
|
|
634
|
-
class="pill-btn"
|
|
635
|
-
:disabled="testing"
|
|
636
|
-
@click="doTest"
|
|
637
|
-
>
|
|
638
|
-
{{ testing ? $t('daqDetail.k1fsh720043') : $t('daqDetail.k1fstglk051') }}
|
|
639
|
-
</button>
|
|
640
|
-
<span
|
|
641
|
-
v-if="testResult"
|
|
642
|
-
class="test-out mono"
|
|
643
|
-
:class="testResult.ok ? 'ok' : 'bad'"
|
|
644
|
-
>{{ testResult.ok ? '✓' : '✗' }} {{ testResult.message }}</span>
|
|
645
|
-
</div>
|
|
646
|
-
</template>
|
|
647
|
-
|
|
648
|
-
<h3 class="sec mt">
|
|
649
|
-
{{ $t('daqDetail.k1ie6qju020') }}
|
|
650
|
-
</h3>
|
|
651
|
-
<div class="bind-row">
|
|
652
|
-
<select
|
|
653
|
-
v-model="bindDeviceId"
|
|
654
|
-
class="input grow"
|
|
655
|
-
>
|
|
656
|
-
<option value="">
|
|
657
|
-
{{ $t('daqDetail.kjobzu3021') }}
|
|
658
|
-
</option>
|
|
659
|
-
<option
|
|
660
|
-
v-for="dv in availableDevices"
|
|
661
|
-
:key="dv.id"
|
|
662
|
-
:value="dv.id"
|
|
663
|
-
>
|
|
664
|
-
{{ dv.name }}
|
|
665
|
-
</option>
|
|
666
|
-
</select>
|
|
667
|
-
<button
|
|
668
|
-
class="pill-btn"
|
|
669
|
-
@click="onBindToggle"
|
|
670
|
-
>
|
|
671
|
-
{{ boundDeviceName ? $t('daqDetail.k479eh044') : $t('daqDetail.k452a8052') }}
|
|
672
|
-
</button>
|
|
673
|
-
</div>
|
|
674
|
-
</section>
|
|
675
|
-
|
|
676
|
-
<!-- 右列:时序库历史 -->
|
|
677
|
-
<section class="col-hist aw-tile pad">
|
|
678
|
-
<div class="hist-hd">
|
|
679
|
-
<h3 class="sec">
|
|
680
|
-
{{ $t('daqDetail.k1i535i5034') }}{{ daq.meta.tsdb }})
|
|
681
|
-
</h3>
|
|
682
|
-
<div class="hist-ctl mono">
|
|
683
|
-
<select
|
|
684
|
-
v-model.number="bucketMs"
|
|
685
|
-
class="input"
|
|
686
|
-
>
|
|
687
|
-
<option
|
|
688
|
-
v-for="b in BUCKETS"
|
|
689
|
-
:key="b.ms"
|
|
690
|
-
:value="b.ms"
|
|
691
|
-
>
|
|
692
|
-
{{ b.label }}
|
|
693
|
-
</option>
|
|
694
|
-
</select>
|
|
695
|
-
<button
|
|
696
|
-
class="pill-btn"
|
|
697
|
-
@click="loadHistory"
|
|
698
|
-
>
|
|
699
|
-
{{ $t('daqDetail.k3x1jg022') }}
|
|
700
|
-
</button>
|
|
701
|
-
</div>
|
|
702
|
-
</div>
|
|
703
|
-
<canvas
|
|
704
|
-
ref="chartCanvas"
|
|
705
|
-
class="hist-canvas"
|
|
706
|
-
/>
|
|
707
|
-
<table class="raw-table mono">
|
|
708
|
-
<thead>
|
|
709
|
-
<tr><th>{{ $t('daqDetail.k40vsf023') }}</th><th>{{ $t('daqDetail.k48v5024') }}</th><th>{{ $t('daqDetail.k4bza025') }}</th></tr>
|
|
710
|
-
</thead>
|
|
711
|
-
<tbody>
|
|
712
|
-
<tr
|
|
713
|
-
v-for="(p, i) in historyPoints.filter(r => r.value != null).slice(-12).reverse()"
|
|
714
|
-
:key="i"
|
|
715
|
-
>
|
|
716
|
-
<td>{{ new Date(p.at).toLocaleTimeString('zh-CN', { hour12: false }) }}</td>
|
|
717
|
-
<td>{{ p.value!.toFixed(node?.decimals ?? 2) }}</td>
|
|
718
|
-
<td>{{ p.state }}</td>
|
|
719
|
-
</tr>
|
|
720
|
-
</tbody>
|
|
721
|
-
</table>
|
|
722
|
-
</section>
|
|
723
|
-
</div>
|
|
724
|
-
|
|
725
|
-
<!-- 帧视图(v2 多形态信号:向量轮廓 / 图像画廊;scalar 节点不渲染) -->
|
|
726
|
-
<section
|
|
727
|
-
v-if="isFrameNode"
|
|
728
|
-
class="aw-tile pad frames-tile"
|
|
729
|
-
>
|
|
730
|
-
<div class="hist-hd">
|
|
731
|
-
<h3 class="sec">
|
|
732
|
-
{{ signalKind === 'image' ? $t('daqDetail.kfrm0001') : $t('daqDetail.kfrm0002') }}
|
|
733
|
-
<span class="mono frames-n">{{ frames.length }}</span>
|
|
734
|
-
</h3>
|
|
735
|
-
<button
|
|
736
|
-
class="pill-btn"
|
|
737
|
-
@click="loadFrames"
|
|
738
|
-
>
|
|
739
|
-
{{ $t('daqDetail.k3x1jg022') }}
|
|
740
|
-
</button>
|
|
741
|
-
</div>
|
|
742
|
-
|
|
743
|
-
<!-- 向量:最近帧轮廓 + 帧表 -->
|
|
744
|
-
<template v-if="signalKind === 'vector'">
|
|
745
|
-
<svg
|
|
746
|
-
class="vec-svg"
|
|
747
|
-
:viewBox="`0 0 ${VEC_W} ${VEC_H}`"
|
|
748
|
-
preserveAspectRatio="none"
|
|
749
|
-
>
|
|
750
|
-
<polyline
|
|
751
|
-
:points="vecPath"
|
|
752
|
-
fill="none"
|
|
753
|
-
stroke="var(--accent)"
|
|
754
|
-
stroke-width="1.5"
|
|
755
|
-
/>
|
|
756
|
-
</svg>
|
|
757
|
-
<table class="raw-table mono">
|
|
758
|
-
<thead>
|
|
759
|
-
<tr><th>{{ $t('daqDetail.k40vsf023') }}</th><th>{{ $t('daqDetail.kfrm0004') }}</th><th>{{ $t('daqDetail.kfrm0005') }}</th></tr>
|
|
760
|
-
</thead>
|
|
761
|
-
<tbody>
|
|
762
|
-
<tr
|
|
763
|
-
v-for="f in frames.filter(x => x.kind === 'vector').slice(0, 12)"
|
|
764
|
-
:key="f.at"
|
|
765
|
-
>
|
|
766
|
-
<td>{{ timeOf(f.at) }}</td>
|
|
767
|
-
<td>{{ f.points?.length ?? 0 }}</td>
|
|
768
|
-
<td>{{ metricsBrief(f) }}</td>
|
|
769
|
-
</tr>
|
|
770
|
-
</tbody>
|
|
771
|
-
</table>
|
|
772
|
-
</template>
|
|
773
|
-
|
|
774
|
-
<!-- 图像:缩略图画gallery(懒加载;点击看原图) -->
|
|
775
|
-
<template v-else>
|
|
776
|
-
<div
|
|
777
|
-
v-if="frames.length"
|
|
778
|
-
class="gal"
|
|
779
|
-
>
|
|
780
|
-
<figure
|
|
781
|
-
v-for="f in frames"
|
|
782
|
-
:key="f.at"
|
|
783
|
-
class="gal-item"
|
|
784
|
-
:title="$t('daqDetail.kfrm0006')"
|
|
785
|
-
@click="fullFrame = f"
|
|
786
|
-
>
|
|
787
|
-
<img
|
|
788
|
-
:src="f.thumbUrl"
|
|
789
|
-
loading="lazy"
|
|
790
|
-
alt="daq frame"
|
|
791
|
-
>
|
|
792
|
-
<figcaption class="mono">
|
|
793
|
-
{{ timeOf(f.at) }} · {{ metricsBrief(f) }}
|
|
794
|
-
</figcaption>
|
|
795
|
-
</figure>
|
|
796
|
-
</div>
|
|
797
|
-
<p
|
|
798
|
-
v-else
|
|
799
|
-
class="frames-empty"
|
|
800
|
-
>
|
|
801
|
-
{{ $t('daqDetail.kfrm0003') }}
|
|
802
|
-
</p>
|
|
803
|
-
<div
|
|
804
|
-
v-if="fullFrame"
|
|
805
|
-
class="gal-full"
|
|
806
|
-
@click="fullFrame = null"
|
|
807
|
-
>
|
|
808
|
-
<img
|
|
809
|
-
:src="fullFrame.contentUrl ?? fullFrame.thumbUrl"
|
|
810
|
-
alt="daq frame full"
|
|
811
|
-
>
|
|
812
|
-
</div>
|
|
813
|
-
</template>
|
|
814
|
-
</section>
|
|
815
|
-
</div>
|
|
816
|
-
</template>
|
|
817
|
-
|
|
818
|
-
<style scoped>
|
|
819
|
-
.page { padding: 4px; }
|
|
820
|
-
.back { color: var(--ink-faint); text-decoration: none; }
|
|
821
|
-
.back:hover { color: var(--accent); }
|
|
822
|
-
.aw-page-head h1 { margin: 2px 0 4px; font-size: 26px; font-weight: 400; letter-spacing: -0.01em; }
|
|
823
|
-
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
|
|
824
|
-
.sec { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
|
|
825
|
-
.mt { margin-top: 22px; }
|
|
826
|
-
.err { margin-top: 14px; font-size: 13px; color: var(--tone-danger-dot); }
|
|
827
|
-
|
|
828
|
-
.grid {
|
|
829
|
-
display: grid;
|
|
830
|
-
gap: 14px;
|
|
831
|
-
align-items: start;
|
|
832
|
-
grid-template-columns: minmax(260px, 340px) minmax(320px, 1fr) minmax(280px, 380px);
|
|
833
|
-
}
|
|
834
|
-
@media (max-width: 1100px) {
|
|
835
|
-
.grid { grid-template-columns: 1fr; }
|
|
836
|
-
}
|
|
837
|
-
.pad { padding: 16px 18px; }
|
|
838
|
-
|
|
839
|
-
/* 实时值卡 */
|
|
840
|
-
.value-card { padding: 16px 18px; }
|
|
841
|
-
.big-val { margin: 8px 0 10px; font-size: 40px; line-height: 1.1; color: var(--accent); }
|
|
842
|
-
.big-val small { margin-left: 8px; font-size: 15px; color: var(--ink-faint); }
|
|
843
|
-
.live-canvas { width: 100%; height: 64px; border: 1px solid var(--line); border-radius: var(--radius-chip); background: var(--paper-deep); }
|
|
844
|
-
.facts { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 0; }
|
|
845
|
-
.facts div { display: flex; justify-content: space-between; font-size: 11.5px; }
|
|
846
|
-
.facts dt { color: var(--ink-faint); }
|
|
847
|
-
.facts dd { margin: 0; color: var(--ink); }
|
|
848
|
-
|
|
849
|
-
/* 参数表单 */
|
|
850
|
-
.form-grid { display: flex; flex-direction: column; gap: 10px; }
|
|
851
|
-
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-faint); flex: 1; }
|
|
852
|
-
.field.row { flex-direction: row; align-items: center; gap: 8px; }
|
|
853
|
-
.field.row small { color: var(--ink-faint); }
|
|
854
|
-
.field-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
|
|
855
|
-
.input {
|
|
856
|
-
width: 100%;
|
|
857
|
-
padding: 6px 9px;
|
|
858
|
-
font-size: 12.5px;
|
|
859
|
-
color: var(--ink);
|
|
860
|
-
background: var(--paper-raised);
|
|
861
|
-
border: 1px solid var(--line-strong);
|
|
862
|
-
border-radius: var(--radius-chip);
|
|
863
|
-
}
|
|
864
|
-
.input:disabled { opacity: 0.45; }
|
|
865
|
-
.grow { flex: 1 1 auto; }
|
|
866
|
-
.toggle {
|
|
867
|
-
align-self: flex-start;
|
|
868
|
-
padding: 6px 12px;
|
|
869
|
-
font-size: 12px;
|
|
870
|
-
cursor: pointer;
|
|
871
|
-
color: var(--tone-neutral-dot);
|
|
872
|
-
background: var(--tone-neutral-bg);
|
|
873
|
-
border: 0;
|
|
874
|
-
border-radius: var(--radius-chip);
|
|
875
|
-
}
|
|
876
|
-
.toggle.on { color: var(--tone-success-dot); background: var(--tone-success-bg); }
|
|
877
|
-
.toggle.slim { padding: 6px 10px; font-size: 11.5px; }
|
|
878
|
-
.
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
.
|
|
888
|
-
.
|
|
889
|
-
.
|
|
890
|
-
.
|
|
891
|
-
.
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
.
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
.
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
.
|
|
910
|
-
.
|
|
911
|
-
.
|
|
912
|
-
.
|
|
913
|
-
|
|
914
|
-
.
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
border-radius: var(--radius-pill);
|
|
921
|
-
}
|
|
922
|
-
.st-pill.ok { color: var(--tone-success-dot); background: var(--tone-success-bg); }
|
|
923
|
-
.st-pill.warn { color: var(--tone-warning-dot); background: var(--tone-warning-bg); }
|
|
924
|
-
.st-pill.alarm { color: var(--tone-danger-dot); background: var(--tone-danger-bg); }
|
|
925
|
-
.st-pill.offline { color: var(--tone-neutral-dot); background: var(--tone-neutral-bg); }
|
|
926
|
-
|
|
927
|
-
/* 帧视图(v2 多形态) */
|
|
928
|
-
.frames-tile { margin-top: 14px; }
|
|
929
|
-
.frames-n { margin-left: 8px; color: var(--ink-faint); }
|
|
930
|
-
.vec-svg { width: 100%; height: 96px; display: block; background: var(--tone-neutral-bg); border-radius: 6px; margin-bottom: 10px; }
|
|
931
|
-
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
|
|
932
|
-
.gal-item { margin: 0; cursor: zoom-in; }
|
|
933
|
-
.gal-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; background: var(--tone-neutral-bg); }
|
|
934
|
-
.gal-item figcaption { margin-top: 4px; font-size: 11px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
935
|
-
.frames-empty { margin: 8px 0; font-size: 13px; color: var(--ink-faint); }
|
|
936
|
-
.gal-full { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgb(0 0 0 / 72%); cursor: zoom-out; }
|
|
937
|
-
.gal-full img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
|
|
938
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 数采节点控制台(/daq/[id])—— 单节点专业控制面。
|
|
4
|
+
* 实时值 + live 趋势(WS 流);参数控制(server DaqNode 单点参数:启停/周期/
|
|
5
|
+
* 驱动/量程/预警带);设备绑定;时序库历史查询(降采样桶选择)。
|
|
6
|
+
*/
|
|
7
|
+
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
|
|
8
|
+
import { useRoute } from 'vue-router'
|
|
9
|
+
import { useDcwStream } from '@/app/composables/workshop/useDcwStream'
|
|
10
|
+
import { useDaqStream, type DaqFrameLive } from '@/app/composables/workshop/useDaqStream'
|
|
11
|
+
import { useDeviceTwins } from '@/app/composables/workshop/useDeviceTwins'
|
|
12
|
+
import { daqKeyFromRef, DAQ_DRIVERS, type DaqDriverKind, type DaqNodeState, type DriverConfigField, type DriverTestResult as DaqDriverTestResult } from '#shared/daq-protocol'
|
|
13
|
+
|
|
14
|
+
const { t } = useI18n()
|
|
15
|
+
|
|
16
|
+
definePageMeta({ layout: 'default' })
|
|
17
|
+
|
|
18
|
+
const route = useRoute()
|
|
19
|
+
const nodeId = computed(() => String(route.params.id ?? ''))
|
|
20
|
+
const daq = useDaqStream()
|
|
21
|
+
const dcw = useDcwStream()
|
|
22
|
+
void dcw.load()
|
|
23
|
+
const deviceTwins = useDeviceTwins()
|
|
24
|
+
|
|
25
|
+
const node = computed(() => daq.nodeById(nodeId.value) ?? null)
|
|
26
|
+
// server 模板目录为唯一事实源:模板被删除时降级显示 key 原文,不再回退到
|
|
27
|
+
// 打包内置常量(那会渲染过期语义)
|
|
28
|
+
const tpl = computed(() => {
|
|
29
|
+
const key = node.value ? daqKeyFromRef(node.value.templateRef) : ''
|
|
30
|
+
return daq.templates.find(t => t.key === key) ?? null
|
|
31
|
+
})
|
|
32
|
+
const stateLabel: Record<DaqNodeState, string> = { ok: t('daqDetail.k41k5c026'), warn: t('daqDetail.k49z8v027'), alarm: t('daqDetail.k3xmid028'), offline: t('daqDetail.k44c2n029') }
|
|
33
|
+
const effectiveState = (): DaqNodeState => {
|
|
34
|
+
const n = node.value
|
|
35
|
+
if (!n) return 'offline'
|
|
36
|
+
if (!daq.controller.running || !n.enabled) return 'offline'
|
|
37
|
+
return n.state
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let unsub: (() => void) | null = null
|
|
41
|
+
onMounted(() => {
|
|
42
|
+
unsub = daq.ensureWsFeed()
|
|
43
|
+
void daq.load()
|
|
44
|
+
void deviceTwins.load()
|
|
45
|
+
if (isFrameNode.value) void loadFrames()
|
|
46
|
+
})
|
|
47
|
+
onBeforeUnmount(() => unsub?.())
|
|
48
|
+
|
|
49
|
+
// ---------- 帧视图(v2 多形态信号:向量轮廓 / 图像画廊;scalar 节点不渲染) ----------
|
|
50
|
+
|
|
51
|
+
const signalKind = computed(() => tpl.value?.signalKind ?? 'scalar')
|
|
52
|
+
const isFrameNode = computed(() => signalKind.value !== 'scalar')
|
|
53
|
+
const frames = computed(() => daq.framesOf(nodeId.value))
|
|
54
|
+
|
|
55
|
+
async function loadFrames(): Promise<void> {
|
|
56
|
+
if (!nodeId.value) return
|
|
57
|
+
await daq.fetchFrames(nodeId.value, { limit: 24 }).catch(() => {})
|
|
58
|
+
}
|
|
59
|
+
watch(nodeId, () => {
|
|
60
|
+
if (isFrameNode.value) void loadFrames()
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const timeOf = (at: number): string => new Date(at).toLocaleTimeString('zh-CN', { hour12: false })
|
|
64
|
+
const metricsBrief = (f: DaqFrameLive): string =>
|
|
65
|
+
Object.entries(f.metrics ?? {}).slice(0, 3).map(([k, v]) => `${k}=${v}`).join(' ')
|
|
66
|
+
|
|
67
|
+
/* 向量轮廓(最近一帧预览;SVG polyline,免 canvas 绘制循环) */
|
|
68
|
+
const VEC_W = 320
|
|
69
|
+
const VEC_H = 84
|
|
70
|
+
const latestVector = computed(() => frames.value.find(f => f.kind === 'vector' && f.points?.length))
|
|
71
|
+
const vecPath = computed(() => {
|
|
72
|
+
const pts = latestVector.value?.points ?? []
|
|
73
|
+
if (pts.length < 2) return ''
|
|
74
|
+
const min = Math.min(...pts)
|
|
75
|
+
const max = Math.max(...pts)
|
|
76
|
+
const span = max - min || 1
|
|
77
|
+
return pts
|
|
78
|
+
.map((p, i) => `${((i / (pts.length - 1)) * VEC_W).toFixed(1)},${(VEC_H - 6 - ((p - min) / span) * (VEC_H - 12)).toFixed(1)}`)
|
|
79
|
+
.join(' ')
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
/* 图像大图查看(点击缩略图;contentUrl 同源 cookie 鉴权直出) */
|
|
83
|
+
const fullFrame = ref<DaqFrameLive | null>(null)
|
|
84
|
+
|
|
85
|
+
/** WS 下发节拍展示(null=跟随全局;0=每帧;>0 独立间隔) */
|
|
86
|
+
function publishLabel(v: number | null): string {
|
|
87
|
+
if (v == null) return t('daqDetail.k9vnp9h053', { p0: daq.controller.defaultPublishIntervalMs })
|
|
88
|
+
if (v === 0) return t('daqDetail.k1m1zwux030')
|
|
89
|
+
return `${v}ms`
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---------- 参数表单(server 单点控制;变更经 PATCH 落库,node.changed 帧回灌) ----------
|
|
93
|
+
const form = reactive({
|
|
94
|
+
enabled: true,
|
|
95
|
+
driver: 'mock' as DaqDriverKind,
|
|
96
|
+
lineId: '',
|
|
97
|
+
followGlobal: true,
|
|
98
|
+
intervalMs: 5000,
|
|
99
|
+
calKind: 'none' as 'none' | 'linear',
|
|
100
|
+
calScale: 1,
|
|
101
|
+
calOffset: 0,
|
|
102
|
+
publishFollow: true,
|
|
103
|
+
publishEveryFrame: false,
|
|
104
|
+
publishMs: 1000,
|
|
105
|
+
unit: '',
|
|
106
|
+
decimals: 1,
|
|
107
|
+
min: 0,
|
|
108
|
+
max: 100,
|
|
109
|
+
warnLow: null as number | null,
|
|
110
|
+
warnHigh: null as number | null,
|
|
111
|
+
})
|
|
112
|
+
watch(node, (n) => {
|
|
113
|
+
if (!n) return
|
|
114
|
+
form.enabled = n.enabled
|
|
115
|
+
form.lineId = n.lineId ?? ''
|
|
116
|
+
form.driver = n.driver
|
|
117
|
+
form.followGlobal = n.intervalMs == null
|
|
118
|
+
form.intervalMs = n.intervalMs ?? daq.controller.defaultIntervalMs
|
|
119
|
+
// WS 下发节拍:null=跟随全局;0=每帧;>0 独立间隔
|
|
120
|
+
form.publishFollow = n.publishIntervalMs == null
|
|
121
|
+
form.publishEveryFrame = n.publishIntervalMs === 0
|
|
122
|
+
form.publishMs = n.publishIntervalMs == null ? daq.controller.defaultPublishIntervalMs : n.publishIntervalMs
|
|
123
|
+
form.unit = n.unit
|
|
124
|
+
form.decimals = n.decimals
|
|
125
|
+
form.min = n.min
|
|
126
|
+
form.max = n.max
|
|
127
|
+
form.warnLow = n.warnLow
|
|
128
|
+
form.warnHigh = n.warnHigh
|
|
129
|
+
}, { immediate: true })
|
|
130
|
+
|
|
131
|
+
// 驱动连接参数编辑(真实协议:host/register/endpoint...;schema 驱动渲染)
|
|
132
|
+
const driverCfg = ref<Record<string, string | number>>({})
|
|
133
|
+
const driverFields = computed<DriverConfigField[]>(() =>
|
|
134
|
+
DAQ_DRIVERS.find(d => d.kind === form.driver)?.configFields ?? [])
|
|
135
|
+
watch(node, (n) => {
|
|
136
|
+
if (n) driverCfg.value = { ...(n.driverConfig as Record<string, string | number>) }
|
|
137
|
+
}, { immediate: true })
|
|
138
|
+
watch(() => form.driver, () => {
|
|
139
|
+
// 切换协议且目标无参数 → 填 schema 缺省
|
|
140
|
+
if (driverFields.value.length && Object.keys(driverCfg.value).length === 0) {
|
|
141
|
+
const cfg: Record<string, string | number> = {}
|
|
142
|
+
for (const f of driverFields.value) if (f.default !== undefined) cfg[f.key] = f.default as string | number
|
|
143
|
+
driverCfg.value = cfg
|
|
144
|
+
}
|
|
145
|
+
}, { immediate: true })
|
|
146
|
+
const testing = ref(false)
|
|
147
|
+
const testResult = ref<DaqDriverTestResult | null>(null)
|
|
148
|
+
async function doTest(): Promise<void> {
|
|
149
|
+
testing.value = true
|
|
150
|
+
testResult.value = null
|
|
151
|
+
try {
|
|
152
|
+
// 先保存当前驱动与参数,再测(测存量节点 = 测已落库配置)
|
|
153
|
+
await daq.patchNode(nodeId.value, { driver: form.driver, driverConfig: { ...driverCfg.value } })
|
|
154
|
+
testResult.value = await daq.testNode(nodeId.value)
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
testResult.value = { ok: false, message: apiErrorMessage(err) }
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
testing.value = false
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const saving = ref(false)
|
|
165
|
+
async function saveParams(): Promise<void> {
|
|
166
|
+
const n = node.value
|
|
167
|
+
if (!n || saving.value) return
|
|
168
|
+
saving.value = true
|
|
169
|
+
try {
|
|
170
|
+
await daq.patchNode(n.id, {
|
|
171
|
+
enabled: form.enabled,
|
|
172
|
+
driver: form.driver,
|
|
173
|
+
lineId: form.lineId,
|
|
174
|
+
driverConfig: { ...driverCfg.value },
|
|
175
|
+
intervalMs: form.followGlobal ? null : Math.max(1000, Math.min(60_000, Math.round(form.intervalMs))),
|
|
176
|
+
publishIntervalMs: form.publishFollow
|
|
177
|
+
? null
|
|
178
|
+
: (form.publishEveryFrame ? 0 : Math.max(0, Math.min(60_000, Math.round(form.publishMs)))),
|
|
179
|
+
unit: form.unit,
|
|
180
|
+
decimals: Math.max(0, Math.min(6, Math.round(form.decimals))),
|
|
181
|
+
min: form.min,
|
|
182
|
+
max: form.max,
|
|
183
|
+
warnLow: form.warnLow,
|
|
184
|
+
warnHigh: form.warnHigh,
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
saving.value = false
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** 驱动是否为预留协议(meta status=planned) */
|
|
193
|
+
function driverPlanned(kind: string): boolean {
|
|
194
|
+
return daq.meta.drivers.find(d => d.kind === kind)?.status === 'planned'
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// ---------- 设备绑定 ----------
|
|
198
|
+
const bindDeviceId = ref('')
|
|
199
|
+
const boundDeviceName = computed(() => {
|
|
200
|
+
const ids = node.value?.deviceIds ?? (node.value?.deviceBindingId ? [node.value.deviceBindingId] : [])
|
|
201
|
+
return ids
|
|
202
|
+
.map(id => deviceTwins.twins.find(t => t.id === id)?.name ?? `${id.slice(0, 8)}…`)
|
|
203
|
+
.join(' / ')
|
|
204
|
+
})
|
|
205
|
+
function onBindToggle(): void {
|
|
206
|
+
void daq.bindNode(nodeId.value, node.value?.deviceBindingId ? null : (bindDeviceId.value || null))
|
|
207
|
+
}
|
|
208
|
+
const availableDevices = computed(() =>
|
|
209
|
+
deviceTwins.twins.filter(t => t.kind !== 'daq' && t.id !== node.value?.id),
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
// ---------- 历史(时序库) ----------
|
|
213
|
+
type ChartRow = { at: number, value?: number, avg?: number, min?: number, max?: number }
|
|
214
|
+
const historyPoints = ref<ChartRow[]>([])
|
|
215
|
+
const bucketMs = ref<number>(15000)
|
|
216
|
+
const histLoading = ref(false)
|
|
217
|
+
const BUCKETS = [
|
|
218
|
+
{ label: '1s 桶', ms: 1000 },
|
|
219
|
+
{ label: '5s 桶', ms: 5000 },
|
|
220
|
+
{ label: '15s 桶(默认)', ms: 15000 },
|
|
221
|
+
{ label: '30s 桶', ms: 30000 },
|
|
222
|
+
{ label: '1min 桶', ms: 60000 },
|
|
223
|
+
]
|
|
224
|
+
async function loadHistory(): Promise<void> {
|
|
225
|
+
if (!nodeId.value) return
|
|
226
|
+
histLoading.value = true
|
|
227
|
+
try {
|
|
228
|
+
const pts = await daq.samplesOf(nodeId.value, {
|
|
229
|
+
toMs: Date.now(),
|
|
230
|
+
bucketMs: bucketMs.value || undefined,
|
|
231
|
+
limit: 400,
|
|
232
|
+
})
|
|
233
|
+
// 接口 DESC 返回 → 图表时间正序
|
|
234
|
+
historyPoints.value = [...pts].reverse() as ChartRow[]
|
|
235
|
+
}
|
|
236
|
+
finally {
|
|
237
|
+
histLoading.value = false
|
|
238
|
+
drawChart()
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const chartCanvas = ref<HTMLCanvasElement | null>(null)
|
|
243
|
+
const trendColor = '#35e0a0'
|
|
244
|
+
const gridColor = 'rgba(120,135,160,0.18)'
|
|
245
|
+
const inkColor = 'rgba(140,155,175,0.8)'
|
|
246
|
+
function drawChart(): void {
|
|
247
|
+
const cv = chartCanvas.value
|
|
248
|
+
if (!cv) return
|
|
249
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2)
|
|
250
|
+
const w = cv.clientWidth
|
|
251
|
+
const h = cv.clientHeight
|
|
252
|
+
if (cv.width !== w * dpr || cv.height !== h * dpr) {
|
|
253
|
+
cv.width = w * dpr
|
|
254
|
+
cv.height = h * dpr
|
|
255
|
+
}
|
|
256
|
+
const ctx = cv.getContext('2d')
|
|
257
|
+
if (!ctx) return
|
|
258
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0)
|
|
259
|
+
ctx.clearRect(0, 0, w, h)
|
|
260
|
+
for (let i = 1; i < 4; i++) {
|
|
261
|
+
ctx.strokeStyle = gridColor
|
|
262
|
+
ctx.beginPath()
|
|
263
|
+
ctx.moveTo(0, (h / 4) * i)
|
|
264
|
+
ctx.lineTo(w, (h / 4) * i)
|
|
265
|
+
ctx.stroke()
|
|
266
|
+
}
|
|
267
|
+
const rows = historyPoints.value
|
|
268
|
+
if (rows.length < 2) return
|
|
269
|
+
let lo = Number.POSITIVE_INFINITY
|
|
270
|
+
let hi = Number.NEGATIVE_INFINITY
|
|
271
|
+
for (const r of rows) {
|
|
272
|
+
const v = r.value ?? r.avg ?? r.min ?? 0
|
|
273
|
+
lo = Math.min(lo, v)
|
|
274
|
+
hi = Math.max(hi, v)
|
|
275
|
+
}
|
|
276
|
+
const span = Math.max(hi - lo, 1e-9)
|
|
277
|
+
ctx.strokeStyle = inkColor
|
|
278
|
+
ctx.font = '10px monospace'
|
|
279
|
+
ctx.fillStyle = inkColor
|
|
280
|
+
ctx.fillText(hi.toFixed(2), 4, 11)
|
|
281
|
+
ctx.fillText(lo.toFixed(2), 4, h - 4)
|
|
282
|
+
ctx.strokeStyle = trendColor
|
|
283
|
+
ctx.lineWidth = 1.6
|
|
284
|
+
ctx.beginPath()
|
|
285
|
+
rows.forEach((r, i) => {
|
|
286
|
+
const x = (i / (rows.length - 1)) * w
|
|
287
|
+
const y = h - (((r.value ?? r.avg ?? 0) - lo) / span) * (h - 16) - 8
|
|
288
|
+
if (i === 0) ctx.moveTo(x, y)
|
|
289
|
+
else ctx.lineTo(x, y)
|
|
290
|
+
})
|
|
291
|
+
ctx.stroke()
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** live 趋势(WS hist 环形缓冲;独立小画布,与历史图互补) */
|
|
295
|
+
const liveCanvas = ref<HTMLCanvasElement | null>(null)
|
|
296
|
+
let uiTimer: ReturnType<typeof setInterval> | null = null
|
|
297
|
+
function drawLive(): void {
|
|
298
|
+
const cv = liveCanvas.value
|
|
299
|
+
const n = node.value
|
|
300
|
+
if (!cv || !n || n.hist.length < 2) return
|
|
301
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2)
|
|
302
|
+
const w = cv.clientWidth
|
|
303
|
+
const h = cv.clientHeight
|
|
304
|
+
if (cv.width !== w * dpr || cv.height !== h * dpr) {
|
|
305
|
+
cv.width = w * dpr
|
|
306
|
+
cv.height = h * dpr
|
|
307
|
+
}
|
|
308
|
+
const ctx = cv.getContext('2d')
|
|
309
|
+
if (!ctx) return
|
|
310
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0)
|
|
311
|
+
ctx.clearRect(0, 0, w, h)
|
|
312
|
+
const hi = Math.max(...n.hist)
|
|
313
|
+
const lo = Math.min(...n.hist)
|
|
314
|
+
const span = Math.max(hi - lo, 1e-9)
|
|
315
|
+
ctx.strokeStyle = 'rgba(65,200,244,0.9)'
|
|
316
|
+
ctx.lineWidth = 1.5
|
|
317
|
+
ctx.beginPath()
|
|
318
|
+
n.hist.forEach((v, i) => {
|
|
319
|
+
const x = (i / (n.hist.length - 1)) * w
|
|
320
|
+
const y = h - ((v - lo) / span) * (h - 6) - 3
|
|
321
|
+
if (i === 0) ctx.moveTo(x, y)
|
|
322
|
+
else ctx.lineTo(x, y)
|
|
323
|
+
})
|
|
324
|
+
ctx.stroke()
|
|
325
|
+
}
|
|
326
|
+
onMounted(() => {
|
|
327
|
+
void loadHistory()
|
|
328
|
+
// live 趋势重绘循环(仅浏览器;SSR 安全)
|
|
329
|
+
uiTimer = setInterval(() => {
|
|
330
|
+
drawLive()
|
|
331
|
+
}, 800)
|
|
332
|
+
})
|
|
333
|
+
onBeforeUnmount(() => {
|
|
334
|
+
if (uiTimer) clearInterval(uiTimer)
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
watch(bucketMs, () => void loadHistory())
|
|
338
|
+
</script>
|
|
339
|
+
|
|
340
|
+
<template>
|
|
341
|
+
<div class="page">
|
|
342
|
+
<p class="aw-kicker">
|
|
343
|
+
<NuxtLink
|
|
344
|
+
to="/daq"
|
|
345
|
+
class="back"
|
|
346
|
+
>{{ $t('daqDetail.k1emg364001') }}</NuxtLink> / NODE {{ nodeId.slice(0, 8).toUpperCase() }}
|
|
347
|
+
</p>
|
|
348
|
+
<div class="aw-page-head">
|
|
349
|
+
<h1>{{ node?.name ?? nodeId }}</h1>
|
|
350
|
+
<span
|
|
351
|
+
class="st-pill"
|
|
352
|
+
:class="[effectiveState()]"
|
|
353
|
+
>{{ stateLabel[effectiveState()] }}</span>
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
<p
|
|
357
|
+
v-if="!node && daq.error"
|
|
358
|
+
class="err"
|
|
359
|
+
>
|
|
360
|
+
{{ daq.error }}(<NuxtLink to="/workshop">{{ $t('daqDetail.k1bhhheq002') }}</NuxtLink>)
|
|
361
|
+
</p>
|
|
362
|
+
|
|
363
|
+
<div
|
|
364
|
+
v-if="node"
|
|
365
|
+
class="grid"
|
|
366
|
+
>
|
|
367
|
+
<!-- 左列:实时状态卡 -->
|
|
368
|
+
<section class="col-live">
|
|
369
|
+
<div class="aw-tile value-card">
|
|
370
|
+
<p class="aw-kicker">
|
|
371
|
+
{{ $t('daqDetail.k1fx2vik032') }} {{ tpl?.ch ?? '-' }}
|
|
372
|
+
</p>
|
|
373
|
+
<div class="big-val mono">
|
|
374
|
+
{{ node.value != null ? node.value.toFixed(node.decimals) : '--' }}<small>{{ node.unit }}</small>
|
|
375
|
+
</div>
|
|
376
|
+
<canvas
|
|
377
|
+
ref="liveCanvas"
|
|
378
|
+
class="live-canvas"
|
|
379
|
+
/>
|
|
380
|
+
<dl class="facts mono">
|
|
381
|
+
<div>
|
|
382
|
+
<dt>{{ $t('daqDetail.k4a0la003') }}</dt>
|
|
383
|
+
<dd>{{ node.driver }}{{ driverPlanned(node.driver) ? $t('daqDetail.kz8zr9v035') : '' }}</dd>
|
|
384
|
+
</div>
|
|
385
|
+
<div>
|
|
386
|
+
<dt>{{ $t('daqDetail.k3xg3w004') }}</dt>
|
|
387
|
+
<dd>{{ node.intervalMs ?? $t('daqDetail.k9vnp9h053', { p0: daq.controller.defaultIntervalMs }) }}</dd>
|
|
388
|
+
</div>
|
|
389
|
+
<div>
|
|
390
|
+
<dt>{{ $t('daqDetail.k3w6td005') }}</dt>
|
|
391
|
+
<dd>{{ publishLabel(node.publishIntervalMs) }}</dd>
|
|
392
|
+
</div>
|
|
393
|
+
<div>
|
|
394
|
+
<dt>{{ $t('daqDetail.k3x5tpx006') }}</dt>
|
|
395
|
+
<dd>{{ node.warnLow ?? '-∞' }} ~ {{ node.warnHigh ?? '+∞' }}</dd>
|
|
396
|
+
</div>
|
|
397
|
+
<div>
|
|
398
|
+
<dt>{{ $t('daqDetail.k1hjj0jf007') }}</dt>
|
|
399
|
+
<dd>{{ node.min }} ~ {{ node.max }}</dd>
|
|
400
|
+
</div>
|
|
401
|
+
<div>
|
|
402
|
+
<dt>{{ $t('daqDetail.k1i8rtqt008') }}</dt>
|
|
403
|
+
<dd>{{ boundDeviceName || $t('daqDetail.k3own4q036') }}</dd>
|
|
404
|
+
</div>
|
|
405
|
+
</dl>
|
|
406
|
+
</div>
|
|
407
|
+
</section>
|
|
408
|
+
|
|
409
|
+
<!-- 中列:参数控制 -->
|
|
410
|
+
<section class="col-form aw-tile pad">
|
|
411
|
+
<h3 class="sec">
|
|
412
|
+
{{ $t('daqDetail.kd9d69j009') }}
|
|
413
|
+
</h3>
|
|
414
|
+
<form
|
|
415
|
+
class="form-grid"
|
|
416
|
+
@submit.prevent="saveParams"
|
|
417
|
+
>
|
|
418
|
+
<label class="field">
|
|
419
|
+
<span>{{ $t('daqDetail.k1iw7tbf010') }}</span>
|
|
420
|
+
<button
|
|
421
|
+
type="button"
|
|
422
|
+
class="toggle"
|
|
423
|
+
:class="{ on: form.enabled }"
|
|
424
|
+
@click="form.enabled = !form.enabled"
|
|
425
|
+
>
|
|
426
|
+
{{ form.enabled ? $t('daqDetail.k3w3j8f037') : $t('daqDetail.k3n5aaj045') }}
|
|
427
|
+
</button>
|
|
428
|
+
</label>
|
|
429
|
+
<label class="field">
|
|
430
|
+
<span>{{ $t('daqDetail.k12k23od011') }}</span>
|
|
431
|
+
<select
|
|
432
|
+
v-model="form.lineId"
|
|
433
|
+
class="input"
|
|
434
|
+
>
|
|
435
|
+
<option value="">
|
|
436
|
+
{{ $t('daqDetail.k3ootr6012') }}
|
|
437
|
+
</option>
|
|
438
|
+
<option
|
|
439
|
+
v-for="l in dcw.lines"
|
|
440
|
+
:key="l.id"
|
|
441
|
+
:value="l.id"
|
|
442
|
+
>
|
|
443
|
+
{{ l.name }}
|
|
444
|
+
</option>
|
|
445
|
+
</select>
|
|
446
|
+
</label>
|
|
447
|
+
<label class="field">
|
|
448
|
+
<span>{{ $t('daqDetail.k1l6smxo013') }}</span>
|
|
449
|
+
<select
|
|
450
|
+
v-model="form.driver"
|
|
451
|
+
class="input"
|
|
452
|
+
>
|
|
453
|
+
<option
|
|
454
|
+
v-for="d in DAQ_DRIVERS"
|
|
455
|
+
:key="d.kind"
|
|
456
|
+
:value="d.kind"
|
|
457
|
+
:disabled="d.status === 'planned'"
|
|
458
|
+
>
|
|
459
|
+
{{ d.label }}{{ d.status === 'planned' ? $t('daqDetail.kz8zr9v035') : '' }}
|
|
460
|
+
</option>
|
|
461
|
+
</select>
|
|
462
|
+
</label>
|
|
463
|
+
<label class="field row">
|
|
464
|
+
<button
|
|
465
|
+
type="button"
|
|
466
|
+
class="toggle slim"
|
|
467
|
+
:class="{ on: form.followGlobal }"
|
|
468
|
+
@click="form.followGlobal = !form.followGlobal"
|
|
469
|
+
>
|
|
470
|
+
{{ form.followGlobal ? $t('daqDetail.k1k2ueyq038') : $t('daqDetail.k1cgi8fy046') }}
|
|
471
|
+
</button>
|
|
472
|
+
<input
|
|
473
|
+
v-model.number="form.intervalMs"
|
|
474
|
+
type="number"
|
|
475
|
+
min="1000"
|
|
476
|
+
max="60000"
|
|
477
|
+
step="500"
|
|
478
|
+
class="input"
|
|
479
|
+
:disabled="form.followGlobal"
|
|
480
|
+
><small>ms</small>
|
|
481
|
+
</label>
|
|
482
|
+
<label class="field row">
|
|
483
|
+
<button
|
|
484
|
+
type="button"
|
|
485
|
+
class="toggle slim"
|
|
486
|
+
:class="{ on: form.calKind === 'linear' }"
|
|
487
|
+
title="采集标定 decoder:物理值 = scale × PLC采集值 + offset"
|
|
488
|
+
@click="form.calKind = form.calKind === 'linear' ? 'none' : 'linear'"
|
|
489
|
+
>
|
|
490
|
+
{{ form.calKind === 'linear' ? $t('daqDetail.k1eru4r1039') : $t('daqDetail.k3oktae047') }}
|
|
491
|
+
</button>
|
|
492
|
+
<input
|
|
493
|
+
v-model.number="form.calScale"
|
|
494
|
+
type="number"
|
|
495
|
+
step="0.1"
|
|
496
|
+
class="input"
|
|
497
|
+
:disabled="form.calKind !== 'linear'"
|
|
498
|
+
title="decode 斜率(≠0)"
|
|
499
|
+
>
|
|
500
|
+
<input
|
|
501
|
+
v-model.number="form.calOffset"
|
|
502
|
+
type="number"
|
|
503
|
+
step="0.1"
|
|
504
|
+
class="input"
|
|
505
|
+
:disabled="form.calKind !== 'linear'"
|
|
506
|
+
title="decode 截距"
|
|
507
|
+
><small>decoder</small>
|
|
508
|
+
</label>
|
|
509
|
+
<label class="field row">
|
|
510
|
+
<button
|
|
511
|
+
type="button"
|
|
512
|
+
class="toggle slim"
|
|
513
|
+
:class="{ on: form.publishFollow }"
|
|
514
|
+
@click="form.publishFollow = !form.publishFollow"
|
|
515
|
+
>
|
|
516
|
+
{{ form.publishFollow ? $t('daqDetail.k1k2t5o7040') : $t('daqDetail.k1cggz5f048') }}
|
|
517
|
+
</button>
|
|
518
|
+
<span
|
|
519
|
+
class="toggle slim"
|
|
520
|
+
:class="{ on: form.publishEveryFrame }"
|
|
521
|
+
style="cursor: pointer;"
|
|
522
|
+
@click="form.publishEveryFrame = !form.publishEveryFrame"
|
|
523
|
+
>{{ form.publishEveryFrame ? $t('daqDetail.k41mvv041') : $t('daqDetail.k3n42dj049') }}</span>
|
|
524
|
+
<input
|
|
525
|
+
v-model.number="form.publishMs"
|
|
526
|
+
type="number"
|
|
527
|
+
min="0"
|
|
528
|
+
max="60000"
|
|
529
|
+
step="100"
|
|
530
|
+
class="input"
|
|
531
|
+
:disabled="form.publishFollow || form.publishEveryFrame"
|
|
532
|
+
><small>ms</small>
|
|
533
|
+
</label>
|
|
534
|
+
<label class="field">
|
|
535
|
+
<span>{{ $t('daqDetail.k3x4ef014') }}</span>
|
|
536
|
+
<input
|
|
537
|
+
v-model="form.unit"
|
|
538
|
+
class="input"
|
|
539
|
+
>
|
|
540
|
+
</label>
|
|
541
|
+
<label class="field">
|
|
542
|
+
<span>{{ $t('daqDetail.k3mxmcx015') }}</span>
|
|
543
|
+
<input
|
|
544
|
+
v-model.number="form.decimals"
|
|
545
|
+
type="number"
|
|
546
|
+
min="0"
|
|
547
|
+
max="6"
|
|
548
|
+
class="input"
|
|
549
|
+
>
|
|
550
|
+
</label>
|
|
551
|
+
<div class="field-row">
|
|
552
|
+
<label class="field">
|
|
553
|
+
<span>{{ $t('daqDetail.k1l9jv5m016') }}</span>
|
|
554
|
+
<input
|
|
555
|
+
v-model.number="form.min"
|
|
556
|
+
type="number"
|
|
557
|
+
step="any"
|
|
558
|
+
class="input"
|
|
559
|
+
>
|
|
560
|
+
</label>
|
|
561
|
+
<label class="field">
|
|
562
|
+
<span>{{ $t('daqDetail.k1md63hm017') }}</span>
|
|
563
|
+
<input
|
|
564
|
+
v-model.number="form.warnLow"
|
|
565
|
+
type="number"
|
|
566
|
+
step="any"
|
|
567
|
+
class="input"
|
|
568
|
+
>
|
|
569
|
+
</label>
|
|
570
|
+
<label class="field">
|
|
571
|
+
<span>{{ $t('daqDetail.k1md63gp018') }}</span>
|
|
572
|
+
<input
|
|
573
|
+
v-model.number="form.warnHigh"
|
|
574
|
+
type="number"
|
|
575
|
+
step="any"
|
|
576
|
+
class="input"
|
|
577
|
+
>
|
|
578
|
+
</label>
|
|
579
|
+
<label class="field">
|
|
580
|
+
<span>{{ $t('daqDetail.k1l9jv4p019') }}</span>
|
|
581
|
+
<input
|
|
582
|
+
v-model.number="form.max"
|
|
583
|
+
type="number"
|
|
584
|
+
step="any"
|
|
585
|
+
class="input"
|
|
586
|
+
>
|
|
587
|
+
</label>
|
|
588
|
+
</div>
|
|
589
|
+
<button
|
|
590
|
+
class="aw-pill"
|
|
591
|
+
type="submit"
|
|
592
|
+
:disabled="saving"
|
|
593
|
+
>
|
|
594
|
+
{{ saving ? $t('daqDetail.k1as0g50042') : $t('daqDetail.ksn9cgo050') }}
|
|
595
|
+
</button>
|
|
596
|
+
</form>
|
|
597
|
+
|
|
598
|
+
<!-- 驱动连接参数(mock 空;真实协议 schema 动态表单 + 测试连接) -->
|
|
599
|
+
<template v-if="driverFields.length">
|
|
600
|
+
<h3 class="sec mt">
|
|
601
|
+
{{ $t('daqDetail.k1p9gioa033') }} {{ DAQ_DRIVERS.find(d => d.kind === form.driver)?.label }}
|
|
602
|
+
</h3>
|
|
603
|
+
<div class="driver-grid">
|
|
604
|
+
<label
|
|
605
|
+
v-for="f in driverFields"
|
|
606
|
+
:key="f.key"
|
|
607
|
+
class="field"
|
|
608
|
+
>
|
|
609
|
+
<span>{{ f.label }}<em v-if="f.required">*</em></span>
|
|
610
|
+
<select
|
|
611
|
+
v-if="f.type === 'select'"
|
|
612
|
+
v-model="driverCfg[f.key]"
|
|
613
|
+
class="input"
|
|
614
|
+
>
|
|
615
|
+
<option
|
|
616
|
+
v-for="o in f.options"
|
|
617
|
+
:key="o.value"
|
|
618
|
+
:value="o.value"
|
|
619
|
+
>
|
|
620
|
+
{{ o.label }}
|
|
621
|
+
</option>
|
|
622
|
+
</select>
|
|
623
|
+
<input
|
|
624
|
+
v-else
|
|
625
|
+
v-model="driverCfg[f.key]"
|
|
626
|
+
:type="f.type === 'number' ? 'number' : 'text'"
|
|
627
|
+
:placeholder="f.placeholder"
|
|
628
|
+
class="input"
|
|
629
|
+
>
|
|
630
|
+
</label>
|
|
631
|
+
</div>
|
|
632
|
+
<div class="test-row">
|
|
633
|
+
<button
|
|
634
|
+
class="pill-btn"
|
|
635
|
+
:disabled="testing"
|
|
636
|
+
@click="doTest"
|
|
637
|
+
>
|
|
638
|
+
{{ testing ? $t('daqDetail.k1fsh720043') : $t('daqDetail.k1fstglk051') }}
|
|
639
|
+
</button>
|
|
640
|
+
<span
|
|
641
|
+
v-if="testResult"
|
|
642
|
+
class="test-out mono"
|
|
643
|
+
:class="testResult.ok ? 'ok' : 'bad'"
|
|
644
|
+
>{{ testResult.ok ? '✓' : '✗' }} {{ testResult.message }}</span>
|
|
645
|
+
</div>
|
|
646
|
+
</template>
|
|
647
|
+
|
|
648
|
+
<h3 class="sec mt">
|
|
649
|
+
{{ $t('daqDetail.k1ie6qju020') }}
|
|
650
|
+
</h3>
|
|
651
|
+
<div class="bind-row">
|
|
652
|
+
<select
|
|
653
|
+
v-model="bindDeviceId"
|
|
654
|
+
class="input grow"
|
|
655
|
+
>
|
|
656
|
+
<option value="">
|
|
657
|
+
{{ $t('daqDetail.kjobzu3021') }}
|
|
658
|
+
</option>
|
|
659
|
+
<option
|
|
660
|
+
v-for="dv in availableDevices"
|
|
661
|
+
:key="dv.id"
|
|
662
|
+
:value="dv.id"
|
|
663
|
+
>
|
|
664
|
+
{{ dv.name }}
|
|
665
|
+
</option>
|
|
666
|
+
</select>
|
|
667
|
+
<button
|
|
668
|
+
class="pill-btn"
|
|
669
|
+
@click="onBindToggle"
|
|
670
|
+
>
|
|
671
|
+
{{ boundDeviceName ? $t('daqDetail.k479eh044') : $t('daqDetail.k452a8052') }}
|
|
672
|
+
</button>
|
|
673
|
+
</div>
|
|
674
|
+
</section>
|
|
675
|
+
|
|
676
|
+
<!-- 右列:时序库历史 -->
|
|
677
|
+
<section class="col-hist aw-tile pad">
|
|
678
|
+
<div class="hist-hd">
|
|
679
|
+
<h3 class="sec">
|
|
680
|
+
{{ $t('daqDetail.k1i535i5034') }}{{ daq.meta.tsdb }})
|
|
681
|
+
</h3>
|
|
682
|
+
<div class="hist-ctl mono">
|
|
683
|
+
<select
|
|
684
|
+
v-model.number="bucketMs"
|
|
685
|
+
class="input"
|
|
686
|
+
>
|
|
687
|
+
<option
|
|
688
|
+
v-for="b in BUCKETS"
|
|
689
|
+
:key="b.ms"
|
|
690
|
+
:value="b.ms"
|
|
691
|
+
>
|
|
692
|
+
{{ b.label }}
|
|
693
|
+
</option>
|
|
694
|
+
</select>
|
|
695
|
+
<button
|
|
696
|
+
class="pill-btn"
|
|
697
|
+
@click="loadHistory"
|
|
698
|
+
>
|
|
699
|
+
{{ $t('daqDetail.k3x1jg022') }}
|
|
700
|
+
</button>
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
<canvas
|
|
704
|
+
ref="chartCanvas"
|
|
705
|
+
class="hist-canvas"
|
|
706
|
+
/>
|
|
707
|
+
<table class="raw-table mono">
|
|
708
|
+
<thead>
|
|
709
|
+
<tr><th>{{ $t('daqDetail.k40vsf023') }}</th><th>{{ $t('daqDetail.k48v5024') }}</th><th>{{ $t('daqDetail.k4bza025') }}</th></tr>
|
|
710
|
+
</thead>
|
|
711
|
+
<tbody>
|
|
712
|
+
<tr
|
|
713
|
+
v-for="(p, i) in historyPoints.filter(r => r.value != null).slice(-12).reverse()"
|
|
714
|
+
:key="i"
|
|
715
|
+
>
|
|
716
|
+
<td>{{ new Date(p.at).toLocaleTimeString('zh-CN', { hour12: false }) }}</td>
|
|
717
|
+
<td>{{ p.value!.toFixed(node?.decimals ?? 2) }}</td>
|
|
718
|
+
<td>{{ p.state }}</td>
|
|
719
|
+
</tr>
|
|
720
|
+
</tbody>
|
|
721
|
+
</table>
|
|
722
|
+
</section>
|
|
723
|
+
</div>
|
|
724
|
+
|
|
725
|
+
<!-- 帧视图(v2 多形态信号:向量轮廓 / 图像画廊;scalar 节点不渲染) -->
|
|
726
|
+
<section
|
|
727
|
+
v-if="isFrameNode"
|
|
728
|
+
class="aw-tile pad frames-tile"
|
|
729
|
+
>
|
|
730
|
+
<div class="hist-hd">
|
|
731
|
+
<h3 class="sec">
|
|
732
|
+
{{ signalKind === 'image' ? $t('daqDetail.kfrm0001') : $t('daqDetail.kfrm0002') }}
|
|
733
|
+
<span class="mono frames-n">{{ frames.length }}</span>
|
|
734
|
+
</h3>
|
|
735
|
+
<button
|
|
736
|
+
class="pill-btn"
|
|
737
|
+
@click="loadFrames"
|
|
738
|
+
>
|
|
739
|
+
{{ $t('daqDetail.k3x1jg022') }}
|
|
740
|
+
</button>
|
|
741
|
+
</div>
|
|
742
|
+
|
|
743
|
+
<!-- 向量:最近帧轮廓 + 帧表 -->
|
|
744
|
+
<template v-if="signalKind === 'vector'">
|
|
745
|
+
<svg
|
|
746
|
+
class="vec-svg"
|
|
747
|
+
:viewBox="`0 0 ${VEC_W} ${VEC_H}`"
|
|
748
|
+
preserveAspectRatio="none"
|
|
749
|
+
>
|
|
750
|
+
<polyline
|
|
751
|
+
:points="vecPath"
|
|
752
|
+
fill="none"
|
|
753
|
+
stroke="var(--accent)"
|
|
754
|
+
stroke-width="1.5"
|
|
755
|
+
/>
|
|
756
|
+
</svg>
|
|
757
|
+
<table class="raw-table mono">
|
|
758
|
+
<thead>
|
|
759
|
+
<tr><th>{{ $t('daqDetail.k40vsf023') }}</th><th>{{ $t('daqDetail.kfrm0004') }}</th><th>{{ $t('daqDetail.kfrm0005') }}</th></tr>
|
|
760
|
+
</thead>
|
|
761
|
+
<tbody>
|
|
762
|
+
<tr
|
|
763
|
+
v-for="f in frames.filter(x => x.kind === 'vector').slice(0, 12)"
|
|
764
|
+
:key="f.at"
|
|
765
|
+
>
|
|
766
|
+
<td>{{ timeOf(f.at) }}</td>
|
|
767
|
+
<td>{{ f.points?.length ?? 0 }}</td>
|
|
768
|
+
<td>{{ metricsBrief(f) }}</td>
|
|
769
|
+
</tr>
|
|
770
|
+
</tbody>
|
|
771
|
+
</table>
|
|
772
|
+
</template>
|
|
773
|
+
|
|
774
|
+
<!-- 图像:缩略图画gallery(懒加载;点击看原图) -->
|
|
775
|
+
<template v-else>
|
|
776
|
+
<div
|
|
777
|
+
v-if="frames.length"
|
|
778
|
+
class="gal"
|
|
779
|
+
>
|
|
780
|
+
<figure
|
|
781
|
+
v-for="f in frames"
|
|
782
|
+
:key="f.at"
|
|
783
|
+
class="gal-item"
|
|
784
|
+
:title="$t('daqDetail.kfrm0006')"
|
|
785
|
+
@click="fullFrame = f"
|
|
786
|
+
>
|
|
787
|
+
<img
|
|
788
|
+
:src="f.thumbUrl"
|
|
789
|
+
loading="lazy"
|
|
790
|
+
alt="daq frame"
|
|
791
|
+
>
|
|
792
|
+
<figcaption class="mono">
|
|
793
|
+
{{ timeOf(f.at) }} · {{ metricsBrief(f) }}
|
|
794
|
+
</figcaption>
|
|
795
|
+
</figure>
|
|
796
|
+
</div>
|
|
797
|
+
<p
|
|
798
|
+
v-else
|
|
799
|
+
class="frames-empty"
|
|
800
|
+
>
|
|
801
|
+
{{ $t('daqDetail.kfrm0003') }}
|
|
802
|
+
</p>
|
|
803
|
+
<div
|
|
804
|
+
v-if="fullFrame"
|
|
805
|
+
class="gal-full"
|
|
806
|
+
@click="fullFrame = null"
|
|
807
|
+
>
|
|
808
|
+
<img
|
|
809
|
+
:src="fullFrame.contentUrl ?? fullFrame.thumbUrl"
|
|
810
|
+
alt="daq frame full"
|
|
811
|
+
>
|
|
812
|
+
</div>
|
|
813
|
+
</template>
|
|
814
|
+
</section>
|
|
815
|
+
</div>
|
|
816
|
+
</template>
|
|
817
|
+
|
|
818
|
+
<style scoped>
|
|
819
|
+
.page { padding: 4px; }
|
|
820
|
+
.back { color: var(--ink-faint); text-decoration: none; }
|
|
821
|
+
.back:hover { color: var(--accent); }
|
|
822
|
+
.aw-page-head h1 { margin: 2px 0 4px; font-size: 26px; font-weight: 400; letter-spacing: -0.01em; }
|
|
823
|
+
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
|
|
824
|
+
.sec { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
|
|
825
|
+
.mt { margin-top: 22px; }
|
|
826
|
+
.err { margin-top: 14px; font-size: 13px; color: var(--tone-danger-dot); }
|
|
827
|
+
|
|
828
|
+
.grid {
|
|
829
|
+
display: grid;
|
|
830
|
+
gap: 14px;
|
|
831
|
+
align-items: start;
|
|
832
|
+
grid-template-columns: minmax(260px, 340px) minmax(320px, 1fr) minmax(280px, 380px);
|
|
833
|
+
}
|
|
834
|
+
@media (max-width: 1100px) {
|
|
835
|
+
.grid { grid-template-columns: 1fr; }
|
|
836
|
+
}
|
|
837
|
+
.pad { padding: 16px 18px; }
|
|
838
|
+
|
|
839
|
+
/* 实时值卡 */
|
|
840
|
+
.value-card { padding: 16px 18px; }
|
|
841
|
+
.big-val { margin: 8px 0 10px; font-size: 40px; line-height: 1.1; color: var(--accent); }
|
|
842
|
+
.big-val small { margin-left: 8px; font-size: 15px; color: var(--ink-faint); }
|
|
843
|
+
.live-canvas { width: 100%; height: 64px; border: 1px solid var(--line); border-radius: var(--radius-chip); background: var(--paper-deep); }
|
|
844
|
+
.facts { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 0; }
|
|
845
|
+
.facts div { display: flex; justify-content: space-between; font-size: 11.5px; }
|
|
846
|
+
.facts dt { color: var(--ink-faint); }
|
|
847
|
+
.facts dd { margin: 0; color: var(--ink); }
|
|
848
|
+
|
|
849
|
+
/* 参数表单 */
|
|
850
|
+
.form-grid { display: flex; flex-direction: column; gap: 10px; }
|
|
851
|
+
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-faint); flex: 1; }
|
|
852
|
+
.field.row { flex-direction: row; align-items: center; gap: 8px; }
|
|
853
|
+
.field.row small { color: var(--ink-faint); }
|
|
854
|
+
.field-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
|
|
855
|
+
.input {
|
|
856
|
+
width: 100%;
|
|
857
|
+
padding: 6px 9px;
|
|
858
|
+
font-size: 12.5px;
|
|
859
|
+
color: var(--ink);
|
|
860
|
+
background: var(--paper-raised);
|
|
861
|
+
border: 1px solid var(--line-strong);
|
|
862
|
+
border-radius: var(--radius-chip);
|
|
863
|
+
}
|
|
864
|
+
.input:disabled { opacity: 0.45; }
|
|
865
|
+
.grow { flex: 1 1 auto; }
|
|
866
|
+
.toggle {
|
|
867
|
+
align-self: flex-start;
|
|
868
|
+
padding: 6px 12px;
|
|
869
|
+
font-size: 12px;
|
|
870
|
+
cursor: pointer;
|
|
871
|
+
color: var(--tone-neutral-dot);
|
|
872
|
+
background: var(--tone-neutral-bg);
|
|
873
|
+
border: 0;
|
|
874
|
+
border-radius: var(--radius-chip);
|
|
875
|
+
}
|
|
876
|
+
.toggle.on { color: var(--tone-success-dot); background: var(--tone-success-bg); }
|
|
877
|
+
.toggle.slim { padding: 6px 10px; font-size: 11.5px; }
|
|
878
|
+
.bind-row { display: flex; gap: 8px; }
|
|
879
|
+
.driver-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
|
|
880
|
+
.field em { margin-left: 2px; font-style: normal; color: var(--tone-danger-dot); }
|
|
881
|
+
.test-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
|
|
882
|
+
.test-out { font-size: 11px; }
|
|
883
|
+
.test-out.ok { color: var(--tone-success-dot); }
|
|
884
|
+
.test-out.bad { color: var(--tone-danger-dot); }
|
|
885
|
+
|
|
886
|
+
/* 历史 */
|
|
887
|
+
.col-hist { min-width: 0; }
|
|
888
|
+
.hist-hd { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
|
|
889
|
+
.hist-ctl { display: flex; gap: 6px; }
|
|
890
|
+
.hist-canvas { width: 100%; height: 130px; border: 1px solid var(--line); border-radius: var(--radius-chip); background: var(--paper-deep); }
|
|
891
|
+
.raw-table { width: 100%; margin-top: 10px; font-size: 11px; border-collapse: collapse; }
|
|
892
|
+
.raw-table th, .raw-table td { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--divider-hair); }
|
|
893
|
+
.raw-table th { font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-fainter); }
|
|
894
|
+
|
|
895
|
+
.st-pill {
|
|
896
|
+
display: inline-block;
|
|
897
|
+
padding: 3px 11px;
|
|
898
|
+
font-family: var(--font-mono);
|
|
899
|
+
font-size: 11px;
|
|
900
|
+
letter-spacing: 0.04em;
|
|
901
|
+
border-radius: var(--radius-pill);
|
|
902
|
+
}
|
|
903
|
+
.st-pill.ok { color: var(--tone-success-dot); background: var(--tone-success-bg); }
|
|
904
|
+
.st-pill.warn { color: var(--tone-warning-dot); background: var(--tone-warning-bg); }
|
|
905
|
+
.st-pill.alarm { color: var(--tone-danger-dot); background: var(--tone-danger-bg); }
|
|
906
|
+
.st-pill.offline { color: var(--tone-neutral-dot); background: var(--tone-neutral-bg); }
|
|
907
|
+
|
|
908
|
+
/* 帧视图(v2 多形态) */
|
|
909
|
+
.frames-tile { margin-top: 14px; }
|
|
910
|
+
.frames-n { margin-left: 8px; color: var(--ink-faint); }
|
|
911
|
+
.vec-svg { width: 100%; height: 96px; display: block; background: var(--tone-neutral-bg); border-radius: 6px; margin-bottom: 10px; }
|
|
912
|
+
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
|
|
913
|
+
.gal-item { margin: 0; cursor: zoom-in; }
|
|
914
|
+
.gal-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; background: var(--tone-neutral-bg); }
|
|
915
|
+
.gal-item figcaption { margin-top: 4px; font-size: 11px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
916
|
+
.frames-empty { margin: 8px 0; font-size: 13px; color: var(--ink-faint); }
|
|
917
|
+
.gal-full { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgb(0 0 0 / 72%); cursor: zoom-out; }
|
|
918
|
+
.gal-full img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
|
|
919
|
+
</style>
|