verce-vue-test 0.0.108 → 0.0.110

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.108",
3
+ "version": "0.0.110",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -25,10 +25,11 @@
25
25
  "license": "ISC",
26
26
  "dependencies": {
27
27
  "echarts": "^6.1.0",
28
- "element-plus": "^2.14.0",
29
- "pinia": "^3.0.4",
30
- "vue": "^3.5.32",
31
- "vue-router": "^5.0.4"
28
+ "element-plus": "2.2.27",
29
+ "pinia": "2.1.7",
30
+ "pinia-plugin-persist": "^1.0.0",
31
+ "vue": "3.4.33",
32
+ "vue-router": "4.4.0"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@tsconfig/node24": "^24.0.4",
@@ -36,6 +37,7 @@
36
37
  "@vitejs/plugin-vue": "^6.0.6",
37
38
  "@vue/tsconfig": "^0.9.1",
38
39
  "npm-run-all2": "^8.0.4",
40
+ "sass-embedded": "^1.100.0",
39
41
  "typescript": "~6.0.0",
40
42
  "vite": "^8.0.8",
41
43
  "vite-plugin-vue-devtools": "^8.1.1",
@@ -7,6 +7,7 @@ import {
7
7
  computed,
8
8
  getCurrentInstance,
9
9
  nextTick,
10
+ onBeforeUnmount,
10
11
  ref,
11
12
  useAttrs,
12
13
  useSlots,
@@ -38,7 +39,7 @@ const props = withDefaults(
38
39
  columnStorageKey?: string
39
40
  // 列配置弹窗挂载节点,用于页面级浮层隔离
40
41
  appendTo?: string | HTMLElement
41
- // 分页条数下拉层挂载节点(Element Plus 仅支持选择器)
42
+ // 分页条数下拉层挂载节点;兼容不支持 append-size-to 的旧版 Element Plus
42
43
  paginationAppendTo?: string
43
44
  // 是否开启列配置功能
44
45
  columnConfig?: boolean
@@ -92,7 +93,11 @@ const route = useRoute()
92
93
  const attrs = useAttrs()
93
94
  const slots = useSlots()
94
95
  // Vue 3.4 尚未提供 useId,使用组件实例 uid 生成页面内唯一的无障碍关联 ID。
95
- const columnOrderTipId = `el-table-pro-column-order-tip-${getCurrentInstance()?.uid ?? 0}`
96
+ const componentUid = getCurrentInstance()?.uid ?? 0
97
+ const columnOrderTipId = `el-table-pro-column-order-tip-${componentUid}`
98
+ // Element Plus 2.2.x 只能通过 popper-class 标识分页条数下拉层。
99
+ const paginationPopperClass = `el-table-pro-pagination-popper-${componentUid}`
100
+ let paginationPopperOriginalParent: HTMLElement | null = null
96
101
 
97
102
  /**
98
103
  * 响应式状态
@@ -138,6 +143,57 @@ watch(
138
143
  }
139
144
  )
140
145
 
146
+ /**
147
+ * Element Plus 2.2.x 的 el-pagination 尚不支持 append-size-to,分页条数下拉层
148
+ * 会固定 Teleport 到 body。浏览器全屏时 body 下的浮层不可见,因此在传入目标选择器后,
149
+ * 将当前表格独有的分页浮层移动到全屏根节点;退出全屏时再还原原挂载位置。
150
+ */
151
+ const syncPaginationPopperTarget = async () => {
152
+ await nextTick()
153
+ if (typeof document === "undefined") return
154
+
155
+ const popper = document.querySelector<HTMLElement>(`.${paginationPopperClass}`)
156
+ if (!popper) return
157
+
158
+ if (!paginationPopperOriginalParent) {
159
+ paginationPopperOriginalParent = popper.parentElement
160
+ }
161
+
162
+ if (props.paginationAppendTo) {
163
+ const target = document.querySelector<HTMLElement>(props.paginationAppendTo)
164
+ if (target && popper.parentElement !== target) {
165
+ target.appendChild(popper)
166
+ }
167
+ return
168
+ }
169
+
170
+ if (
171
+ paginationPopperOriginalParent?.isConnected
172
+ && popper.parentElement !== paginationPopperOriginalParent
173
+ ) {
174
+ paginationPopperOriginalParent.appendChild(popper)
175
+ }
176
+ }
177
+
178
+ watch(
179
+ () => props.paginationAppendTo,
180
+ () => {
181
+ void syncPaginationPopperTarget()
182
+ },
183
+ { immediate: true, flush: "post" }
184
+ )
185
+
186
+ onBeforeUnmount(() => {
187
+ const popper = document.querySelector<HTMLElement>(`.${paginationPopperClass}`)
188
+ if (
189
+ popper
190
+ && paginationPopperOriginalParent?.isConnected
191
+ && popper.parentElement !== paginationPopperOriginalParent
192
+ ) {
193
+ paginationPopperOriginalParent.appendChild(popper)
194
+ }
195
+ })
196
+
141
197
  /**
142
198
  * 计算属性
143
199
  */
@@ -588,7 +644,7 @@ initColumns()
588
644
  :total="total || data.length"
589
645
  :page-sizes="pageSizes"
590
646
  :layout="layout"
591
- :append-size-to="paginationAppendTo"
647
+ :popper-class="paginationPopperClass"
592
648
  background
593
649
  :size="colBtnSize"
594
650
  />
@@ -0,0 +1,267 @@
1
+ import baseHttpClient from '@/utils/baseHttpClient'
2
+
3
+ /**
4
+ * 外币手工核销页面接口。
5
+ *
6
+ * `baseHttpClient` 负责补充 TAM 公共报文头,当前文件只定义业务请求参数、
7
+ * 交易码以及页面需要的响应归一化逻辑。
8
+ */
9
+
10
+ /** TAM 列表接口返回的单行原始数据,字段名保持后端原样。 */
11
+ type ForeignSettlementRow = Record<string, unknown>
12
+
13
+ /** 外币预报、流水查询接口的原始响应体。 */
14
+ type ForeignSettlementListBody = {
15
+ resultInfos?: ForeignSettlementRow[]
16
+ totalCount?: number | string | null
17
+ totalPage?: number | string | null
18
+ }
19
+
20
+ /** 页面统一使用的列表查询结果。 */
21
+ export type ForeignSettlementListResult = {
22
+ /** 当前页数据。 */
23
+ resultList: ForeignSettlementRow[]
24
+ /** 符合查询条件的数据总数。 */
25
+ totalCount: number
26
+ /** 总页数;接口未返回有效值时为 0。 */
27
+ totalPage: number
28
+ }
29
+
30
+ /** 外币预报信息查询参数。 */
31
+ export type ForeignSettlementForecastQueryParams = {
32
+ /** 金额排序方式。 */
33
+ amtOrder: string
34
+ /** 授权状态。 */
35
+ authorization: string
36
+ /** 账户行行号。 */
37
+ bankCode: string
38
+ /** 所属机构代码。 */
39
+ branchs: string
40
+ /** 所属机构名称。 */
41
+ branchsName: string
42
+ /** 币种。 */
43
+ ccy: string
44
+ /** 客户名称。 */
45
+ clientName: string
46
+ /** 截止金额。 */
47
+ endAmt: string
48
+ /** 是否过滤 FTU 数据。 */
49
+ filter: string
50
+ /** 操作类型,列表查询时传空字符串。 */
51
+ opType: string
52
+ /** 当前页码。 */
53
+ pageIndex: number
54
+ /** 每页条数。 */
55
+ pageSize: number
56
+ /** 收支方向。 */
57
+ payDirec: string
58
+ /** 预报方式。 */
59
+ predWay: string
60
+ /** 起始金额。 */
61
+ startAmt: string
62
+ /** 起息日,格式为 YYYYMMDD。 */
63
+ tranDate: string
64
+ /** 业务类型。 */
65
+ tranType: string
66
+ /** 核销状态。 */
67
+ vrfctnSts: string
68
+ }
69
+
70
+ /** 外币流水信息查询参数。 */
71
+ export type ForeignSettlementFlowQueryParams = {
72
+ /** 授权状态。 */
73
+ authorization: string
74
+ /** 账户行行号。 */
75
+ bankCode: string
76
+ /** 所属机构代码。 */
77
+ branchs: string
78
+ /** 所属机构名称。 */
79
+ branchsName: string
80
+ /** 币种。 */
81
+ ccy: string
82
+ /** 客户名称。 */
83
+ clientName: string
84
+ /** 截止金额。 */
85
+ endAmt: string
86
+ /** 操作类型,列表查询时传空字符串。 */
87
+ opType: string
88
+ /** 当前页码。 */
89
+ pageIndex: number
90
+ /** 每页条数。 */
91
+ pageSize: number
92
+ /** 收支方向。 */
93
+ payDirec: string
94
+ /** 预报方式;流水查询时传空字符串。 */
95
+ predWay: string
96
+ /** 起始金额。 */
97
+ startAmt: string
98
+ /** 交易日期,格式为 YYYYMMDD。 */
99
+ tranDate: string
100
+ /** 报文类型列表。 */
101
+ tranType: string[]
102
+ /** 核销状态。 */
103
+ vrfctnSts: string
104
+ }
105
+
106
+ /** 手工核销请求参数;多个值按相同顺序使用英文逗号拼接。 */
107
+ export type ForeignSettlementVerifyParams = {
108
+ /** 预报流水号集合。 */
109
+ predIds: string
110
+ /** 预报金额集合。 */
111
+ predAmts: string
112
+ /** 已核销金额集合。 */
113
+ verifyAmts: string
114
+ /** 预报核销状态集合。 */
115
+ preStatus: string
116
+ /** 预报起息日集合。 */
117
+ predValueDates: string
118
+ /** 流水号集合;未选择流水时不传。 */
119
+ tranSeqIds?: string
120
+ /** 流水未核销金额集合;未选择流水时不传。 */
121
+ tranAmts?: string
122
+ /** 流水核销状态集合;未选择流水时不传。 */
123
+ seqVerifyStatus?: string
124
+ /** 流水起息日集合;未选择流水时不传。 */
125
+ tranValueDates?: string
126
+ }
127
+
128
+ /** 撤销核销请求参数。 */
129
+ export type ForeignSettlementCancelVerifyParams = {
130
+ /** 预报已核销金额。 */
131
+ predAmt: string
132
+ /** 预报流水号。 */
133
+ predRefNo: string
134
+ /** 关联流水号集合,使用英文逗号拼接。 */
135
+ tranRefNos: string
136
+ }
137
+
138
+ /** 自动核销请求参数。 */
139
+ export type ForeignSettlementDateParams = {
140
+ /** 自动核销日期,格式为 YYYYMMDD。 */
141
+ tranDate: string
142
+ }
143
+
144
+ /** 获取流水请求参数。 */
145
+ export type ForeignSettlementQueryDateParams = {
146
+ /** 待获取流水的日期,格式为 YYYYMMDD。 */
147
+ queryDate: string
148
+ }
149
+
150
+ /** 将接口返回的数量安全转换为非负数字。 */
151
+ function normalizeCount(value: unknown, fallback: number) {
152
+ const normalizedValue = String(value ?? '').trim()
153
+ if (!normalizedValue) return fallback
154
+ const count = Number(normalizedValue)
155
+ return Number.isFinite(count) && count >= 0 ? count : fallback
156
+ }
157
+
158
+ /**
159
+ * 将 TAM 的 `resultInfos` 列表结构转换为页面统一使用的分页结构。
160
+ * 接口未返回数组时主动抛错,避免页面把异常响应误认为空列表。
161
+ */
162
+ function normalizeListBody(
163
+ body: ForeignSettlementListBody,
164
+ errorMessage: string,
165
+ ): ForeignSettlementListResult {
166
+ if (!Array.isArray(body.resultInfos)) throw new Error(errorMessage)
167
+ return {
168
+ resultList: body.resultInfos.map((row) => ({ ...row })),
169
+ totalCount: normalizeCount(body.totalCount, body.resultInfos.length),
170
+ totalPage: normalizeCount(body.totalPage, 0),
171
+ }
172
+ }
173
+
174
+ /**
175
+ * 查询外币预报信息。
176
+ * @transactionCode 140202001
177
+ * @returns 归一化后的预报列表及分页信息。
178
+ */
179
+ export async function queryForeignSettlementForecasts(
180
+ params: ForeignSettlementForecastQueryParams,
181
+ ) {
182
+ const response = await baseHttpClient.post(
183
+ '/TAM/0001/140202001',
184
+ params,
185
+ ) as any
186
+ return normalizeListBody(response.body, '外币预报信息接口返回结构不正确')
187
+ }
188
+
189
+ /**
190
+ * 查询外币流水信息。
191
+ * @transactionCode 140202002
192
+ * @returns 归一化后的流水列表及分页信息。
193
+ */
194
+ export async function queryForeignSettlementFlows(
195
+ params: ForeignSettlementFlowQueryParams,
196
+ ) {
197
+ const response = await baseHttpClient.post(
198
+ '/TAM/0001/140202002',
199
+ params,
200
+ ) as any
201
+ return normalizeListBody(response.body, '外币流水信息接口返回结构不正确')
202
+ }
203
+
204
+ /**
205
+ * 按指定起息日发起自动核销。
206
+ * @transactionCode 120202001
207
+ */
208
+ export async function autoVerifyForeignSettlements(
209
+ params: ForeignSettlementDateParams,
210
+ ) {
211
+ await baseHttpClient.post(
212
+ '/TAM/0001/120202001',
213
+ params,
214
+ ) as any
215
+ }
216
+
217
+ /**
218
+ * 获取指定日期的外币流水。
219
+ * @transactionCode 120202004
220
+ */
221
+ export async function fetchForeignSettlementFlows(
222
+ params: ForeignSettlementQueryDateParams,
223
+ ) {
224
+ await baseHttpClient.post(
225
+ '/TAM/0001/120202004',
226
+ params,
227
+ ) as any
228
+ }
229
+
230
+ /**
231
+ * 获取指定日期的外币日终流水。
232
+ * @transactionCode 120202005
233
+ */
234
+ export async function fetchForeignSettlementEndOfDayFlows(
235
+ params: ForeignSettlementQueryDateParams,
236
+ ) {
237
+ await baseHttpClient.post(
238
+ '/TAM/0001/120202005',
239
+ params,
240
+ ) as any
241
+ }
242
+
243
+ /**
244
+ * 手动核销所选外币预报及关联流水。
245
+ * @transactionCode 120202002
246
+ */
247
+ export async function verifyForeignSettlements(
248
+ params: ForeignSettlementVerifyParams,
249
+ ) {
250
+ await baseHttpClient.post(
251
+ '/TAM/0001/120202002',
252
+ params,
253
+ ) as any
254
+ }
255
+
256
+ /**
257
+ * 撤销外币预报及关联流水的核销关系。
258
+ * @transactionCode 120202003
259
+ */
260
+ export async function cancelVerifyForeignSettlements(
261
+ params: ForeignSettlementCancelVerifyParams,
262
+ ) {
263
+ await baseHttpClient.post(
264
+ '/TAM/0001/120202003',
265
+ params,
266
+ ) as any
267
+ }
@@ -285,10 +285,10 @@
285
285
  box-shadow: 0 4px 10px rgba(22, 104, 255, .24);
286
286
  }
287
287
 
288
- /* 左右卡片空间较窄时,仅保留一个快速筛选项和同一行操作按钮。 */
288
+ /* 左右卡片状态下保留两个快速筛选项,并与操作按钮保持同一行。 */
289
289
  .forecast-info-page[data-page-scope="foreign-currency-settlement"] .forecast-info-filter--horizontal {
290
290
  display: grid;
291
- grid-template-columns: minmax(220px, 238px) auto;
291
+ grid-template-columns: minmax(0, 1fr) auto;
292
292
  align-items: center;
293
293
  column-gap: 8px;
294
294
  justify-content: space-between;
@@ -297,8 +297,8 @@
297
297
 
298
298
  .forecast-info-page[data-page-scope="foreign-currency-settlement"] .forecast-info-filter--horizontal .forecast-info-filter__grid {
299
299
  min-width: 0;
300
- grid-template-columns: minmax(0, 1fr);
301
- column-gap: 0;
300
+ grid-template-columns: repeat(2, minmax(0, 1fr));
301
+ column-gap: 8px;
302
302
  }
303
303
 
304
304
  .forecast-info-page[data-page-scope="foreign-currency-settlement"] .forecast-info-filter--horizontal .forecast-info-filter__item {
@@ -8,6 +8,7 @@ export default {
8
8
  <script setup lang="ts">
9
9
  import {
10
10
  computed,
11
+ getCurrentInstance,
11
12
  onActivated,
12
13
  onBeforeUnmount,
13
14
  onDeactivated,
@@ -15,7 +16,6 @@ import {
15
16
  reactive,
16
17
  ref,
17
18
  shallowRef,
18
- useId,
19
19
  watch,
20
20
  } from 'vue'
21
21
  import { onBeforeRouteLeave, useRoute } from 'vue-router'
@@ -32,8 +32,16 @@ import {
32
32
  Search,
33
33
  } from '@element-plus/icons-vue'
34
34
  import { queryAccountBanks } from '@/api/account-bank'
35
- import baseHttpClient from '@/utils/baseHttpClient'
36
35
  import { formatThousands } from '@/utils/formatters'
36
+ import {
37
+ autoVerifyForeignSettlements,
38
+ cancelVerifyForeignSettlements,
39
+ fetchForeignSettlementEndOfDayFlows,
40
+ fetchForeignSettlementFlows,
41
+ queryForeignSettlementFlows,
42
+ queryForeignSettlementForecasts,
43
+ verifyForeignSettlements,
44
+ } from './api'
37
45
  import './foreign-currency-settlement-base.css'
38
46
 
39
47
  type CardLayout = 'vertical' | 'horizontal'
@@ -288,40 +296,6 @@ function isForeignSettlementAbortError(error: unknown) {
288
296
  return error instanceof Error && error.name === 'AbortError'
289
297
  }
290
298
 
291
- function normalizeCount(value: unknown, fallback: number) {
292
- const normalizedValue = String(value ?? '').trim()
293
- if (!normalizedValue) return fallback
294
- const count = Number(normalizedValue)
295
- return Number.isFinite(count) && count >= 0 ? count : fallback
296
- }
297
-
298
- function normalizeListBody(body: any, errorMessage: string): any {
299
- if (!Array.isArray(body.resultInfos)) throw new Error(errorMessage)
300
- return {
301
- resultList: body.resultInfos.map((row: any) => ({ ...row })),
302
- totalCount: normalizeCount(body.totalCount, body.resultInfos.length),
303
- totalPage: normalizeCount(body.totalPage, 0),
304
- }
305
- }
306
-
307
- async function queryForeignSettlementForecasts(params: any) {
308
- const response = await baseHttpClient.post<any>('/TAM/0001/140202001', params)
309
- return normalizeListBody(response.body, '外币预报信息接口返回结构不正确')
310
- }
311
-
312
- async function queryForeignSettlementFlows(params: any) {
313
- const response = await baseHttpClient.post<any>('/TAM/0001/140202002', params)
314
- return normalizeListBody(response.body, '外币流水信息接口返回结构不正确')
315
- }
316
-
317
- async function verifyForeignSettlements(params: any) {
318
- await baseHttpClient.post<any>('/TAM/0001/120202002', params)
319
- }
320
-
321
- async function cancelVerifyForeignSettlements(params: any) {
322
- await baseHttpClient.post<any>('/TAM/0001/120202003', params)
323
- }
324
-
325
299
  function useScopedMessage(resolveAppendTo: () => HTMLElement | null) {
326
300
  const activeHandles = new Set<any>()
327
301
 
@@ -384,6 +358,10 @@ function restoreCardLayout(): CardLayout {
384
358
  return DEFAULT_CARD_LAYOUT
385
359
  }
386
360
 
361
+ function getCardLayoutPageSize(layout: CardLayout) {
362
+ return layout === 'vertical' ? 10 : 20
363
+ }
364
+
387
365
  const cardLayout = ref<CardLayout>(restoreCardLayout())
388
366
  const route = useRoute()
389
367
  const ownerRouteRecord = route.matched[route.matched.length - 1]
@@ -392,7 +370,7 @@ const pageContainer = ref<HTMLElement | null>(null)
392
370
  const overlayContainer = ref<HTMLElement | null>(null)
393
371
  const isFullscreen = ref(false)
394
372
  /** 每个页面实例使用独立根节点,避免 KeepAlive 场景下分页浮层命中旧页面。 */
395
- const pageScopeId = `foreign-currency-settlement-page-${useId()}`
373
+ const pageScopeId = `foreign-currency-settlement-page-${getCurrentInstance()?.uid ?? 0}`
396
374
  const paginationAppendTo = computed(() => (isFullscreen.value ? `#${pageScopeId}` : undefined))
397
375
  const pageMessage = useScopedMessage(() => overlayContainer.value)
398
376
  const forecastSelectedRows = shallowRef<any[]>([])
@@ -404,6 +382,64 @@ const activeOperation = ref<any>(null)
404
382
  const operationLoading = computed(() => activeOperation.value !== null)
405
383
  const cancelVerifyForecastStatuses = new Set(['VS02', 'VS03'])
406
384
 
385
+ // 勾选汇总统一按“收入 - 支出”计算轧差金额。
386
+ function parseSelectionSummaryAmount(value: unknown) {
387
+ const amount = Number(String(value ?? '').trim().replaceAll(',', ''))
388
+ return Number.isFinite(amount) ? amount : 0
389
+ }
390
+
391
+ function formatSelectionSummaryAmount(value: number) {
392
+ const roundedValue = Math.round((value + Number.EPSILON) * 100) / 100
393
+ return formatThousands(Object.is(roundedValue, -0) ? 0 : roundedValue, '0')
394
+ }
395
+
396
+ function buildSelectionSummary(
397
+ rows: any[],
398
+ directionField: string,
399
+ totalAmountField: string,
400
+ unverifiedAmountField: string,
401
+ ) {
402
+ const summary = rows.reduce(
403
+ (result, row) => {
404
+ const direction = String(row[directionField] ?? '').trim().toUpperCase()
405
+ if (direction !== 'I' && direction !== 'O') return result
406
+
407
+ const directionKey = direction === 'I' ? 'income' : 'expense'
408
+ result.total[directionKey] += parseSelectionSummaryAmount(row[totalAmountField])
409
+ result.unverified[directionKey] += parseSelectionSummaryAmount(row[unverifiedAmountField])
410
+ return result
411
+ },
412
+ {
413
+ total: { income: 0, expense: 0 },
414
+ unverified: { income: 0, expense: 0 },
415
+ },
416
+ )
417
+
418
+ return {
419
+ totalIncome: formatSelectionSummaryAmount(summary.total.income),
420
+ totalExpense: formatSelectionSummaryAmount(summary.total.expense),
421
+ totalNet: formatSelectionSummaryAmount(summary.total.income - summary.total.expense),
422
+ unverifiedIncome: formatSelectionSummaryAmount(summary.unverified.income),
423
+ unverifiedExpense: formatSelectionSummaryAmount(summary.unverified.expense),
424
+ unverifiedNet: formatSelectionSummaryAmount(
425
+ summary.unverified.income - summary.unverified.expense,
426
+ ),
427
+ }
428
+ }
429
+
430
+ const forecastSelectionSummary = computed(() => buildSelectionSummary(
431
+ forecastSelectedRows.value,
432
+ 'payDirec',
433
+ 'predAmt',
434
+ 'unverifyAmt',
435
+ ))
436
+ const flowSelectionSummary = computed(() => buildSelectionSummary(
437
+ flowSelectedRows.value,
438
+ 'direction',
439
+ 'tranAmt',
440
+ 'notVerifyAmt',
441
+ ))
442
+
407
443
  function hasText(value: unknown) {
408
444
  return String(value ?? '').trim().length > 0
409
445
  }
@@ -496,6 +532,9 @@ function validateSelection(action: 'verify' | 'cancelVerify'): any {
496
532
  if (action === 'cancelVerify' && forecastSelectedRows.value.length !== 1) {
497
533
  return { success: false, message: '不能选择多行预报!' }
498
534
  }
535
+ if (action === 'cancelVerify' && flowSelectedRows.value.length === 0) {
536
+ return { success: false, message: '撤销核销必须至少勾选一条流水!' }
537
+ }
499
538
  if (
500
539
  action === 'verify'
501
540
  && flowSelectedRows.value.some((row) => normalizeVerifyStatus(row.verifyStatus) === 'VS03')
@@ -632,7 +671,7 @@ let fullscreenOperationGeneration = 0
632
671
  */
633
672
  const forecastFilterForm = reactive(createDefaultForeignSettlementFilter())
634
673
  const forecastPage = ref(1)
635
- const forecastPageSize = ref(20)
674
+ const forecastPageSize = ref(getCardLayoutPageSize(cardLayout.value))
636
675
  const forecastLoading = ref(false)
637
676
  const forecastTotal = ref(0)
638
677
  const forecastRows = shallowRef<any[]>([])
@@ -823,6 +862,38 @@ function handleForecastSelectionChange(selection: any[]) {
823
862
  setForecastSelectedRows(selection)
824
863
  }
825
864
 
865
+ async function handleForecastAutoVerify() {
866
+ if (operationLoading.value) return
867
+
868
+ // 用户确认后再按当前起息日发起自动核销。
869
+ try {
870
+ await ElMessageBox.confirm('您是否确定自动核销', '自动核销', {
871
+ appendTo: overlayContainer.value || undefined,
872
+ confirmButtonText: '确定',
873
+ cancelButtonText: '取消',
874
+ type: 'warning',
875
+ })
876
+ } catch {
877
+ return
878
+ }
879
+
880
+ activeOperation.value = 'autoVerify'
881
+ try {
882
+ await autoVerifyForeignSettlements({
883
+ tranDate: compactForeignSettlementDate(forecastFilterForm.tradeDate),
884
+ })
885
+ refreshOperationLists()
886
+ if (forecastPanelActive) pageMessage.success('自动核销成功!')
887
+ } catch (error) {
888
+ refreshOperationLists()
889
+ if (forecastPanelActive) {
890
+ pageMessage.error(error instanceof Error ? error.message : '自动核销失败,请稍后重试')
891
+ }
892
+ } finally {
893
+ activeOperation.value = null
894
+ }
895
+ }
896
+
826
897
  async function handleForecastVerify() {
827
898
  const validation = validateSelection('verify')
828
899
  if (!validation.success) {
@@ -831,10 +902,7 @@ async function handleForecastVerify() {
831
902
  }
832
903
 
833
904
  try {
834
- const flowCount = flowSelectedRows.value.length
835
- const confirmMessage = flowCount
836
- ? `将核销 ${forecastSelectedRows.value.length} 笔预报,并匹配 ${flowCount} 笔流水。是否继续?`
837
- : `将直接核销 ${forecastSelectedRows.value.length} 笔预报,当前未选择流水。是否继续?`
905
+ const confirmMessage = `将核销 ${forecastSelectedRows.value.length} 笔预报。是否继续?`
838
906
  await ElMessageBox.confirm(confirmMessage, '确认核销', {
839
907
  appendTo: overlayContainer.value || undefined,
840
908
  confirmButtonText: '确认核销',
@@ -866,9 +934,7 @@ async function handleForecastCancelVerify() {
866
934
 
867
935
  try {
868
936
  const flowCount = flowSelectedRows.value.length
869
- const confirmMessage = flowCount
870
- ? `将撤销 1 笔预报与 ${flowCount} 笔流水的核销关系。是否继续?`
871
- : '将按所选预报撤销其当前核销关系,当前未选择流水。是否继续?'
937
+ const confirmMessage = `将撤销 1 笔预报与 ${flowCount} 笔流水的核销关系。是否继续?`
872
938
  await ElMessageBox.confirm(
873
939
  confirmMessage,
874
940
  '确认撤销核销',
@@ -916,7 +982,7 @@ function closeForecastTransientOverlays() {
916
982
  */
917
983
  const flowFilterForm = reactive(createDefaultForeignSettlementFilter())
918
984
  const flowPage = ref(1)
919
- const flowPageSize = ref(20)
985
+ const flowPageSize = ref(getCardLayoutPageSize(cardLayout.value))
920
986
  const flowLoading = ref(false)
921
987
  const flowTotal = ref(0)
922
988
  const flowRows = shallowRef<any[]>([])
@@ -1096,6 +1162,49 @@ function handleFlowSelectionChange(selection: any[]) {
1096
1162
  setFlowSelectedRows(selection)
1097
1163
  }
1098
1164
 
1165
+ async function handleFlowFetch(action: 'fetchFlow' | 'fetchEndOfDayFlow') {
1166
+ if (operationLoading.value) return
1167
+
1168
+ const isEndOfDay = action === 'fetchEndOfDayFlow'
1169
+ const operationLabel = isEndOfDay ? '获取日终流水' : '获取流水'
1170
+ // 两种流水获取操作都需要用户二次确认。
1171
+ try {
1172
+ await ElMessageBox.confirm(`您是否确定${operationLabel}`, operationLabel, {
1173
+ appendTo: overlayContainer.value || undefined,
1174
+ confirmButtonText: '确定',
1175
+ cancelButtonText: '取消',
1176
+ type: 'warning',
1177
+ })
1178
+ } catch {
1179
+ return
1180
+ }
1181
+
1182
+ activeOperation.value = action
1183
+ try {
1184
+ const params = {
1185
+ queryDate: compactForeignSettlementDate(flowFilterForm.tradeDate),
1186
+ }
1187
+ if (isEndOfDay) await fetchForeignSettlementEndOfDayFlows(params)
1188
+ else await fetchForeignSettlementFlows(params)
1189
+
1190
+ flowPage.value = 1
1191
+ resetFlowSelection()
1192
+ if (flowPanelActive) {
1193
+ const refreshed = await loadFlows()
1194
+ if (refreshed) pageMessage.success(`${operationLabel}成功!`)
1195
+ } else {
1196
+ flowPendingOperationRefresh = true
1197
+ }
1198
+ } catch (error) {
1199
+ if (flowPanelActive) {
1200
+ const fallbackMessage = `${operationLabel}失败,请稍后重试`
1201
+ pageMessage.error(error instanceof Error ? error.message : fallbackMessage)
1202
+ }
1203
+ } finally {
1204
+ activeOperation.value = null
1205
+ }
1206
+ }
1207
+
1099
1208
  function getFlowSequence(index: number) {
1100
1209
  return (flowPage.value - 1) * flowPageSize.value + index + 1
1101
1210
  }
@@ -1164,12 +1273,23 @@ async function toggleFullscreen() {
1164
1273
  }
1165
1274
 
1166
1275
  function setCardLayout(layout: CardLayout) {
1276
+ if (cardLayout.value === layout) return
1277
+
1167
1278
  cardLayout.value = layout
1279
+ // 上下布局每页 10 条,左右布局每页 20 条,并同步刷新两张表。
1280
+ const pageSize = getCardLayoutPageSize(layout)
1281
+ forecastPage.value = 1
1282
+ forecastPageSize.value = pageSize
1283
+ flowPage.value = 1
1284
+ flowPageSize.value = pageSize
1285
+
1168
1286
  try {
1169
1287
  window.localStorage.setItem(CARD_LAYOUT_STORAGE_KEY, layout)
1170
1288
  } catch {
1171
1289
  // 本地存储不可用时仅保留本次页面状态。
1172
1290
  }
1291
+
1292
+ refreshOperationLists()
1173
1293
  }
1174
1294
 
1175
1295
  function closePageTransientOverlays() {
@@ -1331,48 +1451,63 @@ onBeforeUnmount(() => {
1331
1451
  />
1332
1452
  </label>
1333
1453
 
1334
- <label v-if="cardLayout === 'vertical'" class="forecast-info-filter__item">
1335
- <span>收支方向</span>
1454
+ <label class="forecast-info-filter__item">
1455
+ <span>筛选FTU</span>
1336
1456
  <el-select
1337
- v-model="forecastFilterForm.direction"
1457
+ v-model="forecastFilterForm.ftuFilter"
1338
1458
  :append-to="overlayContainer || undefined"
1339
1459
  :persistent="false"
1340
1460
  size="small"
1341
1461
  placeholder="请选择"
1342
1462
  clearable
1343
1463
  >
1344
- <el-option v-for="option in payDirectionOptions" :key="option.value" v-bind="option" />
1464
+ <el-option
1465
+ v-for="option in ftuFilterOptions"
1466
+ :key="option.value"
1467
+ :label="option.label"
1468
+ :value="option.value"
1469
+ />
1345
1470
  </el-select>
1346
1471
  </label>
1347
1472
 
1348
1473
  <label v-if="cardLayout === 'vertical'" class="forecast-info-filter__item">
1349
- <span>币种</span>
1474
+ <span>收支方向</span>
1350
1475
  <el-select
1351
- v-model="forecastFilterForm.currency"
1476
+ v-model="forecastFilterForm.direction"
1352
1477
  :append-to="overlayContainer || undefined"
1353
1478
  :persistent="false"
1354
1479
  size="small"
1355
1480
  placeholder="请选择"
1356
- filterable
1357
- allow-create
1358
- default-first-option
1359
1481
  clearable
1360
1482
  >
1361
- <el-option v-for="option in currencyOptions" :key="option.value" v-bind="option" />
1483
+ <el-option
1484
+ v-for="option in payDirectionOptions"
1485
+ :key="option.value"
1486
+ :label="option.label"
1487
+ :value="option.value"
1488
+ />
1362
1489
  </el-select>
1363
1490
  </label>
1364
1491
 
1365
1492
  <label v-if="cardLayout === 'vertical'" class="forecast-info-filter__item">
1366
- <span>核销状态</span>
1493
+ <span>币种</span>
1367
1494
  <el-select
1368
- v-model="forecastFilterForm.verifyStatus"
1495
+ v-model="forecastFilterForm.currency"
1369
1496
  :append-to="overlayContainer || undefined"
1370
1497
  :persistent="false"
1371
1498
  size="small"
1372
1499
  placeholder="请选择"
1500
+ filterable
1501
+ allow-create
1502
+ default-first-option
1373
1503
  clearable
1374
1504
  >
1375
- <el-option v-for="option in verifyStatusOptions" :key="option.value" v-bind="option" />
1505
+ <el-option
1506
+ v-for="option in currencyOptions"
1507
+ :key="option.value"
1508
+ :label="option.label"
1509
+ :value="option.value"
1510
+ />
1376
1511
  </el-select>
1377
1512
  </label>
1378
1513
  </div>
@@ -1392,6 +1527,33 @@ onBeforeUnmount(() => {
1392
1527
  </div>
1393
1528
 
1394
1529
  <section class="forecast-info-table-area" aria-label="外币预报信息列表">
1530
+ <div v-if="forecastSelectedRows.length" class="forecast-info-forecast-summary" aria-live="polite">
1531
+ <div class="forecast-info-forecast-summary__item">
1532
+ <span>预报收入总金额(元)</span>
1533
+ <strong>{{ forecastSelectionSummary.totalIncome }}</strong>
1534
+ </div>
1535
+ <div class="forecast-info-forecast-summary__item">
1536
+ <span>预报支出总金额(元)</span>
1537
+ <strong>{{ forecastSelectionSummary.totalExpense }}</strong>
1538
+ </div>
1539
+ <div class="forecast-info-forecast-summary__item">
1540
+ <span>预报轧差金额(元)</span>
1541
+ <strong>{{ forecastSelectionSummary.totalNet }}</strong>
1542
+ </div>
1543
+ <div class="forecast-info-forecast-summary__item">
1544
+ <span>未核销收入总金额(元)</span>
1545
+ <strong>{{ forecastSelectionSummary.unverifiedIncome }}</strong>
1546
+ </div>
1547
+ <div class="forecast-info-forecast-summary__item">
1548
+ <span>未核销支出总金额(元)</span>
1549
+ <strong>{{ forecastSelectionSummary.unverifiedExpense }}</strong>
1550
+ </div>
1551
+ <div class="forecast-info-forecast-summary__item">
1552
+ <span>未核销轧差金额(元)</span>
1553
+ <strong>{{ forecastSelectionSummary.unverifiedNet }}</strong>
1554
+ </div>
1555
+ </div>
1556
+
1395
1557
  <ElTablePro
1396
1558
  ref="forecastTable"
1397
1559
  v-model:page="forecastPage"
@@ -1416,6 +1578,17 @@ onBeforeUnmount(() => {
1416
1578
  @pagination-change="handleForecastPaginationChange"
1417
1579
  >
1418
1580
  <template #toolbar>
1581
+ <el-button
1582
+ type="primary"
1583
+ plain
1584
+ size="small"
1585
+ :icon="CircleCheck"
1586
+ :loading="activeOperation === 'autoVerify'"
1587
+ :disabled="operationLoading"
1588
+ @click="handleForecastAutoVerify"
1589
+ >
1590
+ 自动核销
1591
+ </el-button>
1419
1592
  <el-button
1420
1593
  type="success"
1421
1594
  plain
@@ -1529,6 +1702,25 @@ onBeforeUnmount(() => {
1529
1702
  />
1530
1703
  </label>
1531
1704
 
1705
+ <label class="forecast-info-filter__item">
1706
+ <span>筛选FTU</span>
1707
+ <el-select
1708
+ v-model="forecastFilterForm.ftuFilter"
1709
+ :append-to="overlayContainer || undefined"
1710
+ :persistent="false"
1711
+ size="small"
1712
+ placeholder="请选择"
1713
+ clearable
1714
+ >
1715
+ <el-option
1716
+ v-for="option in ftuFilterOptions"
1717
+ :key="option.value"
1718
+ :label="option.label"
1719
+ :value="option.value"
1720
+ />
1721
+ </el-select>
1722
+ </label>
1723
+
1532
1724
  <label class="forecast-info-filter__item">
1533
1725
  <span>收支方向</span>
1534
1726
  <el-select
@@ -1539,7 +1731,12 @@ onBeforeUnmount(() => {
1539
1731
  placeholder="请选择"
1540
1732
  clearable
1541
1733
  >
1542
- <el-option v-for="option in payDirectionOptions" :key="option.value" v-bind="option" />
1734
+ <el-option
1735
+ v-for="option in payDirectionOptions"
1736
+ :key="option.value"
1737
+ :label="option.label"
1738
+ :value="option.value"
1739
+ />
1543
1740
  </el-select>
1544
1741
  </label>
1545
1742
 
@@ -1556,7 +1753,12 @@ onBeforeUnmount(() => {
1556
1753
  default-first-option
1557
1754
  clearable
1558
1755
  >
1559
- <el-option v-for="option in currencyOptions" :key="option.value" v-bind="option" />
1756
+ <el-option
1757
+ v-for="option in currencyOptions"
1758
+ :key="option.value"
1759
+ :label="option.label"
1760
+ :value="option.value"
1761
+ />
1560
1762
  </el-select>
1561
1763
  </label>
1562
1764
 
@@ -1570,7 +1772,12 @@ onBeforeUnmount(() => {
1570
1772
  placeholder="请选择"
1571
1773
  clearable
1572
1774
  >
1573
- <el-option v-for="option in businessTypeOptions" :key="option.value" v-bind="option" />
1775
+ <el-option
1776
+ v-for="option in businessTypeOptions"
1777
+ :key="option.value"
1778
+ :label="option.label"
1779
+ :value="option.value"
1780
+ />
1574
1781
  </el-select>
1575
1782
  </label>
1576
1783
 
@@ -1584,7 +1791,12 @@ onBeforeUnmount(() => {
1584
1791
  placeholder="请选择"
1585
1792
  clearable
1586
1793
  >
1587
- <el-option v-for="option in forecastWayOptions" :key="option.value" v-bind="option" />
1794
+ <el-option
1795
+ v-for="option in forecastWayOptions"
1796
+ :key="option.value"
1797
+ :label="option.label"
1798
+ :value="option.value"
1799
+ />
1588
1800
  </el-select>
1589
1801
  </label>
1590
1802
 
@@ -1598,21 +1810,12 @@ onBeforeUnmount(() => {
1598
1810
  placeholder="请选择"
1599
1811
  clearable
1600
1812
  >
1601
- <el-option v-for="option in verifyStatusOptions" :key="option.value" v-bind="option" />
1602
- </el-select>
1603
- </label>
1604
-
1605
- <label class="forecast-info-filter__item">
1606
- <span>筛选FTU</span>
1607
- <el-select
1608
- v-model="forecastFilterForm.ftuFilter"
1609
- :append-to="overlayContainer || undefined"
1610
- :persistent="false"
1611
- size="small"
1612
- placeholder="请选择"
1613
- clearable
1614
- >
1615
- <el-option v-for="option in ftuFilterOptions" :key="option.value" v-bind="option" />
1813
+ <el-option
1814
+ v-for="option in verifyStatusOptions"
1815
+ :key="option.value"
1816
+ :label="option.label"
1817
+ :value="option.value"
1818
+ />
1616
1819
  </el-select>
1617
1820
  </label>
1618
1821
 
@@ -1747,7 +1950,7 @@ onBeforeUnmount(() => {
1747
1950
  />
1748
1951
  </label>
1749
1952
 
1750
- <label v-if="cardLayout === 'vertical'" class="forecast-info-filter__item">
1953
+ <label class="forecast-info-filter__item">
1751
1954
  <span>收支方向</span>
1752
1955
  <el-select
1753
1956
  v-model="flowFilterForm.direction"
@@ -1757,7 +1960,12 @@ onBeforeUnmount(() => {
1757
1960
  placeholder="请选择"
1758
1961
  clearable
1759
1962
  >
1760
- <el-option v-for="option in payDirectionOptions" :key="option.value" v-bind="option" />
1963
+ <el-option
1964
+ v-for="option in payDirectionOptions"
1965
+ :key="option.value"
1966
+ :label="option.label"
1967
+ :value="option.value"
1968
+ />
1761
1969
  </el-select>
1762
1970
  </label>
1763
1971
 
@@ -1774,7 +1982,12 @@ onBeforeUnmount(() => {
1774
1982
  default-first-option
1775
1983
  clearable
1776
1984
  >
1777
- <el-option v-for="option in currencyOptions" :key="option.value" v-bind="option" />
1985
+ <el-option
1986
+ v-for="option in currencyOptions"
1987
+ :key="option.value"
1988
+ :label="option.label"
1989
+ :value="option.value"
1990
+ />
1778
1991
  </el-select>
1779
1992
  </label>
1780
1993
 
@@ -1788,7 +2001,12 @@ onBeforeUnmount(() => {
1788
2001
  placeholder="请选择"
1789
2002
  clearable
1790
2003
  >
1791
- <el-option v-for="option in verifyStatusOptions" :key="option.value" v-bind="option" />
2004
+ <el-option
2005
+ v-for="option in verifyStatusOptions"
2006
+ :key="option.value"
2007
+ :label="option.label"
2008
+ :value="option.value"
2009
+ />
1792
2010
  </el-select>
1793
2011
  </label>
1794
2012
  </div>
@@ -1808,6 +2026,33 @@ onBeforeUnmount(() => {
1808
2026
  </div>
1809
2027
 
1810
2028
  <section class="forecast-info-table-area" aria-label="外币流水信息列表">
2029
+ <div v-if="flowSelectedRows.length" class="forecast-info-forecast-summary" aria-live="polite">
2030
+ <div class="forecast-info-forecast-summary__item">
2031
+ <span>流水收入总金额(元)</span>
2032
+ <strong>{{ flowSelectionSummary.totalIncome }}</strong>
2033
+ </div>
2034
+ <div class="forecast-info-forecast-summary__item">
2035
+ <span>流水支出总金额(元)</span>
2036
+ <strong>{{ flowSelectionSummary.totalExpense }}</strong>
2037
+ </div>
2038
+ <div class="forecast-info-forecast-summary__item">
2039
+ <span>流水轧差金额(元)</span>
2040
+ <strong>{{ flowSelectionSummary.totalNet }}</strong>
2041
+ </div>
2042
+ <div class="forecast-info-forecast-summary__item">
2043
+ <span>未核销收入总金额(元)</span>
2044
+ <strong>{{ flowSelectionSummary.unverifiedIncome }}</strong>
2045
+ </div>
2046
+ <div class="forecast-info-forecast-summary__item">
2047
+ <span>未核销支出总金额(元)</span>
2048
+ <strong>{{ flowSelectionSummary.unverifiedExpense }}</strong>
2049
+ </div>
2050
+ <div class="forecast-info-forecast-summary__item">
2051
+ <span>未核销轧差金额(元)</span>
2052
+ <strong>{{ flowSelectionSummary.unverifiedNet }}</strong>
2053
+ </div>
2054
+ </div>
2055
+
1811
2056
  <ElTablePro
1812
2057
  ref="flowTable"
1813
2058
  v-model:page="flowPage"
@@ -1832,8 +2077,28 @@ onBeforeUnmount(() => {
1832
2077
  @pagination-change="handleFlowPaginationChange"
1833
2078
  >
1834
2079
  <template #toolbar>
1835
- <el-button type="primary" plain size="small" :icon="Refresh">获取流水</el-button>
1836
- <el-button type="primary" plain size="small" :icon="Calendar">获取日终流水</el-button>
2080
+ <el-button
2081
+ type="primary"
2082
+ plain
2083
+ size="small"
2084
+ :icon="Refresh"
2085
+ :loading="activeOperation === 'fetchFlow'"
2086
+ :disabled="operationLoading"
2087
+ @click="handleFlowFetch('fetchFlow')"
2088
+ >
2089
+ 获取流水
2090
+ </el-button>
2091
+ <el-button
2092
+ type="primary"
2093
+ plain
2094
+ size="small"
2095
+ :icon="Calendar"
2096
+ :loading="activeOperation === 'fetchEndOfDayFlow'"
2097
+ :disabled="operationLoading"
2098
+ @click="handleFlowFetch('fetchEndOfDayFlow')"
2099
+ >
2100
+ 获取日终流水
2101
+ </el-button>
1837
2102
 
1838
2103
  <span v-if="flowSelectedRows.length" class="foreign-currency-settlement-selection-count">
1839
2104
  已选 {{ flowSelectedRows.length }} 笔
@@ -1933,7 +2198,12 @@ onBeforeUnmount(() => {
1933
2198
  placeholder="请选择"
1934
2199
  clearable
1935
2200
  >
1936
- <el-option v-for="option in payDirectionOptions" :key="option.value" v-bind="option" />
2201
+ <el-option
2202
+ v-for="option in payDirectionOptions"
2203
+ :key="option.value"
2204
+ :label="option.label"
2205
+ :value="option.value"
2206
+ />
1937
2207
  </el-select>
1938
2208
  </label>
1939
2209
 
@@ -1950,7 +2220,12 @@ onBeforeUnmount(() => {
1950
2220
  default-first-option
1951
2221
  clearable
1952
2222
  >
1953
- <el-option v-for="option in currencyOptions" :key="option.value" v-bind="option" />
2223
+ <el-option
2224
+ v-for="option in currencyOptions"
2225
+ :key="option.value"
2226
+ :label="option.label"
2227
+ :value="option.value"
2228
+ />
1954
2229
  </el-select>
1955
2230
  </label>
1956
2231
 
@@ -1970,7 +2245,12 @@ onBeforeUnmount(() => {
1970
2245
  collapse-tags-tooltip
1971
2246
  clearable
1972
2247
  >
1973
- <el-option v-for="option in messageTypeOptions" :key="option.value" v-bind="option" />
2248
+ <el-option
2249
+ v-for="option in messageTypeOptions"
2250
+ :key="option.value"
2251
+ :label="option.label"
2252
+ :value="option.value"
2253
+ />
1974
2254
  </el-select>
1975
2255
  </label>
1976
2256
 
@@ -1984,7 +2264,12 @@ onBeforeUnmount(() => {
1984
2264
  placeholder="请选择"
1985
2265
  clearable
1986
2266
  >
1987
- <el-option v-for="option in verifyStatusOptions" :key="option.value" v-bind="option" />
2267
+ <el-option
2268
+ v-for="option in verifyStatusOptions"
2269
+ :key="option.value"
2270
+ :label="option.label"
2271
+ :value="option.value"
2272
+ />
1988
2273
  </el-select>
1989
2274
  </label>
1990
2275