EquipmentDetailSections.vue 63 KB

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