verce-vue-test 0.0.109 → 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.109",
3
+ "version": "0.0.110",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -37,6 +37,7 @@
37
37
  "@vitejs/plugin-vue": "^6.0.6",
38
38
  "@vue/tsconfig": "^0.9.1",
39
39
  "npm-run-all2": "^8.0.4",
40
+ "sass-embedded": "^1.100.0",
40
41
  "typescript": "~6.0.0",
41
42
  "vite": "^8.0.8",
42
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
+ }
@@ -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,52 +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 autoVerifyForeignSettlements(params: any) {
318
- await baseHttpClient.post<any>('/TAM/0001/120202001', params)
319
- }
320
-
321
- async function fetchForeignSettlementFlows(params: any) {
322
- await baseHttpClient.post<any>('/TAM/0001/120202004', params)
323
- }
324
-
325
- async function fetchForeignSettlementEndOfDayFlows(params: any) {
326
- await baseHttpClient.post<any>('/TAM/0001/120202005', params)
327
- }
328
-
329
- async function verifyForeignSettlements(params: any) {
330
- await baseHttpClient.post<any>('/TAM/0001/120202002', params)
331
- }
332
-
333
- async function cancelVerifyForeignSettlements(params: any) {
334
- await baseHttpClient.post<any>('/TAM/0001/120202003', params)
335
- }
336
-
337
299
  function useScopedMessage(resolveAppendTo: () => HTMLElement | null) {
338
300
  const activeHandles = new Set<any>()
339
301
 
@@ -408,7 +370,7 @@ const pageContainer = ref<HTMLElement | null>(null)
408
370
  const overlayContainer = ref<HTMLElement | null>(null)
409
371
  const isFullscreen = ref(false)
410
372
  /** 每个页面实例使用独立根节点,避免 KeepAlive 场景下分页浮层命中旧页面。 */
411
- const pageScopeId = `foreign-currency-settlement-page-${useId()}`
373
+ const pageScopeId = `foreign-currency-settlement-page-${getCurrentInstance()?.uid ?? 0}`
412
374
  const paginationAppendTo = computed(() => (isFullscreen.value ? `#${pageScopeId}` : undefined))
413
375
  const pageMessage = useScopedMessage(() => overlayContainer.value)
414
376
  const forecastSelectedRows = shallowRef<any[]>([])