verce-vue-test 0.0.167 → 0.0.168

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.
@@ -26,9 +26,11 @@
26
26
 
27
27
  ## 外币核销对应交易状态
28
28
 
29
- 只提供 `body.predRefNo` 时,业务响应包含 `predResultInfos` 和 `predTotalCount`。只提供 `body.tranRefNo` 时,业务响应包含 `tranResultInfos` 和 `tranTotalCount`。同时提供两个编号时,按有效核销分配查询交集并返回两组字段。金额和状态来自当前数据库记录。
29
+ 从预报进入时传 `body: { predRefNo: "预报流水号", tranRefNo: "" }`;从流水进入时传 `body: { predRefNo: "", tranRefNo: "报文流水号" }`。两种请求都会返回给定编号的记录,以及通过有效核销分配关联的另一类记录。没有关联时,对侧返回空列表和总数 `"0"`。金额和状态来自当前数据库记录。
30
30
 
31
- 列表按 `head.pageIndex` 和 `head.pageSize` 分页,总数为分页前的记录数,以字符串返回。成功和失败响应的顶层字段均为 `head` 和 `body`。失败时 `body` 为空对象,错误信息通过 `head.retCode` 和 `head.retMsg` 返回。
31
+ 预报结果使用 `predResultInfos` 和 `predTotalCount`,流水结果使用 `tranResultInfos` 和 `tranTotalCount`。两组列表分别按同一请求的 `head.pageIndex` 和 `head.pageSize` 分页,各自返回分页前的总数(字符串)。旧调用省略另一编号字段时仍只返回给定编号对应的一组;两个编号都非空时,按有效核销分配查询指定的记录对。
32
+
33
+ 成功和失败响应的顶层字段均为 `head` 和 `body`。失败时 `body` 为空对象,错误信息通过 `head.retCode` 和 `head.retMsg` 返回。
32
34
 
33
35
  ## 外币资金调拨生成指令
34
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verce-vue-test",
3
- "version": "0.0.167",
3
+ "version": "0.0.168",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -0,0 +1,3 @@
1
+ allowBuilds:
2
+ '@parcel/watcher': set this to true or false
3
+ vue-demi: set this to true or false
@@ -3,20 +3,9 @@
3
3
  * ElTablePro 组件
4
4
  * 基于 Element Plus 的增强表格组件,支持列配置、本地存储和分页功能
5
5
  */
6
- import {
7
- computed,
8
- getCurrentInstance,
9
- nextTick,
10
- onBeforeUnmount,
11
- ref,
12
- useAttrs,
13
- useSlots,
14
- watch,
15
- cloneVNode,
16
- Fragment,
17
- type VNode
18
- } from "vue"
6
+ import { computed, getCurrentInstance, nextTick, onBeforeUnmount, ref, useAttrs, useSlots, watch, cloneVNode, Fragment, type VNode } from "vue"
19
7
  import { Refresh } from "@element-plus/icons-vue"
8
+ import type { TableInstance } from "element-plus"
20
9
  import { useRoute } from "vue-router"
21
10
 
22
11
  // 组件配置选项
@@ -32,8 +21,8 @@ const props = withDefaults(
32
21
  defineProps<{
33
22
  // 表格数据源
34
23
  data: any[]
35
- // 行唯一标识字段或复合键生成函数,与 Element Plus 的 row-key 保持一致
36
- rowKey?: string | ((row: any) => string)
24
+ // 行唯一标识字段
25
+ rowKey?: string
37
26
  // 多表格区分 key(用于本地存储)
38
27
  tableKey?: string
39
28
  // 完全自定义缓存 key,优先级最高
@@ -95,9 +84,7 @@ const attrs = useAttrs()
95
84
  const slots = useSlots()
96
85
 
97
86
  /** 表格使用 small 尺寸时,内部按钮和分页同步保持紧凑。 */
98
- const resolveControlSize = () => (
99
- attrs.size === "small" ? "small" : props.colBtnSize
100
- )
87
+ const resolveControlSize = () => (attrs.size === "small" ? "small" : props.colBtnSize)
101
88
 
102
89
  // Vue 3.4 尚未提供 useId,使用组件实例 uid 生成页面内唯一的无障碍关联 ID。
103
90
  const componentUid = getCurrentInstance()?.uid ?? 0
@@ -109,9 +96,9 @@ let paginationPopperOriginalParent: HTMLElement | null = null
109
96
  /**
110
97
  * 响应式状态
111
98
  */
112
- // 列配置弹窗可见性
99
+ // 列配置弹窗可见性
113
100
  const dialogVisible = ref(false)
114
- const tableRef = ref<{ clearSelection: () => void } | null>(null)
101
+ const tableRef = ref<Pick<TableInstance, "clearSelection" | "toggleRowSelection"> | null>(null)
115
102
 
116
103
  // 列选项类型定义
117
104
  type ColumnOption = {
@@ -158,14 +145,14 @@ watch(
158
145
  const syncPaginationPopperTarget = async () => {
159
146
  await nextTick()
160
147
  if (typeof document === "undefined") return
161
-
148
+
162
149
  const popper = document.querySelector<HTMLElement>(`.${paginationPopperClass}`)
163
150
  if (!popper) return
164
-
151
+
165
152
  if (!paginationPopperOriginalParent) {
166
153
  paginationPopperOriginalParent = popper.parentElement
167
154
  }
168
-
155
+
169
156
  if (props.paginationAppendTo) {
170
157
  const target = document.querySelector<HTMLElement>(props.paginationAppendTo)
171
158
  if (target && popper.parentElement !== target) {
@@ -173,11 +160,8 @@ const syncPaginationPopperTarget = async () => {
173
160
  }
174
161
  return
175
162
  }
176
-
177
- if (
178
- paginationPopperOriginalParent?.isConnected
179
- && popper.parentElement !== paginationPopperOriginalParent
180
- ) {
163
+
164
+ if (paginationPopperOriginalParent?.isConnected && popper.parentElement !== paginationPopperOriginalParent) {
181
165
  paginationPopperOriginalParent.appendChild(popper)
182
166
  }
183
167
  }
@@ -192,11 +176,7 @@ watch(
192
176
 
193
177
  onBeforeUnmount(() => {
194
178
  const popper = document.querySelector<HTMLElement>(`.${paginationPopperClass}`)
195
- if (
196
- popper
197
- && paginationPopperOriginalParent?.isConnected
198
- && popper.parentElement !== paginationPopperOriginalParent
199
- ) {
179
+ if (popper && paginationPopperOriginalParent?.isConnected && popper.parentElement !== paginationPopperOriginalParent) {
200
180
  paginationPopperOriginalParent.appendChild(popper)
201
181
  }
202
182
  })
@@ -204,20 +184,20 @@ onBeforeUnmount(() => {
204
184
  /**
205
185
  * 计算属性
206
186
  */
207
-
208
- // 本地存储的 key(根据路由路径和表格 key 生成)
187
+
188
+ // 本地存储的 key(根据路由路径和表格 key 生成)
209
189
  const storageKey = computed(() => {
210
- // 优先使用自定义的存储 key
211
- if (props.columnStorageKey) {
212
- return props.columnStorageKey
213
- }
214
- // 如果指定了表格 key,添加到存储 key 中
215
- if (props.tableKey) {
216
- return `el-table-plus:${route.path}:${props.tableKey}`
217
- }
218
- // 默认使用路由路径作为存储 key
219
- return `el-table-plus:${route.path}`
220
- })
190
+ // 优先使用自定义的存储 key
191
+ if (props.columnStorageKey) {
192
+ return props.columnStorageKey
193
+ }
194
+ // 如果指定了表格 key,添加到存储 key 中
195
+ if (props.tableKey) {
196
+ return `el-table-plus:${route.path}:${props.tableKey}`
197
+ }
198
+ // 默认使用路由路径作为存储 key
199
+ return `el-table-plus:${route.path}`
200
+ })
221
201
 
222
202
  // 当前页码(双向绑定)
223
203
  const currentPage = computed({
@@ -267,9 +247,7 @@ const isAllSelected = computed({
267
247
  }
268
248
  })
269
249
 
270
- const pendingVisibleColumnCount = computed(
271
- () => pendingColumnOptions.value.filter((column) => column.visible).length
272
- )
250
+ const pendingVisibleColumnCount = computed(() => pendingColumnOptions.value.filter((column) => column.visible).length)
273
251
 
274
252
  /**
275
253
  * 方法定义
@@ -284,13 +262,7 @@ const pendingVisibleColumnCount = computed(
284
262
  const getColumnKey = (vnode: VNode, index: number) => {
285
263
  const columnProps = vnode.props as Record<string, any> | null
286
264
 
287
- return (
288
- columnProps?.columnKey ||
289
- columnProps?.prop ||
290
- columnProps?.label ||
291
- columnProps?.type ||
292
- `column_${index}`
293
- )
265
+ return columnProps?.columnKey || columnProps?.prop || columnProps?.label || columnProps?.type || `column_${index}`
294
266
  }
295
267
 
296
268
  /**
@@ -302,12 +274,7 @@ const getColumnKey = (vnode: VNode, index: number) => {
302
274
  const getColumnLabel = (vnode: VNode, index: number) => {
303
275
  const columnProps = vnode.props as Record<string, any> | null
304
276
 
305
- return (
306
- columnProps?.label ||
307
- columnProps?.prop ||
308
- columnProps?.type ||
309
- `列 ${index + 1}`
310
- )
277
+ return columnProps?.label || columnProps?.prop || columnProps?.type || `列 ${index + 1}`
311
278
  }
312
279
 
313
280
  /**
@@ -330,10 +297,10 @@ const restoreColumnConfig = () => {
330
297
  if (!Array.isArray(cacheColumns)) {
331
298
  throw new Error("Invalid column cache")
332
299
  }
333
-
300
+
334
301
  const cacheByKey = new Map(cacheColumns.map((column) => [column.key, column]))
335
302
  const cacheOrder = new Map(cacheColumns.map((column, index) => [column.key, index]))
336
-
303
+
337
304
  // 先恢复显隐状态;禁用显隐的列始终使用组件声明配置
338
305
  columnOptions.value.forEach((column) => {
339
306
  if (column.disabled) return
@@ -342,7 +309,7 @@ const restoreColumnConfig = () => {
342
309
  column.visible = match.visible
343
310
  }
344
311
  })
345
-
312
+
346
313
  // 固定列作为分隔点,只恢复各可移动区间内的顺序
347
314
  const restoredColumns: ColumnOption[] = []
348
315
  let movableColumns: ColumnOption[] = []
@@ -355,10 +322,10 @@ const restoreColumnConfig = () => {
355
322
  if (rightOrder === undefined) return -1
356
323
  return leftOrder - rightOrder
357
324
  })
358
- restoredColumns.push(...movableColumns)
359
- movableColumns = []
360
- }
361
-
325
+ restoredColumns.push(...movableColumns)
326
+ movableColumns = []
327
+ }
328
+
362
329
  columnOptions.value.forEach((column) => {
363
330
  if (column.orderLocked) {
364
331
  flushMovableColumns()
@@ -407,13 +374,13 @@ const canMovePendingColumn = (index: number, direction: -1 | 1) => {
407
374
  const movePendingColumn = (columnKey: string, direction: -1 | 1) => {
408
375
  const currentIndex = pendingColumnOptions.value.findIndex((column) => column.key === columnKey)
409
376
  if (!canMovePendingColumn(currentIndex, direction)) return
410
-
377
+
411
378
  const targetIndex = currentIndex + direction
412
379
  const nextColumns = [...pendingColumnOptions.value]
413
380
  const currentColumn = nextColumns[currentIndex]
414
381
  const targetColumn = nextColumns[targetIndex]
415
382
  if (!currentColumn || !targetColumn) return
416
-
383
+
417
384
  nextColumns[currentIndex] = targetColumn
418
385
  nextColumns[targetIndex] = currentColumn
419
386
  pendingColumnOptions.value = nextColumns
@@ -427,9 +394,7 @@ const canDropColumn = (sourceIndex: number, targetIndex: number) => {
427
394
  if (sourceIndex < 0 || targetIndex < 0 || sourceIndex === targetIndex) return false
428
395
  const startIndex = Math.min(sourceIndex, targetIndex)
429
396
  const endIndex = Math.max(sourceIndex, targetIndex)
430
- return !pendingColumnOptions.value
431
- .slice(startIndex, endIndex + 1)
432
- .some((column) => column.orderLocked)
397
+ return !pendingColumnOptions.value.slice(startIndex, endIndex + 1).some((column) => column.orderLocked)
433
398
  }
434
399
 
435
400
  const resetColumnDragState = () => {
@@ -443,14 +408,12 @@ const handleColumnDragStart = (event: DragEvent, column: ColumnOption) => {
443
408
  event.preventDefault()
444
409
  return
445
410
  }
446
-
411
+
447
412
  draggedColumnKey.value = column.key
448
413
  if (event.dataTransfer) {
449
414
  event.dataTransfer.effectAllowed = "move"
450
415
  event.dataTransfer.setData("text/plain", column.key)
451
- const dragItem = (event.currentTarget as HTMLElement | null)?.closest<HTMLElement>(
452
- ".el-table-plus__column-grid-item"
453
- )
416
+ const dragItem = (event.currentTarget as HTMLElement | null)?.closest<HTMLElement>(".el-table-plus__column-grid-item")
454
417
  if (dragItem) {
455
418
  event.dataTransfer.setDragImage(dragItem, 24, 24)
456
419
  }
@@ -458,23 +421,19 @@ const handleColumnDragStart = (event: DragEvent, column: ColumnOption) => {
458
421
  }
459
422
 
460
423
  const handleColumnDragOver = (event: DragEvent, targetColumn: ColumnOption) => {
461
- const sourceIndex = pendingColumnOptions.value.findIndex(
462
- (column) => column.key === draggedColumnKey.value
463
- )
464
- const targetIndex = pendingColumnOptions.value.findIndex(
465
- (column) => column.key === targetColumn.key
466
- )
424
+ const sourceIndex = pendingColumnOptions.value.findIndex((column) => column.key === draggedColumnKey.value)
425
+ const targetIndex = pendingColumnOptions.value.findIndex((column) => column.key === targetColumn.key)
467
426
  if (!canDropColumn(sourceIndex, targetIndex)) {
468
427
  dragOverColumnKey.value = null
469
428
  dropPlacement.value = null
470
429
  return
471
430
  }
472
-
431
+
473
432
  event.preventDefault()
474
433
  if (event.dataTransfer) {
475
434
  event.dataTransfer.dropEffect = "move"
476
435
  }
477
-
436
+
478
437
  const targetElement = event.currentTarget as HTMLElement
479
438
  const targetRect = targetElement.getBoundingClientRect()
480
439
  dragOverColumnKey.value = targetColumn.key
@@ -483,17 +442,13 @@ const handleColumnDragOver = (event: DragEvent, targetColumn: ColumnOption) => {
483
442
 
484
443
  const handleColumnDrop = (event: DragEvent, targetColumn: ColumnOption) => {
485
444
  event.preventDefault()
486
- const sourceIndex = pendingColumnOptions.value.findIndex(
487
- (column) => column.key === draggedColumnKey.value
488
- )
489
- const targetIndex = pendingColumnOptions.value.findIndex(
490
- (column) => column.key === targetColumn.key
491
- )
445
+ const sourceIndex = pendingColumnOptions.value.findIndex((column) => column.key === draggedColumnKey.value)
446
+ const targetIndex = pendingColumnOptions.value.findIndex((column) => column.key === targetColumn.key)
492
447
  if (!canDropColumn(sourceIndex, targetIndex)) {
493
448
  resetColumnDragState()
494
449
  return
495
450
  }
496
-
451
+
497
452
  let insertIndex = targetIndex + (dropPlacement.value === "after" ? 1 : 0)
498
453
  if (sourceIndex < insertIndex) {
499
454
  insertIndex -= 1
@@ -502,14 +457,14 @@ const handleColumnDrop = (event: DragEvent, targetColumn: ColumnOption) => {
502
457
  resetColumnDragState()
503
458
  return
504
459
  }
505
-
460
+
506
461
  const nextColumns = [...pendingColumnOptions.value]
507
462
  const [movedColumn] = nextColumns.splice(sourceIndex, 1)
508
463
  if (!movedColumn) {
509
464
  resetColumnDragState()
510
465
  return
511
466
  }
512
-
467
+
513
468
  nextColumns.splice(insertIndex, 0, movedColumn)
514
469
  pendingColumnOptions.value = nextColumns
515
470
  columnOrderAnnouncement.value = `${movedColumn.label}已移动到第 ${insertIndex + 1} 位`
@@ -548,7 +503,11 @@ const closeTransientOverlays = () => {
548
503
  cancelColumnConfig()
549
504
  }
550
505
 
551
- defineExpose({ closeTransientOverlays })
506
+ const toggleRowSelection = (row: unknown, selected: boolean) => {
507
+ tableRef.value?.toggleRowSelection(row, selected)
508
+ }
509
+
510
+ defineExpose({ closeTransientOverlays, toggleRowSelection })
552
511
 
553
512
  /**
554
513
  * 初始化列配置
@@ -579,11 +538,7 @@ const initColumns = () => {
579
538
  label: getColumnLabel(vnode, index),
580
539
  visible: columnProps?.visible ?? true,
581
540
  disabled,
582
- orderLocked: Boolean(
583
- disabled ||
584
- fixed ||
585
- lockedColumnTypes.has(columnProps?.type)
586
- ),
541
+ orderLocked: Boolean(disabled || fixed || lockedColumnTypes.has(columnProps?.type)),
587
542
  vnode
588
543
  }
589
544
  })
@@ -615,24 +570,14 @@ initColumns()
615
570
  <template>
616
571
  <div class="el-table-plus">
617
572
  <!-- 工具栏 -->
618
- <div
619
- v-if="columnConfig"
620
- class="el-table-plus__toolbar"
621
- :style="`justify-content:${barJustifyContent}`"
622
- >
573
+ <div v-if="columnConfig" class="el-table-plus__toolbar" :style="`justify-content:${barJustifyContent}`">
623
574
  <div class="el-table-plus__toolbar-left">
624
575
  <slot name="toolbar" />
625
576
  </div>
626
577
 
627
578
  <div class="el-table-plus__toolbar-right">
628
579
  <slot name="toolbar-right" />
629
- <el-button
630
- @click="openColumnConfigDialog"
631
- icon="Setting"
632
- :size="resolveControlSize()"
633
- >
634
- 列配置
635
- </el-button>
580
+ <el-button @click="openColumnConfigDialog" icon="Setting" :size="resolveControlSize()"> 列配置 </el-button>
636
581
  </div>
637
582
  </div>
638
583
 
@@ -646,11 +591,7 @@ initColumns()
646
591
  :data="data"
647
592
  :row-key="rowKey"
648
593
  >
649
- <component
650
- :is="column.vnode"
651
- v-for="column in visibleColumns"
652
- :key="column.key"
653
- />
594
+ <component :is="column.vnode" v-for="column in visibleColumns" :key="column.key" />
654
595
  <template v-if="slots.empty" #empty>
655
596
  <slot name="empty" />
656
597
  </template>
@@ -699,15 +640,9 @@ initColumns()
699
640
  </template>
700
641
  <div>
701
642
  <p style="font-weight: bold; margin-bottom: 5px">提示</p>
702
- <p style="margin: 5px 0; line-height: 1.4">
703
- 1.列的显示状态和排列顺序只对当前浏览器生效(和登录账户无关)。
704
- </p>
705
- <p style="margin: 5px 0; line-height: 1.4">
706
- 2.清除浏览器缓存后,列配置会恢复到默认。
707
- </p>
708
- <p style="margin: 5px 0; line-height: 1.4">
709
- 3.切换账号,不会重置列配置
710
- </p>
643
+ <p style="margin: 5px 0; line-height: 1.4">1.列的显示状态和排列顺序只对当前浏览器生效(和登录账户无关)。</p>
644
+ <p style="margin: 5px 0; line-height: 1.4">2.清除浏览器缓存后,列配置会恢复到默认。</p>
645
+ <p style="margin: 5px 0; line-height: 1.4">3.切换账号,不会重置列配置</p>
711
646
  </div>
712
647
  </el-popover>
713
648
  </p>
@@ -717,9 +652,7 @@ initColumns()
717
652
  <!-- 全选行 -->
718
653
  <div class="el-table-plus__column-select-all">
719
654
  <el-checkbox v-model="isAllSelected"> 全选 </el-checkbox>
720
- <span class="el-table-plus__column-count">
721
- 已显示 {{ pendingVisibleColumnCount }}/{{ pendingColumnOptions.length }} 列
722
- </span>
655
+ <span class="el-table-plus__column-count"> 已显示 {{ pendingVisibleColumnCount }}/{{ pendingColumnOptions.length }} 列 </span>
723
656
  </div>
724
657
 
725
658
  <!-- 分隔线 -->
@@ -732,47 +665,41 @@ initColumns()
732
665
  :key="column.key"
733
666
  class="el-table-plus__column-grid-item"
734
667
  :class="{
735
- 'is-dragging': draggedColumnKey === column.key,
736
- 'is-drop-before': dragOverColumnKey === column.key && dropPlacement === 'before',
737
- 'is-drop-after': dragOverColumnKey === column.key && dropPlacement === 'after',
738
- 'is-order-locked': column.orderLocked
739
- }"
668
+ 'is-dragging': draggedColumnKey === column.key,
669
+ 'is-drop-before': dragOverColumnKey === column.key && dropPlacement === 'before',
670
+ 'is-drop-after': dragOverColumnKey === column.key && dropPlacement === 'after',
671
+ 'is-order-locked': column.orderLocked
672
+ }"
740
673
  @dragover="handleColumnDragOver($event, column)"
741
674
  @drop="handleColumnDrop($event, column)"
742
675
  >
743
- <span
744
- class="el-table-plus__drag-handle"
745
- :class="{ 'is-disabled': column.orderLocked }"
746
- :draggable="!column.orderLocked"
747
- :role="column.orderLocked ? undefined : 'spinbutton'"
748
- :tabindex="column.orderLocked ? -1 : 0"
749
- :aria-label="column.orderLocked ? undefined : `调整${column.label}的顺序`"
750
- :aria-describedby="column.orderLocked ? undefined : columnOrderTipId"
751
- :aria-valuemin="column.orderLocked ? undefined : 1"
752
- :aria-valuemax="column.orderLocked ? undefined : pendingColumnOptions.length"
753
- :aria-valuenow="column.orderLocked ? undefined : index + 1"
754
- :aria-valuetext="column.orderLocked ? undefined : `第 ${index + 1} 位`"
755
- :title="column.orderLocked ? '该列顺序已固定' : '拖动或使用上下方向键调整顺序'"
756
- @dragstart="handleColumnDragStart($event, column)"
757
- @dragend="resetColumnDragState"
758
- @keydown.up.prevent="movePendingColumn(column.key, -1)"
759
- @keydown.down.prevent="movePendingColumn(column.key, 1)"
760
- >
761
- <span class="el-table-plus__drag-dots" aria-hidden="true"></span>
762
- </span>
676
+ <span
677
+ class="el-table-plus__drag-handle"
678
+ :class="{ 'is-disabled': column.orderLocked }"
679
+ :draggable="!column.orderLocked"
680
+ :role="column.orderLocked ? undefined : 'spinbutton'"
681
+ :tabindex="column.orderLocked ? -1 : 0"
682
+ :aria-label="column.orderLocked ? undefined : `调整${column.label}的顺序`"
683
+ :aria-describedby="column.orderLocked ? undefined : columnOrderTipId"
684
+ :aria-valuemin="column.orderLocked ? undefined : 1"
685
+ :aria-valuemax="column.orderLocked ? undefined : pendingColumnOptions.length"
686
+ :aria-valuenow="column.orderLocked ? undefined : index + 1"
687
+ :aria-valuetext="column.orderLocked ? undefined : `第 ${index + 1} 位`"
688
+ :title="column.orderLocked ? '该列顺序已固定' : '拖动或使用上下方向键调整顺序'"
689
+ @dragstart="handleColumnDragStart($event, column)"
690
+ @dragend="resetColumnDragState"
691
+ @keydown.up.prevent="movePendingColumn(column.key, -1)"
692
+ @keydown.down.prevent="movePendingColumn(column.key, 1)"
693
+ >
694
+ <span class="el-table-plus__drag-dots" aria-hidden="true"></span>
695
+ </span>
763
696
  <span class="el-table-plus__column-order" aria-hidden="true">
764
- {{ String(index + 1).padStart(2, "0") }}
765
- </span>
766
- <el-checkbox
767
- v-model="column.visible"
768
- class="el-table-plus__column-checkbox"
769
- :disabled="column.disabled"
770
- >
697
+ {{ String(index + 1).padStart(2, "0") }}
698
+ </span>
699
+ <el-checkbox v-model="column.visible" class="el-table-plus__column-checkbox" :disabled="column.disabled">
771
700
  {{ column.label }}
772
701
  </el-checkbox>
773
- <span v-if="column.orderLocked" class="el-table-plus__column-lock">
774
- 固定顺序
775
- </span>
702
+ <span v-if="column.orderLocked" class="el-table-plus__column-lock"> 固定顺序 </span>
776
703
  <div v-else class="el-table-plus__column-move-actions">
777
704
  <button
778
705
  type="button"
@@ -807,9 +734,7 @@ initColumns()
807
734
  <div class="el-table-plus__dialog-footer">
808
735
  <el-button @click="cancelColumnConfig"> 取消 </el-button>
809
736
 
810
- <el-button type="primary" @click="confirmColumnConfig">
811
- 确认
812
- </el-button>
737
+ <el-button type="primary" @click="confirmColumnConfig"> 确认 </el-button>
813
738
  </div>
814
739
  </template>
815
740
  </el-dialog>
@@ -817,28 +742,24 @@ initColumns()
817
742
  </template>
818
743
 
819
744
  <style scoped lang="scss">
820
- $small-horizontal-scrollbar-height: 10px;
821
-
822
745
  /**
823
- * 主容器样式
824
- */
746
+ * 主容器样式
747
+ */
825
748
  .el-table-plus {
826
749
  width: 100%;
827
750
  }
828
751
 
829
752
  /**
830
- * 小尺寸表格样式:统一文字尺寸、压缩单元格上下留白,并为底部横向滚动条预留空间。
831
- */
753
+ * 小尺寸表格样式:压缩单元格上下留白,并加粗底部横向滚动条的可操作区域。
754
+ */
832
755
  .el-table-plus :deep(.el-table--small) {
833
756
  --el-table-text-color: #000;
834
757
  --el-table-header-text-color: #000;
835
- font-size: 15px;
836
758
  color: #000;
837
759
  }
838
760
 
839
761
  .el-table-plus :deep(.el-table--small .el-table__cell) {
840
762
  padding: 0 !important;
841
- font-size: 15px !important;
842
763
  }
843
764
 
844
765
  .el-table-plus :deep(.el-table--small .cell) {
@@ -854,24 +775,19 @@ $small-horizontal-scrollbar-height: 10px;
854
775
  height: 20px;
855
776
  }
856
777
 
857
- .el-table-plus :deep(.el-table--small.el-table--scrollable-x .el-table__body-wrapper .el-scrollbar) {
858
- box-sizing: border-box;
859
- padding-bottom: $small-horizontal-scrollbar-height;
860
- }
861
-
862
- .el-table-plus :deep(.el-table--small.el-table--scrollable-x .el-table__body-wrapper .el-scrollbar__bar.is-horizontal) {
863
- height: $small-horizontal-scrollbar-height;
778
+ .el-table-plus :deep(.el-table--small .el-table__body-wrapper .el-scrollbar__bar.is-horizontal) {
779
+ height: 20px;
864
780
  bottom: 0;
865
781
  }
866
782
 
867
783
  /**
868
- * 工具栏样式
869
- */
784
+ * 工具栏样式
785
+ */
870
786
  .el-table-plus__toolbar {
871
787
  display: flex;
872
788
  align-items: center;
873
789
  justify-content: space-between;
874
- margin-bottom: 5px;
790
+ margin-bottom: 12px;
875
791
  }
876
792
  .el-table-plus__toolbar-left {
877
793
  width: 100%;
@@ -885,8 +801,8 @@ $small-horizontal-scrollbar-height: 10px;
885
801
  }
886
802
 
887
803
  /**
888
- * 分页组件样式
889
- */
804
+ * 分页组件样式
805
+ */
890
806
  .el-table-plus__pagination {
891
807
  display: flex;
892
808
  align-items: center;
@@ -900,8 +816,8 @@ $small-horizontal-scrollbar-height: 10px;
900
816
  }
901
817
 
902
818
  /**
903
- * 弹窗提示文字样式
904
- */
819
+ * 弹窗提示文字样式
820
+ */
905
821
  .el-table-plus__dialog-tip {
906
822
  font-size: 14px;
907
823
  color: #909399;
@@ -918,8 +834,8 @@ $small-horizontal-scrollbar-height: 10px;
918
834
  }
919
835
 
920
836
  /**
921
- * 列配置容器样式
922
- */
837
+ * 列配置容器样式
838
+ */
923
839
  .el-table-plus__column-config {
924
840
  border: 1px solid #e4e7ed;
925
841
  border-radius: 10px;
@@ -928,8 +844,8 @@ $small-horizontal-scrollbar-height: 10px;
928
844
  }
929
845
 
930
846
  /**
931
- * 全选行样式
932
- */
847
+ * 全选行样式
848
+ */
933
849
  .el-table-plus__column-select-all {
934
850
  display: flex;
935
851
  align-items: center;
@@ -945,8 +861,8 @@ $small-horizontal-scrollbar-height: 10px;
945
861
  }
946
862
 
947
863
  /**
948
- * 分隔线样式
949
- */
864
+ * 分隔线样式
865
+ */
950
866
  .el-table-plus__column-divider {
951
867
  height: 1px;
952
868
  background-color: #e4e7ed;
@@ -954,8 +870,8 @@ $small-horizontal-scrollbar-height: 10px;
954
870
  }
955
871
 
956
872
  /**
957
- * 列选项网格布局样式
958
- */
873
+ * 列选项网格布局样式
874
+ */
959
875
  .el-table-plus__column-grid {
960
876
  display: flex;
961
877
  flex-direction: column;
@@ -968,8 +884,8 @@ $small-horizontal-scrollbar-height: 10px;
968
884
  }
969
885
 
970
886
  /**
971
- * 网格项样式
972
- */
887
+ * 网格项样式
888
+ */
973
889
  .el-table-plus__column-grid-item {
974
890
  position: relative;
975
891
  display: grid;
@@ -982,10 +898,10 @@ $small-horizontal-scrollbar-height: 10px;
982
898
  border-radius: 8px;
983
899
  background: #ffffff;
984
900
  transition:
985
- border-color 160ms ease,
986
- box-shadow 160ms ease,
987
- background-color 160ms ease,
988
- opacity 160ms ease;
901
+ border-color 160ms ease,
902
+ box-shadow 160ms ease,
903
+ background-color 160ms ease,
904
+ opacity 160ms ease;
989
905
  }
990
906
 
991
907
  .el-table-plus__column-grid-item:hover {
@@ -1112,9 +1028,9 @@ $small-horizontal-scrollbar-height: 10px;
1112
1028
  font: inherit;
1113
1029
  cursor: pointer;
1114
1030
  transition:
1115
- color 150ms ease,
1116
- border-color 150ms ease,
1117
- background-color 150ms ease;
1031
+ color 150ms ease,
1032
+ border-color 150ms ease,
1033
+ background-color 150ms ease;
1118
1034
  }
1119
1035
 
1120
1036
  .el-table-plus__move-button:hover:not(:disabled) {
@@ -1150,19 +1066,19 @@ $small-horizontal-scrollbar-height: 10px;
1150
1066
  .el-table-plus__column-grid-item {
1151
1067
  grid-template-columns: 24px minmax(0, 1fr) auto;
1152
1068
  }
1153
-
1069
+
1154
1070
  .el-table-plus__column-order {
1155
1071
  display: none;
1156
1072
  }
1157
-
1073
+
1158
1074
  .el-table-plus__column-lock {
1159
1075
  padding-inline: 6px;
1160
1076
  }
1161
1077
  }
1162
1078
 
1163
1079
  /**
1164
- * 弹窗底部按钮容器样式
1165
- */
1080
+ * 弹窗底部按钮容器样式
1081
+ */
1166
1082
  .el-table-plus__dialog-footer {
1167
1083
  display: flex;
1168
1084
  justify-content: flex-end;
@@ -1170,8 +1086,8 @@ $small-horizontal-scrollbar-height: 10px;
1170
1086
  }
1171
1087
 
1172
1088
  /**
1173
- * 弹窗底部取消按钮样式
1174
- */
1089
+ * 弹窗底部取消按钮样式
1090
+ */
1175
1091
  .el-table-plus__dialog-footer .el-button:first-child {
1176
1092
  background-color: #f5f7fa;
1177
1093
  color: #606266;
@@ -1184,8 +1100,8 @@ $small-horizontal-scrollbar-height: 10px;
1184
1100
  }
1185
1101
 
1186
1102
  /**
1187
- * 弹窗底部确认按钮样式
1188
- */
1103
+ * 弹窗底部确认按钮样式
1104
+ */
1189
1105
  .el-table-plus__dialog-footer .el-button--primary {
1190
1106
  background-color: #1890ff;
1191
1107
  border-color: #1890ff;
@@ -1196,4 +1112,4 @@ $small-horizontal-scrollbar-height: 10px;
1196
1112
  background-color: #40a9ff;
1197
1113
  border-color: #40a9ff;
1198
1114
  }
1199
- </style>
1115
+ </style>
@@ -18,6 +18,7 @@ import {
18
18
  foreignExchangeTypeOptions,
19
19
  payDirectionOptions,
20
20
  paymentRouteOptions,
21
+ valueDateShortcuts,
21
22
  } from '../options'
22
23
 
23
24
  const defaultLegacyFieldPolicy: any = {
@@ -621,6 +622,8 @@ onBeforeUnmount(() => {
621
622
  type="date"
622
623
  value-format="YYYYMMDD"
623
624
  format="YYYY-MM-DD"
625
+ :shortcuts="valueDateShortcuts"
626
+ popper-class="foreign-position-date-popper"
624
627
  :editable="false"
625
628
  :disabled-date="disablePastDate"
626
629
  placeholder="请选择"
@@ -15,7 +15,8 @@ import {
15
15
  Search,
16
16
  UploadFilled,
17
17
  } from '@element-plus/icons-vue'
18
- import { formatDate } from './model'
18
+ import type ElTableProComponent from '@/components/element-rewrite/ElTablePro.vue'
19
+ import { formatDate, type ForeignPositionForecast } from './model'
19
20
  import {
20
21
  foreignPositionForecastBusinessContext,
21
22
  hasForeignPositionForecastRole,
@@ -40,6 +41,7 @@ import {
40
41
  forecastWayOptions,
41
42
  foreignExchangeTypeOptions,
42
43
  payDirectionOptions,
44
+ valueDateShortcuts,
43
45
  verifyStatusOptions,
44
46
  } from './options'
45
47
  import {
@@ -94,6 +96,8 @@ const tablePageSize = computed({
94
96
  set: (value: any) => { tableState.pageSize = value },
95
97
  })
96
98
  const tableKey = 'foreign-currency-position-forecast'
99
+ const forecastTableRef = ref<InstanceType<typeof ElTableProComponent> | null>(null)
100
+ const selectedRowKeys = computed(() => new Set(selectedRows.value.map((row) => row.predRefNo)))
97
101
 
98
102
  /** 计算当前页表格的连续序号。 */
99
103
  const getRowIndex = (index: any) => (
@@ -448,10 +452,19 @@ function handleExport() {
448
452
  }
449
453
 
450
454
  /** 同步表格的行选择结果到页面状态。 */
451
- function handleSelectionChange(rows: any[]) {
455
+ function handleSelectionChange(rows: ForeignPositionForecast[]) {
452
456
  selectedRows.value = rows
453
457
  }
454
458
 
459
+ /** 点击行时切换该行的勾选状态。 */
460
+ function handleRowClick(row: ForeignPositionForecast) {
461
+ forecastTableRef.value?.toggleRowSelection(row, !selectedRowKeys.value.has(row.predRefNo))
462
+ }
463
+
464
+ function getRowClassName({ row }: { row: ForeignPositionForecast }) {
465
+ return selectedRowKeys.value.has(row.predRefNo) ? 'forecast-row-selected' : ''
466
+ }
467
+
455
468
  /** 将表格排序变化转换为接口排序参数并重新查询。 */
456
469
  async function handleSortChange({ prop, order }: any) {
457
470
  if (
@@ -800,6 +813,8 @@ onBeforeUnmount(() => {
800
813
  type="date"
801
814
  value-format="YYYYMMDD"
802
815
  format="YYYY-MM-DD"
816
+ :shortcuts="valueDateShortcuts"
817
+ popper-class="foreign-position-date-popper"
803
818
  placeholder="请选择"
804
819
  clearable
805
820
  />
@@ -958,6 +973,7 @@ onBeforeUnmount(() => {
958
973
 
959
974
  <section class="table-panel" aria-label="外币头寸预报列表">
960
975
  <ElTablePro
976
+ ref="forecastTableRef"
961
977
  :key="tableKey"
962
978
  v-model:page="tablePage"
963
979
  v-model:page-size="tablePageSize"
@@ -969,6 +985,7 @@ onBeforeUnmount(() => {
969
985
  :default-sort="tableDefaultSort"
970
986
  :table-key="tableKey"
971
987
  row-key="predRefNo"
988
+ :row-class-name="getRowClassName"
972
989
  size="small"
973
990
  border
974
991
  stripe
@@ -978,6 +995,7 @@ onBeforeUnmount(() => {
978
995
  layout="total, sizes, prev, pager, next, jumper"
979
996
  pagination-size="small"
980
997
  @selection-change="handleSelectionChange"
998
+ @row-click="handleRowClick"
981
999
  @sort-change="handleSortChange"
982
1000
  @pagination-change="handlePaginationChange"
983
1001
  >
@@ -1138,6 +1156,17 @@ onBeforeUnmount(() => {
1138
1156
  </template>
1139
1157
 
1140
1158
  <style scoped>
1159
+ :global(.foreign-position-date-popper .el-picker-panel__sidebar) {
1160
+ right: 0;
1161
+ border-right: 0;
1162
+ border-left: 1px solid var(--el-datepicker-inner-border-color);
1163
+ }
1164
+
1165
+ :global(.foreign-position-date-popper .el-picker-panel__sidebar + .el-picker-panel__body) {
1166
+ margin-left: 0;
1167
+ margin-right: 110px;
1168
+ }
1169
+
1141
1170
  .foreign-position-page {
1142
1171
  --page-blue: #1f62d6;
1143
1172
  --page-blue-dark: #174ea6;
@@ -1424,6 +1453,11 @@ onBeforeUnmount(() => {
1424
1453
 
1425
1454
  .forecast-table :deep(.el-table__row) {
1426
1455
  height: 20px;
1456
+ cursor: pointer;
1457
+ }
1458
+
1459
+ .forecast-table :deep(.el-table__body tr.forecast-row-selected > td.el-table__cell) {
1460
+ background-color: #e0ecff;
1427
1461
  }
1428
1462
 
1429
1463
  .money-cell {
@@ -1,3 +1,7 @@
1
+ export const valueDateShortcuts = [
2
+ { text: '今天', value: () => new Date() },
3
+ ]
4
+
1
5
  export const forecastWayOptions = [
2
6
  { value: 'PW01', label: '新增预报' },
3
7
  { value: 'PW02', label: '到期预报' },
@@ -1,4 +1,20 @@
1
- import baseHttpClient from '@/utils/baseHttpClient'
1
+ import baseHttpClient, { type TamResponse } from '@/utils/baseHttpClient'
2
+
3
+ export type SettlementTransactionLookup =
4
+ | { predRefNo: string; tranRefNo: '' }
5
+ | { predRefNo: ''; tranRefNo: string }
6
+
7
+ export type SettlementTransactionStatusBody = {
8
+ predResultInfos?: Record<string, unknown>[]
9
+ predTotalCount?: string
10
+ tranResultInfos?: Record<string, unknown>[]
11
+ tranTotalCount?: string
12
+ }
13
+
14
+ type SettlementTransactionStatusParams = SettlementTransactionLookup & {
15
+ pageIndex: number
16
+ pageSize: number
17
+ }
2
18
 
3
19
  const API = {
4
20
  // 查询账户及银行信息
@@ -13,6 +29,10 @@ const API = {
13
29
  flowQueryApi: (params: any) => {
14
30
  return baseHttpClient.post('/TAM/0001/140202002', params)
15
31
  },
32
+ // 按预报号或流水号查对应交易,另一编号字段传空字符串。
33
+ transactionStatusQueryApi: (params: SettlementTransactionStatusParams) => {
34
+ return baseHttpClient.post<TamResponse<SettlementTransactionStatusBody>>('/TAM/0001/140202003', params)
35
+ },
16
36
  // 执行自动核销
17
37
  autoVerifyApi: (params: any) => {
18
38
  return baseHttpClient.post('/TAM/0001/120202001', params)
@@ -21,6 +21,7 @@ import {
21
21
  import { onBeforeRouteLeave, useRoute } from 'vue-router'
22
22
  import { ElMessage, ElMessageBox } from 'element-plus'
23
23
  import {
24
+ ArrowLeft,
24
25
  Calendar,
25
26
  CircleCheck,
26
27
  Download,
@@ -31,9 +32,10 @@ import {
31
32
  RefreshLeft,
32
33
  Search,
33
34
  } from '@element-plus/icons-vue'
35
+ import type ElTableProComponent from '@/components/element-rewrite/ElTablePro.vue'
34
36
  import { formatThousands } from '@/utils/formatters'
35
37
  import { runtimeConfig } from '@/utils/public/runtime'
36
- import API from './api'
38
+ import API, { type SettlementTransactionLookup } from './api'
37
39
 
38
40
  type CardLayout = 'vertical' | 'horizontal'
39
41
 
@@ -108,9 +110,9 @@ const baseForecastColumns = [
108
110
  { prop: 'tranDate', label: '起息日期', minWidth: 108, format: 'date', defaultVisible: true },
109
111
  { prop: 'payDirec', label: '收支方向', minWidth: 94, format: 'direction', defaultVisible: true },
110
112
  { prop: 'ccy', label: '币种', minWidth: 176, defaultVisible: true, solt: true },
111
- { prop: 'predAmt', label: '预报金额(原币)', minWidth: 142, format: 'amount', defaultVisible: true },
112
- { prop: 'verifyAmt', label: '已核销金额(原币)', minWidth: 154, format: 'amount', defaultVisible: true },
113
- { prop: 'unverifyAmt', label: '未核销金额(原币)', minWidth: 166, format: 'amount', defaultVisible: true },
113
+ { prop: 'predAmt', label: '预报金额(元)', minWidth: 142, format: 'amount', defaultVisible: true },
114
+ { prop: 'verifyAmt', label: '已核销金额(元)', minWidth: 154, format: 'amount', defaultVisible: true },
115
+ { prop: 'unverifyAmt', label: '未核销金额(元)', minWidth: 166, format: 'amount', defaultVisible: true },
114
116
  { prop: 'verifyStatus', label: '核销状态', minWidth: 100, format: 'verifyStatus', defaultVisible: true },
115
117
  { prop: 'tranType', label: '业务类型', minWidth: 116, format: 'businessType', defaultVisible: true },
116
118
  { prop: 'predWay', label: '预报方式', minWidth: 104, format: 'forecastWay', defaultVisible: true },
@@ -140,8 +142,8 @@ const baseFlowColumns = [
140
142
  { prop: 'direction', label: '往来标志', minWidth: 94, format: 'direction', defaultVisible: true },
141
143
  { prop: 'paymentType', label: '收付款类型', minWidth: 108, format: 'paymentType', defaultVisible: true },
142
144
  { prop: 'ccy', label: '币种', minWidth: 176, defaultVisible: true, solt: true },
143
- { prop: 'tranAmt', label: '交易金额(原币)', minWidth: 146, format: 'amount', defaultVisible: true },
144
- { prop: 'notVerifyAmt', label: '未核销金额(原币)', minWidth: 166, format: 'amount', defaultVisible: true },
145
+ { prop: 'tranAmt', label: '交易金额(元)', minWidth: 146, format: 'amount', defaultVisible: true },
146
+ { prop: 'notVerifyAmt', label: '未核销金额(元)', minWidth: 166, format: 'amount', defaultVisible: true },
145
147
  { prop: 'verifyStatus', label: '核销状态', minWidth: 100, format: 'verifyStatus', defaultVisible: true },
146
148
  { prop: 'branchCode', label: '归属机构', minWidth: 100, defaultVisible: true },
147
149
  { prop: 'bankCode', label: '账户行行号', minWidth: 142, defaultVisible: true },
@@ -231,6 +233,34 @@ const flowColumns = orderColumns(baseFlowColumns, [
231
233
  defaultVisible: flowDefaultVisibleProps.has(column.prop),
232
234
  }))
233
235
 
236
+ // 对应交易页沿用列表字段定义,展示流水号、金额和核销状态等关键信息。
237
+ const transactionForecastColumns = baseForecastColumns.filter(({ prop }) => [
238
+ 'predRefNo', 'tranDate', 'payDirec', 'ccy', 'predAmt', 'verifyAmt', 'unverifyAmt',
239
+ 'verifyStatus', 'clientName', 'competName',
240
+ ].includes(prop))
241
+ const transactionFlowColumns = baseFlowColumns.filter(({ prop }) => [
242
+ 'tranRefNo', 'valueDate', 'direction', 'ccy', 'tranAmt', 'notVerifyAmt',
243
+ 'verifyStatus', 'acctName', 'othAcctName',
244
+ ].includes(prop))
245
+ const transactionStatusTables = {
246
+ forecast: {
247
+ title: '预报信息',
248
+ rowKey: 'predRefNo',
249
+ responseKey: 'predResultInfos',
250
+ totalKey: 'predTotalCount',
251
+ columns: transactionForecastColumns,
252
+ },
253
+ flow: {
254
+ title: '流水信息',
255
+ rowKey: 'tranRefNo',
256
+ responseKey: 'tranResultInfos',
257
+ totalKey: 'tranTotalCount',
258
+ columns: transactionFlowColumns,
259
+ },
260
+ } as const
261
+ const transactionStatusKinds = ['forecast', 'flow'] as const
262
+ type TransactionStatusKind = (typeof transactionStatusKinds)[number]
263
+
234
264
  // 将协议字段值转换为表格中的中文显示文本。
235
265
  const optionMaps = {
236
266
  direction: Object.fromEntries(payDirectionOptions.map((option) => [option.value, option.label])),
@@ -486,6 +516,14 @@ const pageMessage = useScopedMessage(() => overlayContainer.value)
486
516
  const forecastSelectedRows = shallowRef<any[]>([])
487
517
  // 当前选中的流水记录。
488
518
  const flowSelectedRows = shallowRef<any[]>([])
519
+ const forecastSelectedKeys = computed(() => new Set(forecastSelectedRows.value.map((row) => row.predRefNo)))
520
+ const flowSelectedKeys = computed(() => new Set(flowSelectedRows.value.map((row) => row.tranRefNo)))
521
+ const selectedForecastRefNo = computed(() => forecastSelectedRows.value.length === 1
522
+ ? String(forecastSelectedRows.value[0]?.predRefNo ?? '').trim()
523
+ : '')
524
+ const selectedFlowRefNo = computed(() => flowSelectedRows.value.length === 1
525
+ ? String(flowSelectedRows.value[0]?.tranRefNo ?? '').trim()
526
+ : '')
489
527
  // 预报表格选择状态的重置标识。
490
528
  const forecastSelectionResetKey = ref(0)
491
529
  // 流水表格选择状态的重置标识。
@@ -499,6 +537,67 @@ const operationLoading = computed(() => activeOperation.value !== null)
499
537
  // 允许撤销核销的预报状态集合。
500
538
  const cancelVerifyForecastStatuses = new Set(['VS02', 'VS03'])
501
539
 
540
+ const transactionStatusLookup = shallowRef<SettlementTransactionLookup | null>(null)
541
+ const transactionStatusRows = shallowRef<Record<TransactionStatusKind, Record<string, unknown>[]>>({
542
+ forecast: [], flow: [],
543
+ })
544
+ const transactionStatusLoading = ref(false)
545
+ const transactionStatusError = ref('')
546
+ let transactionStatusRequestId = 0
547
+
548
+ const transactionStatusDisplayRows = computed(() => ({
549
+ forecast: prepareForeignSettlementRows(transactionStatusRows.value.forecast, transactionStatusTables.forecast.columns),
550
+ flow: prepareForeignSettlementRows(transactionStatusRows.value.flow, transactionStatusTables.flow.columns),
551
+ }))
552
+
553
+ async function openTransactionStatus(lookup: SettlementTransactionLookup) {
554
+ if (!lookup.predRefNo && !lookup.tranRefNo) return
555
+
556
+ const requestId = ++transactionStatusRequestId
557
+ transactionStatusLookup.value = lookup
558
+ transactionStatusRows.value = { forecast: [], flow: [] }
559
+ transactionStatusError.value = ''
560
+ transactionStatusLoading.value = true
561
+
562
+ const pageSize = 100
563
+ const rows: Record<TransactionStatusKind, Record<string, unknown>[]> = { forecast: [], flow: [] }
564
+ try {
565
+ // 接口仍按页返回,详情页合并各页结果后一次展示。
566
+ let pageCount = 1
567
+ for (let pageIndex = 1; pageIndex <= pageCount; pageIndex += 1) {
568
+ const { body } = await API.transactionStatusQueryApi({ ...lookup, pageIndex, pageSize })
569
+ if (requestId !== transactionStatusRequestId) return
570
+
571
+ for (const kind of transactionStatusKinds) {
572
+ const { responseKey, totalKey } = transactionStatusTables[kind]
573
+ const pageRows = body[responseKey]
574
+ if (Array.isArray(pageRows)) rows[kind].push(...pageRows)
575
+ if (pageIndex === 1) {
576
+ const total = Number(body[totalKey])
577
+ if (Number.isSafeInteger(total) && total > 0) {
578
+ pageCount = Math.max(pageCount, Math.ceil(total / pageSize))
579
+ }
580
+ }
581
+ }
582
+ }
583
+ transactionStatusRows.value = rows
584
+ } catch (error) {
585
+ if (requestId === transactionStatusRequestId) {
586
+ transactionStatusError.value = error instanceof Error ? error.message : '对应交易查询失败'
587
+ }
588
+ } finally {
589
+ if (requestId === transactionStatusRequestId) transactionStatusLoading.value = false
590
+ }
591
+ }
592
+
593
+ function returnFromTransactionStatus() {
594
+ transactionStatusRequestId += 1
595
+ transactionStatusLookup.value = null
596
+ transactionStatusRows.value = { forecast: [], flow: [] }
597
+ transactionStatusError.value = ''
598
+ transactionStatusLoading.value = false
599
+ }
600
+
502
601
  // 勾选汇总统一按“收入 - 支出”计算轧差金额。
503
602
  // 将选中行中的金额字段转换为可计算数字。
504
603
  function parseSelectionSummaryAmount(value: unknown) {
@@ -876,7 +975,7 @@ const forecastColumnComponentMap: Record<string, string> = {
876
975
  }
877
976
 
878
977
  // 预报表格实例引用。
879
- const forecastTable = ref<any>(null)
978
+ const forecastTable = ref<InstanceType<typeof ElTableProComponent> | null>(null)
880
979
 
881
980
  // 预报列表请求控制器。
882
981
  let forecastRequestController: AbortController | null = null
@@ -1098,6 +1197,14 @@ function handleForecastSelectionChange(selection: any[]) {
1098
1197
  setForecastSelectedRows(selection)
1099
1198
  }
1100
1199
 
1200
+ function handleForecastRowClick(row: { predRefNo: string }) {
1201
+ forecastTable.value?.toggleRowSelection(row, !forecastSelectedKeys.value.has(row.predRefNo))
1202
+ }
1203
+
1204
+ function getForecastRowClassName({ row }: { row: { predRefNo: string } }) {
1205
+ return forecastSelectedKeys.value.has(row.predRefNo) ? 'settlement-row-selected' : ''
1206
+ }
1207
+
1101
1208
  // 发起按当前交易日期执行的自动核销。
1102
1209
  async function handleForecastAutoVerify() {
1103
1210
  if (operationLoading.value) return
@@ -1258,7 +1365,7 @@ const flowColumnComponentMap: Record<string, string> = {
1258
1365
  }
1259
1366
 
1260
1367
  // 流水表格实例引用。
1261
- const flowTable = ref<any>(null)
1368
+ const flowTable = ref<InstanceType<typeof ElTableProComponent> | null>(null)
1262
1369
 
1263
1370
  // 流水列表请求控制器。
1264
1371
  let flowRequestController: AbortController | null = null
@@ -1465,6 +1572,14 @@ function handleFlowSelectionChange(selection: any[]) {
1465
1572
  setFlowSelectedRows(selection)
1466
1573
  }
1467
1574
 
1575
+ function handleFlowRowClick(row: { tranRefNo: string }) {
1576
+ flowTable.value?.toggleRowSelection(row, !flowSelectedKeys.value.has(row.tranRefNo))
1577
+ }
1578
+
1579
+ function getFlowRowClassName({ row }: { row: { tranRefNo: string } }) {
1580
+ return flowSelectedKeys.value.has(row.tranRefNo) ? 'settlement-row-selected' : ''
1581
+ }
1582
+
1468
1583
  // 获取普通流水或日终流水,并刷新流水列表。
1469
1584
  async function handleFlowFetch(action: 'fetchFlow' | 'fetchEndOfDayFlow') {
1470
1585
  if (operationLoading.value) return
@@ -1611,6 +1726,7 @@ function closePageTransientOverlays() {
1611
1726
  fullscreenOperationGeneration += 1
1612
1727
 
1613
1728
  const cleanupTasks = [
1729
+ returnFromTransactionStatus,
1614
1730
  () => pageMessage.closeAll(),
1615
1731
  () => resetAllTableSelections(),
1616
1732
  () => deactivateForecastPanel(),
@@ -1735,6 +1851,7 @@ onBeforeUnmount(() => {
1735
1851
 
1736
1852
  <!-- 预报信息:筛选、核销操作、汇总和列表。 -->
1737
1853
  <section
1854
+ v-show="!transactionStatusLookup"
1738
1855
  class="forecast-info-card forecast-info-card--forecast"
1739
1856
  aria-labelledby="foreign-currency-forecast-info-title"
1740
1857
  :aria-busy="forecastLoading"
@@ -1979,6 +2096,7 @@ onBeforeUnmount(() => {
1979
2096
  :pagination-append-to="paginationAppendTo"
1980
2097
  table-key="foreign-currency-settlement-forecast-info"
1981
2098
  row-key="predRefNo"
2099
+ :row-class-name="getForecastRowClassName"
1982
2100
  border
1983
2101
  stripe
1984
2102
  size="small"
@@ -1987,9 +2105,30 @@ onBeforeUnmount(() => {
1987
2105
  col-btn-size="small"
1988
2106
  class="forecast-info-table foreign-currency-settlement-table foreign-currency-settlement-table-shell"
1989
2107
  @selection-change="handleForecastSelectionChange"
2108
+ @row-click="handleForecastRowClick"
1990
2109
  @pagination-change="handleForecastPaginationChange"
1991
2110
  >
1992
2111
  <template #toolbar>
2112
+ <el-tooltip
2113
+ content="请选择一条预报记录"
2114
+ placement="top"
2115
+ popper-class="foreign-currency-settlement-transaction-tooltip"
2116
+ :disabled="Boolean(selectedForecastRefNo)"
2117
+ :append-to="overlayContainer || undefined"
2118
+ >
2119
+ <span>
2120
+ <el-button
2121
+ type="primary"
2122
+ plain
2123
+ size="small"
2124
+ :disabled="!selectedForecastRefNo"
2125
+ @click="openTransactionStatus({ predRefNo: selectedForecastRefNo, tranRefNo: '' })"
2126
+ >
2127
+ 对应交易
2128
+ </el-button>
2129
+ </span>
2130
+ </el-tooltip>
2131
+ <span class="foreign-currency-settlement-toolbar-divider" aria-hidden="true"></span>
1993
2132
  <el-button
1994
2133
  type="primary"
1995
2134
  plain
@@ -2305,6 +2444,7 @@ onBeforeUnmount(() => {
2305
2444
  </section>
2306
2445
  <!-- 流水信息:流水获取、筛选、汇总和列表。 -->
2307
2446
  <section
2447
+ v-show="!transactionStatusLookup"
2308
2448
  class="forecast-info-card forecast-info-card--flow"
2309
2449
  aria-labelledby="foreign-currency-flow-info-title"
2310
2450
  :aria-busy="flowLoading"
@@ -2533,6 +2673,7 @@ onBeforeUnmount(() => {
2533
2673
  :pagination-append-to="paginationAppendTo"
2534
2674
  table-key="foreign-currency-settlement-flow-info"
2535
2675
  row-key="tranRefNo"
2676
+ :row-class-name="getFlowRowClassName"
2536
2677
  border
2537
2678
  stripe
2538
2679
  size="small"
@@ -2541,9 +2682,30 @@ onBeforeUnmount(() => {
2541
2682
  col-btn-size="small"
2542
2683
  class="forecast-info-table foreign-currency-settlement-table foreign-currency-settlement-table-shell"
2543
2684
  @selection-change="handleFlowSelectionChange"
2685
+ @row-click="handleFlowRowClick"
2544
2686
  @pagination-change="handleFlowPaginationChange"
2545
2687
  >
2546
2688
  <template #toolbar>
2689
+ <el-tooltip
2690
+ content="请选择一条流水记录"
2691
+ placement="top"
2692
+ popper-class="foreign-currency-settlement-transaction-tooltip"
2693
+ :disabled="Boolean(selectedFlowRefNo)"
2694
+ :append-to="overlayContainer || undefined"
2695
+ >
2696
+ <span>
2697
+ <el-button
2698
+ type="primary"
2699
+ plain
2700
+ size="small"
2701
+ :disabled="!selectedFlowRefNo"
2702
+ @click="openTransactionStatus({ predRefNo: '', tranRefNo: selectedFlowRefNo })"
2703
+ >
2704
+ 对应交易
2705
+ </el-button>
2706
+ </span>
2707
+ </el-tooltip>
2708
+ <span class="foreign-currency-settlement-toolbar-divider" aria-hidden="true"></span>
2547
2709
  <el-button
2548
2710
  type="primary"
2549
2711
  plain
@@ -2797,6 +2959,69 @@ onBeforeUnmount(() => {
2797
2959
  </el-drawer>
2798
2960
 
2799
2961
  </section>
2962
+
2963
+ <section
2964
+ v-if="transactionStatusLookup"
2965
+ class="forecast-info-card"
2966
+ :aria-labelledby="`${pageScopeId}-transaction-title`"
2967
+ :aria-busy="transactionStatusLoading"
2968
+ >
2969
+ <header class="foreign-currency-settlement-transaction-header">
2970
+ <el-button size="small" :icon="ArrowLeft" @click="returnFromTransactionStatus">返回</el-button>
2971
+ <h2 :id="`${pageScopeId}-transaction-title`" class="forecast-info-card__title">
2972
+ 对应交易
2973
+ </h2>
2974
+ </header>
2975
+ <div v-loading="transactionStatusLoading" class="foreign-currency-settlement-transaction-body">
2976
+ <el-alert
2977
+ v-if="transactionStatusError"
2978
+ title="对应交易查询失败"
2979
+ :description="transactionStatusError"
2980
+ type="error"
2981
+ :closable="false"
2982
+ show-icon
2983
+ />
2984
+ <section
2985
+ v-for="kind in transactionStatusKinds"
2986
+ :key="kind"
2987
+ class="foreign-currency-settlement-transaction-group"
2988
+ :aria-labelledby="`${pageScopeId}-transaction-${kind}-title`"
2989
+ >
2990
+ <h3 :id="`${pageScopeId}-transaction-${kind}-title`" class="foreign-currency-settlement-transaction-group-title">
2991
+ {{ transactionStatusTables[kind].title }}
2992
+ </h3>
2993
+ <div class="forecast-info-table-area">
2994
+ <ElTablePro
2995
+ :data="transactionStatusDisplayRows[kind]"
2996
+ :row-key="transactionStatusTables[kind].rowKey"
2997
+ :column-config="false"
2998
+ :column-storage="false"
2999
+ :pagination="false"
3000
+ :empty-text="`暂无${transactionStatusTables[kind].title}`"
3001
+ height="100%"
3002
+ size="small"
3003
+ class="forecast-info-table"
3004
+ border
3005
+ stripe
3006
+ >
3007
+ <el-table-column
3008
+ v-for="column in transactionStatusTables[kind].columns"
3009
+ :key="column.prop"
3010
+ :prop="column.prop"
3011
+ :label="column.label"
3012
+ :min-width="column.minWidth"
3013
+ :align="column.format === 'amount' ? 'right' : 'center'"
3014
+ show-overflow-tooltip
3015
+ >
3016
+ <template #default="{ row }">
3017
+ {{ row.__displayValues[column.prop] || '—' }}
3018
+ </template>
3019
+ </el-table-column>
3020
+ </ElTablePro>
3021
+ </div>
3022
+ </section>
3023
+ </div>
3024
+ </section>
2800
3025
  </div>
2801
3026
  </template>
2802
3027
 
@@ -3384,6 +3609,14 @@ onBeforeUnmount(() => {
3384
3609
  padding: 0;
3385
3610
  }
3386
3611
 
3612
+ .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-table .el-table__row {
3613
+ cursor: pointer;
3614
+ }
3615
+
3616
+ .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-table .el-table__body tr.settlement-row-selected > td.el-table__cell {
3617
+ background-color: #e0ecff;
3618
+ }
3619
+
3387
3620
  /* 表头与数据单元格统一使用 Element Plus 的单行省略,完整内容通过悬浮提示查看。 */
3388
3621
  .forecast-info-page[data-page-scope="foreign-currency-settlement"] .forecast-info-table .el-table__cell .cell {
3389
3622
  overflow: hidden;
@@ -3732,6 +3965,55 @@ onBeforeUnmount(() => {
3732
3965
  flex: 0 0 auto;
3733
3966
  }
3734
3967
 
3968
+ .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-toolbar-divider {
3969
+ flex: 0 0 1px;
3970
+ height: 22px;
3971
+ margin-inline: 2px;
3972
+ background: #d9e1eb;
3973
+ }
3974
+
3975
+ .foreign-currency-settlement-transaction-tooltip.el-popper {
3976
+ width: max-content;
3977
+ white-space: nowrap;
3978
+ }
3979
+
3980
+ .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-transaction-header {
3981
+ display: flex;
3982
+ align-items: center;
3983
+ flex: 0 0 auto;
3984
+ gap: 12px;
3985
+ padding: 0 4px;
3986
+ }
3987
+
3988
+ .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-transaction-body {
3989
+ display: flex;
3990
+ min-height: 0;
3991
+ flex: 1 1 0;
3992
+ flex-direction: column;
3993
+ gap: 12px;
3994
+ padding-top: 12px;
3995
+ overflow: auto;
3996
+ }
3997
+
3998
+ .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-transaction-body > .el-alert {
3999
+ flex: 0 0 auto;
4000
+ }
4001
+
4002
+ .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-transaction-group {
4003
+ display: flex;
4004
+ min-width: 0;
4005
+ min-height: 160px;
4006
+ flex: 1 1 0;
4007
+ flex-direction: column;
4008
+ }
4009
+
4010
+ .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-transaction-group-title {
4011
+ margin: 0 4px;
4012
+ color: #1d2a3c;
4013
+ font-size: 14px;
4014
+ font-weight: 600;
4015
+ }
4016
+
3735
4017
  .forecast-info-page[data-page-scope="foreign-currency-settlement"] .foreign-currency-settlement-selection-count {
3736
4018
  color: #4a5668;
3737
4019
  font-size: 12px;
Binary file