verce-vue-test 0.0.70 → 0.0.71

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.70",
3
+ "version": "0.0.71",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -8,6 +8,7 @@ import {
8
8
  ref,
9
9
  useAttrs,
10
10
  useSlots,
11
+ watch,
11
12
  cloneVNode,
12
13
  Fragment,
13
14
  type VNode,
@@ -51,6 +52,8 @@ const props = withDefaults(
51
52
  layout?: string
52
53
  // 分页尺寸
53
54
  paginationSize?: 'large' | 'default' | 'small'
55
+ // 外部选择重置标识;值变化时清空表格内部及跨页保留的选择
56
+ selectionResetKey?: number
54
57
  }>(),
55
58
  {
56
59
  columnConfig: true,
@@ -88,6 +91,15 @@ const slots = useSlots()
88
91
  */
89
92
  // 列配置弹窗可见性
90
93
  const dialogVisible = ref(false)
94
+ /** ElTable 选择控制器,仅声明当前组件需要调用的方法。 */
95
+ const tableRef = ref<{ clearSelection: () => void } | null>(null)
96
+
97
+ /** 业务操作完成后,在新数据渲染完毕时清空 reserve-selection 保存的勾选。 */
98
+ watch(
99
+ () => props.selectionResetKey,
100
+ () => tableRef.value?.clearSelection(),
101
+ { flush: 'post' },
102
+ )
91
103
 
92
104
  // 列选项类型定义
93
105
  type ColumnOption = {
@@ -351,6 +363,7 @@ initColumns()
351
363
 
352
364
  <!-- 表格主体 -->
353
365
  <el-table
366
+ ref="tableRef"
354
367
  v-bind="attrs"
355
368
  :data="data"
356
369
  :row-key="rowKey"
@@ -14,25 +14,119 @@ import IconEcosystem from './icons/IconEcosystem.vue'
14
14
  import IconSupport from './icons/IconSupport.vue'
15
15
  import IconTooling from './icons/IconTooling.vue'
16
16
 
17
- const globalComponents: Record<string, Component> = {
18
- ElButtonPro,
19
- ElFormDialog,
20
- ElInputThousandth,
21
- ElTablePro,
22
- ElUploadButton,
23
- LoginSuccessNotification,
24
- NumberRange,
25
- WebsiteNoticeTitle,
26
- IconCommunity,
27
- IconDocumentation,
28
- IconEcosystem,
29
- IconSupport,
30
- IconTooling,
17
+ type GlobalComponentDefinition = {
18
+ name: string
19
+ component: Component
20
+ category: '操作组件' | '表单组件' | '数据组件' | '反馈组件' | '展示组件' | '图标组件'
21
+ description: string
22
+ filePath: string
31
23
  }
32
24
 
25
+ const globalComponentDefinitions: GlobalComponentDefinition[] = [
26
+ {
27
+ name: 'ElButtonPro',
28
+ component: ElButtonPro,
29
+ category: '操作组件',
30
+ description: '增强版按钮,提供权限、防抖、节流和操作确认能力。',
31
+ filePath: 'src/components/ElButtonPro.vue',
32
+ },
33
+ {
34
+ name: 'ElFormDialog',
35
+ component: ElFormDialog,
36
+ category: '表单组件',
37
+ description: '通过字段配置快速生成新增或编辑表单弹窗。',
38
+ filePath: 'src/components/ElFormDialog.vue',
39
+ },
40
+ {
41
+ name: 'ElInputThousandth',
42
+ component: ElInputThousandth,
43
+ category: '表单组件',
44
+ description: '支持千分位展示和数字输入格式化的金额输入框。',
45
+ filePath: 'src/components/ElInputThousandth.vue',
46
+ },
47
+ {
48
+ name: 'ElTablePro',
49
+ component: ElTablePro,
50
+ category: '数据组件',
51
+ description: '封装列配置、列持久化和分页能力的增强表格。',
52
+ filePath: 'src/components/ElTablePro.vue',
53
+ },
54
+ {
55
+ name: 'ElUploadButton',
56
+ component: ElUploadButton,
57
+ category: '操作组件',
58
+ description: '以按钮形态封装上传流程、校验和上传状态。',
59
+ filePath: 'src/components/ElUploadButton.vue',
60
+ },
61
+ {
62
+ name: 'LoginSuccessNotification',
63
+ component: LoginSuccessNotification,
64
+ category: '反馈组件',
65
+ description: '展示当前与上次登录信息的登录成功通知内容。',
66
+ filePath: 'src/components/LoginSuccessNotification.vue',
67
+ },
68
+ {
69
+ name: 'NumberRange',
70
+ component: NumberRange,
71
+ category: '表单组件',
72
+ description: '支持数组或双字段绑定、单位换算和区间校验的数字范围输入。',
73
+ filePath: 'src/components/NumberRange.vue',
74
+ },
75
+ {
76
+ name: 'WebsiteNoticeTitle',
77
+ component: WebsiteNoticeTitle,
78
+ category: '展示组件',
79
+ description: '用于页面顶部展示网站公告内容和查看更多入口。',
80
+ filePath: 'src/components/WebsiteNoticeTitle.vue',
81
+ },
82
+ {
83
+ name: 'IconCommunity',
84
+ component: IconCommunity,
85
+ category: '图标组件',
86
+ description: '社区场景图标。',
87
+ filePath: 'src/components/icons/IconCommunity.vue',
88
+ },
89
+ {
90
+ name: 'IconDocumentation',
91
+ component: IconDocumentation,
92
+ category: '图标组件',
93
+ description: '文档场景图标。',
94
+ filePath: 'src/components/icons/IconDocumentation.vue',
95
+ },
96
+ {
97
+ name: 'IconEcosystem',
98
+ component: IconEcosystem,
99
+ category: '图标组件',
100
+ description: '生态场景图标。',
101
+ filePath: 'src/components/icons/IconEcosystem.vue',
102
+ },
103
+ {
104
+ name: 'IconSupport',
105
+ component: IconSupport,
106
+ category: '图标组件',
107
+ description: '支持与服务场景图标。',
108
+ filePath: 'src/components/icons/IconSupport.vue',
109
+ },
110
+ {
111
+ name: 'IconTooling',
112
+ component: IconTooling,
113
+ category: '图标组件',
114
+ description: '工具场景图标。',
115
+ filePath: 'src/components/icons/IconTooling.vue',
116
+ },
117
+ ]
118
+
119
+ /** 组件清单页与全局注册共用同一份数据,避免展示内容与实际注册状态不一致。 */
120
+ export const globalComponentCatalog = globalComponentDefinitions.map((definition) => ({
121
+ name: definition.name,
122
+ category: definition.category,
123
+ description: definition.description,
124
+ filePath: definition.filePath,
125
+ }))
126
+
33
127
  /** 注册 src/components 下的公共组件,页面模板中可直接使用。 */
34
128
  export function registerGlobalComponents(app: App) {
35
- Object.entries(globalComponents).forEach(([name, component]) => {
129
+ globalComponentDefinitions.forEach(({ name, component }) => {
36
130
  app.component(name, component)
37
131
  })
38
132
  }
@@ -35,6 +35,11 @@ const router = createRouter({
35
35
  name: 'form',
36
36
  component: () => import('../views/FormView.vue'),
37
37
  },
38
+ {
39
+ path: '/components',
40
+ name: 'componentCatalog',
41
+ component: () => import('../views/ComponentCatalogView.vue'),
42
+ },
38
43
  {
39
44
  path: '/table-pro',
40
45
  name: 'tablePro',
@@ -0,0 +1,768 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'vue'
3
+ import { ElMessage } from 'element-plus'
4
+ import {
5
+ CircleCheck,
6
+ CopyDocument,
7
+ Files,
8
+ FolderOpened,
9
+ Search,
10
+ } from '@element-plus/icons-vue'
11
+ import { globalComponentCatalog } from '@/components'
12
+
13
+ const keyword = ref('')
14
+ const activeCategory = ref('全部')
15
+
16
+ const categories = computed(() => [
17
+ '全部',
18
+ ...new Set(globalComponentCatalog.map((item) => item.category)),
19
+ ])
20
+
21
+ const iconCount = computed(
22
+ () => globalComponentCatalog.filter((item) => item.category === '图标组件').length,
23
+ )
24
+
25
+ const filteredComponents = computed(() => {
26
+ const normalizedKeyword = keyword.value.trim().toLowerCase()
27
+
28
+ return globalComponentCatalog.filter((item) => {
29
+ const matchesCategory = activeCategory.value === '全部'
30
+ || item.category === activeCategory.value
31
+ const matchesKeyword = !normalizedKeyword
32
+ || [item.name, item.category, item.description, item.filePath]
33
+ .some((value) => value.toLowerCase().includes(normalizedKeyword))
34
+
35
+ return matchesCategory && matchesKeyword
36
+ })
37
+ })
38
+
39
+ async function copyFilePath(filePath: string) {
40
+ try {
41
+ await navigator.clipboard.writeText(filePath)
42
+ ElMessage.success('组件文件位置已复制')
43
+ } catch {
44
+ ElMessage.error('复制失败,请手动复制文件位置')
45
+ }
46
+ }
47
+ </script>
48
+
49
+ <template>
50
+ <div class="component-catalog-page">
51
+ <section class="catalog-hero">
52
+ <div class="catalog-hero__content">
53
+ <div class="catalog-eyebrow">
54
+ <el-icon><Files /></el-icon>
55
+ COMPONENT REGISTRY
56
+ </div>
57
+ <h1>公共组件清单</h1>
58
+ <p>
59
+ 项目内已全局注册的公共组件都收录在这里,可按名称或类型快速查找,
60
+ 并直接复制对应的源码位置。
61
+ </p>
62
+ </div>
63
+
64
+ <div class="catalog-summary" aria-label="组件统计">
65
+ <div class="summary-item summary-item--primary">
66
+ <strong>{{ globalComponentCatalog.length }}</strong>
67
+ <span>公共组件</span>
68
+ </div>
69
+ <div class="summary-divider"></div>
70
+ <div class="summary-item">
71
+ <strong>{{ categories.length - 1 }}</strong>
72
+ <span>组件分类</span>
73
+ </div>
74
+ <div class="summary-divider"></div>
75
+ <div class="summary-item">
76
+ <strong>{{ iconCount }}</strong>
77
+ <span>图标组件</span>
78
+ </div>
79
+ </div>
80
+ </section>
81
+
82
+ <section class="catalog-toolbar" aria-label="组件筛选">
83
+ <label class="catalog-search">
84
+ <el-icon><Search /></el-icon>
85
+ <input
86
+ v-model="keyword"
87
+ type="search"
88
+ placeholder="搜索组件名称、说明或文件位置"
89
+ />
90
+ <span class="search-shortcut">{{ filteredComponents.length }} / {{ globalComponentCatalog.length }}</span>
91
+ </label>
92
+
93
+ <div class="category-tabs" role="tablist" aria-label="组件分类">
94
+ <button
95
+ v-for="category in categories"
96
+ :key="category"
97
+ type="button"
98
+ class="category-tab"
99
+ :class="{ 'is-active': activeCategory === category }"
100
+ @click="activeCategory = category"
101
+ >
102
+ {{ category }}
103
+ </button>
104
+ </div>
105
+ </section>
106
+
107
+ <section class="catalog-list" aria-live="polite">
108
+ <div class="catalog-list__heading">
109
+ <div>
110
+ <span class="heading-kicker">AVAILABLE COMPONENTS</span>
111
+ <h2>{{ activeCategory === '全部' ? '全部组件' : activeCategory }}</h2>
112
+ </div>
113
+ <span class="global-status">
114
+ <el-icon><CircleCheck /></el-icon>
115
+ 全部已全局注册
116
+ </span>
117
+ </div>
118
+
119
+ <div v-if="filteredComponents.length" class="component-grid">
120
+ <article
121
+ v-for="(item, index) in filteredComponents"
122
+ :key="item.name"
123
+ class="component-card"
124
+ :style="{ '--enter-delay': `${Math.min(index, 8) * 35}ms` }"
125
+ >
126
+ <div class="component-card__index">
127
+ {{ String(globalComponentCatalog.indexOf(item) + 1).padStart(2, '0') }}
128
+ </div>
129
+
130
+ <div class="component-card__preview" :class="{ 'is-icon': item.category === '图标组件' }">
131
+ <component
132
+ :is="item.name"
133
+ v-if="item.category === '图标组件'"
134
+ />
135
+ <span v-else>{{ item.name.slice(0, 2) }}</span>
136
+ </div>
137
+
138
+ <div class="component-card__body">
139
+ <div class="component-card__title-row">
140
+ <h3>{{ item.name }}</h3>
141
+ <span class="category-badge">{{ item.category }}</span>
142
+ </div>
143
+ <p>{{ item.description }}</p>
144
+
145
+ <div class="component-location">
146
+ <div class="component-location__icon">
147
+ <el-icon><FolderOpened /></el-icon>
148
+ </div>
149
+ <div class="component-location__content">
150
+ <span>组件文件位置</span>
151
+ <code>{{ item.filePath }}</code>
152
+ </div>
153
+ <button
154
+ type="button"
155
+ class="copy-button"
156
+ :aria-label="`复制 ${item.name} 文件位置`"
157
+ @click="copyFilePath(item.filePath)"
158
+ >
159
+ <el-icon><CopyDocument /></el-icon>
160
+ </button>
161
+ </div>
162
+
163
+ <div class="component-usage">
164
+ <span>模板中直接使用</span>
165
+ <code>&lt;{{ item.name }} /&gt;</code>
166
+ </div>
167
+ </div>
168
+ </article>
169
+ </div>
170
+
171
+ <div v-else class="catalog-empty">
172
+ <div class="catalog-empty__icon">
173
+ <el-icon><Search /></el-icon>
174
+ </div>
175
+ <h3>没有找到匹配的组件</h3>
176
+ <p>换一个关键词,或切换到“全部”分类再看看。</p>
177
+ <button type="button" @click="keyword = ''; activeCategory = '全部'">
178
+ 清除筛选
179
+ </button>
180
+ </div>
181
+ </section>
182
+ </div>
183
+ </template>
184
+
185
+ <style scoped>
186
+ .component-catalog-page {
187
+ --catalog-ink: #152235;
188
+ --catalog-muted: #647188;
189
+ --catalog-blue: #1769e0;
190
+ --catalog-cyan: #28c6d8;
191
+ --catalog-border: #dfe6ef;
192
+ min-height: 100%;
193
+ padding: 28px;
194
+ color: var(--catalog-ink);
195
+ font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
196
+ background:
197
+ linear-gradient(rgba(21, 34, 53, .035) 1px, transparent 1px),
198
+ linear-gradient(90deg, rgba(21, 34, 53, .035) 1px, transparent 1px),
199
+ #f5f8fc;
200
+ background-size: 32px 32px;
201
+ }
202
+
203
+ .catalog-hero {
204
+ position: relative;
205
+ display: flex;
206
+ align-items: flex-end;
207
+ justify-content: space-between;
208
+ gap: 48px;
209
+ min-height: 248px;
210
+ padding: 42px 44px;
211
+ overflow: hidden;
212
+ color: #fff;
213
+ border-radius: 20px;
214
+ background:
215
+ radial-gradient(circle at 80% -20%, rgba(40, 198, 216, .42), transparent 38%),
216
+ linear-gradient(118deg, #102139 0%, #17365e 58%, #125c79 100%);
217
+ box-shadow: 0 24px 56px rgba(27, 52, 82, .19);
218
+ }
219
+
220
+ .catalog-hero::before,
221
+ .catalog-hero::after {
222
+ content: "";
223
+ position: absolute;
224
+ border: 1px solid rgba(255, 255, 255, .12);
225
+ border-radius: 50%;
226
+ }
227
+
228
+ .catalog-hero::before {
229
+ width: 280px;
230
+ height: 280px;
231
+ top: -170px;
232
+ right: 15%;
233
+ }
234
+
235
+ .catalog-hero::after {
236
+ width: 420px;
237
+ height: 420px;
238
+ right: -250px;
239
+ bottom: -330px;
240
+ }
241
+
242
+ .catalog-hero__content,
243
+ .catalog-summary {
244
+ position: relative;
245
+ z-index: 1;
246
+ }
247
+
248
+ .catalog-hero__content {
249
+ max-width: 690px;
250
+ }
251
+
252
+ .catalog-eyebrow {
253
+ display: inline-flex;
254
+ align-items: center;
255
+ gap: 9px;
256
+ margin-bottom: 19px;
257
+ color: #79e7ef;
258
+ font-size: 12px;
259
+ font-weight: 700;
260
+ letter-spacing: .17em;
261
+ }
262
+
263
+ .catalog-hero h1 {
264
+ margin: 0;
265
+ font-size: clamp(34px, 4vw, 52px);
266
+ line-height: 1.08;
267
+ letter-spacing: -.04em;
268
+ }
269
+
270
+ .catalog-hero p {
271
+ max-width: 640px;
272
+ margin: 19px 0 0;
273
+ color: rgba(234, 242, 252, .78);
274
+ font-size: 15px;
275
+ line-height: 1.85;
276
+ }
277
+
278
+ .catalog-summary {
279
+ display: flex;
280
+ align-items: center;
281
+ flex: 0 0 auto;
282
+ padding: 19px 22px;
283
+ border: 1px solid rgba(255, 255, 255, .14);
284
+ border-radius: 16px;
285
+ background: rgba(7, 23, 42, .34);
286
+ backdrop-filter: blur(14px);
287
+ }
288
+
289
+ .summary-item {
290
+ display: flex;
291
+ min-width: 82px;
292
+ flex-direction: column;
293
+ align-items: center;
294
+ gap: 3px;
295
+ }
296
+
297
+ .summary-item strong {
298
+ font-family: "SFMono-Regular", Consolas, monospace;
299
+ font-size: 28px;
300
+ line-height: 1;
301
+ }
302
+
303
+ .summary-item--primary strong {
304
+ color: #72e4ed;
305
+ }
306
+
307
+ .summary-item span {
308
+ color: rgba(226, 236, 247, .65);
309
+ font-size: 11px;
310
+ }
311
+
312
+ .summary-divider {
313
+ width: 1px;
314
+ height: 35px;
315
+ margin: 0 14px;
316
+ background: rgba(255, 255, 255, .13);
317
+ }
318
+
319
+ .catalog-toolbar {
320
+ position: relative;
321
+ z-index: 2;
322
+ display: flex;
323
+ align-items: center;
324
+ justify-content: space-between;
325
+ gap: 24px;
326
+ margin: -1px 20px 0;
327
+ padding: 22px 24px;
328
+ border: 1px solid var(--catalog-border);
329
+ border-top: 0;
330
+ border-radius: 0 0 17px 17px;
331
+ background: rgba(255, 255, 255, .94);
332
+ box-shadow: 0 16px 34px rgba(36, 62, 94, .08);
333
+ }
334
+
335
+ .catalog-search {
336
+ display: flex;
337
+ align-items: center;
338
+ width: min(430px, 100%);
339
+ height: 44px;
340
+ gap: 11px;
341
+ padding: 0 14px;
342
+ color: #718097;
343
+ border: 1px solid #d9e1eb;
344
+ border-radius: 10px;
345
+ background: #f8fafc;
346
+ transition: border-color .2s, box-shadow .2s, background .2s;
347
+ }
348
+
349
+ .catalog-search:focus-within {
350
+ border-color: #74a9ef;
351
+ background: #fff;
352
+ box-shadow: 0 0 0 3px rgba(23, 105, 224, .09);
353
+ }
354
+
355
+ .catalog-search input {
356
+ min-width: 0;
357
+ flex: 1;
358
+ color: var(--catalog-ink);
359
+ border: 0;
360
+ outline: 0;
361
+ background: transparent;
362
+ font: inherit;
363
+ font-size: 14px;
364
+ }
365
+
366
+ .catalog-search input::-webkit-search-cancel-button {
367
+ display: none;
368
+ }
369
+
370
+ .search-shortcut {
371
+ padding: 4px 7px;
372
+ color: #79869a;
373
+ border: 1px solid #e0e6ed;
374
+ border-radius: 6px;
375
+ background: #fff;
376
+ font-family: "SFMono-Regular", Consolas, monospace;
377
+ font-size: 10px;
378
+ white-space: nowrap;
379
+ }
380
+
381
+ .category-tabs {
382
+ display: flex;
383
+ align-items: center;
384
+ justify-content: flex-end;
385
+ gap: 7px;
386
+ overflow-x: auto;
387
+ }
388
+
389
+ .category-tab {
390
+ flex: 0 0 auto;
391
+ padding: 8px 12px;
392
+ color: #637087;
393
+ border: 1px solid transparent;
394
+ border-radius: 8px;
395
+ background: transparent;
396
+ font: inherit;
397
+ font-size: 13px;
398
+ cursor: pointer;
399
+ transition: color .2s, border-color .2s, background .2s;
400
+ }
401
+
402
+ .category-tab:hover {
403
+ color: var(--catalog-blue);
404
+ background: #f2f6fc;
405
+ }
406
+
407
+ .category-tab.is-active {
408
+ color: #fff;
409
+ border-color: var(--catalog-blue);
410
+ background: var(--catalog-blue);
411
+ box-shadow: 0 7px 16px rgba(23, 105, 224, .2);
412
+ }
413
+
414
+ .catalog-list {
415
+ margin-top: 34px;
416
+ }
417
+
418
+ .catalog-list__heading {
419
+ display: flex;
420
+ align-items: flex-end;
421
+ justify-content: space-between;
422
+ margin-bottom: 17px;
423
+ padding: 0 4px;
424
+ }
425
+
426
+ .heading-kicker {
427
+ display: block;
428
+ margin-bottom: 5px;
429
+ color: #8590a2;
430
+ font-size: 10px;
431
+ font-weight: 700;
432
+ letter-spacing: .16em;
433
+ }
434
+
435
+ .catalog-list__heading h2 {
436
+ margin: 0;
437
+ font-size: 24px;
438
+ letter-spacing: -.02em;
439
+ }
440
+
441
+ .global-status {
442
+ display: inline-flex;
443
+ align-items: center;
444
+ gap: 7px;
445
+ color: #13805b;
446
+ font-size: 13px;
447
+ font-weight: 600;
448
+ }
449
+
450
+ .component-grid {
451
+ display: grid;
452
+ grid-template-columns: repeat(2, minmax(0, 1fr));
453
+ gap: 16px;
454
+ }
455
+
456
+ .component-card {
457
+ position: relative;
458
+ display: grid;
459
+ grid-template-columns: 62px minmax(0, 1fr);
460
+ min-height: 254px;
461
+ overflow: hidden;
462
+ border: 1px solid var(--catalog-border);
463
+ border-radius: 15px;
464
+ background: #fff;
465
+ box-shadow: 0 10px 26px rgba(32, 58, 89, .055);
466
+ animation: catalog-card-in .42s both;
467
+ animation-delay: var(--enter-delay);
468
+ transition: transform .22s, border-color .22s, box-shadow .22s;
469
+ }
470
+
471
+ .component-card:hover {
472
+ z-index: 1;
473
+ border-color: #b9cef0;
474
+ box-shadow: 0 18px 38px rgba(32, 73, 122, .12);
475
+ transform: translateY(-3px);
476
+ }
477
+
478
+ .component-card__index {
479
+ position: absolute;
480
+ top: 15px;
481
+ right: 17px;
482
+ color: #c8d1dd;
483
+ font-family: "SFMono-Regular", Consolas, monospace;
484
+ font-size: 11px;
485
+ letter-spacing: .08em;
486
+ }
487
+
488
+ .component-card__preview {
489
+ display: flex;
490
+ align-items: flex-start;
491
+ justify-content: center;
492
+ padding-top: 28px;
493
+ color: #266dc8;
494
+ border-right: 1px solid #edf1f6;
495
+ background: linear-gradient(180deg, #f1f7ff, #f8fbff);
496
+ font-family: "SFMono-Regular", Consolas, monospace;
497
+ font-size: 16px;
498
+ font-weight: 700;
499
+ }
500
+
501
+ .component-card__preview.is-icon :deep(svg) {
502
+ width: 24px;
503
+ height: 24px;
504
+ }
505
+
506
+ .component-card__body {
507
+ min-width: 0;
508
+ padding: 25px 24px 21px;
509
+ }
510
+
511
+ .component-card__title-row {
512
+ display: flex;
513
+ align-items: center;
514
+ gap: 10px;
515
+ padding-right: 28px;
516
+ }
517
+
518
+ .component-card h3 {
519
+ min-width: 0;
520
+ margin: 0;
521
+ overflow: hidden;
522
+ color: #17263b;
523
+ font-family: "SFMono-Regular", Consolas, monospace;
524
+ font-size: 17px;
525
+ letter-spacing: -.025em;
526
+ text-overflow: ellipsis;
527
+ white-space: nowrap;
528
+ }
529
+
530
+ .category-badge {
531
+ flex: 0 0 auto;
532
+ padding: 4px 7px;
533
+ color: #41658e;
534
+ border: 1px solid #d7e4f2;
535
+ border-radius: 999px;
536
+ background: #f2f7fc;
537
+ font-size: 10px;
538
+ font-weight: 600;
539
+ }
540
+
541
+ .component-card__body > p {
542
+ min-height: 42px;
543
+ margin: 13px 0 17px;
544
+ color: var(--catalog-muted);
545
+ font-size: 13px;
546
+ line-height: 1.65;
547
+ }
548
+
549
+ .component-location {
550
+ display: flex;
551
+ align-items: center;
552
+ gap: 10px;
553
+ min-width: 0;
554
+ padding: 10px;
555
+ border: 1px solid #e3e9f0;
556
+ border-radius: 9px;
557
+ background: #f8fafc;
558
+ }
559
+
560
+ .component-location__icon {
561
+ display: grid;
562
+ width: 30px;
563
+ height: 30px;
564
+ flex: 0 0 auto;
565
+ place-items: center;
566
+ color: #3178cd;
567
+ border-radius: 7px;
568
+ background: #e8f2ff;
569
+ }
570
+
571
+ .component-location__content {
572
+ display: flex;
573
+ min-width: 0;
574
+ flex: 1;
575
+ flex-direction: column;
576
+ gap: 2px;
577
+ }
578
+
579
+ .component-location__content span {
580
+ color: #8a96a8;
581
+ font-size: 9px;
582
+ font-weight: 600;
583
+ letter-spacing: .08em;
584
+ }
585
+
586
+ .component-location code,
587
+ .component-usage code {
588
+ overflow: hidden;
589
+ color: #31425a;
590
+ font-family: "SFMono-Regular", Consolas, monospace;
591
+ font-size: 11px;
592
+ text-overflow: ellipsis;
593
+ white-space: nowrap;
594
+ }
595
+
596
+ .copy-button {
597
+ display: grid;
598
+ width: 30px;
599
+ height: 30px;
600
+ flex: 0 0 auto;
601
+ place-items: center;
602
+ color: #78869a;
603
+ border: 0;
604
+ border-radius: 7px;
605
+ background: transparent;
606
+ cursor: pointer;
607
+ transition: color .2s, background .2s;
608
+ }
609
+
610
+ .copy-button:hover {
611
+ color: var(--catalog-blue);
612
+ background: #e9f2ff;
613
+ }
614
+
615
+ .component-usage {
616
+ display: flex;
617
+ align-items: center;
618
+ justify-content: space-between;
619
+ gap: 12px;
620
+ margin-top: 12px;
621
+ color: #919cad;
622
+ font-size: 10px;
623
+ }
624
+
625
+ .component-usage code {
626
+ color: #0d7c86;
627
+ }
628
+
629
+ .catalog-empty {
630
+ display: flex;
631
+ min-height: 330px;
632
+ flex-direction: column;
633
+ align-items: center;
634
+ justify-content: center;
635
+ border: 1px dashed #cbd6e3;
636
+ border-radius: 16px;
637
+ background: rgba(255, 255, 255, .72);
638
+ text-align: center;
639
+ }
640
+
641
+ .catalog-empty__icon {
642
+ display: grid;
643
+ width: 52px;
644
+ height: 52px;
645
+ margin-bottom: 15px;
646
+ place-items: center;
647
+ color: #6783a6;
648
+ border-radius: 50%;
649
+ background: #edf3fa;
650
+ font-size: 22px;
651
+ }
652
+
653
+ .catalog-empty h3 {
654
+ margin: 0;
655
+ font-size: 18px;
656
+ }
657
+
658
+ .catalog-empty p {
659
+ margin: 8px 0 17px;
660
+ color: var(--catalog-muted);
661
+ font-size: 13px;
662
+ }
663
+
664
+ .catalog-empty button {
665
+ padding: 8px 16px;
666
+ color: #fff;
667
+ border: 0;
668
+ border-radius: 8px;
669
+ background: var(--catalog-blue);
670
+ cursor: pointer;
671
+ }
672
+
673
+ @keyframes catalog-card-in {
674
+ from {
675
+ opacity: 0;
676
+ transform: translateY(12px);
677
+ }
678
+ to {
679
+ opacity: 1;
680
+ transform: translateY(0);
681
+ }
682
+ }
683
+
684
+ @media (max-width: 1180px) {
685
+ .catalog-hero {
686
+ align-items: flex-start;
687
+ flex-direction: column;
688
+ }
689
+
690
+ .catalog-summary {
691
+ align-self: stretch;
692
+ justify-content: space-around;
693
+ }
694
+
695
+ .catalog-toolbar {
696
+ align-items: stretch;
697
+ flex-direction: column;
698
+ }
699
+
700
+ .catalog-search {
701
+ width: 100%;
702
+ }
703
+
704
+ .category-tabs {
705
+ justify-content: flex-start;
706
+ }
707
+ }
708
+
709
+ @media (max-width: 820px) {
710
+ .component-catalog-page {
711
+ padding: 16px;
712
+ }
713
+
714
+ .catalog-hero {
715
+ min-height: auto;
716
+ padding: 30px 24px;
717
+ }
718
+
719
+ .catalog-toolbar {
720
+ margin: 0 8px;
721
+ }
722
+
723
+ .component-grid {
724
+ grid-template-columns: 1fr;
725
+ }
726
+ }
727
+
728
+ @media (max-width: 520px) {
729
+ .catalog-summary {
730
+ padding: 16px 8px;
731
+ }
732
+
733
+ .summary-item {
734
+ min-width: 65px;
735
+ }
736
+
737
+ .summary-divider {
738
+ margin: 0 5px;
739
+ }
740
+
741
+ .component-card {
742
+ grid-template-columns: 48px minmax(0, 1fr);
743
+ }
744
+
745
+ .component-card__body {
746
+ padding: 23px 16px 18px;
747
+ }
748
+
749
+ .component-card__title-row {
750
+ align-items: flex-start;
751
+ flex-direction: column;
752
+ gap: 7px;
753
+ }
754
+
755
+ .catalog-list__heading {
756
+ align-items: flex-start;
757
+ flex-direction: column;
758
+ gap: 9px;
759
+ }
760
+ }
761
+
762
+ @media (prefers-reduced-motion: reduce) {
763
+ .component-card {
764
+ animation: none;
765
+ transition: none;
766
+ }
767
+ }
768
+ </style>
@@ -10,6 +10,7 @@ export default {
10
10
 
11
11
  <script setup lang="ts">
12
12
  import { onBeforeUnmount, onDeactivated, onMounted, ref, type Component } from 'vue'
13
+ import { onBeforeRouteLeave } from 'vue-router'
13
14
  import { storeToRefs } from 'pinia'
14
15
  import { ElMessage } from 'element-plus'
15
16
  import { Grid, Menu } from '@element-plus/icons-vue'
@@ -40,6 +41,17 @@ const overlayContainer = ref<HTMLElement | null>(null)
40
41
  const pageContainer = ref<HTMLElement | null>(null)
41
42
  const isFullscreen = ref(false)
42
43
 
44
+ type TransientOverlayController = {
45
+ closeTransientOverlays: () => void
46
+ }
47
+
48
+ /**
49
+ * 父页面统一持有两个面板的临时浮层清理入口。
50
+ * 这样路由离开时可以先清理页面状态,不依赖目标项目的 RouterView 是否使用 KeepAlive。
51
+ */
52
+ const forecastInfoPanel = ref<TransientOverlayController | null>(null)
53
+ const flowInfoPanel = ref<TransientOverlayController | null>(null)
54
+
43
55
  function syncFullscreenState() {
44
56
  isFullscreen.value = document.fullscreenElement === pageContainer.value
45
57
  }
@@ -66,17 +78,42 @@ async function toggleFullscreen() {
66
78
  }
67
79
  }
68
80
 
69
- function exitPageFullscreen() {
81
+ async function exitPageFullscreen() {
70
82
  if (document.fullscreenElement === pageContainer.value) {
71
- void document.exitFullscreen()
83
+ try {
84
+ await document.exitFullscreen()
85
+ } catch {
86
+ // 退出失败也不能阻断路由跳转;浏览器在全屏元素移除后会自行恢复。
87
+ } finally {
88
+ isFullscreen.value = false
89
+ }
72
90
  }
73
91
  }
74
92
 
93
+ function closePageTransientOverlays() {
94
+ forecastInfoPanel.value?.closeTransientOverlays()
95
+ flowInfoPanel.value?.closeTransientOverlays()
96
+ }
97
+
98
+ /**
99
+ * 路由守卫早于组件停用和卸载执行。
100
+ * 在 Layout、KeepAlive、多页签等不同承载方式下,都先退出浏览器顶层全屏并移除本页遮罩。
101
+ */
102
+ async function cleanupBeforeRouteLeave() {
103
+ closePageTransientOverlays()
104
+ await exitPageFullscreen()
105
+ }
106
+
75
107
  onMounted(() => document.addEventListener('fullscreenchange', syncFullscreenState))
76
- onDeactivated(exitPageFullscreen)
108
+ onBeforeRouteLeave(cleanupBeforeRouteLeave)
109
+ onDeactivated(() => {
110
+ closePageTransientOverlays()
111
+ void exitPageFullscreen()
112
+ })
77
113
  onBeforeUnmount(() => {
78
114
  document.removeEventListener('fullscreenchange', syncFullscreenState)
79
- exitPageFullscreen()
115
+ closePageTransientOverlays()
116
+ void exitPageFullscreen()
80
117
  })
81
118
  </script>
82
119
 
@@ -94,6 +131,7 @@ onBeforeUnmount(() => {
94
131
  <div ref="overlayContainer" class="forecast-info-overlay-host"></div>
95
132
  <!-- 两个面板接收同一布局值,保证任一入口切换后页面整体保持一致。 -->
96
133
  <ForecastInfoPanel
134
+ ref="forecastInfoPanel"
97
135
  :layout="cardLayout"
98
136
  :layout-options="layoutOptions"
99
137
  :overlay-container="overlayContainer"
@@ -102,6 +140,7 @@ onBeforeUnmount(() => {
102
140
  @toggle-fullscreen="toggleFullscreen"
103
141
  />
104
142
  <FlowInfoPanel
143
+ ref="flowInfoPanel"
105
144
  :layout="cardLayout"
106
145
  :layout-options="layoutOptions"
107
146
  :overlay-container="overlayContainer"
@@ -111,6 +111,7 @@ const {
111
111
  flowLoading,
112
112
  flowQueryParams,
113
113
  flowSelectedRows,
114
+ tableSelectionResetKey,
114
115
  } = storeToRefs(forecastInfoStore)
115
116
 
116
117
  /**
@@ -137,6 +138,11 @@ function closeFlowTransientOverlays() {
137
138
  flowDrawerVisible.value = false
138
139
  }
139
140
 
141
+ /** 供路由页在 leave 守卫阶段提前清理,兼容不同项目的 Layout 与 KeepAlive 实现。 */
142
+ defineExpose({
143
+ closeTransientOverlays: closeFlowTransientOverlays,
144
+ })
145
+
140
146
  onDeactivated(closeFlowTransientOverlays)
141
147
  onBeforeUnmount(closeFlowTransientOverlays)
142
148
 
@@ -195,8 +201,9 @@ function handleFlowReset() {
195
201
  ElMessage.info('流水筛选条件已重置')
196
202
  }
197
203
 
198
- /** 翻页或改变每页条数时复用当前表单映射,避免遗漏后端参数字段。 */
204
+ /** 翻页或改变每页条数时先清空两张表选择,再复用当前表单映射。 */
199
205
  function handleFlowPaginationChange(_value: { page: number; pageSize: number }) {
206
+ forecastInfoStore.resetAllTableSelections()
200
207
  const params = buildFlowQueryParams()
201
208
  flowQueryParams.value = params
202
209
  forecastInfoStore.loadFlowInfoList(params)
@@ -298,6 +305,7 @@ function getFlowSequence(index: number) {
298
305
  :total="flowTotal"
299
306
  v-loading="flowLoading"
300
307
  table-key="flow-info"
308
+ :selection-reset-key="tableSelectionResetKey"
301
309
  row-key="refNo"
302
310
  border
303
311
  stripe
@@ -179,7 +179,8 @@ const modifyForm = reactive({
179
179
  /** 页面级 store 提供跨预报、流水表共享的业务状态与操作。 */
180
180
  const forecastInfoStore = useForecastInfoStore()
181
181
  /** 工具栏按钮仅在至少选择一条预报信息时可用。 */
182
- const { forecastHasSelectedRows, forecastSelectedRows } = storeToRefs(forecastInfoStore)
182
+ const { forecastHasSelectedRows, forecastSelectedRows, tableSelectionResetKey } =
183
+ storeToRefs(forecastInfoStore)
183
184
  /** 列表、分页、加载状态和匡算弹窗状态均从 Pinia 取值,避免布局切换后丢失。 */
184
185
  const {
185
186
  forecastRows,
@@ -241,8 +242,14 @@ function closeForecastTransientOverlays() {
241
242
  forecastDrawerVisible.value = false
242
243
  modifyDialogVisible.value = false
243
244
  calculationDialogVisible.value = false
245
+ ElMessageBox.close()
244
246
  }
245
247
 
248
+ /** 供路由页在 leave 守卫阶段提前清理,避免等待 KeepAlive 停用后才释放遮罩。 */
249
+ defineExpose({
250
+ closeTransientOverlays: closeForecastTransientOverlays,
251
+ })
252
+
246
253
  onDeactivated(closeForecastTransientOverlays)
247
254
  onBeforeUnmount(closeForecastTransientOverlays)
248
255
 
@@ -377,8 +384,9 @@ function getForecastSequence(index: number) {
377
384
  return (forecastPage.value - 1) * forecastPageSize.value + index + 1
378
385
  }
379
386
 
380
- /** 翻页直接复用 Pinia 保存的最近一次查询参数。 */
387
+ /** 翻页前清空两张表的选择状态,再复用 Pinia 保存的最近一次查询参数。 */
381
388
  function handleForecastPaginationChange(_value: { page: number; pageSize: number }) {
389
+ forecastInfoStore.resetAllTableSelections()
382
390
  forecastInfoStore.loadForecastInfoList()
383
391
  }
384
392
  </script>
@@ -499,6 +507,7 @@ function handleForecastPaginationChange(_value: { page: number; pageSize: number
499
507
  :total="forecastTotal"
500
508
  v-loading="forecastLoading"
501
509
  table-key="forecast-info"
510
+ :selection-reset-key="tableSelectionResetKey"
502
511
  row-key="predRefNo"
503
512
  border
504
513
  stripe
@@ -763,6 +763,8 @@ export const useForecastInfoStore = defineStore('forecastInfo', () => {
763
763
  forecastInfo: [],
764
764
  flowInfo: [],
765
765
  })
766
+ /** 业务操作完成后的表格选择重置标识,递增时通知两张表清空内部保留的勾选。 */
767
+ const tableSelectionResetKey = ref(0)
766
768
  /** 预报信息表格已选行,用于匡算等批量操作。 */
767
769
  const forecastSelectedRows = computed(() => tableSelectedRows.value.forecastInfo)
768
770
  /** 流水信息表格已选行,用于匡算等跨表统计。 */
@@ -820,6 +822,12 @@ export const useForecastInfoStore = defineStore('forecastInfo', () => {
820
822
  tableSelectedRows.value.flowInfo = []
821
823
  }
822
824
 
825
+ /** 同时清空 Pinia 选择数据,并通知表格清除 reserve-selection 保存的勾选。 */
826
+ function resetAllTableSelections() {
827
+ clearAllTableSelectedRows()
828
+ tableSelectionResetKey.value += 1
829
+ }
830
+
823
831
  /** 判断指定业务表格是否存在已选数据。 */
824
832
  function hasTableSelectedRows(key: ForecastInfoSelectionKey) {
825
833
  return tableSelectedRows.value[key].length > 0
@@ -957,13 +965,23 @@ export const useForecastInfoStore = defineStore('forecastInfo', () => {
957
965
  return result
958
966
  }
959
967
 
968
+ /** 核销或撤销核销完成后,携带两张表上次的查询条件并发刷新表格。 */
969
+ async function refreshVerificationLists() {
970
+ await Promise.all([
971
+ loadForecastInfoList(forecastQueryParams.value),
972
+ loadFlowInfoList(flowQueryParams.value),
973
+ ])
974
+ resetAllTableSelections()
975
+ }
976
+
960
977
  /** 预报信息核销按钮的统一业务入口。 */
961
- function handleForecastVerify() {
978
+ async function handleForecastVerify() {
962
979
  const params = buildVerificationRequestParams()
963
980
  console.log('核销入参', params)
964
981
 
965
982
  const result = verifySelectedForecastRows()
966
983
  if (result.success) {
984
+ await refreshVerificationLists()
967
985
  ElMessage.info(result.message)
968
986
  return result
969
987
  }
@@ -973,12 +991,13 @@ export const useForecastInfoStore = defineStore('forecastInfo', () => {
973
991
  }
974
992
 
975
993
  /** 预报信息撤销核销按钮的统一业务入口。 */
976
- function handleForecastCancelVerify() {
994
+ async function handleForecastCancelVerify() {
977
995
  const params = buildVerificationRequestParams()
978
996
  console.log('撤销核销入参', params)
979
997
 
980
998
  const result = cancelVerifySelectedForecastRows()
981
999
  if (result.success) {
1000
+ await refreshVerificationLists()
982
1001
  ElMessage.info(result.message)
983
1002
  return result
984
1003
  }
@@ -1058,6 +1077,7 @@ export const useForecastInfoStore = defineStore('forecastInfo', () => {
1058
1077
  flowLoading,
1059
1078
  flowQueryParams,
1060
1079
  tableSelectedRows,
1080
+ tableSelectionResetKey,
1061
1081
  forecastSelectedRows,
1062
1082
  flowSelectedRows,
1063
1083
  forecastHasSelectedRows,
@@ -1069,6 +1089,7 @@ export const useForecastInfoStore = defineStore('forecastInfo', () => {
1069
1089
  setTableSelectedRows,
1070
1090
  clearTableSelectedRows,
1071
1091
  clearAllTableSelectedRows,
1092
+ resetAllTableSelections,
1072
1093
  hasTableSelectedRows,
1073
1094
  // ----预报信息-----
1074
1095
  handleForecastSelectionChange,
@@ -8,6 +8,7 @@ import {
8
8
  Compass,
9
9
  Connection,
10
10
  DataLine,
11
+ Files,
11
12
  HomeFilled,
12
13
  Lock,
13
14
  School,
@@ -215,6 +216,7 @@ const balanceCards = shallowRef<BalanceCard[]>([
215
216
 
216
217
  const menuItems: HomeMenuItem[] = [
217
218
  { label: '总览', route: '/', icon: HomeFilled, active: true },
219
+ { label: '组件', route: '/components', icon: Files },
218
220
  // { label: '驾驶舱', route: '/fund-cockpit', icon: TrendCharts },
219
221
  // { label: '头寸', route: '/position-forecast', icon: DataLine },
220
222
  { label: '公告', route: '/notice-list', icon: Bell },