App.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141
  1. <script setup lang="ts">
  2. import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
  3. import { ElMessageBox } from 'element-plus'
  4. import { createAnnotation, deleteAnnotation, deletePretrain, fetchAnnotationConfig, fetchAnnotationsByIds, fetchPeriodDetail, fetchPretrainStatus, fetchQueryOptions, fetchSitePoints, fetchTimePoints, fetchTspluseRuler, fetchWaveWindow, getToken, login as apiLogin, logout as apiLogout, recordPretrain } from './api'
  5. import PeriodModal from './components/PeriodModal.vue'
  6. import { fixedAxisRange } from './utils/axis'
  7. import TimePointStrip from './components/TimePointStrip.vue'
  8. import WaveChart from './components/WaveChart.vue'
  9. import { STOPPED_COLOR, statusGradientColor } from './statusColor'
  10. import { DEVICE_POINT_TO_TYPE, DEVICE_POINTS, PRIMARY_DEVICE_POINT, type Annotation, type AnnotationLabel, type Cycle, type DevicePoint, type MeasurementType, type PeriodDetail, type QueryOption, type SitePoint, type TimePoint, type QueryOptionsResponse, type WaveWindowFile, type WaveWindowResponse } from './types'
  11. const queryMeta = ref<QueryOptionsResponse | null>(null)
  12. const selectedDevicePart = ref('')
  13. const selectedDevicePoints = ref<DevicePoint[]>([PRIMARY_DEVICE_POINT])
  14. const fileListPoint = ref<DevicePoint | string>(PRIMARY_DEVICE_POINT)
  15. const minTime = ref('')
  16. const maxTime = ref('')
  17. const selectedTimeRangePoint = ref<DevicePoint | ''>('')
  18. const windowSize = ref(4)
  19. const maxPoints = ref(200000)
  20. const noSampling = ref(false)
  21. const includeStopped = ref(false)
  22. const abnormalOnly = ref(false)
  23. const noCycleOnly = ref(false)
  24. const minStatus = ref<number | null>(null)
  25. const firstCycleOnly = ref(false)
  26. const sitePointOptions = ref<SitePoint[]>([])
  27. const selectedSitePoints = ref<string[]>([])
  28. const ruler = ref<{ min: number; max: number } | null>(null)
  29. const timePoints = ref<TimePoint[]>([])
  30. const referencePoints = ref<TimePoint[]>([])
  31. const startIndex = ref(0)
  32. const waveData = ref<WaveWindowResponse | null>(null)
  33. const chartMode = ref<'split' | 'merge'>('split')
  34. const chartDirty = ref(false)
  35. const queryLoading = ref(false)
  36. const timePointsLoading = ref(false)
  37. const waveLoading = ref(false)
  38. const errorMessage = ref('')
  39. const initialized = ref(false)
  40. const periodDetail = ref<PeriodDetail | null>(null)
  41. const periodVisible = ref(false)
  42. const periodLoading = ref(false)
  43. const annotationWidth = ref(10)
  44. const annotations = ref<Annotation[]>([])
  45. const annotationLoading = ref(false)
  46. const loggedIn = ref(false)
  47. const loginLoading = ref(false)
  48. const loginError = ref('')
  49. const loginForm = reactive({ username: '', password: '' })
  50. const waveChartRef = ref<InstanceType<typeof WaveChart> | null>(null)
  51. const recordedFileIds = ref<number[]>([])
  52. const recordingFileId = ref<number | null>(null)
  53. let queryDebounce: ReturnType<typeof setTimeout> | undefined
  54. let waveRequestId = 0
  55. const deviceParts = computed(() => queryMeta.value?.deviceParts ?? [])
  56. const devicePoints = computed(() => queryMeta.value?.devicePoints ?? DEVICE_POINTS)
  57. const unitNumber = computed(() => {
  58. const match = /^([789])号机组/.exec(selectedDevicePart.value)
  59. return match ? match[1] : null
  60. })
  61. const isPksMode = computed(() => firstCycleOnly.value && !!unitNumber.value)
  62. const pointModel = computed({
  63. get: () => (isPksMode.value
  64. ? [...selectedDevicePoints.value as unknown as string[], ...selectedSitePoints.value]
  65. : selectedDevicePoints.value as unknown as string[]),
  66. set: (value: string[]) => {
  67. const wave = value.filter((item) => (DEVICE_POINTS as readonly string[]).includes(item)) as DevicePoint[]
  68. const site = value.filter((item) => !(DEVICE_POINTS as readonly string[]).includes(item))
  69. selectedDevicePoints.value = wave
  70. selectedSitePoints.value = site
  71. },
  72. })
  73. const sitePointLabel = (point: SitePoint) => `${point.itemName} ${point.itemDescription}`.trim()
  74. const SITE_TAB_LABEL = '全场点位'
  75. const siteDescriptionMap = computed<Record<string, string>>(() => {
  76. const map: Record<string, string> = {}
  77. for (const item of sitePointOptions.value) map[item.itemName] = item.itemDescription
  78. return map
  79. })
  80. const siteDescription = (itemName: string) => siteDescriptionMap.value[itemName] || itemName
  81. const fileTabs = computed(() => {
  82. if (!isPksMode.value) return selectedDevicePoints.value as unknown as string[]
  83. return [
  84. ...selectedDevicePoints.value as unknown as string[],
  85. ...(selectedSitePoints.value.length ? [SITE_TAB_LABEL] : []),
  86. ]
  87. })
  88. const isSiteTab = computed(() => fileListPoint.value === SITE_TAB_LABEL)
  89. const windowSiteRows = computed(() => {
  90. if (!isSiteTab.value) return []
  91. return (waveData.value?.points ?? []).map((point, index) => ({
  92. index,
  93. sampleTime: point.sampleTime,
  94. values: Object.fromEntries(
  95. selectedSitePoints.value.map((itemName) => [itemName, point.siteValues?.[itemName] ?? null]),
  96. ),
  97. }))
  98. })
  99. const devicePointCounts = computed<Record<string, { pre: number | null; ab: number | null }>>(() => {
  100. const map: Record<string, { pre: number | null; ab: number | null }> = {}
  101. for (const point of devicePoints.value) {
  102. const pointName = `${selectedDevicePart.value}${point}`
  103. map[point] = {
  104. pre: queryMeta.value?.pretrainCounts?.[pointName] ?? null,
  105. ab: queryMeta.value?.abnormalCounts?.[pointName] ?? null,
  106. }
  107. }
  108. return map
  109. })
  110. function devicePointLabel(point: DevicePoint): string {
  111. const { pre, ab } = devicePointCounts.value[point] ?? { pre: null, ab: null }
  112. const inner: string[] = []
  113. if (pre != null) inner.push(String(pre))
  114. if (ab != null) inner.push(String(ab))
  115. return inner.length ? `${point} (${inner.join(' · ')})` : point
  116. }
  117. const selectedOptionRows = computed<QueryOption[]>(() => (
  118. queryMeta.value?.options.filter((row) => (
  119. row.devicePart === selectedDevicePart.value && selectedDevicePoints.value.includes(row.devicePoint)
  120. )) ?? []
  121. ))
  122. const timeRangeOptions = computed<QueryOption[]>(() => (
  123. queryMeta.value?.options.filter((row) => row.devicePart === selectedDevicePart.value) ?? []
  124. ))
  125. const selectedWindowPoints = computed(() => {
  126. const slice = timePoints.value.slice(startIndex.value, startIndex.value + stripWindowSize.value)
  127. return hasReference.value ? [...referencePoints.value, ...slice] : slice
  128. })
  129. const hasReference = computed(() => referencePoints.value.length > 0)
  130. const stripWindowSize = computed(() => Math.max(0, windowSize.value - (hasReference.value ? 1 : 0)))
  131. const maxStart = computed(() => Math.max(0, timePoints.value.length - stripWindowSize.value))
  132. const endIndex = computed(() => Math.min(timePoints.value.length, startIndex.value + stripWindowSize.value))
  133. const statusFilter = computed(() => {
  134. const list: string[] = []
  135. if (abnormalOnly.value) list.push('abnormal')
  136. if (noCycleOnly.value) list.push('no_cycle')
  137. return list
  138. })
  139. const currentCycles = computed(() => waveData.value?.cycles ?? [])
  140. const pressureAxis = computed(() => {
  141. const series = waveData.value?.series.find((item) => item.measurementType === '压力')
  142. if (!series) return null
  143. return fixedAxisRange('压力', series.min, series.max)
  144. })
  145. const currentSource = computed(() => waveData.value?.source ?? timePointsSource.value)
  146. const timePointsSource = ref<'database' | 'demo'>('demo')
  147. const availableTypeCount = computed(() => selectedOptionRows.value.reduce((total, row) => total + row.fileCount, 0))
  148. const annotatedFileIds = computed(() => [...new Set(annotations.value.map((item) => item.waveFileId))])
  149. const windowFiles = computed(() => (waveData.value?.files ?? []).filter((file) => file.devicePoint === fileListPoint.value))
  150. const primaryDevicePoint = computed(() => (
  151. waveData.value?.primaryPoint
  152. ?? (selectedDevicePoints.value.includes('压力盖侧')
  153. ? '压力盖侧'
  154. : selectedDevicePoints.value.includes('压力轴侧')
  155. ? '压力轴侧'
  156. : selectedDevicePoints.value[0])
  157. ))
  158. function toInputTime(value: string) {
  159. if (!value) return ''
  160. return value.replace('T', ' ').slice(0, 19)
  161. }
  162. function toApiTime(value: string) {
  163. return value ? value.replace('T', ' ') + (value.length === 16 ? ':00' : '') : undefined
  164. }
  165. function boundsForSelection() {
  166. const rows = selectedOptionRows.value
  167. if (!rows.length) return null
  168. const unionRows = rows.filter((row) => row.devicePoint === PRIMARY_DEVICE_POINT || row.devicePoint === '压力轴侧')
  169. const effective = unionRows.length ? unionRows : rows
  170. const min = effective.reduce((latest, row) => (row.minTime > latest ? row.minTime : latest), effective[0].minTime)
  171. const max = effective.reduce((earliest, row) => (row.maxTime < earliest ? row.maxTime : earliest), effective[0].maxTime)
  172. return { min: toInputTime(min), max: toInputTime(max) }
  173. }
  174. function syncTimeBounds(force = false) {
  175. const bounds = boundsForSelection()
  176. if (!bounds) return
  177. if (force || !minTime.value || minTime.value < bounds.min || minTime.value > bounds.max) minTime.value = bounds.min
  178. if (force || !maxTime.value || maxTime.value > bounds.max || maxTime.value < bounds.min) maxTime.value = bounds.max
  179. if (minTime.value > maxTime.value) {
  180. minTime.value = bounds.min
  181. maxTime.value = bounds.max
  182. }
  183. }
  184. function formatDateTime(value: string | undefined) {
  185. if (!value) return '未选择'
  186. return value.replace('T', ' ').slice(0, 16)
  187. }
  188. function statusText() {
  189. if (timePointsLoading.value) return '正在读取时间点'
  190. if (waveLoading.value) return '正在整理波形'
  191. if (!timePoints.value.length) return '等待查询'
  192. return '窗口已就绪'
  193. }
  194. async function loadOptions() {
  195. queryLoading.value = true
  196. errorMessage.value = ''
  197. try {
  198. const result = await fetchQueryOptions()
  199. queryMeta.value = result
  200. selectedDevicePart.value = result.deviceParts[0] ?? ''
  201. selectedTimeRangePoint.value = ''
  202. syncTimeBounds(true)
  203. initialized.value = true
  204. await loadTimePoints()
  205. } catch (error) {
  206. errorMessage.value = error instanceof Error ? error.message : '查询条件读取失败'
  207. } finally {
  208. queryLoading.value = false
  209. }
  210. }
  211. async function loadSitePoints() {
  212. if (!isPksMode.value || !selectedDevicePart.value) {
  213. sitePointOptions.value = []
  214. return
  215. }
  216. try {
  217. const result = await fetchSitePoints(selectedDevicePart.value)
  218. sitePointOptions.value = result.items
  219. } catch {
  220. sitePointOptions.value = []
  221. }
  222. }
  223. async function loadTspluseRuler() {
  224. try {
  225. ruler.value = await fetchTspluseRuler()
  226. } catch {
  227. ruler.value = null
  228. }
  229. }
  230. function firstRunningIndex(): number {
  231. const index = timePoints.value.findIndex((point) =>
  232. selectedDevicePoints.value.some((pointName) => (point.files[pointName]?.rpm ?? 0) > 0),
  233. )
  234. return index >= 0 ? index : 0
  235. }
  236. async function loadTimePoints() {
  237. if (!selectedDevicePart.value || !selectedDevicePoints.value.length) return
  238. timePointsLoading.value = true
  239. waveData.value = null
  240. errorMessage.value = ''
  241. try {
  242. const result = await fetchTimePoints({
  243. devicePart: selectedDevicePart.value,
  244. devicePoints: selectedDevicePoints.value,
  245. minTime: toApiTime(minTime.value),
  246. maxTime: toApiTime(maxTime.value),
  247. includeStopped: includeStopped.value,
  248. minStatus: noCycleOnly.value ? null : minStatus.value,
  249. statusFilter: statusFilter.value,
  250. sitePoints: isPksMode.value ? selectedSitePoints.value : [],
  251. })
  252. timePoints.value = result.points
  253. referencePoints.value = result.referencePoints ?? []
  254. timePointsSource.value = result.source
  255. startIndex.value = Math.max(
  256. 0,
  257. Math.min(firstRunningIndex(), Math.max(0, timePoints.value.length - stripWindowSize.value)),
  258. )
  259. chartDirty.value = true
  260. void loadAnnotations()
  261. } catch (error) {
  262. timePoints.value = []
  263. referencePoints.value = []
  264. errorMessage.value = error instanceof Error ? error.message : '时间点读取失败'
  265. } finally {
  266. timePointsLoading.value = false
  267. }
  268. }
  269. async function loadWaveWindowNow() {
  270. const points = selectedWindowPoints.value
  271. if (!points.length || !selectedDevicePart.value) {
  272. waveData.value = null
  273. chartDirty.value = false
  274. return
  275. }
  276. const requestId = ++waveRequestId
  277. waveLoading.value = true
  278. try {
  279. const result = await fetchWaveWindow({
  280. devicePart: selectedDevicePart.value,
  281. devicePoints: selectedDevicePoints.value,
  282. points,
  283. maxPoints: maxPoints.value,
  284. noSampling: noSampling.value,
  285. firstCycleOnly: firstCycleOnly.value,
  286. sitePoints: isPksMode.value ? selectedSitePoints.value : [],
  287. })
  288. if (requestId === waveRequestId) {
  289. waveData.value = result
  290. chartDirty.value = false
  291. }
  292. } catch (error) {
  293. if (requestId === waveRequestId) errorMessage.value = error instanceof Error ? error.message : '波形读取失败'
  294. } finally {
  295. if (requestId === waveRequestId) waveLoading.value = false
  296. }
  297. }
  298. function markChartDirty() {
  299. chartDirty.value = true
  300. }
  301. function scheduleTimePoints() {
  302. if (!initialized.value) return
  303. if (queryDebounce) clearTimeout(queryDebounce)
  304. queryDebounce = setTimeout(() => void loadTimePoints(), 180)
  305. }
  306. function formatRange(option: QueryOption) {
  307. return `${formatDateTime(option.minTime)} ~ ${formatDateTime(option.maxTime)}`
  308. }
  309. function onTimeRangeChange(value: DevicePoint | '') {
  310. if (!value) return
  311. const row = queryMeta.value?.options.find((item) => (
  312. item.devicePart === selectedDevicePart.value && item.devicePoint === value
  313. ))
  314. if (!row) return
  315. minTime.value = toInputTime(row.minTime)
  316. maxTime.value = toInputTime(row.maxTime)
  317. }
  318. function onDevicePartChange() {
  319. selectedTimeRangePoint.value = ''
  320. selectedSitePoints.value = []
  321. syncTimeBounds(true)
  322. scheduleTimePoints()
  323. }
  324. function onDevicePointsChange() {
  325. const points = selectedDevicePoints.value
  326. if (!points.length) {
  327. selectedDevicePoints.value = [PRIMARY_DEVICE_POINT]
  328. return
  329. }
  330. syncTimeBounds(true)
  331. scheduleTimePoints()
  332. }
  333. function onTimeChange() {
  334. if (minTime.value > maxTime.value) {
  335. errorMessage.value = '开始时间不能晚于结束时间'
  336. return
  337. }
  338. scheduleTimePoints()
  339. }
  340. function onStartIndexChange(value: number) {
  341. startIndex.value = Math.max(0, Math.min(value, maxStart.value))
  342. markChartDirty()
  343. }
  344. function onWindowSizeChange(value: number) {
  345. windowSize.value = Math.max(1, Math.min(200, Math.round(value || 1)))
  346. startIndex.value = Math.min(startIndex.value, maxStart.value)
  347. markChartDirty()
  348. }
  349. function resetWindow() {
  350. startIndex.value = 0
  351. markChartDirty()
  352. }
  353. function pageWindow(direction: -1 | 1) {
  354. const next = startIndex.value + direction * stripWindowSize.value
  355. startIndex.value = Math.max(0, Math.min(next, maxStart.value))
  356. markChartDirty()
  357. }
  358. function jumpToIndex(index: number) {
  359. onStartIndexChange(Number(index))
  360. }
  361. type JumpSegment = { text: string; color?: string }
  362. const jumpOptions = computed(() => timePoints.value.map((point, index) => {
  363. const text = point.sampleTime.replace('T', ' ')
  364. const segments: JumpSegment[] = [{ text }]
  365. const statuses: JumpSegment[] = []
  366. for (const devicePoint of selectedDevicePoints.value) {
  367. const file = point.files[devicePoint]
  368. if (!file || file.status === undefined) continue
  369. const color = file.rpm <= 0 ? STOPPED_COLOR : statusGradientColor(file.status, ruler.value)
  370. statuses.push({ text: String(file.status), color })
  371. }
  372. if (statuses.length) {
  373. segments.push({ text: ' (' })
  374. statuses.forEach((segment, i) => {
  375. if (i > 0) segments.push({ text: '·', color: '#8b9aa2' })
  376. segments.push(segment)
  377. })
  378. segments.push({ text: ')' })
  379. }
  380. const label = statuses.length
  381. ? `${text} (${statuses.map((segment) => segment.text).join('·')})`
  382. : text
  383. return { value: index, segments, label }
  384. }))
  385. function sampleTimeStyle(file: WaveWindowFile) {
  386. if (file.measurementType !== '压力') return undefined
  387. const color = file.rpm <= 0 ? STOPPED_COLOR : statusGradientColor(file.status, ruler.value)
  388. return { color }
  389. }
  390. function refresh() {
  391. void loadOptions()
  392. }
  393. async function openPeriod(cycle: Cycle) {
  394. periodVisible.value = true
  395. periodLoading.value = true
  396. periodDetail.value = null
  397. try {
  398. periodDetail.value = await fetchPeriodDetail(cycle.waveFileId, cycle.periodNo)
  399. } catch (error) {
  400. errorMessage.value = error instanceof Error ? error.message : '周期详情读取失败'
  401. periodVisible.value = false
  402. } finally {
  403. periodLoading.value = false
  404. }
  405. }
  406. function closePeriod() {
  407. periodVisible.value = false
  408. }
  409. async function loadAnnotationConfig() {
  410. try {
  411. const result = await fetchAnnotationConfig()
  412. annotationWidth.value = result.annotationWidth
  413. } catch {
  414. annotationWidth.value = 10
  415. }
  416. }
  417. async function loadAnnotations() {
  418. const ids = [...new Set(
  419. timePoints.value.flatMap((point) => (
  420. selectedDevicePoints.value
  421. .map((devicePoint) => point.files[devicePoint]?.id)
  422. .filter((id): id is number => id != null)
  423. )),
  424. )]
  425. if (!ids.length) {
  426. annotations.value = []
  427. return
  428. }
  429. try {
  430. const result = await fetchAnnotationsByIds(ids)
  431. annotations.value = result.annotations
  432. } catch {
  433. annotations.value = []
  434. }
  435. }
  436. type AnnotationBlock = {
  437. waveFileId: number
  438. periodStart: number
  439. periodEnd: number
  440. sampleIndexStart: number
  441. sampleIndexEnd: number
  442. }
  443. function annotationBlock(cycle: Cycle): AnnotationBlock | null {
  444. const width = Math.max(1, annotationWidth.value)
  445. const fileCycles = (waveData.value?.cycles ?? []).filter((item) => item.waveFileId === cycle.waveFileId)
  446. const maxPeriod = Math.max(1, ...fileCycles.map((item) => item.periodNo))
  447. let leftBound = 1
  448. let rightBound = maxPeriod
  449. const existing = annotations.value
  450. .filter((item) => item.waveFileId === cycle.waveFileId)
  451. .sort((a, b) => a.periodStart - b.periodStart)
  452. for (const item of existing) {
  453. if (item.periodEnd < cycle.periodNo) {
  454. leftBound = Math.max(leftBound, item.periodEnd + 1)
  455. } else if (item.periodStart > cycle.periodNo) {
  456. rightBound = Math.min(rightBound, item.periodStart - 1)
  457. } else {
  458. return null
  459. }
  460. }
  461. if (leftBound > rightBound) return null
  462. let start = Math.max(leftBound, cycle.periodNo - Math.floor((width - 1) / 2))
  463. let end = Math.min(rightBound, start + width - 1)
  464. start = Math.max(leftBound, end - width + 1)
  465. const startCycle = fileCycles.find((item) => item.periodNo === start)
  466. const endCycle = fileCycles.find((item) => item.periodNo === end)
  467. return {
  468. waveFileId: cycle.waveFileId,
  469. periodStart: start,
  470. periodEnd: end,
  471. sampleIndexStart: startCycle?.startSampleIndex ?? cycle.startSampleIndex,
  472. sampleIndexEnd: endCycle?.endSampleIndex ?? cycle.endSampleIndex,
  473. }
  474. }
  475. async function chooseLabel(block: AnnotationBlock): Promise<AnnotationLabel | null> {
  476. try {
  477. await ElMessageBox.confirm(
  478. `将在周期 ${block.periodStart} — ${block.periodEnd} 创建标注,请选择样本类型`,
  479. '创建标注',
  480. {
  481. confirmButtonText: '正常样本',
  482. cancelButtonText: '异常样本',
  483. distinguishCancelAndClose: true,
  484. type: 'info',
  485. closeOnClickModal: false,
  486. },
  487. )
  488. return '正常'
  489. } catch (action) {
  490. if (action === 'cancel') return '异常'
  491. return null
  492. }
  493. }
  494. async function onAnnotationToggle(cycle: Cycle) {
  495. if (annotationLoading.value) return
  496. const existing = annotations.value.find((item) => (
  497. item.waveFileId === cycle.waveFileId && cycle.periodNo >= item.periodStart && cycle.periodNo <= item.periodEnd
  498. ))
  499. if (existing) {
  500. try {
  501. await ElMessageBox.confirm(
  502. `取消该标注(${existing.label},周期 ${existing.periodStart} — ${existing.periodEnd})?`,
  503. '取消标注',
  504. { confirmButtonText: '取消标注', cancelButtonText: '保留', type: 'warning', closeOnClickModal: false },
  505. )
  506. } catch {
  507. return
  508. }
  509. annotationLoading.value = true
  510. try {
  511. await deleteAnnotation(existing.id)
  512. await loadAnnotations()
  513. } catch (error) {
  514. errorMessage.value = error instanceof Error ? error.message : '标注取消失败'
  515. } finally {
  516. annotationLoading.value = false
  517. }
  518. return
  519. }
  520. const block = annotationBlock(cycle)
  521. if (!block) return
  522. const label = await chooseLabel(block)
  523. if (!label) return
  524. annotationLoading.value = true
  525. try {
  526. await createAnnotation({
  527. wave_file_id: block.waveFileId,
  528. label,
  529. period_start: block.periodStart,
  530. period_end: block.periodEnd,
  531. sample_index_start: block.sampleIndexStart,
  532. sample_index_end: block.sampleIndexEnd,
  533. })
  534. await loadAnnotations()
  535. } catch (error) {
  536. errorMessage.value = error instanceof Error ? error.message : '标注创建失败'
  537. } finally {
  538. annotationLoading.value = false
  539. }
  540. }
  541. watch(selectedDevicePart, () => {
  542. if (initialized.value) onDevicePartChange()
  543. })
  544. watch(selectedDevicePoints, () => {
  545. if (initialized.value) onDevicePointsChange()
  546. }, { deep: true })
  547. watch([minTime, maxTime], () => {
  548. if (initialized.value) onTimeChange()
  549. })
  550. watch(windowSize, () => {
  551. if (initialized.value) onWindowSizeChange(windowSize.value)
  552. })
  553. watch(noSampling, () => {
  554. if (initialized.value && selectedWindowPoints.value.length) loadWaveWindowNow()
  555. })
  556. watch(includeStopped, () => {
  557. if (initialized.value) scheduleTimePoints()
  558. })
  559. watch(abnormalOnly, () => {
  560. if (initialized.value) scheduleTimePoints()
  561. })
  562. watch(noCycleOnly, () => {
  563. if (initialized.value) scheduleTimePoints()
  564. })
  565. watch(minStatus, () => {
  566. if (initialized.value) scheduleTimePoints()
  567. })
  568. watch(firstCycleOnly, () => {
  569. if (!initialized.value) return
  570. windowSize.value = firstCycleOnly.value ? 50 : 4
  571. markChartDirty()
  572. void loadWaveWindowNow()
  573. })
  574. watch([firstCycleOnly, unitNumber], async () => {
  575. if (!initialized.value) return
  576. if (isPksMode.value) {
  577. await loadSitePoints()
  578. if (selectedSitePoints.value.length) fileListPoint.value = SITE_TAB_LABEL
  579. } else {
  580. sitePointOptions.value = []
  581. }
  582. })
  583. watch(selectedSitePoints, (points) => {
  584. if (initialized.value && isPksMode.value) scheduleTimePoints()
  585. if (points.length) fileListPoint.value = SITE_TAB_LABEL
  586. })
  587. watch(waveData, () => void refreshPretrainStatus(), { deep: false })
  588. async function refreshPretrainStatus() {
  589. const ids = waveData.value?.files.map((file) => file.id) ?? []
  590. if (!ids.length) {
  591. recordedFileIds.value = []
  592. return
  593. }
  594. try {
  595. const result = await fetchPretrainStatus(ids)
  596. recordedFileIds.value = result.recorded
  597. } catch {
  598. recordedFileIds.value = []
  599. }
  600. }
  601. function locateFile(file: WaveWindowFile) {
  602. waveChartRef.value?.locateFile(file.pointIndex)
  603. }
  604. async function recordFile(file: WaveWindowFile) {
  605. if (recordedFileIds.value.includes(file.id) || recordingFileId.value != null) return
  606. recordingFileId.value = file.id
  607. try {
  608. const result = await recordPretrain({
  609. id: file.id,
  610. point_name: file.pointName,
  611. measurement_type: file.measurementType,
  612. rpm: file.rpm,
  613. sample_time: file.sampleTime,
  614. file_name: file.fileName,
  615. })
  616. if (result.recorded || result.already) {
  617. recordedFileIds.value = [...new Set([...recordedFileIds.value, file.id])]
  618. }
  619. } catch (error) {
  620. errorMessage.value = error instanceof Error ? error.message : '记录失败'
  621. } finally {
  622. recordingFileId.value = null
  623. }
  624. }
  625. async function deleteRecordedFile(file: WaveWindowFile) {
  626. if (!recordedFileIds.value.includes(file.id) || recordingFileId.value != null) return
  627. recordingFileId.value = file.id
  628. try {
  629. await deletePretrain(file.id)
  630. recordedFileIds.value = recordedFileIds.value.filter((id) => id !== file.id)
  631. } catch (error) {
  632. errorMessage.value = error instanceof Error ? error.message : '删除失败'
  633. } finally {
  634. recordingFileId.value = null
  635. }
  636. }
  637. async function handleLogin() {
  638. if (!loginForm.username || !loginForm.password) {
  639. loginError.value = '请输入账号和密码'
  640. return
  641. }
  642. loginLoading.value = true
  643. loginError.value = ''
  644. try {
  645. await apiLogin(loginForm.username, loginForm.password)
  646. loggedIn.value = true
  647. loginForm.password = ''
  648. await loadOptions()
  649. void loadTspluseRuler()
  650. void loadAnnotationConfig()
  651. } catch (error) {
  652. loginError.value = error instanceof Error ? error.message : '登录失败'
  653. } finally {
  654. loginLoading.value = false
  655. }
  656. }
  657. async function handleLogout() {
  658. await apiLogout()
  659. loggedIn.value = false
  660. waveData.value = null
  661. timePoints.value = []
  662. annotations.value = []
  663. }
  664. function onAuthExpired() {
  665. loggedIn.value = false
  666. waveData.value = null
  667. timePoints.value = []
  668. annotations.value = []
  669. }
  670. onMounted(() => {
  671. window.addEventListener('auth-expired', onAuthExpired)
  672. loggedIn.value = getToken() != null
  673. if (loggedIn.value) {
  674. void loadOptions()
  675. void loadTspluseRuler()
  676. void loadAnnotationConfig()
  677. }
  678. })
  679. onBeforeUnmount(() => {
  680. window.removeEventListener('auth-expired', onAuthExpired)
  681. if (queryDebounce) clearTimeout(queryDebounce)
  682. })
  683. </script>
  684. <template>
  685. <div v-if="!loggedIn" class="login-shell">
  686. <form class="login-card" @submit.prevent="handleLogin">
  687. <div class="login-brand">
  688. <div class="brand-mark"><span></span><span></span><span></span></div>
  689. <div>
  690. <div class="brand-kicker">COMPRESSOR / WAVE LAB</div>
  691. <h1>故障预测波形工作台</h1>
  692. </div>
  693. </div>
  694. <p class="login-hint">请登录后继续使用</p>
  695. <el-input v-model="loginForm.username" class="login-input" size="large" placeholder="账号" clearable @input="loginError = ''" />
  696. <el-input v-model="loginForm.password" class="login-input" size="large" type="password" show-password placeholder="密码" @keyup.enter="handleLogin" @input="loginError = ''" />
  697. <el-alert v-if="loginError" class="login-error" type="error" :closable="false" show-icon :title="loginError" />
  698. <el-button class="login-button" type="primary" size="large" :loading="loginLoading" native-type="submit">登 录</el-button>
  699. </form>
  700. </div>
  701. <div v-else class="app-shell">
  702. <header class="app-header">
  703. <div class="brand-lockup">
  704. <div class="brand-mark"><span></span><span></span><span></span></div>
  705. <div>
  706. <div class="brand-kicker">COMPRESSOR / WAVE LAB</div>
  707. <h1>故障预测波形工作台</h1>
  708. </div>
  709. </div>
  710. <div class="header-meta">
  711. <span class="live-indicator"><i></i> 浏览模式</span>
  712. <span class="header-date">{{ selectedDevicePart || '未选择机组与部位' }}</span>
  713. <el-button class="header-refresh" type="primary" plain :loading="queryLoading" @click="refresh">刷新</el-button>
  714. <el-button class="header-logout" plain @click="handleLogout">退出登录</el-button>
  715. </div>
  716. </header>
  717. <main class="workspace">
  718. <section class="query-panel panel">
  719. <div class="panel-heading compact-heading">
  720. <div>
  721. <h2>查询条件</h2>
  722. </div>
  723. <el-tag class="connection-badge" :type="currentSource === 'database' ? 'success' : 'warning'" effect="plain">
  724. {{ currentSource === 'database' ? '数据库已连接' : '演示数据' }}
  725. </el-tag>
  726. </div>
  727. <div class="query-grid">
  728. <label class="field field-point">
  729. <span class="field-label">机组与部位</span>
  730. <el-select
  731. v-model="selectedDevicePart"
  732. class="query-control"
  733. size="large"
  734. filterable
  735. :disabled="queryLoading"
  736. placeholder="输入机组、气缸或部位关键词"
  737. filter-placeholder="搜索机组与部位"
  738. >
  739. <el-option v-for="devicePart in deviceParts" :key="devicePart" :label="devicePart" :value="devicePart" />
  740. </el-select>
  741. </label>
  742. <div class="field field-types">
  743. <span class="field-label">测试点位</span>
  744. <el-select
  745. v-model="pointModel"
  746. class="query-control"
  747. size="large"
  748. multiple
  749. collapse-tags
  750. collapse-tags-tooltip
  751. :max-collapse-tags="2"
  752. placeholder="选择测试点位"
  753. >
  754. <template v-if="isPksMode">
  755. <el-option-group label="波形点位">
  756. <el-option
  757. v-for="point in devicePoints"
  758. :key="point"
  759. :label="devicePointLabel(point)"
  760. :value="point"
  761. >
  762. <span>{{ point }}</span>
  763. <template v-if="devicePointCounts[point]?.pre !== null || devicePointCounts[point]?.ab !== null">
  764. <span class="point-counts">
  765. (<span v-if="devicePointCounts[point]?.pre !== null">{{ devicePointCounts[point]?.pre }}</span><template v-if="devicePointCounts[point]?.pre !== null && devicePointCounts[point]?.ab !== null"> · </template><span v-if="devicePointCounts[point]?.ab !== null" class="abnormal-count">{{ devicePointCounts[point]?.ab }}</span>)
  766. </span>
  767. </template>
  768. </el-option>
  769. </el-option-group>
  770. <el-option-group label="全场点位 (PKS)">
  771. <el-option
  772. v-for="point in sitePointOptions"
  773. :key="point.itemName"
  774. :value="point.itemName"
  775. :label="sitePointLabel(point)"
  776. />
  777. </el-option-group>
  778. </template>
  779. <template v-else>
  780. <el-option
  781. v-for="point in devicePoints"
  782. :key="point"
  783. :label="devicePointLabel(point)"
  784. :value="point"
  785. >
  786. <span>{{ point }}</span>
  787. <template v-if="devicePointCounts[point]?.pre !== null || devicePointCounts[point]?.ab !== null">
  788. <span class="point-counts">
  789. (<span v-if="devicePointCounts[point]?.pre !== null">{{ devicePointCounts[point]?.pre }}</span><template v-if="devicePointCounts[point]?.pre !== null && devicePointCounts[point]?.ab !== null"> · </template><span v-if="devicePointCounts[point]?.ab !== null" class="abnormal-count">{{ devicePointCounts[point]?.ab }}</span>)
  790. </span>
  791. </template>
  792. </el-option>
  793. </template>
  794. </el-select>
  795. </div>
  796. <label class="field">
  797. <span class="field-label">开始时间</span>
  798. <el-date-picker
  799. v-model="minTime"
  800. class="query-control"
  801. size="large"
  802. type="datetime"
  803. value-format="YYYY-MM-DD HH:mm:ss"
  804. format="YYYY-MM-DD HH:mm:ss"
  805. :disabled="queryLoading"
  806. :disabled-date="(date: Date) => date < new Date(`${boundsForSelection()?.min ?? '1970-01-01 00:00:00'}`) || date > new Date(`${boundsForSelection()?.max ?? '2999-12-31 23:59:59'}`)"
  807. placeholder="选择开始时间"
  808. />
  809. </label>
  810. <label class="field">
  811. <span class="field-label">结束时间</span>
  812. <el-date-picker
  813. v-model="maxTime"
  814. class="query-control"
  815. size="large"
  816. type="datetime"
  817. value-format="YYYY-MM-DD HH:mm:ss"
  818. format="YYYY-MM-DD HH:mm:ss"
  819. :disabled="queryLoading"
  820. :disabled-date="(date: Date) => date < new Date(`${boundsForSelection()?.min ?? '1970-01-01 00:00:00'}`) || date > new Date(`${boundsForSelection()?.max ?? '2999-12-31 23:59:59'}`)"
  821. placeholder="选择结束时间"
  822. />
  823. </label>
  824. <el-button class="query-action query-button" type="primary" size="large" :loading="timePointsLoading" :disabled="!selectedDevicePart" @click="loadTimePoints">
  825. 查询时间点
  826. </el-button>
  827. <div class="query-row-2">
  828. <label class="field field-check">
  829. <span class="field-label">运行状态</span>
  830. <el-checkbox v-model="includeStopped" class="query-checkbox" size="large">停机</el-checkbox>
  831. <el-checkbox v-model="abnormalOnly" class="query-checkbox" size="large">异常</el-checkbox>
  832. <el-checkbox v-model="noCycleOnly" class="query-checkbox" size="large">无周期</el-checkbox>
  833. </label>
  834. <div class="field-second-group">
  835. <label class="field field-status">
  836. <span class="field-label">质心距离</span>
  837. <el-input-number
  838. v-model="minStatus"
  839. class="query-control"
  840. size="large"
  841. :min="0"
  842. :max="4"
  843. :step="1"
  844. :step-strictly="true"
  845. controls-position="right"
  846. :disabled="queryLoading || noCycleOnly"
  847. clearable
  848. placeholder="可空"
  849. :title="noCycleOnly ? '勾选无周期时忽略质心距离' : undefined"
  850. />
  851. </label>
  852. <label class="field field-first-cycle">
  853. <span class="field-label">首个周期</span>
  854. <el-checkbox v-model="firstCycleOnly" class="query-checkbox" size="large" :disabled="queryLoading">连续曲线</el-checkbox>
  855. </label>
  856. </div>
  857. <label class="field window-field">
  858. <span class="field-label">时间窗口 <em>文件数量</em></span>
  859. <el-input-number
  860. v-model="windowSize"
  861. class="query-control window-number"
  862. size="large"
  863. :min="1"
  864. :max="200"
  865. controls-position="right"
  866. :disabled="queryLoading"
  867. />
  868. </label>
  869. <label class="field field-time-range">
  870. <span class="field-label">时间段</span>
  871. <el-select
  872. v-model="selectedTimeRangePoint"
  873. class="query-control"
  874. size="large"
  875. clearable
  876. filterable
  877. :disabled="queryLoading"
  878. placeholder="选择测试点位"
  879. filter-placeholder="搜索测试点位"
  880. @change="onTimeRangeChange"
  881. >
  882. <el-option
  883. v-for="option in timeRangeOptions"
  884. :key="option.devicePoint"
  885. :value="option.devicePoint"
  886. :label="`${option.devicePoint} ${formatRange(option)}`"
  887. />
  888. </el-select>
  889. </label>
  890. </div>
  891. </div>
  892. <el-alert v-if="errorMessage" class="data-alert" type="error" :closable="false" show-icon :title="errorMessage" />
  893. </section>
  894. <section class="selection-panel panel">
  895. <TimePointStrip
  896. :points="timePoints"
  897. :device-points="selectedDevicePoints"
  898. :point-to-type="DEVICE_POINT_TO_TYPE"
  899. :start-index="startIndex"
  900. :window-size="stripWindowSize"
  901. :loading="timePointsLoading"
  902. :min-time="minTime"
  903. :max-time="maxTime"
  904. :annotated-file-ids="annotatedFileIds"
  905. :ruler="ruler"
  906. :site-points="isPksMode ? selectedSitePoints : []"
  907. :site-descriptions="siteDescriptionMap"
  908. @update:start-index="onStartIndexChange"
  909. />
  910. <div class="selection-controls">
  911. <div class="selection-readout">
  912. <span class="selection-accent"></span>
  913. <span>当前窗口覆盖 <strong>{{ selectedWindowPoints.length }}</strong> 个时间点</span>
  914. <span v-if="hasReference" class="reference-badge" title="始终保留一个 status=0 的正常数据用于对比,固定不随翻页变化">
  915. 正常对比:{{ formatDateTime(referencePoints[0]?.sampleTime) }}
  916. </span>
  917. </div>
  918. <div class="selection-actions">
  919. <el-button class="ghost-button" plain :disabled="!startIndex" @click="resetWindow">回到起点</el-button>
  920. <el-button class="ghost-button" plain :disabled="startIndex <= 0" @click="pageWindow(-1)">上一页</el-button>
  921. <el-button class="ghost-button" plain :disabled="startIndex >= timePoints.length - windowSize" @click="pageWindow(1)">下一页</el-button>
  922. <el-select-v2
  923. class="jump-select"
  924. :options="jumpOptions"
  925. :model-value="startIndex"
  926. :disabled="!timePoints.length"
  927. size="small"
  928. filterable
  929. placeholder="跳转"
  930. @update:model-value="jumpToIndex"
  931. >
  932. <template #default="{ item }">
  933. <template v-for="(segment, segmentIndex) in item.segments" :key="segmentIndex">
  934. <span v-if="segment.color" :style="{ color: segment.color }">{{ segment.text }}</span>
  935. <span v-else>{{ segment.text }}</span>
  936. </template>
  937. </template>
  938. </el-select-v2>
  939. <el-button
  940. class="ghost-button chart-query"
  941. :class="{ 'is-dirty': chartDirty }"
  942. type="primary"
  943. plain
  944. :loading="waveLoading"
  945. :disabled="waveLoading || !selectedWindowPoints.length"
  946. @click="loadWaveWindowNow"
  947. >查询图表</el-button>
  948. </div>
  949. </div>
  950. <div v-if="(waveData?.files.length || windowSiteRows.length)" class="window-files">
  951. <div class="window-files-title">
  952. <span>{{ isSiteTab ? '当前窗口 全场点位记录' : '当前窗口 wave_file 记录' }}</span>
  953. <el-radio-group v-model="fileListPoint" class="file-point-radio" size="small">
  954. <el-radio-button v-for="point in fileTabs" :key="point" :value="point">{{ point }}</el-radio-button>
  955. </el-radio-group>
  956. </div>
  957. <div class="window-files-scroll">
  958. <table v-if="isSiteTab" class="window-files-table">
  959. <thead>
  960. <tr>
  961. <th>#</th>
  962. <th>sample_time</th>
  963. <th v-for="itemName in selectedSitePoints" :key="itemName" :title="itemName">{{ siteDescription(itemName) }}</th>
  964. </tr>
  965. </thead>
  966. <tbody>
  967. <tr v-for="row in windowSiteRows" :key="row.index">
  968. <td class="mono">{{ row.index + 1 }}</td>
  969. <td class="mono">{{ row.sampleTime }}</td>
  970. <td v-for="itemName in selectedSitePoints" :key="itemName" class="mono">{{ row.values[itemName] ?? '—' }}</td>
  971. </tr>
  972. </tbody>
  973. </table>
  974. <table v-else class="window-files-table">
  975. <thead>
  976. <tr>
  977. <th>id</th>
  978. <th>point_name</th>
  979. <th>测试点位</th>
  980. <th>measurement_type</th>
  981. <th>rpm</th>
  982. <th>sample_time</th>
  983. <th>tspluse_status</th>
  984. <th>file_name</th>
  985. <th>操作</th>
  986. </tr>
  987. </thead>
  988. <tbody>
  989. <tr v-for="file in windowFiles" :key="file.id">
  990. <td class="mono">{{ file.id }}</td>
  991. <td>{{ file.pointName }}</td>
  992. <td>{{ file.devicePoint }}</td>
  993. <td>{{ file.measurementType }}</td>
  994. <td class="mono">{{ file.rpm }}</td>
  995. <td class="mono" :style="sampleTimeStyle(file)">{{ file.sampleTime.replace('T', ' ') }}</td>
  996. <td class="mono">{{ file.status ?? '' }}</td>
  997. <td class="file-name" :title="file.fileName">{{ file.fileName || '—' }}</td>
  998. <td class="actions">
  999. <el-button class="file-action" size="small" plain :disabled="!waveData" @click="locateFile(file)">定位</el-button>
  1000. <el-button
  1001. v-if="!recordedFileIds.includes(file.id)"
  1002. class="file-action"
  1003. size="small"
  1004. type="primary"
  1005. plain
  1006. :loading="recordingFileId === file.id"
  1007. @click="recordFile(file)"
  1008. >记录</el-button>
  1009. <el-button
  1010. v-else
  1011. class="file-action"
  1012. size="small"
  1013. type="danger"
  1014. plain
  1015. :loading="recordingFileId === file.id"
  1016. @click="deleteRecordedFile(file)"
  1017. >删除</el-button>
  1018. </td>
  1019. </tr>
  1020. </tbody>
  1021. </table>
  1022. </div>
  1023. </div>
  1024. </section>
  1025. <section class="chart-panel panel">
  1026. <div class="panel-heading chart-heading">
  1027. <div>
  1028. <h2>波形预览</h2>
  1029. </div>
  1030. <div class="chart-actions">
  1031. <span class="annotation-width">标度宽度:<strong>{{ annotationWidth }}</strong></span>
  1032. <el-radio-group v-model="chartMode" class="mode-switch" size="small">
  1033. <el-radio-button label="split">分图显示</el-radio-button>
  1034. <el-radio-button label="merge">归一合并</el-radio-button>
  1035. </el-radio-group>
  1036. <el-switch
  1037. v-model="noSampling"
  1038. class="sampling-switch"
  1039. size="small"
  1040. active-text="不采样"
  1041. inactive-text="采样"
  1042. :disabled="waveLoading"
  1043. />
  1044. <div class="chart-status"><i :class="{ busy: waveLoading }"></i>{{ statusText() }}</div>
  1045. </div>
  1046. </div>
  1047. <WaveChart
  1048. ref="waveChartRef"
  1049. :data="waveData"
  1050. :points="selectedWindowPoints"
  1051. :mode="chartMode"
  1052. :loading="waveLoading"
  1053. :annotations="annotations"
  1054. :site-descriptions="siteDescriptionMap"
  1055. @period-dblclick="openPeriod"
  1056. @annotation-toggle="onAnnotationToggle"
  1057. />
  1058. </section>
  1059. <aside class="insight-panel panel">
  1060. <div class="panel-heading compact-heading">
  1061. <div><h2>当前窗口</h2></div>
  1062. <span class="readout-number">{{ String(selectedWindowPoints.length).padStart(2, '0') }}</span>
  1063. </div>
  1064. <div class="readout-grid">
  1065. <div class="readout-card">
  1066. <span>时间跨度</span>
  1067. <div class="readout-value">
  1068. <strong>{{ formatDateTime(selectedWindowPoints[0]?.sampleTime) }}</strong>
  1069. <small>至 {{ formatDateTime(selectedWindowPoints[selectedWindowPoints.length - 1]?.sampleTime) }}</small>
  1070. </div>
  1071. </div>
  1072. <div class="readout-card"><span>检测周期</span><strong>{{ currentCycles.length }}</strong></div>
  1073. <div class="readout-card"><span>选择范围</span><strong>#{{ startIndex + 1 }} — #{{ endIndex }}</strong></div>
  1074. <div class="readout-card"><span>显示策略</span><strong>MIN / MAX</strong></div>
  1075. </div>
  1076. <div class="data-footprint">
  1077. <div><span>测试点位</span><strong>{{ [...selectedDevicePoints, ...(isPksMode ? selectedSitePoints : [])].join(' / ') || '未选择' }}</strong></div>
  1078. <div><span>可用文件</span><strong>{{ availableTypeCount.toLocaleString() }}</strong></div>
  1079. <div><span>抽样上限</span><strong>{{ maxPoints.toLocaleString() }} 点</strong></div>
  1080. </div>
  1081. </aside>
  1082. </main>
  1083. <PeriodModal :visible="periodVisible" :detail="periodDetail" :loading="periodLoading" :pressure-axis="pressureAxis" @close="closePeriod" />
  1084. </div>
  1085. </template>