EquipmentDetailSections.vue 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395
  1. <!--
  2. 设备详情的分区(票 11):档案 / 指标 / 预警 / 报警 / 工单状态 / 设备图片。
  3. 票 46 返工(维护者 2026-10-15 第 1 条):**弃用六块竖排的长滚动**,改为标签页切换
  4. 设备档案(默认,图片归此页下方)|最新指标|预警信息|报警信息|工单状态;
  5. 预警/报警列表每页最多 10 条。页签计划与分页边界都是
  6. domain 纯函数(`EQUIPMENT_TABS`/`panelsForTab`/`pagedRows`),组件只画结论。
  7. 票 59(统一分页批次一):**三清单(预警/报警/工单)都接共享 `PagerNav.vue`**
  8. (页码直达 + 输入框跳页 + 计数行),翻页窗口计算归 `domain/pagination.js` 单源,
  9. 本组件不再自画 pager、不再有第二份翻页算术;前后页/页码/跳页共用唯一出口
  10. `gotoPage(panel, target)`,越界夹回由 `pagedRows` 做。
  11. **渲染计划仍是六块独立分区**(t11 D1/D9):标签页只改呈现归属,
  12. 每块仍独立成败;指标页改读独立采集记录分区,按当前需求不画状态点/过期说明。
  13. 档案读失败但指标可用仍各自呈现,不能共用一个成败。
  14. 三种「没内容」在界面上的区别(票 16 的词汇,措辞由 domain/equipmentDetailView.js 给):
  15. 空数据 EMPTY → 「该分区当前没有数据」
  16. 失败 FAILED → 「该分区加载失败(其它分区不受影响)」
  17. 不可用 UNAVAILABLE → 「该分区数据不可用(其它分区不受影响)」
  18. 过期 STALE 是**有值**:内容照画,只是标签说「数据已过期,显示最后一次成功数据」。
  19. 事件高亮采用既有四级颜色词表;数值预警黄/报警红与等级提示点分别呈现。
  20. 票 12 在**工单状态这块里**接上了状态时间线(不新增第七块面板):
  21. 每张工单下面挂它自己的那条轨迹(`timelineSource()` 按工单编码配好)。
  22. 轨迹分区**独立于工单列表成败** —— 后端可在工单列表成功时单独把 `timelines` 标 FAILED
  23. (`SOURCE_SECTION_FAILED`),那时界面必须说「轨迹没取到」而不是"没有动作记录"。
  24. -->
  25. <template>
  26. <div ref="sectionsRoot" class="equipment-sections" data-equipment-sections :data-device-code="deviceCode">
  27. <!--
  28. 票 46 返工:标签页条。计数挂在页签上(预警/报警/工单才有;
  29. 维护者要「避免长滚动列表查找困难」——点之前就知道每页后面有多少条)。
  30. -->
  31. <div class="equipment-tabs" role="tablist" aria-label="设备详情分区切换" data-equipment-tabs>
  32. <button
  33. v-for="tab in tabs"
  34. :key="tab.name"
  35. type="button"
  36. role="tab"
  37. class="equipment-tabs__tab"
  38. :class="{ 'is-active': tab.name === activeTab }"
  39. :aria-selected="tab.name === activeTab"
  40. :data-equipment-tab="tab.name"
  41. :data-tab-count="tab.count || ''"
  42. @click="activeTab = tab.name"
  43. >
  44. {{ tab.label }}<b v-if="tab.count" class="equipment-tabs__count">{{ tab.count }}</b>
  45. </button>
  46. </div>
  47. <!--
  48. 当前页签的面板(档案页含两块:档案 + 设备图片,所以 tabpanel 挂在**包装层**
  49. 而不是每块 section 上 —— 一个页签对应一个 tabpanel 才是正确的可访问语义)。
  50. -->
  51. <p v-if="aggregate?.retained" class="equipment-section__hint" data-detail-refresh-retained>本次详情更新未完成,保留上次已加载内容。</p>
  52. <div class="equipment-tab__body" role="tabpanel" data-equipment-tab-body>
  53. <section
  54. v-for="panel in activePanels"
  55. :key="panel.name"
  56. class="equipment-section"
  57. :class="{ 'equipment-section--video': panel.kind === 'metrics' && isCamera }"
  58. :data-equipment-section="panel.name"
  59. :data-panel-state="panel.section.state || 'empty'"
  60. :data-panel-retained="panel.section.retained ? 'true' : 'false'"
  61. >
  62. <header class="equipment-section__head">
  63. <span class="equipment-section__title">{{ panel.label }}</span>
  64. <SectionStateTag v-if="panel.kind !== 'metrics'" :name="panel.name" :section="panel.section" />
  65. </header>
  66. <!-- 过期分区在内容之上再点一次题(颜色之外的第二种提示,灰度下也读得出) -->
  67. <p v-if="panel.kind !== 'metrics' && panel.section.retained" class="equipment-section__stale" data-section-stale-note>
  68. {{ staleNote }}
  69. </p>
  70. <!-- ---------- 有内容:按 kind 分派 ---------- -->
  71. <template v-if="panel.kind === 'metrics' || panel.hasContent">
  72. <!--
  73. 票 46:分类查询条 —— 预警/报警/工单**共用这一块**(同一组绑定只写一处)。
  74. 分类归组在 domain(等级复用票 13 词表、工单复用 0–7 字典),组件只画 chips;
  75. 点分类只筛视图,不发请求、不动选择(筛选变化不丢详情上下文)。
  76. -->
  77. <template v-if="isFilterable(panel) && chipsOf(panel).length > 1">
  78. <div class="equipment-section__chips" role="group" :aria-label="`${panel.label}分类查询`" data-category-bar>
  79. <button
  80. v-for="chip in chipsOf(panel)"
  81. :key="chip.key || 'all'"
  82. type="button"
  83. class="equipment-section__chip"
  84. :class="{ 'is-active': chip.key === activeCategory(panel.name) }"
  85. :aria-pressed="chip.key === activeCategory(panel.name)"
  86. :data-category-chip="`${panel.name}:${chip.key || 'all'}`"
  87. @click="toggleCategory(panel.name, chip.key)"
  88. >
  89. {{ chip.label }} <b class="equipment-section__chip-count" data-category-count>{{ chip.count }}</b>
  90. </button>
  91. </div>
  92. <p v-if="categoryNoteText(panel)" class="equipment-section__note" data-category-note>{{ categoryNoteText(panel) }}</p>
  93. </template>
  94. <!-- 档案:键值行 -->
  95. <dl v-if="panel.kind === 'archive'" class="equipment-section__rows" data-archive-rows>
  96. <div v-for="row in rowsOf(panel)" :key="row.key" class="equipment-section__row" :data-archive-row="row.key">
  97. <dt>{{ row.label }}</dt>
  98. <dd :class="{ 'is-muted': isPlaceholder(row.value), 'equipment-section__mono': row.mono }">{{ row.value }}</dd>
  99. </div>
  100. </dl>
  101. <!-- 采集记录:最近50行;分页后只合并当前页相同采集时间。 -->
  102. <div v-else-if="panel.kind === 'metrics'" class="equipment-section__list" data-collection-records>
  103. <!-- 监控入口属于最新指标卡片本身,不再与指标框并列(维护者 2026-11-18)。 -->
  104. <p v-if="isCamera" class="equipment-section__hint" data-video-metrics-note>
  105. 视频监控通过下方入口查看实时画面与已有录像
  106. </p>
  107. <VideoMonitorEntry :device-code="deviceCode" :monitor-source="monitorSource" @device-resolved="videoDevice = $event" />
  108. <!-- 仅已确认的摄像机不呈现数值采集记录;其它设备保留独立分区的真实状态。 -->
  109. <template v-if="!isCamera">
  110. <p v-if="panel.section.state === 'failed'" class="equipment-section__hint" data-metrics-failed>
  111. 该分区加载失败(其它分区不受影响)
  112. </p>
  113. <p v-else-if="panel.section.state === 'unavailable'" class="equipment-section__hint" data-metrics-unavailable>
  114. 该分区数据不可用(其它分区不受影响)
  115. </p>
  116. <p v-else-if="!recordTableOf(panel).total" class="equipment-section__hint" data-metrics-empty>
  117. 暂无采集记录
  118. </p>
  119. <template v-else>
  120. <p class="equipment-section__note">采集记录(最近50条)</p>
  121. <div class="collection-table-wrap">
  122. <table v-if="recordTableOf(panel).total" class="collection-table" data-collection-table aria-label="设备最近采集记录">
  123. <thead>
  124. <tr>
  125. <th v-for="column in recordTableOf(panel).columns" :key="column.key" :class="{ 'collection-table__time': column.isTime, 'collection-table__audio-col': column.isAudio }">
  126. <span class="collection-table__heading" :title="column.label">{{ column.label }}</span>
  127. <span v-if="column.unit" class="collection-table__unit">({{ column.unit }})</span>
  128. </th>
  129. </tr>
  130. </thead>
  131. <tbody v-for="group in recordTableOf(panel).groups" :key="group.key"
  132. :class="{ 'collection-table__group--latest': group.isLatest }"
  133. :style="{ '--collection-accent': group.color }"
  134. :data-collection-group="group.key" :data-collection-group-state="group.state">
  135. <tr v-for="(row, rowIndex) in group.rows" :key="rowIndex" data-collection-row :class="{ 'collection-table__row--latest': group.isLatest }" :data-collection-latest="group.isLatest ? 'true' : undefined">
  136. <template v-for="(cell, cellIndex) in row.cells" :key="cell.key">
  137. <td
  138. v-if="!recordTableOf(panel).columns[cellIndex].isTime || row.timeRowspan > 0"
  139. data-collection-cell
  140. :data-reading-state="cell.assessment?.state"
  141. :style="cell.assessment ? { '--reading-color': cell.assessment.color } : undefined"
  142. :title="cell.assessment?.label"
  143. :rowspan="recordTableOf(panel).columns[cellIndex].isTime ? row.timeRowspan : undefined"
  144. :class="{ 'collection-table__time': recordTableOf(panel).columns[cellIndex].isTime, 'collection-table__audio-col': recordTableOf(panel).columns[cellIndex].isAudio }"
  145. >
  146. <template v-if="recordTableOf(panel).columns[cellIndex].isTime">
  147. <span v-if="group.isLatest" class="collection-table__latest-badge" data-collection-latest-badge>最新</span>
  148. <span class="collection-table__time-date">{{ row.createDate }}</span>
  149. <span v-if="row.createClock" class="collection-table__time-clock">{{ row.createClock }}</span>
  150. </template>
  151. <button v-else-if="cell.audioPath" type="button" class="collection-table__audio-button" data-collection-audio-open :aria-label="'播放' + (cell.audioLabel || '音频记录')" :title="cell.audioLabel || '播放音频'" @click="openRecordAudio(cell, $event)">
  152. <span aria-hidden="true">▶</span><span>播放</span>
  153. </button>
  154. <!--
  155. long 布局的格内是「指标名:读数」整条:名称走正文样式,
  156. 读数段与其它设备的指标值同一套等宽数字字体。
  157. -->
  158. <span
  159. v-else-if="cell.reading && cell.reading.label"
  160. class="collection-table__reading"
  161. >
  162. <span class="collection-table__reading-label">{{ cell.reading.label }}</span>
  163. <span class="collection-table__reading-result">
  164. <span class="collection-table__reading-value" :class="{ 'is-muted': isPlaceholder(cell.reading.value) }">{{ cell.reading.value }}</span>
  165. <MetricStateHint v-if="cell.assessment?.hint" :color="cell.assessment.hint.color"
  166. :label="cell.assessment.hint.label" :refresh-key="aggregate" />
  167. </span>
  168. </span>
  169. <span v-else class="collection-table__reading-result">
  170. <span :class="{ 'is-muted': isPlaceholder(cell.text), 'collection-table__value': cell.isReading }">{{ cell.text }}</span>
  171. <MetricStateHint v-if="cell.assessment?.hint" :color="cell.assessment.hint.color"
  172. :label="cell.assessment.hint.label" :refresh-key="aggregate" />
  173. </span>
  174. </td>
  175. </template>
  176. </tr>
  177. </tbody>
  178. </table>
  179. </div>
  180. <p v-if="recordTableOf(panel).assessmentNote" class="equipment-section__hint" data-collection-assessment-note>{{ recordTableOf(panel).assessmentNote }}</p>
  181. <PagerNav
  182. :page="recordTableOf(panel).page"
  183. :page-count="recordTableOf(panel).pageCount"
  184. :total="recordTableOf(panel).total"
  185. list-name="采集记录"
  186. @page="(target) => gotoPage(panel, target)"
  187. />
  188. </template>
  189. </template>
  190. </div>
  191. <!--
  192. 预警 / 报警:条目默认可折叠(票 46)—— 折叠行给时间·名称·等级·状态·量值,
  193. 展开看详情(事件时间 / 状态 / 来源 / 关联设备,缺值给占位符)。
  194. 票 46 返工第 1 条:每页最多 10 条(上一页/下一页 + 页码;先筛后翻)。
  195. 分类 chips 在上面共用那一块。
  196. -->
  197. <div v-else-if="panel.kind === 'events'" class="equipment-section__list" :data-event-list="panel.name">
  198. <details
  199. v-for="(event, index) in pagedOf(panel).rows"
  200. :key="event.code || index"
  201. class="equipment-section__item equipment-section__item--collapsible"
  202. :class="{ 'equipment-section__item--active': event.active }"
  203. :style="{ '--detail-accent': event.activeColor }"
  204. :open="isDetailOpen(panel, event, index)"
  205. @toggle="rememberDetailToggle(panel, event, index, $event)"
  206. :data-event="event.code || index"
  207. :data-event-level-color="event.levelColor"
  208. :data-item-active="event.active ? 'true' : 'false'"
  209. data-history-item
  210. >
  211. <summary class="equipment-section__item-head">
  212. <!-- 标题=单号;内容=描述、时间、等级、状态;右下角提示可展开看详情。 -->
  213. <span class="equipment-section__item-name equipment-section__mono" data-event-title>{{ event.title }}</span>
  214. <span v-if="event.description" class="equipment-section__item-desc" data-event-desc>{{ event.description }}</span>
  215. <span class="equipment-section__meta" data-event-meta>
  216. <span data-event-level :data-tone="event.levelTone">{{ event.levelText }}</span>
  217. <!-- 维护者 2026-11-13:不再用笼统的「未解除」徽标,直接高亮真实状态。 -->
  218. <span v-if="event.status" class="equipment-section__status-badge"
  219. :data-event-status="event.status" :data-status-tone="event.statusTone"
  220. :data-tone="event.statusTone">{{ event.status }}</span>
  221. <span v-if="event.timeText" data-event-time>{{ event.timeText }}</span>
  222. </span>
  223. <span class="equipment-section__item-more" aria-hidden="true" data-event-more>点击查看详情 ›</span>
  224. </summary>
  225. <dl class="equipment-section__detail" data-history-detail>
  226. <div v-for="row in eventDetailRows(event)" :key="row.label" class="equipment-section__detail-row" :data-detail-row="row.label">
  227. <dt>{{ row.label }}</dt>
  228. <dd :data-tone="row.tone || undefined" :class="{ 'equipment-section__detail-value--tone': row.tone }">{{ row.value }}</dd>
  229. </div>
  230. </dl>
  231. </details>
  232. <p v-if="!pagedOf(panel).total" class="equipment-section__hint" data-section-empty-list>
  233. {{ rowsOf(panel).length ? '当前分类下没有记录(换一个分类或点「全部」)' : emptyList(panel.label) }}
  234. </p>
  235. <!-- 分页控件(票 59 共享 PagerNav,前后页/页码/跳页同一个 @page 出口) -->
  236. <PagerNav
  237. :page="pagedOf(panel).page"
  238. :page-count="pagedOf(panel).pageCount"
  239. :total="pagedOf(panel).total"
  240. :list-name="panel.label"
  241. @page="(target) => gotoPage(panel, target)"
  242. />
  243. </div>
  244. <!--
  245. 工单状态:状态名(缺则按状态字典补)+ 关键时间 + 每张工单自己的状态时间线(票 12)。
  246. 票 46:条目默认可折叠,展开保留事件时间/状态/来源/关联对象 + 计划与实际结案时间。
  247. 「没有动作记录」那句仍由 `timeline.hasContent` 门控(票 12 的 F9 守卫逐字钉住)。
  248. 票 59:接入统一分页(每页 ≤10,先分类后翻页)。
  249. -->
  250. <div v-else-if="panel.kind === 'orders'" class="equipment-section__list" data-work-order-list>
  251. <details
  252. v-for="(order, index) in pagedOf(panel).rows"
  253. :key="order.code || index"
  254. class="equipment-section__item equipment-section__item--collapsible"
  255. :class="{ 'equipment-section__item--active': order.active }"
  256. :style="{ '--detail-accent': order.activeColor }"
  257. :open="isDetailOpen(panel, order, index)"
  258. @toggle="rememberDetailToggle(panel, order, index, $event)"
  259. :data-work-order="order.code || index"
  260. :data-work-order-state="order.stateCode"
  261. :data-item-active="order.active ? 'true' : 'false'"
  262. data-history-item
  263. >
  264. <summary class="equipment-section__item-head equipment-section__wo-head">
  265. <!-- 维护者 2026-11-13:按管理端工单卡片排版(工单号+状态、描述、关联设备、位置、故障时间、查看详情)。 -->
  266. <span class="equipment-section__wo-title">
  267. <span class="equipment-section__wo-label">工单号</span>
  268. <span class="equipment-section__mono" data-work-order-code>{{ order.title }}</span>
  269. <span class="equipment-section__status-badge" :data-work-order-state-name="order.stateName"
  270. :data-tone="order.active ? 'lv3' : 'lv4'">{{ order.stateName }}</span>
  271. </span>
  272. <span class="equipment-section__wo-row">
  273. <span class="equipment-section__wo-label">工单描述</span>
  274. <span data-work-order-desc>{{ order.description || '—' }}</span>
  275. </span>
  276. <span class="equipment-section__wo-row">
  277. <span class="equipment-section__wo-label">关联设备</span>
  278. <span data-work-order-device>{{ order.deviceLabel }}</span>
  279. </span>
  280. <span class="equipment-section__wo-row">
  281. <span class="equipment-section__wo-label">设备位置</span>
  282. <span data-work-order-location>{{ order.deviceLocation }}</span>
  283. </span>
  284. <span class="equipment-section__wo-row">
  285. <span class="equipment-section__wo-label">故障时间</span>
  286. <span data-work-order-fault-time>{{ order.faultTimeText || order.timeText || '—' }}</span>
  287. </span>
  288. <span class="equipment-section__item-more" aria-hidden="true" data-work-order-more>查看详情 ›</span>
  289. </summary>
  290. <!--
  291. 票 12:这张工单自己的状态路径 + 动作轨迹。
  292. · 轨迹分区拿到了数据 → 完整轨迹(状态路径 + 动作流水);
  293. · 轨迹分区失败/为空 → **仍铺状态路径**(当前状态码在工单列表里,
  294. 本来就拿得到),只是没有动作流水。因为"轨迹没取到"而连
  295. "这张工单现在在哪一态"也一起不画,等于丢掉已有的信息。
  296. 分区自己的成败由下面那条整块占位说明如实交代。
  297. -->
  298. <WorkOrderTimeline
  299. v-if="trackOfOrder(order)"
  300. :track="trackOfOrder(order)"
  301. :path-only="!timeline.hasContent"
  302. />
  303. <p v-else-if="timeline.hasContent" class="equipment-section__hint" data-wo-timeline-missing>
  304. 这张工单没有动作记录
  305. </p>
  306. <dl class="equipment-section__detail equipment-section__wo-detail" data-history-detail>
  307. <div v-for="row in workOrderDetailRows(order)" :key="row.label" class="equipment-section__detail-row" :data-detail-row="row.label">
  308. <dt>{{ row.label }}</dt>
  309. <dd>{{ row.value }}</dd>
  310. </div>
  311. </dl>
  312. </details>
  313. <!-- 轨迹分区自己失败/为空:整块说一句(不按每张工单重复同一句话,那是噪音) -->
  314. <p v-if="timeline.placeholder" class="equipment-section__hint" data-wo-timeline-placeholder>
  315. {{ timeline.placeholder }}
  316. </p>
  317. <p v-if="!pagedOf(panel).total" class="equipment-section__hint" data-section-empty-list>
  318. {{ rowsOf(panel).length ? '当前分类下没有记录(换一个分类或点「全部」)' : emptyList('工单') }}
  319. </p>
  320. <!-- 分页控件(票 59 共享 PagerNav,与预警/报警同一控件、同一出口) -->
  321. <PagerNav
  322. :page="pagedOf(panel).page"
  323. :page-count="pagedOf(panel).pageCount"
  324. :total="pagedOf(panel).total"
  325. :list-name="panel.label"
  326. @page="(target) => gotoPage(panel, target)"
  327. />
  328. </div>
  329. <!-- 设备图片:只画后端指定的那一张(前端不索引、不挑选) -->
  330. <figure v-else-if="panel.kind === 'image'" class="equipment-section__figure" data-latest-image>
  331. <template v-if="image(panel).hasImage">
  332. <button v-if="!imageFailed" type="button" class="equipment-section__image-button" aria-label="放大查看设备图片" @click="imageDialog.showModal()">
  333. <img class="equipment-section__img" :src="image(panel).url" :alt="`${deviceCode} 设备图片`" @load="imageLoading = false" @error="imageFailed = true; imageLoading = false" />
  334. <span>{{ imageLoading ? '图片加载中…' : '点击放大' }}</span>
  335. </button>
  336. <p v-else class="equipment-section__hint" role="status">图片加载失败,请检查图片服务地址或文件是否可访问。<button type="button" @click="imageFailed = false; imageLoading = true">重试</button></p>
  337. <figcaption class="equipment-section__meta">拍摄于 {{ image(panel).capturedAt }}</figcaption>
  338. </template>
  339. <p v-else class="equipment-section__hint" data-latest-image-empty>后端未提供该设备的图片</p>
  340. </figure>
  341. </template>
  342. <!-- ---------- 没内容:如实说,不画空框冒充数据 ---------- -->
  343. <p v-else class="equipment-section__hint" data-section-placeholder>{{ panel.placeholder }}</p>
  344. <!-- 字段缺失:只说条数,具体路径进 tooltip(不漏接口字段名给值班人员) -->
  345. <p
  346. v-if="panel.missing.count"
  347. class="equipment-section__missing"
  348. data-section-missing
  349. :data-missing-count="panel.missing.count"
  350. :title="panel.missing.tooltip"
  351. >
  352. {{ panel.missing.text }}
  353. </p>
  354. </section>
  355. </div>
  356. <dialog ref="imageDialog" class="equipment-image-viewer" aria-label="设备图片放大查看" @click="closeImageBackdrop">
  357. <button type="button" autofocus class="equipment-image-viewer__close" @click="imageDialog.close()">关闭</button>
  358. <img :src="currentImageUrl" :alt="`${deviceCode} 设备图片`" />
  359. </dialog>
  360. <!--
  361. 音频播放条:贴在播放键上方渐入的小浮层(Teleport 到 body,避免被滚动容器裁剪)。
  362. 不再用居中大弹窗/背景虚化;点击外部、滚动或 Esc 都会收起。
  363. -->
  364. <Teleport to="body">
  365. <div
  366. v-if="activeAudioPath"
  367. ref="audioPlayer"
  368. class="collection-audio-player"
  369. :class="{ 'is-below': audioPlacement.below }"
  370. :style="audioPlayerStyle"
  371. data-collection-audio-player
  372. >
  373. <div class="collection-audio-player__head">
  374. <span class="collection-audio-player__label">{{ activeAudioLabel }}</span>
  375. <button type="button" class="collection-audio-player__close" aria-label="关闭播放条" @click="closeAudioPlayer">×</button>
  376. </div>
  377. <audio v-if="activeAudioUrl" class="collection-audio-player__audio" controls preload="metadata" :src="activeAudioUrl" />
  378. </div>
  379. </Teleport>
  380. </div>
  381. </template>
  382. <script setup>
  383. import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'
  384. import { resolveDeviceImageUrl } from '../services/deviceImage.js'
  385. import { DETAIL_PLACEHOLDER } from '../domain/detailFlow.js'
  386. import {
  387. DEFAULT_EQUIPMENT_TAB,
  388. EVENT_CATEGORY_ORDER,
  389. EQUIPMENT_TABS,
  390. WORK_ORDER_CATEGORY_ORDER,
  391. archiveRows,
  392. categoryChips,
  393. categoryNote,
  394. emptyListText,
  395. equipmentPanels,
  396. eventDetailRows,
  397. eventRows,
  398. filterByCategory,
  399. imageView,
  400. collectionRecordTable,
  401. pagedRows,
  402. panelsForTab,
  403. prioritizeActiveRows,
  404. tabCount,
  405. timelineSource,
  406. workOrderDetailRows,
  407. workOrderRows,
  408. } from '../domain/equipmentDetailView.js'
  409. import { pathOnlyTrack } from '../domain/workOrderTimeline.js'
  410. import VideoMonitorEntry from './VideoMonitorEntry.vue'
  411. import SectionStateTag from './SectionStateTag.vue'
  412. import WorkOrderTimeline from './WorkOrderTimeline.vue'
  413. import PagerNav from './PagerNav.vue'
  414. import MetricStateHint from './MetricStateHint.vue'
  415. const props = defineProps({
  416. /** `stores/detailStore.js` 的 `sections.equipmentAggregate`。 */
  417. aggregate: { type: Object, default: null },
  418. /** 当前选中的设备编码(分区头与图片 alt 用)。 */
  419. deviceCode: { type: String, default: '' },
  420. monitorSource: { type: String, default: 'detail' },
  421. })
  422. const sectionsRoot = ref(null)
  423. const panels = computed(() => equipmentPanels(props.aggregate))
  424. const videoDevice = ref(null)
  425. // 工单详情要显示「设备类型」,但工单接口不下发它:面板里每张工单都属于当前这台设备,
  426. // 所以用档案分区的类型名兜底(拿不到就留空,详情里那一行自然不出现)。
  427. const archiveDeviceTypeName = computed(() => {
  428. const archive = panels.value.find((panel) => panel.kind === 'archive')?.section.data
  429. return String(archive?.deviceTypeName ?? '').trim()
  430. })
  431. // 档案 type 是 deviceType 的领域字段;只认当前设备的摄像机正证据,不以能力查询失败推断传感器。
  432. const isCamera = computed(() => {
  433. const archive = panels.value.find((panel) => panel.kind === 'archive')?.section.data
  434. return String(archive?.type ?? '').trim() === '20'
  435. || (videoDevice.value?.deviceCode === props.deviceCode && videoDevice.value?.typeCode === '20')
  436. })
  437. // ---- 票 46 返工第 1 条:标签页切换(弃用六块竖排的长滚动)----
  438. /** 页签清单(domain 给顺序与背后的分区归属;计数给预警/报警/工单三页)。 */
  439. const tabs = computed(() =>
  440. EQUIPMENT_TABS.map((tab) => ({ ...tab, count: tabCount(panels.value, tab.name) })),
  441. )
  442. /** 当前页签(默认「设备档案」;换设备复位,不把 A 的页签停在 B 上)。 */
  443. const activeTab = ref(DEFAULT_EQUIPMENT_TAB)
  444. // 同设备刷新只更新内容;DOM 重排后保留内部及外层详情的滚动位置与可见条目。
  445. let scrollRevision = 0
  446. watch([() => props.aggregate, () => props.deviceCode], (_current, previous) => {
  447. const revision = ++scrollRevision
  448. const device = props.deviceCode
  449. const sameDevice = previous[1] === device
  450. const tab = activeTab.value
  451. const positions = []
  452. const items = Array.from(sectionsRoot.value?.querySelectorAll?.('[data-collection-record-key], [data-history-item]') || [])
  453. for (let element = sectionsRoot.value; element; element = element.parentElement) {
  454. if (typeof document !== 'undefined' && (element === document.body || element === document.documentElement)) break
  455. if (typeof element.scrollTop === 'number' && (element.scrollTop || element.scrollHeight > element.clientHeight)) {
  456. const rect = element.getBoundingClientRect?.()
  457. const anchor = rect && items.find((item) => {
  458. const bounds = item.getBoundingClientRect()
  459. return bounds.bottom > rect.top && bounds.top < rect.bottom
  460. })
  461. const key = anchor && (anchor.getAttribute('data-collection-record-key') || anchor.getAttribute('data-event') || anchor.getAttribute('data-work-order'))
  462. positions.push({ element, top: element.scrollTop, left: element.scrollLeft,
  463. key: key && key !== DETAIL_PLACEHOLDER ? key : '',
  464. offset: anchor ? anchor.getBoundingClientRect().top - rect.top : 0,
  465. })
  466. }
  467. }
  468. nextTick(() => {
  469. if (revision !== scrollRevision || device !== props.deviceCode || (sameDevice && tab !== activeTab.value)) return
  470. if (!sameDevice) {
  471. for (const { element } of positions) { element.scrollTop = 0; element.scrollLeft = 0 }
  472. return
  473. }
  474. const currentItems = Array.from(sectionsRoot.value?.querySelectorAll?.('[data-collection-record-key], [data-history-item]') || [])
  475. for (const { element, top, left, key, offset } of positions) {
  476. if (element.isConnected === false) continue
  477. const anchor = key && currentItems.find((item) =>
  478. [item.getAttribute('data-collection-record-key'), item.getAttribute('data-event'), item.getAttribute('data-work-order')].includes(key))
  479. // 新记录插到前面时仍跟住原来正在看的条目;条目已移除才退回像素位置。
  480. element.scrollTop = anchor ? element.scrollTop + anchor.getBoundingClientRect().top - element.getBoundingClientRect().top - offset : top
  481. element.scrollLeft = left
  482. }
  483. })
  484. }, { flush: 'pre' })
  485. onBeforeUnmount(() => { scrollRevision += 1 })
  486. /** 当前页签要渲染的面板(保留渲染计划自己的次序;图片随档案页出现)。 */
  487. const activePanels = computed(() => panelsForTab(panels.value, activeTab.value))
  488. /**
  489. * 时间线来源(票 12):按工单编码配好的轨迹 + 轨迹分区自己的状态。
  490. * 只算一次 —— 每张工单渲染时都去重算会把 O(n²) 的判断塞进模板。
  491. */
  492. const timeline = computed(() => timelineSource(props.aggregate))
  493. const staleNote = '数据已过期 · 显示最后一次成功数据,不是实时值'
  494. // ---- 票 46:分类查询与历史折叠(**视图本地状态**)----
  495. //
  496. // 为什么不进 store:分类/页码/折叠是「这一屏怎么看」,不是业务事实,也不是全局筛选条件。
  497. // 放进 `filterStore` 会让它跨设备、跨模式生效并触发重新取数 —— 那是把视图偏好
  498. // 冒充成数据条件(票 46 非目标明写「不改变后端事实与只读边界」)。
  499. // 组件卸载即消失;换设备时下面 `watch` 把它清掉,不残留成"A 的分类挂在 B 上"。
  500. /** 各分区当前生效的分类键(`{ [分区名]: 分类键 }`;空串/缺失=全部)。 */
  501. const categories = ref({})
  502. /** 各分区当前页码(1 起;预警/报警/工单三块都接入分页)。 */
  503. const pages = ref({})
  504. const recordTables = computed(() => Object.fromEntries(
  505. panels.value.filter((panel) => panel.kind === 'metrics').map((panel) => [panel.name, collectionRecordTable(panel.section.data, pages.value[panel.name] || 1)]),
  506. ))
  507. function recordTableOf(panel) {
  508. return recordTables.value[panel.name]
  509. }
  510. function recordKey(row) {
  511. if (!row.timeKey) return undefined
  512. return JSON.stringify([row.timeKey, row.cells.filter((cell) => cell.isReading).map((cell) => [cell.key, cell.reading?.label])])
  513. }
  514. const audioPlayer = ref(null)
  515. const activeAudioPath = ref('')
  516. const activeAudioLabel = ref('音频记录')
  517. const activeAudioUrl = computed(() => activeAudioPath.value ? resolveDeviceImageUrl(activeAudioPath.value) : '')
  518. const audioPlacement = ref({ left: 0, top: 0, below: false })
  519. const audioPlayerStyle = computed(() => ({
  520. left: `${audioPlacement.value.left}px`,
  521. top: `${audioPlacement.value.top}px`,
  522. }))
  523. let audioTriggerEl = null
  524. /** 打开播放条:以触发按钮为锚,默认在按钮上方渐入;顶部空间不足时翻到按钮下方。 */
  525. function openRecordAudio(cell, event) {
  526. if (!cell?.audioPath) return
  527. const rect = event?.currentTarget?.getBoundingClientRect?.()
  528. if (rect) {
  529. const margin = 132
  530. const left = Math.min(Math.max(rect.left + rect.width / 2, margin), Math.max(margin, window.innerWidth - margin))
  531. const below = rect.top < 96
  532. audioPlacement.value = { left: Math.round(left), top: Math.round(below ? rect.bottom : rect.top), below }
  533. }
  534. audioTriggerEl = event?.currentTarget || null
  535. activeAudioPath.value = cell.audioPath
  536. activeAudioLabel.value = cell.audioLabel || '音频记录'
  537. }
  538. function closeAudioPlayer() {
  539. if (!activeAudioPath.value) return
  540. activeAudioPath.value = ''
  541. audioTriggerEl = null
  542. }
  543. function audioOutsideHandler(event) {
  544. if (audioPlayer.value?.contains(event.target) || audioTriggerEl?.contains?.(event.target)) return
  545. closeAudioPlayer()
  546. }
  547. function audioEscapeHandler(event) {
  548. if (event.key === 'Escape') closeAudioPlayer()
  549. }
  550. function attachAudioGuards() {
  551. document.addEventListener('pointerdown', audioOutsideHandler, true)
  552. // 滚动时按钮会离开锚点,直接收起(capture 才能收到各滚动容器不冒泡的 scroll)。
  553. window.addEventListener('scroll', closeAudioPlayer, true)
  554. window.addEventListener('keydown', audioEscapeHandler, true)
  555. }
  556. function detachAudioGuards() {
  557. if (typeof document === 'undefined' || typeof window === 'undefined') return
  558. document.removeEventListener('pointerdown', audioOutsideHandler, true)
  559. window.removeEventListener('scroll', closeAudioPlayer, true)
  560. window.removeEventListener('keydown', audioEscapeHandler, true)
  561. }
  562. watch(activeAudioPath, (open) => { if (open) attachAudioGuards(); else detachAudioGuards() })
  563. onBeforeUnmount(detachAudioGuards)
  564. /** 某分区的行视图(未过滤)。 */
  565. function rowsOf(panel) {
  566. const data = panel.section.data
  567. if (panel.kind === 'archive') return archiveRows(data)
  568. if (panel.kind === 'orders') return workOrderRows(data, { deviceTypeName: archiveDeviceTypeName.value })
  569. return eventRows(data)
  570. }
  571. /** 这一块有没有分类查询(预警/报警/工单有;档案/指标/图片没有列表语义)。 */
  572. function isFilterable(panel) {
  573. return panel.kind === 'events' || panel.kind === 'orders'
  574. }
  575. /** 某分区的分类 chips(只有 events/orders 两类有;其它块回空数组,模板据此不画 chip 条)。 */
  576. function chipsOf(panel) {
  577. if (panel.kind !== 'events' && panel.kind !== 'orders') return []
  578. const order = panel.kind === 'orders' ? WORK_ORDER_CATEGORY_ORDER : EVENT_CATEGORY_ORDER
  579. return categoryChips(rowsOf(panel), order)
  580. }
  581. function activeCategory(panelName) {
  582. return categories.value[panelName] || ''
  583. }
  584. /** 点同一项取消(与票 37 的类型筛选同款交互:不需要额外的"清除"按钮就能撤)。 */
  585. function toggleCategory(panelName, key) {
  586. categories.value = { ...categories.value, [panelName]: activeCategory(panelName) === key ? '' : key }
  587. // 换分类 = 换结果集,页码回第 1 页(停在第 3 页看新分类会直接显示"没有记录")。
  588. pages.value = { ...pages.value, [panelName]: 1 }
  589. }
  590. /** 过滤后的行(chip 只筛视图,不动数据、不发请求)。 */
  591. function visibleRows(panel) {
  592. const rows = filterByCategory(rowsOf(panel), activeCategory(panel.name))
  593. if (panel.kind !== 'events' && panel.kind !== 'orders') return rows
  594. return prioritizeActiveRows(rows)
  595. }
  596. /** 过滤 + 分页后的窗口(domain 单源 `pagedRows` 收边界;票 59 三清单同一条路径,组件不再备第二份兜底形状)。 */
  597. function pagedOf(panel) {
  598. return pagedRows(visibleRows(panel), pages.value[panel.name] || 1)
  599. }
  600. /**
  601. * 翻页唯一出口(票 59):PagerNav 的前后页/页码直达/跳页都带**目标页码(1 起)**回来。
  602. * 这里只存状态,不另做夹取——越界统一由 domain `pagedRows` 在下一帧渲染时夹回(条文 6)。
  603. */
  604. function gotoPage(panel, target) {
  605. pages.value = { ...pages.value, [panel.name]: Number(target) || 1 }
  606. }
  607. function categoryNoteText(panel) {
  608. return categoryNote(chipsOf(panel), activeCategory(panel.name))
  609. }
  610. /**
  611. * 票 115 优化:未解除/未结案条目的展开状态。
  612. *
  613. * 切换页签时清空手动状态 ⇒ 进入对应页签时,active 条目默认展开;
  614. * 用户手动收起/展开后以手动状态为准(manualOpen[key]),不会每帧被默认值顶回去。
  615. */
  616. const manualOpen = ref({})
  617. function detailKey(panel, item, index) {
  618. return panel.name + '|' + (item.code || index)
  619. }
  620. function isDetailOpen(panel, item, index) {
  621. const key = detailKey(panel, item, index)
  622. return Object.hasOwn(manualOpen.value, key) ? manualOpen.value[key] : item.active === true
  623. }
  624. function rememberDetailToggle(panel, item, index, event) {
  625. const key = detailKey(panel, item, index)
  626. manualOpen.value = { ...manualOpen.value, [key]: event.target.open }
  627. }
  628. watch(activeTab, () => {
  629. manualOpen.value = {}
  630. })
  631. // 换设备:页签、分类条件与页码全部复位(不同设备的分布互不相干,留着就是拿 A 的状态看 B)。
  632. watch(
  633. () => props.deviceCode,
  634. () => {
  635. categories.value = {}
  636. pages.value = {}
  637. manualOpen.value = {}
  638. activeTab.value = DEFAULT_EQUIPMENT_TAB
  639. },
  640. )
  641. /**
  642. * 取某张工单的轨迹。
  643. *
  644. * 轨迹分区有数据 → 用它那条**完整**轨迹(按工单编码配,票 12 验收第 2 条);
  645. * 分区没数据(失败/空)→ 退回**只有状态路径**的那份(`pathOnlyTrack`),
  646. * 因为"这张工单现在在哪一态"来自工单列表,与轨迹成败无关,不该一起丢掉。
  647. */
  648. function trackOfOrder(order) {
  649. if (!order.code) return null
  650. const full = timeline.value.hasContent ? timeline.value.tracks[order.code] : null
  651. return full || pathOnlyTrack(order)
  652. }
  653. function image(panel) {
  654. const view = imageView(panel.section.data)
  655. return { ...view, url: resolveDeviceImageUrl(view.url) }
  656. }
  657. const imageDialog = ref(null)
  658. const imageFailed = ref(false)
  659. const imageLoading = ref(true)
  660. const currentImageUrl = computed(() => {
  661. const panel = panels.value.find((item) => item.kind === 'image')
  662. return panel ? image(panel).url : ''
  663. })
  664. watch([() => props.deviceCode, currentImageUrl], () => {
  665. imageDialog.value?.close()
  666. imageFailed.value = false
  667. imageLoading.value = true
  668. })
  669. watch([() => props.deviceCode, activeTab], () => {
  670. closeAudioPlayer()
  671. })
  672. function closeImageBackdrop(event) {
  673. if (event.target !== imageDialog.value) return
  674. const rect = imageDialog.value.getBoundingClientRect()
  675. if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) imageDialog.value.close()
  676. }
  677. function emptyList(label) {
  678. return emptyListText(label)
  679. }
  680. function isPlaceholder(text) {
  681. return text === DETAIL_PLACEHOLDER
  682. }
  683. </script>
  684. <style scoped>
  685. .collection-table-wrap { min-width: 0; overflow-x: hidden; }
  686. .collection-table {
  687. width: 100%;
  688. table-layout: fixed;
  689. border-collapse: collapse;
  690. color: var(--text-primary, #e5f4ff);
  691. font-size: calc(11 * var(--u, 1px));
  692. }
  693. .collection-table th,
  694. .collection-table td {
  695. min-width: 0;
  696. padding: calc(4 * var(--u, 1px)) calc(3 * var(--u, 1px));
  697. border: 1px solid rgba(69, 161, 226, .16);
  698. text-align: left;
  699. vertical-align: middle;
  700. }
  701. .collection-table th {
  702. color: #a6d8ff;
  703. background: rgba(29, 83, 124, .25);
  704. font-size: calc(10 * var(--u, 1px));
  705. letter-spacing: .02em;
  706. line-height: 1.2;
  707. }
  708. .collection-table__heading {
  709. display: inline-block;
  710. max-width: 100%;
  711. overflow: hidden;
  712. color: inherit;
  713. font-weight: 600;
  714. text-overflow: ellipsis;
  715. vertical-align: bottom;
  716. white-space: nowrap;
  717. word-break: keep-all;
  718. }
  719. .collection-table__unit {
  720. white-space: normal;
  721. word-break: break-word;
  722. overflow-wrap: anywhere;
  723. font-size: .92em;
  724. }
  725. .collection-table td { background: rgba(7, 27, 48, .35); font-variant-numeric: tabular-nums; line-height: 1.35; overflow-wrap: anywhere; }
  726. .collection-table tbody:not(.collection-table__group--latest):nth-of-type(even) td { background: rgba(7, 27, 48, .22); }
  727. .collection-table tbody:not(.collection-table__group--latest) tr:hover td { background: rgba(1, 171, 234, .12); }
  728. /* 渐变只画在整次采集的行组上,td 透明;长表 rowspan 的时间格也共用同一张背景。 */
  729. .collection-table__group--latest {
  730. --reading-color: var(--lv4, #27d17a);
  731. background: linear-gradient(90deg, color-mix(in srgb, var(--collection-accent) 24%, transparent), rgba(7, 27, 48, .28) 100%);
  732. }
  733. .collection-table .collection-table__group--latest td {
  734. background: transparent;
  735. border-color: color-mix(in srgb, var(--collection-accent) 30%, transparent);
  736. }
  737. .collection-table__group--latest tr:first-child td:first-child { box-shadow: inset 3px 0 0 var(--collection-accent); }
  738. .collection-table__group--latest:hover {
  739. background: linear-gradient(90deg, color-mix(in srgb, var(--collection-accent) 30%, transparent), rgba(7, 27, 48, .34) 100%);
  740. }
  741. .collection-table__latest-badge {
  742. display: inline-flex;
  743. align-items: center;
  744. margin-bottom: calc(2 * var(--u, 1px));
  745. padding: 0 calc(5 * var(--u, 1px));
  746. border: 1px solid color-mix(in srgb, var(--collection-accent) 65%, transparent);
  747. border-radius: 999px;
  748. background: color-mix(in srgb, var(--collection-accent) 16%, transparent);
  749. color: var(--collection-accent);
  750. font-size: var(--fs-caption, 10.5px);
  751. line-height: calc(16 * var(--u, 1px));
  752. letter-spacing: .04em;
  753. white-space: nowrap;
  754. }
  755. /* 采集时间已拆两行(日期 10 字符是最宽一行),定宽按内容收紧,
  756. 余量让给右侧指标列(维护者 2026-11-06 反馈:125u 约剩一半空白)。 */
  757. .collection-table__time { width: calc(82 * var(--u, 1px)); }
  758. .collection-table__time-date,
  759. .collection-table__time-clock { display: block; white-space: nowrap; }
  760. .collection-table__audio-col { width: calc(72 * var(--u, 1px)); }
  761. .collection-table__audio-button {
  762. display: inline-flex;
  763. align-items: center;
  764. justify-content: center;
  765. gap: calc(3 * var(--u, 1px));
  766. width: 100%;
  767. min-width: 0;
  768. padding: calc(3 * var(--u, 1px)) calc(4 * var(--u, 1px));
  769. border: 1px solid rgba(1, 171, 234, .5);
  770. border-radius: 999px;
  771. background: rgba(1, 91, 150, .26);
  772. color: #b8e8ff;
  773. font: inherit;
  774. white-space: nowrap;
  775. cursor: pointer;
  776. }
  777. .collection-table__audio-button:hover,
  778. .collection-table__audio-button:focus-visible { border-color: #ffb020; color: #ffd08a; outline: none; }
  779. /* 指标读数排版(wide / long 两种布局共用这一套,不因列名不同而脱节):
  780. 字体与左右侧面板 KPI 数值(.panel-kpi__value)同档 --num(Rajdhani / Share Tech Mono…,
  781. 单源 tokens.css);字号按表格密度自 22u KPI 档收到 13.5u;满不透明度的 --text-strong
  782. 高亮白并加粗,读数在大屏上一眼可读;读数相对单元格左边界略微缩进。
  783. long 布局的「指标名:读数」整条,名称段用正文样式、读数段复用本套字体(见下)。
  784. 报警行以更高优先级抢回红色,占位灰由后置 is-muted 覆盖。 */
  785. .collection-table__value,
  786. .collection-table__reading-value {
  787. color: var(--reading-color, var(--text-strong, #fff));
  788. opacity: 1;
  789. font-family: var(--num, monospace);
  790. font-size: calc(13.5 * var(--u, 1px));
  791. font-weight: 700;
  792. letter-spacing: .02em;
  793. text-shadow: 0 0 8px color-mix(in srgb, currentColor 24%, transparent);
  794. }
  795. .collection-table__value {
  796. padding-left: calc(4 * var(--u, 1px));
  797. }
  798. .collection-table__reading-label {
  799. color: var(--muted, #5680b0);
  800. font-size: calc(11 * var(--u, 1px));
  801. font-weight: 400;
  802. }
  803. .collection-table__reading {
  804. display: grid;
  805. grid-template-columns: minmax(0, 48%) minmax(0, 1fr);
  806. column-gap: calc(14 * var(--u, 1px));
  807. align-items: baseline;
  808. padding-left: calc(4 * var(--u, 1px));
  809. text-align: left;
  810. }
  811. .collection-table__reading-result {
  812. display: inline-flex;
  813. min-width: 0;
  814. align-items: baseline;
  815. justify-content: flex-start;
  816. gap: calc(6 * var(--u, 1px));
  817. }
  818. .collection-table__reading-result > span:first-child { min-width: 0; }
  819. .collection-table__value.is-muted,
  820. .collection-table__reading-value.is-muted { color: var(--muted, #5680b0); font-weight: 400; text-shadow: none; }
  821. .collection-table__label {
  822. color: var(--muted, #5680b0);
  823. font-size: calc(10.5 * var(--u, 1px));
  824. }
  825. .equipment-sections,
  826. .equipment-sections *,
  827. .equipment-sections *::before,
  828. .equipment-sections *::after {
  829. box-sizing: border-box;
  830. }
  831. .equipment-sections {
  832. display: grid;
  833. gap: calc(6 * var(--u, 1px));
  834. }
  835. /*
  836. 票 46 返工第 1 条:标签页条(与票 13 的分段切换、票 46 的分类 chips 同一套视觉语言,
  837. 但它是**分区切换**不是筛选)。计数挂在页签右上角;默认页 = 设备档案。
  838. */
  839. .equipment-tabs {
  840. display: flex;
  841. flex-wrap: wrap;
  842. gap: calc(3 * var(--u, 1px));
  843. }
  844. .equipment-tabs__tab {
  845. display: inline-flex;
  846. align-items: center;
  847. gap: calc(3 * var(--u, 1px));
  848. padding: calc(2 * var(--u, 1px)) calc(9 * var(--u, 1px));
  849. border: 1px solid rgba(1, 171, 234, 0.32);
  850. border-radius: calc(8 * var(--u, 1px));
  851. background: rgba(0, 20, 72, 0.6);
  852. color: var(--text-2);
  853. font: inherit;
  854. font-size: var(--fs-caption, 10.5px);
  855. letter-spacing: 0.04em;
  856. cursor: pointer;
  857. }
  858. .equipment-tabs__tab:hover,
  859. .equipment-tabs__tab:focus-visible {
  860. border-color: rgba(1, 171, 234, 0.6);
  861. color: var(--text-strong);
  862. outline: none;
  863. }
  864. .equipment-tabs__tab.is-active {
  865. border-color: rgba(0, 184, 255, 0.85);
  866. background: linear-gradient(180deg, rgba(1, 171, 234, 0.85), rgba(0, 82, 168, 0.85));
  867. color: var(--text-strong);
  868. }
  869. .equipment-tabs__count {
  870. font-family: var(--num, monospace);
  871. color: var(--lv2, #ffb020);
  872. }
  873. .equipment-tabs__tab.is-active .equipment-tabs__count {
  874. color: var(--text-strong);
  875. }
  876. .equipment-tab__body {
  877. display: grid;
  878. gap: calc(6 * var(--u, 1px));
  879. }
  880. /* 票 59:分页控件与样式移交共享 PagerNav.vue,组件不再自画 pager。 */
  881. /* 每块分区:自己的边框与抬头 —— 失败的那一块缩成一行提示,成功的照常展开。 */
  882. .equipment-section {
  883. display: grid;
  884. gap: calc(3 * var(--u, 1px));
  885. padding: calc(5 * var(--u, 1px)) var(--space-2, 8px);
  886. border: 1px solid rgba(1, 171, 234, 0.24);
  887. border-radius: calc(8 * var(--u, 1px));
  888. background: var(--inset, rgba(2, 10, 20, 0.55));
  889. }
  890. .equipment-section[data-panel-state='failed'],
  891. .equipment-section[data-panel-state='unavailable'] {
  892. border-color: rgba(255, 59, 82, 0.4);
  893. }
  894. .equipment-section--video[data-panel-state='failed'],
  895. .equipment-section--video[data-panel-state='unavailable'] {
  896. border-color: rgba(1, 171, 234, 0.24);
  897. }
  898. .equipment-section[data-panel-state='stale'] {
  899. border-color: rgba(255, 176, 32, 0.45);
  900. }
  901. .equipment-section__head {
  902. display: flex;
  903. align-items: center;
  904. justify-content: space-between;
  905. gap: var(--space-2, 8px);
  906. }
  907. .equipment-section__title {
  908. min-width: 0;
  909. overflow: hidden;
  910. color: var(--text);
  911. font-size: var(--fs-body, 13px);
  912. font-weight: 700;
  913. letter-spacing: 0.06em;
  914. white-space: nowrap;
  915. text-overflow: ellipsis;
  916. }
  917. .equipment-section__stale {
  918. margin: 0;
  919. color: var(--lv2, #ffb020);
  920. font-size: var(--fs-caption, 10.5px);
  921. letter-spacing: 0.04em;
  922. }
  923. .equipment-section__rows {
  924. display: grid;
  925. gap: calc(2 * var(--u, 1px));
  926. margin: 0;
  927. }
  928. .equipment-section__row {
  929. display: grid;
  930. grid-template-columns: calc(58 * var(--u, 1px)) minmax(0, 1fr);
  931. align-items: baseline;
  932. gap: var(--space-2, 8px);
  933. border-bottom: 1px dashed rgba(1, 171, 234, 0.14);
  934. }
  935. .equipment-section__row dt {
  936. color: var(--muted, #5680b0);
  937. font-size: var(--fs-caption, 10.5px);
  938. letter-spacing: 0.04em;
  939. }
  940. .equipment-section__row dd {
  941. margin: 0;
  942. color: var(--text, #d7ecff);
  943. min-width: 0;
  944. overflow-wrap: anywhere;
  945. word-break: normal;
  946. }
  947. .equipment-section__list {
  948. display: grid;
  949. gap: calc(4 * var(--u, 1px));
  950. }
  951. .equipment-section__item {
  952. display: grid;
  953. gap: 1px;
  954. padding-bottom: calc(3 * var(--u, 1px));
  955. border-bottom: 1px dashed rgba(1, 171, 234, 0.14);
  956. }
  957. /*
  958. 票 46:分类 chips 条(预警/报警按等级、工单按状态)。
  959. 与票 13 的分段切换同一套视觉语言(胶囊 + 选中高亮),但它是**视图过滤**不是模式切换。
  960. 计数直接挂在 chip 上 —— 分类前有多少条要看得见,筛完剩几条由列表自己说话。
  961. */
  962. .equipment-section__chips {
  963. display: flex;
  964. flex-wrap: wrap;
  965. gap: calc(3 * var(--u, 1px));
  966. }
  967. .equipment-section__chip {
  968. display: inline-flex;
  969. align-items: center;
  970. gap: calc(3 * var(--u, 1px));
  971. padding: 1px calc(7 * var(--u, 1px));
  972. border: 1px solid rgba(1, 171, 234, 0.32);
  973. border-radius: calc(8 * var(--u, 1px));
  974. background: rgba(0, 20, 72, 0.6);
  975. color: var(--text-2);
  976. font: inherit;
  977. font-size: var(--fs-caption, 10.5px);
  978. letter-spacing: 0.04em;
  979. cursor: pointer;
  980. }
  981. .equipment-section__chip:hover,
  982. .equipment-section__chip:focus-visible {
  983. border-color: rgba(1, 171, 234, 0.6);
  984. color: var(--text-strong);
  985. outline: none;
  986. }
  987. .equipment-section__chip.is-active {
  988. border-color: rgba(0, 184, 255, 0.85);
  989. background: linear-gradient(180deg, rgba(1, 171, 234, 0.85), rgba(0, 82, 168, 0.85));
  990. color: var(--text-strong);
  991. }
  992. .equipment-section__chip-count {
  993. font-family: var(--num, monospace);
  994. }
  995. /*
  996. 票 46:历史条目默认折叠(`<details>` 原生语义:键盘可达、展开态自带 aria-expanded)。
  997. summary 一行读完关键信息;展开后的详情走 dl 键值行。去掉原生三角,换成边框反馈。
  998. */
  999. .equipment-section__item--collapsible {
  1000. gap: calc(2 * var(--u, 1px));
  1001. /* 每条数据一个线框:普通项也由整块持有边框,与高亮项同一层,不再出现错位/重叠。 */
  1002. padding: calc(4 * var(--u, 1px)) calc(6 * var(--u, 1px));
  1003. border: 1px solid rgba(1, 171, 234, 0.22);
  1004. border-radius: calc(6 * var(--u, 1px));
  1005. }
  1006. .equipment-section__item--collapsible[open] {
  1007. border-color: rgba(1, 171, 234, 0.5);
  1008. }
  1009. .equipment-section__item--collapsible[open] {
  1010. border-bottom-color: rgba(1, 171, 234, 0.35);
  1011. padding-bottom: calc(5 * var(--u, 1px));
  1012. }
  1013. /*
  1014. 事件按等级色强调;未分级预警黄、报警红;非终态工单天蓝。
  1015. 2026-11-12 维护者反馈「高亮框和普通框对不上、边框重叠」:原来整块用 inset box-shadow
  1016. 画了一圈,头部又各带一条 border + 背景,两层框叠在一起。现在**每条只保留一个线框**:
  1017. 普通项用整块 border,高亮项把同一个 border 换成等级色,头部不再画框。
  1018. */
  1019. .equipment-section__item--active {
  1020. padding-left: calc(6 * var(--u, 1px));
  1021. border: 1px solid color-mix(in srgb, var(--detail-accent) 55%, transparent);
  1022. border-radius: calc(6 * var(--u, 1px));
  1023. background: linear-gradient(90deg, color-mix(in srgb, var(--detail-accent) 20%, transparent), rgba(7, 27, 48, .12) 78%);
  1024. box-shadow: inset 3px 0 0 var(--detail-accent), 0 0 12px color-mix(in srgb, var(--detail-accent) 12%, transparent);
  1025. }
  1026. .equipment-section__item--active[open] {
  1027. border-color: color-mix(in srgb, var(--detail-accent) 78%, transparent);
  1028. background: linear-gradient(90deg, color-mix(in srgb, var(--detail-accent) 26%, transparent), rgba(7, 27, 48, .16) 82%);
  1029. }
  1030. /* 高亮项的头部不另画框,避免与整块边框形成双层。 */
  1031. .equipment-section__item--active .equipment-section__item-head,
  1032. .equipment-section__item--collapsible.equipment-section__item--active[open] .equipment-section__item-head {
  1033. border-color: transparent;
  1034. background: transparent;
  1035. }
  1036. /* 状态徽标:按预警状态色高亮(待接收/已接收黄、处置中蓝、已处置紫、已解除绿)。 */
  1037. .equipment-section__status-badge {
  1038. display: inline-flex;
  1039. align-items: center;
  1040. padding: 0 calc(6 * var(--u, 1px));
  1041. border: 1px solid currentcolor;
  1042. border-radius: 999px;
  1043. background: color-mix(in srgb, currentcolor 18%, transparent);
  1044. font-size: var(--fs-caption, 10.5px);
  1045. line-height: calc(16 * var(--u, 1px));
  1046. letter-spacing: .04em;
  1047. white-space: nowrap;
  1048. }
  1049. /* 等级与状态共用的色键映射(色值只在 tokens.css 声明一份)。 */
  1050. [data-tone="lv1"] { color: var(--lv1); }
  1051. [data-tone="lv2"] { color: var(--lv2); }
  1052. [data-tone="lv3"] { color: var(--lv3); }
  1053. [data-tone="lv4"] { color: var(--lv4); }
  1054. [data-tone="handled"] { color: var(--status-handled); }
  1055. [data-tone="neutral"] { color: var(--neutral); }
  1056. .equipment-section__detail-value--tone { font-weight: 600; }
  1057. /* 预警描述允许多行(简单描述一行、实际值/阈值一行)。 */
  1058. .equipment-section__detail-row dd { white-space: pre-line; }
  1059. .equipment-section__active-badge {
  1060. display: inline-flex;
  1061. align-items: center;
  1062. padding: 0 calc(6 * var(--u, 1px));
  1063. border: 1px solid var(--detail-accent);
  1064. border-radius: 999px;
  1065. background: color-mix(in srgb, var(--detail-accent) 24%, transparent);
  1066. color: color-mix(in srgb, var(--detail-accent) 55%, white);
  1067. font-size: var(--fs-caption, 10.5px);
  1068. line-height: calc(16 * var(--u, 1px));
  1069. letter-spacing: .04em;
  1070. white-space: nowrap;
  1071. }
  1072. /* 工单卡片:管理端同款竖向排布,字号提到正文级(维护者 2026-11-13 要求加大)。 */
  1073. .equipment-section__wo-head { gap: calc(4 * var(--u, 1px)); }
  1074. /* 工单卡片字号与预警/报警卡片保持一致(不单独放大),只保留卡片式排布。 */
  1075. .equipment-section__wo-title {
  1076. display: flex;
  1077. align-items: center;
  1078. gap: calc(8 * var(--u, 1px));
  1079. min-width: 0;
  1080. padding-bottom: calc(3 * var(--u, 1px));
  1081. border-bottom: 1px dashed rgba(1, 171, 234, 0.28);
  1082. }
  1083. .equipment-section__wo-label {
  1084. flex: none;
  1085. min-width: calc(56 * var(--u, 1px));
  1086. color: var(--muted, #5680b0);
  1087. }
  1088. .equipment-section__wo-row {
  1089. display: flex;
  1090. align-items: flex-start;
  1091. gap: calc(8 * var(--u, 1px));
  1092. line-height: 1.5;
  1093. }
  1094. .equipment-section__wo-row > span:last-child { min-width: 0; overflow-wrap: anywhere; }
  1095. /* 工单详情:面板较窄,两列键值改为竖向一行一项,字号与正文一致。 */
  1096. .equipment-section__wo-detail { gap: calc(6 * var(--u, 1px)); }
  1097. .equipment-section__item-desc {
  1098. color: var(--text-2, #88b7e8);
  1099. font-size: var(--fs-caption, 10.5px);
  1100. line-height: 1.5;
  1101. overflow-wrap: anywhere;
  1102. }
  1103. .equipment-section__item-more {
  1104. justify-self: end;
  1105. color: var(--muted, #5680b0);
  1106. font-size: var(--fs-caption, 10.5px);
  1107. letter-spacing: .02em;
  1108. }
  1109. .equipment-section__item-head:hover .equipment-section__item-more { color: var(--cyan-hi, #00b8ff); }
  1110. .equipment-section__item-head {
  1111. display: grid;
  1112. gap: 1px;
  1113. cursor: pointer;
  1114. list-style: none;
  1115. padding: calc(1 * var(--u, 1px)) calc(3 * var(--u, 1px));
  1116. margin: calc(-1 * var(--u, 1px)) calc(-3 * var(--u, 1px)) 0;
  1117. border: 1px solid transparent;
  1118. border-radius: calc(8 * var(--u, 1px));
  1119. }
  1120. .equipment-section__item-head::-webkit-details-marker {
  1121. display: none;
  1122. }
  1123. /* hover / 展开只改背景,不再给头部加第二条框——整块边框已经是这一行的唯一线框。 */
  1124. .equipment-section__item-head:hover {
  1125. background: rgba(0, 53, 156, 0.28);
  1126. }
  1127. .equipment-section__item--collapsible[open] .equipment-section__item-head {
  1128. background: rgba(0, 53, 156, 0.22);
  1129. }
  1130. .equipment-section__detail {
  1131. display: grid;
  1132. gap: calc(1 * var(--u, 1px));
  1133. margin: calc(2 * var(--u, 1px)) 0 0;
  1134. padding: calc(3 * var(--u, 1px)) var(--space-2, 8px);
  1135. border-left: 2px solid rgba(1, 171, 234, 0.4);
  1136. background: rgba(2, 10, 20, 0.4);
  1137. }
  1138. .equipment-section__detail-row {
  1139. display: grid;
  1140. grid-template-columns: calc(58 * var(--u, 1px)) minmax(0, 1fr);
  1141. align-items: baseline;
  1142. gap: var(--space-2, 8px);
  1143. }
  1144. /* 详情键值改竖向一项一行,字号与事件详情一致(不单独放大)。 */
  1145. .equipment-section__wo-detail .equipment-section__detail-row { grid-template-columns: calc(84 * var(--u, 1px)) minmax(0, 1fr); }
  1146. .equipment-section__detail-row dt {
  1147. color: var(--muted, #5680b0);
  1148. font-size: var(--fs-caption, 10.5px);
  1149. letter-spacing: 0.04em;
  1150. }
  1151. .equipment-section__detail-row dd {
  1152. margin: 0;
  1153. min-width: 0;
  1154. color: var(--text, #d7ecff);
  1155. font-size: var(--fs-caption, 10.5px);
  1156. overflow-wrap: anywhere;
  1157. }
  1158. .equipment-section__item-name {
  1159. color: var(--text, #d7ecff);
  1160. font-size: var(--fs-caption, 10.5px);
  1161. }
  1162. .equipment-section__item-name em {
  1163. color: var(--muted, #5680b0);
  1164. font-style: normal;
  1165. }
  1166. .equipment-section__value {
  1167. color: var(--text);
  1168. font-family: var(--num, monospace);
  1169. font-size: var(--fs-body, 13px);
  1170. }
  1171. .equipment-section__value em {
  1172. color: var(--muted, #5680b0);
  1173. font-style: normal;
  1174. font-size: var(--fs-caption, 10.5px);
  1175. }
  1176. .equipment-section__meta {
  1177. display: flex;
  1178. flex-wrap: wrap;
  1179. gap: var(--space-2, 8px);
  1180. color: var(--text-2, #88b7e8);
  1181. font-size: var(--fs-caption, 10.5px);
  1182. }
  1183. .equipment-section__note {
  1184. margin: 0;
  1185. color: var(--muted, #5680b0);
  1186. font-size: var(--fs-caption, 10.5px);
  1187. }
  1188. .equipment-section__figure {
  1189. display: grid;
  1190. gap: calc(3 * var(--u, 1px));
  1191. margin: 0;
  1192. }
  1193. .equipment-section__img {
  1194. display: block;
  1195. width: 100%;
  1196. max-height: calc(140 * var(--u, 1px));
  1197. object-fit: cover;
  1198. border: 1px solid rgba(1, 171, 234, 0.35);
  1199. border-radius: calc(8 * var(--u, 1px));
  1200. }
  1201. .equipment-section__hint,
  1202. .equipment-section__missing,
  1203. .is-muted {
  1204. margin: 0;
  1205. color: var(--muted, #5680b0);
  1206. font-size: var(--fs-caption, 10.5px);
  1207. letter-spacing: 0.04em;
  1208. }
  1209. .equipment-section__missing {
  1210. color: var(--lv2, #ffb020);
  1211. }
  1212. .equipment-section__mono {
  1213. font-family: var(--num, monospace);
  1214. letter-spacing: 0.04em;
  1215. }
  1216. .equipment-section__image-button {
  1217. display: grid;
  1218. gap: 6px;
  1219. width: 100%;
  1220. padding: 0;
  1221. border: 0;
  1222. background: transparent;
  1223. color: var(--cyan-hi);
  1224. font: inherit;
  1225. cursor: zoom-in;
  1226. }
  1227. .equipment-image-viewer {
  1228. width: min(90vw, 1200px);
  1229. max-height: 90vh;
  1230. padding: 16px;
  1231. border: 1px solid var(--cyan);
  1232. border-radius: calc(8 * var(--u, 1px));
  1233. background: var(--bg-0);
  1234. color: var(--text);
  1235. }
  1236. .equipment-image-viewer::backdrop { background: rgba(1, 5, 20, .8); backdrop-filter: blur(6px); }
  1237. .equipment-image-viewer img { display: block; width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
  1238. .equipment-image-viewer__close { display: block; margin-left: auto; margin-bottom: 8px; cursor: pointer; }
  1239. /* 音频播放条:贴播放键上方渐入的小浮层,不遮罩、不虚化整屏 UI。 */
  1240. .collection-audio-player {
  1241. position: fixed;
  1242. z-index: calc(var(--z-columns, 30) + 5);
  1243. width: min(264px, 88vw);
  1244. padding: calc(6 * var(--u, 1px)) calc(8 * var(--u, 1px)) calc(8 * var(--u, 1px));
  1245. border: 1px solid var(--cyan, #01abea);
  1246. border-radius: calc(8 * var(--u, 1px));
  1247. background: rgba(4, 20, 38, .97);
  1248. box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
  1249. color: var(--text, #e5f4ff);
  1250. transform: translate(-50%, calc(-100% - 8px));
  1251. animation: collection-audio-pop-above .18s ease-out;
  1252. }
  1253. .collection-audio-player.is-below {
  1254. transform: translate(-50%, 8px);
  1255. animation-name: collection-audio-pop-below;
  1256. }
  1257. @keyframes collection-audio-pop-above {
  1258. from { opacity: 0; transform: translate(-50%, calc(-100% - 2px)); }
  1259. }
  1260. @keyframes collection-audio-pop-below {
  1261. from { opacity: 0; transform: translate(-50%, 2px); }
  1262. }
  1263. .collection-audio-player__head {
  1264. display: flex;
  1265. align-items: center;
  1266. justify-content: space-between;
  1267. gap: calc(6 * var(--u, 1px));
  1268. margin-bottom: calc(4 * var(--u, 1px));
  1269. }
  1270. .collection-audio-player__label {
  1271. min-width: 0;
  1272. overflow: hidden;
  1273. color: #a6d8ff;
  1274. font-size: var(--fs-caption, 10.5px);
  1275. text-overflow: ellipsis;
  1276. white-space: nowrap;
  1277. }
  1278. .collection-audio-player__close {
  1279. flex: none;
  1280. width: calc(20 * var(--u, 1px));
  1281. height: calc(20 * var(--u, 1px));
  1282. padding: 0;
  1283. border: 1px solid rgba(1, 171, 234, .5);
  1284. border-radius: 999px;
  1285. background: rgba(1, 91, 150, .26);
  1286. color: inherit;
  1287. font-size: calc(12 * var(--u, 1px));
  1288. line-height: 1;
  1289. cursor: pointer;
  1290. }
  1291. .collection-audio-player__audio { display: block; width: 100%; max-width: 100%; height: calc(32 * var(--u, 1px)); }
  1292. </style>