EquipmentDetailSections.vue 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388
  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. // 档案 type 是 deviceType 的领域字段;只认当前设备的摄像机正证据,不以能力查询失败推断传感器。
  426. const isCamera = computed(() => {
  427. const archive = panels.value.find((panel) => panel.kind === 'archive')?.section.data
  428. return String(archive?.type ?? '').trim() === '20'
  429. || (videoDevice.value?.deviceCode === props.deviceCode && videoDevice.value?.typeCode === '20')
  430. })
  431. // ---- 票 46 返工第 1 条:标签页切换(弃用六块竖排的长滚动)----
  432. /** 页签清单(domain 给顺序与背后的分区归属;计数给预警/报警/工单三页)。 */
  433. const tabs = computed(() =>
  434. EQUIPMENT_TABS.map((tab) => ({ ...tab, count: tabCount(panels.value, tab.name) })),
  435. )
  436. /** 当前页签(默认「设备档案」;换设备复位,不把 A 的页签停在 B 上)。 */
  437. const activeTab = ref(DEFAULT_EQUIPMENT_TAB)
  438. // 同设备刷新只更新内容;DOM 重排后保留内部及外层详情的滚动位置与可见条目。
  439. let scrollRevision = 0
  440. watch([() => props.aggregate, () => props.deviceCode], (_current, previous) => {
  441. const revision = ++scrollRevision
  442. const device = props.deviceCode
  443. const sameDevice = previous[1] === device
  444. const tab = activeTab.value
  445. const positions = []
  446. const items = Array.from(sectionsRoot.value?.querySelectorAll?.('[data-collection-record-key], [data-history-item]') || [])
  447. for (let element = sectionsRoot.value; element; element = element.parentElement) {
  448. if (typeof document !== 'undefined' && (element === document.body || element === document.documentElement)) break
  449. if (typeof element.scrollTop === 'number' && (element.scrollTop || element.scrollHeight > element.clientHeight)) {
  450. const rect = element.getBoundingClientRect?.()
  451. const anchor = rect && items.find((item) => {
  452. const bounds = item.getBoundingClientRect()
  453. return bounds.bottom > rect.top && bounds.top < rect.bottom
  454. })
  455. const key = anchor && (anchor.getAttribute('data-collection-record-key') || anchor.getAttribute('data-event') || anchor.getAttribute('data-work-order'))
  456. positions.push({ element, top: element.scrollTop, left: element.scrollLeft,
  457. key: key && key !== DETAIL_PLACEHOLDER ? key : '',
  458. offset: anchor ? anchor.getBoundingClientRect().top - rect.top : 0,
  459. })
  460. }
  461. }
  462. nextTick(() => {
  463. if (revision !== scrollRevision || device !== props.deviceCode || (sameDevice && tab !== activeTab.value)) return
  464. if (!sameDevice) {
  465. for (const { element } of positions) { element.scrollTop = 0; element.scrollLeft = 0 }
  466. return
  467. }
  468. const currentItems = Array.from(sectionsRoot.value?.querySelectorAll?.('[data-collection-record-key], [data-history-item]') || [])
  469. for (const { element, top, left, key, offset } of positions) {
  470. if (element.isConnected === false) continue
  471. const anchor = key && currentItems.find((item) =>
  472. [item.getAttribute('data-collection-record-key'), item.getAttribute('data-event'), item.getAttribute('data-work-order')].includes(key))
  473. // 新记录插到前面时仍跟住原来正在看的条目;条目已移除才退回像素位置。
  474. element.scrollTop = anchor ? element.scrollTop + anchor.getBoundingClientRect().top - element.getBoundingClientRect().top - offset : top
  475. element.scrollLeft = left
  476. }
  477. })
  478. }, { flush: 'pre' })
  479. onBeforeUnmount(() => { scrollRevision += 1 })
  480. /** 当前页签要渲染的面板(保留渲染计划自己的次序;图片随档案页出现)。 */
  481. const activePanels = computed(() => panelsForTab(panels.value, activeTab.value))
  482. /**
  483. * 时间线来源(票 12):按工单编码配好的轨迹 + 轨迹分区自己的状态。
  484. * 只算一次 —— 每张工单渲染时都去重算会把 O(n²) 的判断塞进模板。
  485. */
  486. const timeline = computed(() => timelineSource(props.aggregate))
  487. const staleNote = '数据已过期 · 显示最后一次成功数据,不是实时值'
  488. // ---- 票 46:分类查询与历史折叠(**视图本地状态**)----
  489. //
  490. // 为什么不进 store:分类/页码/折叠是「这一屏怎么看」,不是业务事实,也不是全局筛选条件。
  491. // 放进 `filterStore` 会让它跨设备、跨模式生效并触发重新取数 —— 那是把视图偏好
  492. // 冒充成数据条件(票 46 非目标明写「不改变后端事实与只读边界」)。
  493. // 组件卸载即消失;换设备时下面 `watch` 把它清掉,不残留成"A 的分类挂在 B 上"。
  494. /** 各分区当前生效的分类键(`{ [分区名]: 分类键 }`;空串/缺失=全部)。 */
  495. const categories = ref({})
  496. /** 各分区当前页码(1 起;预警/报警/工单三块都接入分页)。 */
  497. const pages = ref({})
  498. const recordTables = computed(() => Object.fromEntries(
  499. panels.value.filter((panel) => panel.kind === 'metrics').map((panel) => [panel.name, collectionRecordTable(panel.section.data, pages.value[panel.name] || 1)]),
  500. ))
  501. function recordTableOf(panel) {
  502. return recordTables.value[panel.name]
  503. }
  504. function recordKey(row) {
  505. if (!row.timeKey) return undefined
  506. return JSON.stringify([row.timeKey, row.cells.filter((cell) => cell.isReading).map((cell) => [cell.key, cell.reading?.label])])
  507. }
  508. const audioPlayer = ref(null)
  509. const activeAudioPath = ref('')
  510. const activeAudioLabel = ref('音频记录')
  511. const activeAudioUrl = computed(() => activeAudioPath.value ? resolveDeviceImageUrl(activeAudioPath.value) : '')
  512. const audioPlacement = ref({ left: 0, top: 0, below: false })
  513. const audioPlayerStyle = computed(() => ({
  514. left: `${audioPlacement.value.left}px`,
  515. top: `${audioPlacement.value.top}px`,
  516. }))
  517. let audioTriggerEl = null
  518. /** 打开播放条:以触发按钮为锚,默认在按钮上方渐入;顶部空间不足时翻到按钮下方。 */
  519. function openRecordAudio(cell, event) {
  520. if (!cell?.audioPath) return
  521. const rect = event?.currentTarget?.getBoundingClientRect?.()
  522. if (rect) {
  523. const margin = 132
  524. const left = Math.min(Math.max(rect.left + rect.width / 2, margin), Math.max(margin, window.innerWidth - margin))
  525. const below = rect.top < 96
  526. audioPlacement.value = { left: Math.round(left), top: Math.round(below ? rect.bottom : rect.top), below }
  527. }
  528. audioTriggerEl = event?.currentTarget || null
  529. activeAudioPath.value = cell.audioPath
  530. activeAudioLabel.value = cell.audioLabel || '音频记录'
  531. }
  532. function closeAudioPlayer() {
  533. if (!activeAudioPath.value) return
  534. activeAudioPath.value = ''
  535. audioTriggerEl = null
  536. }
  537. function audioOutsideHandler(event) {
  538. if (audioPlayer.value?.contains(event.target) || audioTriggerEl?.contains?.(event.target)) return
  539. closeAudioPlayer()
  540. }
  541. function audioEscapeHandler(event) {
  542. if (event.key === 'Escape') closeAudioPlayer()
  543. }
  544. function attachAudioGuards() {
  545. document.addEventListener('pointerdown', audioOutsideHandler, true)
  546. // 滚动时按钮会离开锚点,直接收起(capture 才能收到各滚动容器不冒泡的 scroll)。
  547. window.addEventListener('scroll', closeAudioPlayer, true)
  548. window.addEventListener('keydown', audioEscapeHandler, true)
  549. }
  550. function detachAudioGuards() {
  551. if (typeof document === 'undefined' || typeof window === 'undefined') return
  552. document.removeEventListener('pointerdown', audioOutsideHandler, true)
  553. window.removeEventListener('scroll', closeAudioPlayer, true)
  554. window.removeEventListener('keydown', audioEscapeHandler, true)
  555. }
  556. watch(activeAudioPath, (open) => { if (open) attachAudioGuards(); else detachAudioGuards() })
  557. onBeforeUnmount(detachAudioGuards)
  558. /** 某分区的行视图(未过滤)。 */
  559. function rowsOf(panel) {
  560. const data = panel.section.data
  561. if (panel.kind === 'archive') return archiveRows(data)
  562. if (panel.kind === 'orders') return workOrderRows(data)
  563. return eventRows(data)
  564. }
  565. /** 这一块有没有分类查询(预警/报警/工单有;档案/指标/图片没有列表语义)。 */
  566. function isFilterable(panel) {
  567. return panel.kind === 'events' || panel.kind === 'orders'
  568. }
  569. /** 某分区的分类 chips(只有 events/orders 两类有;其它块回空数组,模板据此不画 chip 条)。 */
  570. function chipsOf(panel) {
  571. if (panel.kind !== 'events' && panel.kind !== 'orders') return []
  572. const order = panel.kind === 'orders' ? WORK_ORDER_CATEGORY_ORDER : EVENT_CATEGORY_ORDER
  573. return categoryChips(rowsOf(panel), order)
  574. }
  575. function activeCategory(panelName) {
  576. return categories.value[panelName] || ''
  577. }
  578. /** 点同一项取消(与票 37 的类型筛选同款交互:不需要额外的"清除"按钮就能撤)。 */
  579. function toggleCategory(panelName, key) {
  580. categories.value = { ...categories.value, [panelName]: activeCategory(panelName) === key ? '' : key }
  581. // 换分类 = 换结果集,页码回第 1 页(停在第 3 页看新分类会直接显示"没有记录")。
  582. pages.value = { ...pages.value, [panelName]: 1 }
  583. }
  584. /** 过滤后的行(chip 只筛视图,不动数据、不发请求)。 */
  585. function visibleRows(panel) {
  586. const rows = filterByCategory(rowsOf(panel), activeCategory(panel.name))
  587. if (panel.kind !== 'events' && panel.kind !== 'orders') return rows
  588. return prioritizeActiveRows(rows)
  589. }
  590. /** 过滤 + 分页后的窗口(domain 单源 `pagedRows` 收边界;票 59 三清单同一条路径,组件不再备第二份兜底形状)。 */
  591. function pagedOf(panel) {
  592. return pagedRows(visibleRows(panel), pages.value[panel.name] || 1)
  593. }
  594. /**
  595. * 翻页唯一出口(票 59):PagerNav 的前后页/页码直达/跳页都带**目标页码(1 起)**回来。
  596. * 这里只存状态,不另做夹取——越界统一由 domain `pagedRows` 在下一帧渲染时夹回(条文 6)。
  597. */
  598. function gotoPage(panel, target) {
  599. pages.value = { ...pages.value, [panel.name]: Number(target) || 1 }
  600. }
  601. function categoryNoteText(panel) {
  602. return categoryNote(chipsOf(panel), activeCategory(panel.name))
  603. }
  604. /**
  605. * 票 115 优化:未解除/未结案条目的展开状态。
  606. *
  607. * 切换页签时清空手动状态 ⇒ 进入对应页签时,active 条目默认展开;
  608. * 用户手动收起/展开后以手动状态为准(manualOpen[key]),不会每帧被默认值顶回去。
  609. */
  610. const manualOpen = ref({})
  611. function detailKey(panel, item, index) {
  612. return panel.name + '|' + (item.code || index)
  613. }
  614. function isDetailOpen(panel, item, index) {
  615. const key = detailKey(panel, item, index)
  616. return Object.hasOwn(manualOpen.value, key) ? manualOpen.value[key] : item.active === true
  617. }
  618. function rememberDetailToggle(panel, item, index, event) {
  619. const key = detailKey(panel, item, index)
  620. manualOpen.value = { ...manualOpen.value, [key]: event.target.open }
  621. }
  622. watch(activeTab, () => {
  623. manualOpen.value = {}
  624. })
  625. // 换设备:页签、分类条件与页码全部复位(不同设备的分布互不相干,留着就是拿 A 的状态看 B)。
  626. watch(
  627. () => props.deviceCode,
  628. () => {
  629. categories.value = {}
  630. pages.value = {}
  631. manualOpen.value = {}
  632. activeTab.value = DEFAULT_EQUIPMENT_TAB
  633. },
  634. )
  635. /**
  636. * 取某张工单的轨迹。
  637. *
  638. * 轨迹分区有数据 → 用它那条**完整**轨迹(按工单编码配,票 12 验收第 2 条);
  639. * 分区没数据(失败/空)→ 退回**只有状态路径**的那份(`pathOnlyTrack`),
  640. * 因为"这张工单现在在哪一态"来自工单列表,与轨迹成败无关,不该一起丢掉。
  641. */
  642. function trackOfOrder(order) {
  643. if (!order.code) return null
  644. const full = timeline.value.hasContent ? timeline.value.tracks[order.code] : null
  645. return full || pathOnlyTrack(order)
  646. }
  647. function image(panel) {
  648. const view = imageView(panel.section.data)
  649. return { ...view, url: resolveDeviceImageUrl(view.url) }
  650. }
  651. const imageDialog = ref(null)
  652. const imageFailed = ref(false)
  653. const imageLoading = ref(true)
  654. const currentImageUrl = computed(() => {
  655. const panel = panels.value.find((item) => item.kind === 'image')
  656. return panel ? image(panel).url : ''
  657. })
  658. watch([() => props.deviceCode, currentImageUrl], () => {
  659. imageDialog.value?.close()
  660. imageFailed.value = false
  661. imageLoading.value = true
  662. })
  663. watch([() => props.deviceCode, activeTab], () => {
  664. closeAudioPlayer()
  665. })
  666. function closeImageBackdrop(event) {
  667. if (event.target !== imageDialog.value) return
  668. const rect = imageDialog.value.getBoundingClientRect()
  669. if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) imageDialog.value.close()
  670. }
  671. function emptyList(label) {
  672. return emptyListText(label)
  673. }
  674. function isPlaceholder(text) {
  675. return text === DETAIL_PLACEHOLDER
  676. }
  677. </script>
  678. <style scoped>
  679. .collection-table-wrap { min-width: 0; overflow-x: hidden; }
  680. .collection-table {
  681. width: 100%;
  682. table-layout: fixed;
  683. border-collapse: collapse;
  684. color: var(--text-primary, #e5f4ff);
  685. font-size: calc(11 * var(--u, 1px));
  686. }
  687. .collection-table th,
  688. .collection-table td {
  689. min-width: 0;
  690. padding: calc(4 * var(--u, 1px)) calc(3 * var(--u, 1px));
  691. border: 1px solid rgba(69, 161, 226, .16);
  692. text-align: left;
  693. vertical-align: middle;
  694. }
  695. .collection-table th {
  696. color: #a6d8ff;
  697. background: rgba(29, 83, 124, .25);
  698. font-size: calc(10 * var(--u, 1px));
  699. letter-spacing: .02em;
  700. line-height: 1.2;
  701. }
  702. .collection-table__heading {
  703. display: inline-block;
  704. max-width: 100%;
  705. overflow: hidden;
  706. color: inherit;
  707. font-weight: 600;
  708. text-overflow: ellipsis;
  709. vertical-align: bottom;
  710. white-space: nowrap;
  711. word-break: keep-all;
  712. }
  713. .collection-table__unit {
  714. white-space: normal;
  715. word-break: break-word;
  716. overflow-wrap: anywhere;
  717. font-size: .92em;
  718. }
  719. .collection-table td { background: rgba(7, 27, 48, .35); font-variant-numeric: tabular-nums; line-height: 1.35; overflow-wrap: anywhere; }
  720. .collection-table tbody:not(.collection-table__group--latest):nth-of-type(even) td { background: rgba(7, 27, 48, .22); }
  721. .collection-table tbody:not(.collection-table__group--latest) tr:hover td { background: rgba(1, 171, 234, .12); }
  722. /* 渐变只画在整次采集的行组上,td 透明;长表 rowspan 的时间格也共用同一张背景。 */
  723. .collection-table__group--latest {
  724. --reading-color: var(--lv4, #27d17a);
  725. background: linear-gradient(90deg, color-mix(in srgb, var(--collection-accent) 24%, transparent), rgba(7, 27, 48, .28) 100%);
  726. }
  727. .collection-table .collection-table__group--latest td {
  728. background: transparent;
  729. border-color: color-mix(in srgb, var(--collection-accent) 30%, transparent);
  730. }
  731. .collection-table__group--latest tr:first-child td:first-child { box-shadow: inset 3px 0 0 var(--collection-accent); }
  732. .collection-table__group--latest:hover {
  733. background: linear-gradient(90deg, color-mix(in srgb, var(--collection-accent) 30%, transparent), rgba(7, 27, 48, .34) 100%);
  734. }
  735. .collection-table__latest-badge {
  736. display: inline-flex;
  737. align-items: center;
  738. margin-bottom: calc(2 * var(--u, 1px));
  739. padding: 0 calc(5 * var(--u, 1px));
  740. border: 1px solid color-mix(in srgb, var(--collection-accent) 65%, transparent);
  741. border-radius: 999px;
  742. background: color-mix(in srgb, var(--collection-accent) 16%, transparent);
  743. color: var(--collection-accent);
  744. font-size: var(--fs-caption, 10.5px);
  745. line-height: calc(16 * var(--u, 1px));
  746. letter-spacing: .04em;
  747. white-space: nowrap;
  748. }
  749. /* 采集时间已拆两行(日期 10 字符是最宽一行),定宽按内容收紧,
  750. 余量让给右侧指标列(维护者 2026-11-06 反馈:125u 约剩一半空白)。 */
  751. .collection-table__time { width: calc(82 * var(--u, 1px)); }
  752. .collection-table__time-date,
  753. .collection-table__time-clock { display: block; white-space: nowrap; }
  754. .collection-table__audio-col { width: calc(72 * var(--u, 1px)); }
  755. .collection-table__audio-button {
  756. display: inline-flex;
  757. align-items: center;
  758. justify-content: center;
  759. gap: calc(3 * var(--u, 1px));
  760. width: 100%;
  761. min-width: 0;
  762. padding: calc(3 * var(--u, 1px)) calc(4 * var(--u, 1px));
  763. border: 1px solid rgba(1, 171, 234, .5);
  764. border-radius: 999px;
  765. background: rgba(1, 91, 150, .26);
  766. color: #b8e8ff;
  767. font: inherit;
  768. white-space: nowrap;
  769. cursor: pointer;
  770. }
  771. .collection-table__audio-button:hover,
  772. .collection-table__audio-button:focus-visible { border-color: #ffb020; color: #ffd08a; outline: none; }
  773. /* 指标读数排版(wide / long 两种布局共用这一套,不因列名不同而脱节):
  774. 字体与左右侧面板 KPI 数值(.panel-kpi__value)同档 --num(Rajdhani / Share Tech Mono…,
  775. 单源 tokens.css);字号按表格密度自 22u KPI 档收到 13.5u;满不透明度的 --text-strong
  776. 高亮白并加粗,读数在大屏上一眼可读;读数相对单元格左边界略微缩进。
  777. long 布局的「指标名:读数」整条,名称段用正文样式、读数段复用本套字体(见下)。
  778. 报警行以更高优先级抢回红色,占位灰由后置 is-muted 覆盖。 */
  779. .collection-table__value,
  780. .collection-table__reading-value {
  781. color: var(--reading-color, var(--text-strong, #fff));
  782. opacity: 1;
  783. font-family: var(--num, monospace);
  784. font-size: calc(13.5 * var(--u, 1px));
  785. font-weight: 700;
  786. letter-spacing: .02em;
  787. text-shadow: 0 0 8px color-mix(in srgb, currentColor 24%, transparent);
  788. }
  789. .collection-table__value {
  790. padding-left: calc(4 * var(--u, 1px));
  791. }
  792. .collection-table__reading-label {
  793. color: var(--muted, #5680b0);
  794. font-size: calc(11 * var(--u, 1px));
  795. font-weight: 400;
  796. }
  797. .collection-table__reading {
  798. display: grid;
  799. grid-template-columns: minmax(0, 48%) minmax(0, 1fr);
  800. column-gap: calc(14 * var(--u, 1px));
  801. align-items: baseline;
  802. padding-left: calc(4 * var(--u, 1px));
  803. text-align: left;
  804. }
  805. .collection-table__reading-result {
  806. display: inline-flex;
  807. min-width: 0;
  808. align-items: baseline;
  809. justify-content: flex-start;
  810. gap: calc(6 * var(--u, 1px));
  811. }
  812. .collection-table__reading-result > span:first-child { min-width: 0; }
  813. .collection-table__value.is-muted,
  814. .collection-table__reading-value.is-muted { color: var(--muted, #5680b0); font-weight: 400; text-shadow: none; }
  815. .collection-table__label {
  816. color: var(--muted, #5680b0);
  817. font-size: calc(10.5 * var(--u, 1px));
  818. }
  819. .equipment-sections,
  820. .equipment-sections *,
  821. .equipment-sections *::before,
  822. .equipment-sections *::after {
  823. box-sizing: border-box;
  824. }
  825. .equipment-sections {
  826. display: grid;
  827. gap: calc(6 * var(--u, 1px));
  828. }
  829. /*
  830. 票 46 返工第 1 条:标签页条(与票 13 的分段切换、票 46 的分类 chips 同一套视觉语言,
  831. 但它是**分区切换**不是筛选)。计数挂在页签右上角;默认页 = 设备档案。
  832. */
  833. .equipment-tabs {
  834. display: flex;
  835. flex-wrap: wrap;
  836. gap: calc(3 * var(--u, 1px));
  837. }
  838. .equipment-tabs__tab {
  839. display: inline-flex;
  840. align-items: center;
  841. gap: calc(3 * var(--u, 1px));
  842. padding: calc(2 * var(--u, 1px)) calc(9 * var(--u, 1px));
  843. border: 1px solid rgba(1, 171, 234, 0.32);
  844. border-radius: calc(8 * var(--u, 1px));
  845. background: rgba(0, 20, 72, 0.6);
  846. color: var(--text-2);
  847. font: inherit;
  848. font-size: var(--fs-caption, 10.5px);
  849. letter-spacing: 0.04em;
  850. cursor: pointer;
  851. }
  852. .equipment-tabs__tab:hover,
  853. .equipment-tabs__tab:focus-visible {
  854. border-color: rgba(1, 171, 234, 0.6);
  855. color: var(--text-strong);
  856. outline: none;
  857. }
  858. .equipment-tabs__tab.is-active {
  859. border-color: rgba(0, 184, 255, 0.85);
  860. background: linear-gradient(180deg, rgba(1, 171, 234, 0.85), rgba(0, 82, 168, 0.85));
  861. color: var(--text-strong);
  862. }
  863. .equipment-tabs__count {
  864. font-family: var(--num, monospace);
  865. color: var(--lv2, #ffb020);
  866. }
  867. .equipment-tabs__tab.is-active .equipment-tabs__count {
  868. color: var(--text-strong);
  869. }
  870. .equipment-tab__body {
  871. display: grid;
  872. gap: calc(6 * var(--u, 1px));
  873. }
  874. /* 票 59:分页控件与样式移交共享 PagerNav.vue,组件不再自画 pager。 */
  875. /* 每块分区:自己的边框与抬头 —— 失败的那一块缩成一行提示,成功的照常展开。 */
  876. .equipment-section {
  877. display: grid;
  878. gap: calc(3 * var(--u, 1px));
  879. padding: calc(5 * var(--u, 1px)) var(--space-2, 8px);
  880. border: 1px solid rgba(1, 171, 234, 0.24);
  881. border-radius: calc(8 * var(--u, 1px));
  882. background: var(--inset, rgba(2, 10, 20, 0.55));
  883. }
  884. .equipment-section[data-panel-state='failed'],
  885. .equipment-section[data-panel-state='unavailable'] {
  886. border-color: rgba(255, 59, 82, 0.4);
  887. }
  888. .equipment-section--video[data-panel-state='failed'],
  889. .equipment-section--video[data-panel-state='unavailable'] {
  890. border-color: rgba(1, 171, 234, 0.24);
  891. }
  892. .equipment-section[data-panel-state='stale'] {
  893. border-color: rgba(255, 176, 32, 0.45);
  894. }
  895. .equipment-section__head {
  896. display: flex;
  897. align-items: center;
  898. justify-content: space-between;
  899. gap: var(--space-2, 8px);
  900. }
  901. .equipment-section__title {
  902. min-width: 0;
  903. overflow: hidden;
  904. color: var(--text);
  905. font-size: var(--fs-body, 13px);
  906. font-weight: 700;
  907. letter-spacing: 0.06em;
  908. white-space: nowrap;
  909. text-overflow: ellipsis;
  910. }
  911. .equipment-section__stale {
  912. margin: 0;
  913. color: var(--lv2, #ffb020);
  914. font-size: var(--fs-caption, 10.5px);
  915. letter-spacing: 0.04em;
  916. }
  917. .equipment-section__rows {
  918. display: grid;
  919. gap: calc(2 * var(--u, 1px));
  920. margin: 0;
  921. }
  922. .equipment-section__row {
  923. display: grid;
  924. grid-template-columns: calc(58 * var(--u, 1px)) minmax(0, 1fr);
  925. align-items: baseline;
  926. gap: var(--space-2, 8px);
  927. border-bottom: 1px dashed rgba(1, 171, 234, 0.14);
  928. }
  929. .equipment-section__row dt {
  930. color: var(--muted, #5680b0);
  931. font-size: var(--fs-caption, 10.5px);
  932. letter-spacing: 0.04em;
  933. }
  934. .equipment-section__row dd {
  935. margin: 0;
  936. color: var(--text, #d7ecff);
  937. min-width: 0;
  938. overflow-wrap: anywhere;
  939. word-break: normal;
  940. }
  941. .equipment-section__list {
  942. display: grid;
  943. gap: calc(4 * var(--u, 1px));
  944. }
  945. .equipment-section__item {
  946. display: grid;
  947. gap: 1px;
  948. padding-bottom: calc(3 * var(--u, 1px));
  949. border-bottom: 1px dashed rgba(1, 171, 234, 0.14);
  950. }
  951. /*
  952. 票 46:分类 chips 条(预警/报警按等级、工单按状态)。
  953. 与票 13 的分段切换同一套视觉语言(胶囊 + 选中高亮),但它是**视图过滤**不是模式切换。
  954. 计数直接挂在 chip 上 —— 分类前有多少条要看得见,筛完剩几条由列表自己说话。
  955. */
  956. .equipment-section__chips {
  957. display: flex;
  958. flex-wrap: wrap;
  959. gap: calc(3 * var(--u, 1px));
  960. }
  961. .equipment-section__chip {
  962. display: inline-flex;
  963. align-items: center;
  964. gap: calc(3 * var(--u, 1px));
  965. padding: 1px calc(7 * var(--u, 1px));
  966. border: 1px solid rgba(1, 171, 234, 0.32);
  967. border-radius: calc(8 * var(--u, 1px));
  968. background: rgba(0, 20, 72, 0.6);
  969. color: var(--text-2);
  970. font: inherit;
  971. font-size: var(--fs-caption, 10.5px);
  972. letter-spacing: 0.04em;
  973. cursor: pointer;
  974. }
  975. .equipment-section__chip:hover,
  976. .equipment-section__chip:focus-visible {
  977. border-color: rgba(1, 171, 234, 0.6);
  978. color: var(--text-strong);
  979. outline: none;
  980. }
  981. .equipment-section__chip.is-active {
  982. border-color: rgba(0, 184, 255, 0.85);
  983. background: linear-gradient(180deg, rgba(1, 171, 234, 0.85), rgba(0, 82, 168, 0.85));
  984. color: var(--text-strong);
  985. }
  986. .equipment-section__chip-count {
  987. font-family: var(--num, monospace);
  988. }
  989. /*
  990. 票 46:历史条目默认折叠(`<details>` 原生语义:键盘可达、展开态自带 aria-expanded)。
  991. summary 一行读完关键信息;展开后的详情走 dl 键值行。去掉原生三角,换成边框反馈。
  992. */
  993. .equipment-section__item--collapsible {
  994. gap: calc(2 * var(--u, 1px));
  995. /* 每条数据一个线框:普通项也由整块持有边框,与高亮项同一层,不再出现错位/重叠。 */
  996. padding: calc(4 * var(--u, 1px)) calc(6 * var(--u, 1px));
  997. border: 1px solid rgba(1, 171, 234, 0.22);
  998. border-radius: calc(6 * var(--u, 1px));
  999. }
  1000. .equipment-section__item--collapsible[open] {
  1001. border-color: rgba(1, 171, 234, 0.5);
  1002. }
  1003. .equipment-section__item--collapsible[open] {
  1004. border-bottom-color: rgba(1, 171, 234, 0.35);
  1005. padding-bottom: calc(5 * var(--u, 1px));
  1006. }
  1007. /*
  1008. 事件按等级色强调;未分级预警黄、报警红;非终态工单天蓝。
  1009. 2026-11-12 维护者反馈「高亮框和普通框对不上、边框重叠」:原来整块用 inset box-shadow
  1010. 画了一圈,头部又各带一条 border + 背景,两层框叠在一起。现在**每条只保留一个线框**:
  1011. 普通项用整块 border,高亮项把同一个 border 换成等级色,头部不再画框。
  1012. */
  1013. .equipment-section__item--active {
  1014. padding-left: calc(6 * var(--u, 1px));
  1015. border: 1px solid color-mix(in srgb, var(--detail-accent) 55%, transparent);
  1016. border-radius: calc(6 * var(--u, 1px));
  1017. background: linear-gradient(90deg, color-mix(in srgb, var(--detail-accent) 20%, transparent), rgba(7, 27, 48, .12) 78%);
  1018. box-shadow: inset 3px 0 0 var(--detail-accent), 0 0 12px color-mix(in srgb, var(--detail-accent) 12%, transparent);
  1019. }
  1020. .equipment-section__item--active[open] {
  1021. border-color: color-mix(in srgb, var(--detail-accent) 78%, transparent);
  1022. background: linear-gradient(90deg, color-mix(in srgb, var(--detail-accent) 26%, transparent), rgba(7, 27, 48, .16) 82%);
  1023. }
  1024. /* 高亮项的头部不另画框,避免与整块边框形成双层。 */
  1025. .equipment-section__item--active .equipment-section__item-head,
  1026. .equipment-section__item--collapsible.equipment-section__item--active[open] .equipment-section__item-head {
  1027. border-color: transparent;
  1028. background: transparent;
  1029. }
  1030. /* 状态徽标:按预警状态色高亮(待接收/已接收黄、处置中蓝、已处置紫、已解除绿)。 */
  1031. .equipment-section__status-badge {
  1032. display: inline-flex;
  1033. align-items: center;
  1034. padding: 0 calc(6 * var(--u, 1px));
  1035. border: 1px solid currentcolor;
  1036. border-radius: 999px;
  1037. background: color-mix(in srgb, currentcolor 18%, transparent);
  1038. font-size: var(--fs-caption, 10.5px);
  1039. line-height: calc(16 * var(--u, 1px));
  1040. letter-spacing: .04em;
  1041. white-space: nowrap;
  1042. }
  1043. /* 等级与状态共用的色键映射(色值只在 tokens.css 声明一份)。 */
  1044. [data-tone="lv1"] { color: var(--lv1); }
  1045. [data-tone="lv2"] { color: var(--lv2); }
  1046. [data-tone="lv3"] { color: var(--lv3); }
  1047. [data-tone="lv4"] { color: var(--lv4); }
  1048. [data-tone="handled"] { color: var(--status-handled); }
  1049. [data-tone="neutral"] { color: var(--neutral); }
  1050. .equipment-section__detail-value--tone { font-weight: 600; }
  1051. /* 预警描述允许多行(简单描述一行、实际值/阈值一行)。 */
  1052. .equipment-section__detail-row dd { white-space: pre-line; }
  1053. .equipment-section__active-badge {
  1054. display: inline-flex;
  1055. align-items: center;
  1056. padding: 0 calc(6 * var(--u, 1px));
  1057. border: 1px solid var(--detail-accent);
  1058. border-radius: 999px;
  1059. background: color-mix(in srgb, var(--detail-accent) 24%, transparent);
  1060. color: color-mix(in srgb, var(--detail-accent) 55%, white);
  1061. font-size: var(--fs-caption, 10.5px);
  1062. line-height: calc(16 * var(--u, 1px));
  1063. letter-spacing: .04em;
  1064. white-space: nowrap;
  1065. }
  1066. /* 工单卡片:管理端同款竖向排布,字号提到正文级(维护者 2026-11-13 要求加大)。 */
  1067. .equipment-section__wo-head { gap: calc(4 * var(--u, 1px)); }
  1068. /* 工单卡片字号与预警/报警卡片保持一致(不单独放大),只保留卡片式排布。 */
  1069. .equipment-section__wo-title {
  1070. display: flex;
  1071. align-items: center;
  1072. gap: calc(8 * var(--u, 1px));
  1073. min-width: 0;
  1074. padding-bottom: calc(3 * var(--u, 1px));
  1075. border-bottom: 1px dashed rgba(1, 171, 234, 0.28);
  1076. }
  1077. .equipment-section__wo-label {
  1078. flex: none;
  1079. min-width: calc(56 * var(--u, 1px));
  1080. color: var(--muted, #5680b0);
  1081. }
  1082. .equipment-section__wo-row {
  1083. display: flex;
  1084. align-items: flex-start;
  1085. gap: calc(8 * var(--u, 1px));
  1086. line-height: 1.5;
  1087. }
  1088. .equipment-section__wo-row > span:last-child { min-width: 0; overflow-wrap: anywhere; }
  1089. /* 工单详情:面板较窄,两列键值改为竖向一行一项,字号与正文一致。 */
  1090. .equipment-section__wo-detail { gap: calc(6 * var(--u, 1px)); }
  1091. .equipment-section__item-desc {
  1092. color: var(--text-2, #88b7e8);
  1093. font-size: var(--fs-caption, 10.5px);
  1094. line-height: 1.5;
  1095. overflow-wrap: anywhere;
  1096. }
  1097. .equipment-section__item-more {
  1098. justify-self: end;
  1099. color: var(--muted, #5680b0);
  1100. font-size: var(--fs-caption, 10.5px);
  1101. letter-spacing: .02em;
  1102. }
  1103. .equipment-section__item-head:hover .equipment-section__item-more { color: var(--cyan-hi, #00b8ff); }
  1104. .equipment-section__item-head {
  1105. display: grid;
  1106. gap: 1px;
  1107. cursor: pointer;
  1108. list-style: none;
  1109. padding: calc(1 * var(--u, 1px)) calc(3 * var(--u, 1px));
  1110. margin: calc(-1 * var(--u, 1px)) calc(-3 * var(--u, 1px)) 0;
  1111. border: 1px solid transparent;
  1112. border-radius: calc(8 * var(--u, 1px));
  1113. }
  1114. .equipment-section__item-head::-webkit-details-marker {
  1115. display: none;
  1116. }
  1117. /* hover / 展开只改背景,不再给头部加第二条框——整块边框已经是这一行的唯一线框。 */
  1118. .equipment-section__item-head:hover {
  1119. background: rgba(0, 53, 156, 0.28);
  1120. }
  1121. .equipment-section__item--collapsible[open] .equipment-section__item-head {
  1122. background: rgba(0, 53, 156, 0.22);
  1123. }
  1124. .equipment-section__detail {
  1125. display: grid;
  1126. gap: calc(1 * var(--u, 1px));
  1127. margin: calc(2 * var(--u, 1px)) 0 0;
  1128. padding: calc(3 * var(--u, 1px)) var(--space-2, 8px);
  1129. border-left: 2px solid rgba(1, 171, 234, 0.4);
  1130. background: rgba(2, 10, 20, 0.4);
  1131. }
  1132. .equipment-section__detail-row {
  1133. display: grid;
  1134. grid-template-columns: calc(58 * var(--u, 1px)) minmax(0, 1fr);
  1135. align-items: baseline;
  1136. gap: var(--space-2, 8px);
  1137. }
  1138. /* 详情键值改竖向一项一行,字号与事件详情一致(不单独放大)。 */
  1139. .equipment-section__wo-detail .equipment-section__detail-row { grid-template-columns: calc(84 * var(--u, 1px)) minmax(0, 1fr); }
  1140. .equipment-section__detail-row dt {
  1141. color: var(--muted, #5680b0);
  1142. font-size: var(--fs-caption, 10.5px);
  1143. letter-spacing: 0.04em;
  1144. }
  1145. .equipment-section__detail-row dd {
  1146. margin: 0;
  1147. min-width: 0;
  1148. color: var(--text, #d7ecff);
  1149. font-size: var(--fs-caption, 10.5px);
  1150. overflow-wrap: anywhere;
  1151. }
  1152. .equipment-section__item-name {
  1153. color: var(--text, #d7ecff);
  1154. font-size: var(--fs-caption, 10.5px);
  1155. }
  1156. .equipment-section__item-name em {
  1157. color: var(--muted, #5680b0);
  1158. font-style: normal;
  1159. }
  1160. .equipment-section__value {
  1161. color: var(--text);
  1162. font-family: var(--num, monospace);
  1163. font-size: var(--fs-body, 13px);
  1164. }
  1165. .equipment-section__value em {
  1166. color: var(--muted, #5680b0);
  1167. font-style: normal;
  1168. font-size: var(--fs-caption, 10.5px);
  1169. }
  1170. .equipment-section__meta {
  1171. display: flex;
  1172. flex-wrap: wrap;
  1173. gap: var(--space-2, 8px);
  1174. color: var(--text-2, #88b7e8);
  1175. font-size: var(--fs-caption, 10.5px);
  1176. }
  1177. .equipment-section__note {
  1178. margin: 0;
  1179. color: var(--muted, #5680b0);
  1180. font-size: var(--fs-caption, 10.5px);
  1181. }
  1182. .equipment-section__figure {
  1183. display: grid;
  1184. gap: calc(3 * var(--u, 1px));
  1185. margin: 0;
  1186. }
  1187. .equipment-section__img {
  1188. display: block;
  1189. width: 100%;
  1190. max-height: calc(140 * var(--u, 1px));
  1191. object-fit: cover;
  1192. border: 1px solid rgba(1, 171, 234, 0.35);
  1193. border-radius: calc(8 * var(--u, 1px));
  1194. }
  1195. .equipment-section__hint,
  1196. .equipment-section__missing,
  1197. .is-muted {
  1198. margin: 0;
  1199. color: var(--muted, #5680b0);
  1200. font-size: var(--fs-caption, 10.5px);
  1201. letter-spacing: 0.04em;
  1202. }
  1203. .equipment-section__missing {
  1204. color: var(--lv2, #ffb020);
  1205. }
  1206. .equipment-section__mono {
  1207. font-family: var(--num, monospace);
  1208. letter-spacing: 0.04em;
  1209. }
  1210. .equipment-section__image-button {
  1211. display: grid;
  1212. gap: 6px;
  1213. width: 100%;
  1214. padding: 0;
  1215. border: 0;
  1216. background: transparent;
  1217. color: var(--cyan-hi);
  1218. font: inherit;
  1219. cursor: zoom-in;
  1220. }
  1221. .equipment-image-viewer {
  1222. width: min(90vw, 1200px);
  1223. max-height: 90vh;
  1224. padding: 16px;
  1225. border: 1px solid var(--cyan);
  1226. border-radius: calc(8 * var(--u, 1px));
  1227. background: var(--bg-0);
  1228. color: var(--text);
  1229. }
  1230. .equipment-image-viewer::backdrop { background: rgba(1, 5, 20, .8); backdrop-filter: blur(6px); }
  1231. .equipment-image-viewer img { display: block; width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
  1232. .equipment-image-viewer__close { display: block; margin-left: auto; margin-bottom: 8px; cursor: pointer; }
  1233. /* 音频播放条:贴播放键上方渐入的小浮层,不遮罩、不虚化整屏 UI。 */
  1234. .collection-audio-player {
  1235. position: fixed;
  1236. z-index: calc(var(--z-columns, 30) + 5);
  1237. width: min(264px, 88vw);
  1238. padding: calc(6 * var(--u, 1px)) calc(8 * var(--u, 1px)) calc(8 * var(--u, 1px));
  1239. border: 1px solid var(--cyan, #01abea);
  1240. border-radius: calc(8 * var(--u, 1px));
  1241. background: rgba(4, 20, 38, .97);
  1242. box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
  1243. color: var(--text, #e5f4ff);
  1244. transform: translate(-50%, calc(-100% - 8px));
  1245. animation: collection-audio-pop-above .18s ease-out;
  1246. }
  1247. .collection-audio-player.is-below {
  1248. transform: translate(-50%, 8px);
  1249. animation-name: collection-audio-pop-below;
  1250. }
  1251. @keyframes collection-audio-pop-above {
  1252. from { opacity: 0; transform: translate(-50%, calc(-100% - 2px)); }
  1253. }
  1254. @keyframes collection-audio-pop-below {
  1255. from { opacity: 0; transform: translate(-50%, 2px); }
  1256. }
  1257. .collection-audio-player__head {
  1258. display: flex;
  1259. align-items: center;
  1260. justify-content: space-between;
  1261. gap: calc(6 * var(--u, 1px));
  1262. margin-bottom: calc(4 * var(--u, 1px));
  1263. }
  1264. .collection-audio-player__label {
  1265. min-width: 0;
  1266. overflow: hidden;
  1267. color: #a6d8ff;
  1268. font-size: var(--fs-caption, 10.5px);
  1269. text-overflow: ellipsis;
  1270. white-space: nowrap;
  1271. }
  1272. .collection-audio-player__close {
  1273. flex: none;
  1274. width: calc(20 * var(--u, 1px));
  1275. height: calc(20 * var(--u, 1px));
  1276. padding: 0;
  1277. border: 1px solid rgba(1, 171, 234, .5);
  1278. border-radius: 999px;
  1279. background: rgba(1, 91, 150, .26);
  1280. color: inherit;
  1281. font-size: calc(12 * var(--u, 1px));
  1282. line-height: 1;
  1283. cursor: pointer;
  1284. }
  1285. .collection-audio-player__audio { display: block; width: 100%; max-width: 100%; height: calc(32 * var(--u, 1px)); }
  1286. </style>