EquipmentDetailSections.vue 62 KB

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