verce-vue-test 0.0.65 → 0.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verce-vue-test",
3
- "version": "0.0.65",
3
+ "version": "0.0.66",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { reactive, ref, type Component } from 'vue'
2
+ import { onBeforeUnmount, onDeactivated, reactive, ref, type Component } from 'vue'
3
3
  import { storeToRefs } from 'pinia'
4
4
  import { ElMessage } from 'element-plus'
5
5
  import { Search } from '@element-plus/icons-vue'
@@ -33,6 +33,8 @@ type TableColumn = {
33
33
  defineProps<{
34
34
  layout: ForecastInfoCardLayout
35
35
  layoutOptions: LayoutOption[]
36
+ /** 页面级局部浮层容器,防止抽屉直接挂到 Layout 的 body 节点。 */
37
+ overlayContainer: HTMLElement | null
36
38
  }>()
37
39
 
38
40
  const emit = defineEmits<{
@@ -101,6 +103,17 @@ const forecastInfoStore = useForecastInfoStore()
101
103
  /** 分页、列表和最近一次查询参数从 Pinia 读取,翻页时不依赖组件局部状态。 */
102
104
  const { flowRows, flowTotal, flowPage, flowPageSize, flowLoading, flowQueryParams } = storeToRefs(forecastInfoStore)
103
105
 
106
+ /**
107
+ * 关闭流水卡片的更多筛选抽屉。
108
+ * 抽屉挂到页面专属容器后,在 KeepAlive 或路由过渡中仍需提前关闭,避免遮罩遗留到其他页面。
109
+ */
110
+ function closeFlowTransientOverlays() {
111
+ flowDrawerVisible.value = false
112
+ }
113
+
114
+ onDeactivated(closeFlowTransientOverlays)
115
+ onBeforeUnmount(closeFlowTransientOverlays)
116
+
104
117
  /** 恢复筛选表单初始值,不会立即请求列表。 */
105
118
  function resetFlowForm() {
106
119
  Object.assign(flowForm, defaultFlowForm())
@@ -293,7 +306,9 @@ function getFlowSequence(index: number) {
293
306
  v-model="flowDrawerVisible"
294
307
  title="流水更多筛选"
295
308
  size="520px"
296
- append-to-body
309
+ :append-to="overlayContainer || undefined"
310
+ destroy-on-close
311
+ :lock-scroll="false"
297
312
  class="forecast-info-filter-drawer"
298
313
  >
299
314
  <div class="forecast-info-filter__drawer-grid">
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { reactive, ref, type Component } from 'vue'
2
+ import { onBeforeUnmount, onDeactivated, reactive, ref, type Component } from 'vue'
3
3
  import { storeToRefs } from 'pinia'
4
4
  import { ElMessage, ElMessageBox } from 'element-plus'
5
5
  import {
@@ -55,6 +55,8 @@ const amountColumnProps = new Set(['predAmt', 'verifyAmt'])
55
55
  defineProps<{
56
56
  layout: ForecastInfoCardLayout
57
57
  layoutOptions: LayoutOption[]
58
+ /** 页面级局部浮层容器,防止抽屉与弹窗直接污染 Layout 的 body 节点。 */
59
+ overlayContainer: HTMLElement | null
58
60
  }>()
59
61
 
60
62
  /** 任一业务卡片点击布局图标时,将新布局回传给页面容器。 */
@@ -186,6 +188,21 @@ const {
186
188
  calculationDialogVisible,
187
189
  } = storeToRefs(forecastInfoStore)
188
190
 
191
+ /**
192
+ * 关闭预报卡片创建的所有临时浮层。
193
+ *
194
+ * 抽屉和弹窗挂到页面专属容器后,仍在停用和卸载阶段主动关闭,
195
+ * 防止路由缓存和过渡期间残留遮罩或焦点锁定。
196
+ */
197
+ function closeForecastTransientOverlays() {
198
+ forecastDrawerVisible.value = false
199
+ modifyDialogVisible.value = false
200
+ calculationDialogVisible.value = false
201
+ }
202
+
203
+ onDeactivated(closeForecastTransientOverlays)
204
+ onBeforeUnmount(closeForecastTransientOverlays)
205
+
189
206
  /** 将筛选项恢复为默认值,不会自动触发查询。 */
190
207
  function resetForecastForm() {
191
208
  Object.assign(forecastForm, defaultForecastForm())
@@ -510,7 +527,9 @@ function handleForecastPaginationChange(_value: { page: number; pageSize: number
510
527
  <el-dialog
511
528
  v-model="calculationDialogVisible"
512
529
  width="520px"
513
- append-to-body
530
+ :append-to="overlayContainer || undefined"
531
+ destroy-on-close
532
+ :lock-scroll="false"
514
533
  class="forecast-info-calculation-dialog"
515
534
  >
516
535
  <template #header>
@@ -580,13 +599,14 @@ function handleForecastPaginationChange(_value: { page: number; pageSize: number
580
599
  v-model="modifyDialogVisible"
581
600
  title="修改"
582
601
  width="520px"
583
- append-to-body
602
+ :append-to="overlayContainer || undefined"
584
603
  destroy-on-close
604
+ :lock-scroll="false"
585
605
  :close-on-click-modal="false"
586
606
  class="forecast-info-modify-dialog"
587
607
  @closed="handleModifyDialogClosed"
588
608
  >
589
- <div class="forecast-info-modify-dialog__forecast-info-card__title">
609
+ <div class="forecast-info-modify-dialog__section-title">
590
610
  <el-icon><EditPen /></el-icon>
591
611
  <span>修改记录</span>
592
612
  </div>
@@ -616,7 +636,9 @@ function handleForecastPaginationChange(_value: { page: number; pageSize: number
616
636
  v-model="forecastDrawerVisible"
617
637
  title="预报更多筛选"
618
638
  size="520px"
619
- append-to-body
639
+ :append-to="overlayContainer || undefined"
640
+ destroy-on-close
641
+ :lock-scroll="false"
620
642
  class="forecast-info-filter-drawer"
621
643
  >
622
644
  <div class="forecast-info-filter__drawer-grid">
@@ -19,6 +19,16 @@
19
19
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
20
20
  }
21
21
 
22
+ /* 本页抽屉和弹窗的局部 Teleport 目标,不参与卡片网格,也不会覆盖其他路由。 */
23
+ .forecast-info-overlay-host {
24
+ position: fixed;
25
+ top: 0;
26
+ left: 0;
27
+ width: 0;
28
+ height: 0;
29
+ overflow: visible;
30
+ }
31
+
22
32
  /* 左右布局改为两列等宽;默认布局为上下两行等高。 */
23
33
  .forecast-info-page--horizontal {
24
34
  grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -575,7 +585,7 @@
575
585
  padding: 22px 28px 10px;
576
586
  }
577
587
 
578
- .forecast-info-modify-dialog__forecast-info-card__title {
588
+ .forecast-info-modify-dialog__section-title {
579
589
  display: flex;
580
590
  align-items: center;
581
591
  gap: 8px;
@@ -585,7 +595,7 @@
585
595
  font-weight: 700;
586
596
  }
587
597
 
588
- .forecast-info-modify-dialog__forecast-info-card__title .el-icon {
598
+ .forecast-info-modify-dialog__section-title .el-icon {
589
599
  font-size: 17px;
590
600
  }
591
601
 
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import type { Component } from 'vue'
2
+ import { ref, type Component } from 'vue'
3
3
  import { storeToRefs } from 'pinia'
4
4
  import { Grid, Menu } from '@element-plus/icons-vue'
5
5
  import ForecastInfoPanel from './components/ForecastInfoPanel.vue'
@@ -19,20 +19,30 @@ const layoutOptions: Array<{ label: string; value: ForecastInfoCardLayout; icon:
19
19
  /** 页面容器只负责组合两张卡片,业务数据、分页和多选状态均由页面级 Pinia 管理。 */
20
20
  const forecastInfoStore = useForecastInfoStore()
21
21
  const { cardLayout } = storeToRefs(forecastInfoStore)
22
+
23
+ /**
24
+ * 页面专属的浮层挂载点。
25
+ * 抽屉和弹窗不再直接挂到 body,避免 Layout 路由切换或 KeepAlive 缓存时遮罩残留在其他页面上。
26
+ */
27
+ const overlayContainer = ref<HTMLElement | null>(null)
22
28
  </script>
23
29
 
24
30
  <template>
25
31
  <!-- 水平布局使用两列;垂直布局由公共样式切换为两行等高卡片。 -->
26
32
  <div class="forecast-info-page" :class="{ 'forecast-info-page--horizontal': cardLayout === 'horizontal' }">
33
+ <!-- 固定定位且不参与网格布局,专门承接本页抽屉和弹窗。 -->
34
+ <div ref="overlayContainer" class="forecast-info-overlay-host"></div>
27
35
  <!-- 两个面板接收同一布局值,保证任一入口切换后页面整体保持一致。 -->
28
36
  <ForecastInfoPanel
29
37
  :layout="cardLayout"
30
38
  :layout-options="layoutOptions"
39
+ :overlay-container="overlayContainer"
31
40
  @change-layout="forecastInfoStore.setCardLayout"
32
41
  />
33
42
  <FlowInfoPanel
34
43
  :layout="cardLayout"
35
44
  :layout-options="layoutOptions"
45
+ :overlay-container="overlayContainer"
36
46
  @change-layout="forecastInfoStore.setCardLayout"
37
47
  />
38
48
  </div>