提交 c62bcf89 authored 作者: liujiaxing's avatar liujiaxing

Merge branch 'dev/z' into dev/L

......@@ -31,9 +31,14 @@
- `footerTimeHasedSelectTimeToSub`:标记主系统时间范围是否已同步给子系统
- `globalTimeLineEndSelectTime`:记录滑块当前指向的时间,用于分系统返回后恢复(**实时和历史模式都要更新**`updateSelectedTimes` 已改为无条件更新,不再限制 `!is_flag_isRealtime`
- `globalSubsystemSelectedStartTime`:记录用户选择的时间范围 `[startTime, endTime]`
- `globalLeftWssCONTINE`:WebSocket 数据对象,包含 `type``"history"``"realtime"`
- 从子系统返回时,根据 `footerTimeHasedSelectTimeToSub``globalLeftWssCONTINE.type` 判断走历史模式恢复还是实时模式恢复
- `globalLeftWssCONTINE`:WebSocket 数据对象,包含 `type``"history"``"realtime"`)。**注意**`lefts/index.vue``onMounted` 会把 `wss`(WebSocket 实例)写入该字段,导致 `.type` 变成 `undefined`**不可用于判断实时/历史模式**
- `globalIsRealtimeBeforeSub`**专门用于从子系统返回时恢复**,在 `timers.vue``onUnmounted` 时写入 `is_flag_isRealtime.value``onMounted` 恢复时读该字段判断。
- 从子系统返回时,根据 `footerTimeHasedSelectTimeToSub``globalIsRealtimeBeforeSub` 判断走历史模式恢复还是实时模式恢复
- **实时模式返回**:恢复 `is_flag_isRealtime = true`,重新开启实时 WS + 自动播放,不重置滑块
- 实时模式不回显时间段:`dateRange=[]``pick_select_date=null`
- **不走 `handleDateRangeChange`**,因为它会重置 `is_flag_isRealtime=false``isDateRangeNotEmpty=false``updateTimeline()` 重置滑块为0;之后设 `isDateRangeNotEmpty=true` 会触发 watch,`autoHandleDateRangeChange` 每秒把时间改成 `Date.now()-24h`,覆盖原来时间
- 实时模式恢复只需:`is_flag_isRealtime=true` + `isChange_flag_select_date=true` + `updateTimeline()` + `wssOpenHandle({continue})`
- **不设 `isDateRangeNotEmpty=true`**,避免 `autoHandleDateRangeChange` 把时间改成当前时间;实时模式的 WS 返回数据时会自动更新时间
- **历史模式返回**:恢复时间范围和滑块位置,发 `continue` WS 请求
- 滑块恢复:`handleDateRangeChange(..., true)` 内部会把滑块重置为 0,需在 `nextTick` 后调用 `jumpToSpecificTime(new Date(tempDateTime.value))` 跳回保存的位置
- `tempDateTime.value``onMounted` 开头赋值为 `globalTimeLineEndSelectTime`(每次 `updateSelectedTimes` 都会更新该 Store 字段)
......@@ -41,5 +46,5 @@
- ⚠️ **关键时序**`wssOpenHandle` 末尾无条件调用 `startAutoPlay()`,因此必须把 `wssOpenHandle` 放在 `nextTick` **内部**(在 `jumpToSpecificTime` 之后),否则 `startAutoPlay` 会从 `endHandlePercent=0` 开始播放,自动走的滑块仍会从头重置
- 正确顺序:`handleDateRangeChange``nextTick``jumpToSpecificTime``wssOpenHandle`(含 `startAutoPlay`
- ⚠️ **onMounted 末尾的 realTimeData() 陷阱**`onUnmounted` 调用 `stopAutoPlay()` 导致 `isPlaying=false`,所以 onMounted 末尾的 `if (!isPlaying.value) { realTimeData() }` 在历史恢复分支执行后**还会继续执行**,生成新 taskCode、重开 WS,把恢复逻辑全部覆盖。修复:在 `setGlobalisFromTosub(false)` 之后,`realTimeData()` 之前,判断 `if (footerTimeHasedSelectTimeToSub) return;` 提前退出。
- ⚠️ **实时模式 is_flag_isRealtime 被覆盖**`handleDateRangeChange` 内部会把 `is_flag_isRealtime = false`,导致实时模式返回后变成历史模式。修复:在调用 `handleDateRangeChange` 前先读取 `wasRealtime = globalLeftWssCONTINE.type === "realtime"`,调用后如果 `wasRealtime=true` 则恢复 `is_flag_isRealtime.value = true`
- ⚠️ **实时模式 is_flag_isRealtime 被覆盖**`handleDateRangeChange` 内部会把 `is_flag_isRealtime = false`,导致实时模式返回后变成历史模式。修复:在 `onUnmounted` 时把 `is_flag_isRealtime.value` 存入 `globalIsRealtimeBeforeSub``onMounted` 恢复时读 `wasRealtime = globalIsRealtimeBeforeSub === true`,调用 `handleDateRangeChange` 后如果 `wasRealtime=true` 则恢复 `is_flag_isRealtime.value = true`
- ⚠️ **isPlaying 没有恢复**`handleDateRangeChange` 内部设置 `isPlaying=false`,但 `startAutoPlay` 里没有设置 `isPlaying=true`,导致 `moveEndHandle` 检查 `if (!isPlaying) return` 直接返回,滑块不动。修复:在 `nextTick``jumpToSpecificTime` 之后、`wssOpenHandle` 之前手动设置 `isPlaying.value = true`
\ No newline at end of file
......@@ -154,9 +154,9 @@ const calculateConfig = (selectedTemplate) => {
component2.value = obj[selectedTemplate.availabilityCurveType]
component3.value = obj[selectedTemplate.latencyCurveType]
console.log('component1', component1.value)
console.log('component2', component2.value)
console.log('component3', component3.value)
// console.log('component1', component1.value)
// console.log('component2', component2.value)
// console.log('component3', component3.value)
const curveType = {
'1': '瞬时值曲线',
......
......@@ -25,6 +25,9 @@ const useAppStore = defineStore("app", {
globalLeftWssCONTINE: false,
// 进入子系统前是否处于实时模式(专门用于返回时恢复,不依赖 globalLeftWssCONTINE)
globalIsRealtimeBeforeSub: false,
globalRecordMainSysTaskCode: 0,
subSystemTimeLineEndSelectTime: "-",
......@@ -71,6 +74,9 @@ const useAppStore = defineStore("app", {
setGlobalLeftWssCONTINE(status) {
this.globalLeftWssCONTINE = status;
},
setGlobalIsRealtimeBeforeSub(status) {
this.globalIsRealtimeBeforeSub = status;
},
setSubSystemTimeLineEndSelectTime(status) {
this.subSystemTimeLineEndSelectTime = status;
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论