verce-vue-test 0.0.86 → 0.0.88
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 +1 -1
- package/src/views/foreign-currency-settlement/api.ts +15 -0
- package/src/views/foreign-currency-settlement/components/ForeignSettlementFlowPanel.vue +51 -19
- package/src/views/foreign-currency-settlement/components/ForeignSettlementForecastPanel.vue +138 -30
- package/src/views/foreign-currency-settlement/index.vue +28 -1
- package/src/views/foreign-currency-settlement/store.ts +286 -0
- package/src/views/foreign-currency-settlement/types.ts +27 -0
- package/src/views/foreign-currency-settlement/utils.ts +17 -0
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import baseHttpClient, { type TamResponse } from '@/utils/baseHttpClient'
|
|
2
2
|
import type {
|
|
3
|
+
ForeignSettlementCancelVerifyRequest,
|
|
3
4
|
ForeignSettlementFlowQuery,
|
|
4
5
|
ForeignSettlementFlowRow,
|
|
5
6
|
ForeignSettlementForecastQuery,
|
|
6
7
|
ForeignSettlementForecastRow,
|
|
7
8
|
ForeignSettlementQueryResult,
|
|
9
|
+
ForeignSettlementVerifyRequest,
|
|
8
10
|
} from './types'
|
|
9
11
|
|
|
10
12
|
const FORECAST_QUERY_TRAN_CODE = '/TAM/0001/140202001'
|
|
11
13
|
const FLOW_QUERY_TRAN_CODE = '/TAM/0001/140202002'
|
|
14
|
+
const VERIFY_TRAN_CODE = '/TAM/0001/120202002'
|
|
15
|
+
const CANCEL_VERIFY_TRAN_CODE = '/TAM/0001/120202003'
|
|
12
16
|
|
|
13
17
|
type TamListBody<T extends object> = {
|
|
14
18
|
fileName?: string
|
|
@@ -75,3 +79,14 @@ export async function queryForeignSettlementFlows(
|
|
|
75
79
|
|
|
76
80
|
return normalizeListBody(response.body, '外币流水信息接口返回结构不正确')
|
|
77
81
|
}
|
|
82
|
+
|
|
83
|
+
/** 外币操作接口的响应业务体为空,baseHttpClient 已统一校验 TAM 响应头。 */
|
|
84
|
+
export async function verifyForeignSettlements(params: ForeignSettlementVerifyRequest) {
|
|
85
|
+
await baseHttpClient.post<TamResponse<Record<string, never>>>(VERIFY_TRAN_CODE, params)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export async function cancelVerifyForeignSettlements(
|
|
89
|
+
params: ForeignSettlementCancelVerifyRequest,
|
|
90
|
+
) {
|
|
91
|
+
await baseHttpClient.post<TamResponse<Record<string, never>>>(CANCEL_VERIFY_TRAN_CODE, params)
|
|
92
|
+
}
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
onMounted,
|
|
7
7
|
reactive,
|
|
8
8
|
ref,
|
|
9
|
+
watch,
|
|
9
10
|
} from 'vue'
|
|
11
|
+
import { storeToRefs } from 'pinia'
|
|
10
12
|
import { FullScreen, InfoFilled, Search } from '@element-plus/icons-vue'
|
|
11
13
|
import { queryForeignSettlementFlows } from '../api'
|
|
12
14
|
import {
|
|
@@ -31,6 +33,7 @@ import {
|
|
|
31
33
|
toForeignSettlementAmountText,
|
|
32
34
|
} from '../utils'
|
|
33
35
|
import { useScopedMessage } from '../../ForecastInfo/useScopedMessage'
|
|
36
|
+
import { useForeignSettlementStore } from '../store'
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
* 外币流水信息业务面板。
|
|
@@ -40,6 +43,7 @@ const props = defineProps<{
|
|
|
40
43
|
layout: ForeignSettlementCardLayout
|
|
41
44
|
layoutOptions: ForeignSettlementLayoutOption[]
|
|
42
45
|
isFullscreen: boolean
|
|
46
|
+
isActive: boolean
|
|
43
47
|
overlayContainer: HTMLElement | null
|
|
44
48
|
}>()
|
|
45
49
|
|
|
@@ -49,14 +53,18 @@ const emit = defineEmits<{
|
|
|
49
53
|
}>()
|
|
50
54
|
|
|
51
55
|
const pageMessage = useScopedMessage(() => props.overlayContainer)
|
|
56
|
+
const foreignSettlementStore = useForeignSettlementStore()
|
|
57
|
+
const {
|
|
58
|
+
flowSelectedRows: selectedRows,
|
|
59
|
+
tableSelectionResetKey,
|
|
60
|
+
listRefreshKey,
|
|
61
|
+
} = storeToRefs(foreignSettlementStore)
|
|
52
62
|
const filterForm = reactive(createDefaultForeignSettlementFilter())
|
|
53
63
|
const page = ref(1)
|
|
54
64
|
const pageSize = ref(10)
|
|
55
65
|
const loading = ref(false)
|
|
56
66
|
const total = ref(0)
|
|
57
67
|
const rows = ref<ForeignSettlementFlowRow[]>([])
|
|
58
|
-
const selectedRows = ref<ForeignSettlementFlowRow[]>([])
|
|
59
|
-
const selectionResetKey = ref(0)
|
|
60
68
|
const filterDrawerVisible = ref(false)
|
|
61
69
|
|
|
62
70
|
type TableOverlayController = {
|
|
@@ -66,7 +74,20 @@ type TableOverlayController = {
|
|
|
66
74
|
const flowTable = ref<TableOverlayController | null>(null)
|
|
67
75
|
|
|
68
76
|
let requestController: AbortController | null = null
|
|
69
|
-
let panelActive =
|
|
77
|
+
let panelActive = props.isActive
|
|
78
|
+
let pendingOperationRefresh = false
|
|
79
|
+
|
|
80
|
+
function activatePanel() {
|
|
81
|
+
panelActive = props.isActive
|
|
82
|
+
if (!panelActive || !pendingOperationRefresh) return
|
|
83
|
+
pendingOperationRefresh = false
|
|
84
|
+
void loadFlows()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function deactivatePanel() {
|
|
88
|
+
panelActive = false
|
|
89
|
+
closeTransientOverlays()
|
|
90
|
+
}
|
|
70
91
|
|
|
71
92
|
function buildQuery(): ForeignSettlementFlowQuery {
|
|
72
93
|
const [startAmount, endAmount] = filterForm.amountRange
|
|
@@ -106,8 +127,7 @@ function validateFilter() {
|
|
|
106
127
|
}
|
|
107
128
|
|
|
108
129
|
function resetSelection() {
|
|
109
|
-
|
|
110
|
-
selectedRows.value = []
|
|
130
|
+
foreignSettlementStore.resetAllTableSelections()
|
|
111
131
|
}
|
|
112
132
|
|
|
113
133
|
function cancelPendingRequest() {
|
|
@@ -118,6 +138,7 @@ function cancelPendingRequest() {
|
|
|
118
138
|
|
|
119
139
|
async function loadFlows(showSuccessMessage = false) {
|
|
120
140
|
requestController?.abort()
|
|
141
|
+
resetSelection()
|
|
121
142
|
const controller = new AbortController()
|
|
122
143
|
requestController = controller
|
|
123
144
|
loading.value = true
|
|
@@ -134,7 +155,6 @@ async function loadFlows(showSuccessMessage = false) {
|
|
|
134
155
|
|
|
135
156
|
rows.value = result.resultList
|
|
136
157
|
total.value = result.totalCount
|
|
137
|
-
resetSelection()
|
|
138
158
|
if (showSuccessMessage) pageMessage.success('已查询流水信息')
|
|
139
159
|
return true
|
|
140
160
|
} catch (error) {
|
|
@@ -172,7 +192,7 @@ function handlePaginationChange(pagination: { page: number; pageSize: number })
|
|
|
172
192
|
}
|
|
173
193
|
|
|
174
194
|
function handleSelectionChange(selection: ForeignSettlementFlowRow[]) {
|
|
175
|
-
|
|
195
|
+
foreignSettlementStore.setFlowSelectedRows(selection)
|
|
176
196
|
}
|
|
177
197
|
|
|
178
198
|
function getSequence(index: number) {
|
|
@@ -189,18 +209,30 @@ function closeTransientOverlays() {
|
|
|
189
209
|
defineExpose({ closeTransientOverlays })
|
|
190
210
|
|
|
191
211
|
onMounted(() => {
|
|
192
|
-
void loadFlows()
|
|
212
|
+
if (panelActive) void loadFlows()
|
|
193
213
|
})
|
|
194
|
-
onActivated(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
214
|
+
onActivated(activatePanel)
|
|
215
|
+
onDeactivated(deactivatePanel)
|
|
216
|
+
onBeforeUnmount(deactivatePanel)
|
|
217
|
+
|
|
218
|
+
watch(
|
|
219
|
+
() => props.isActive,
|
|
220
|
+
(active) => {
|
|
221
|
+
if (!active) {
|
|
222
|
+
deactivatePanel()
|
|
223
|
+
return
|
|
224
|
+
}
|
|
225
|
+
activatePanel()
|
|
226
|
+
},
|
|
227
|
+
{ flush: 'sync' },
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
watch(listRefreshKey, () => {
|
|
231
|
+
if (!panelActive) {
|
|
232
|
+
pendingOperationRefresh = true
|
|
233
|
+
return
|
|
234
|
+
}
|
|
235
|
+
void loadFlows()
|
|
204
236
|
})
|
|
205
237
|
</script>
|
|
206
238
|
|
|
@@ -304,7 +336,7 @@ onBeforeUnmount(() => {
|
|
|
304
336
|
:data="rows"
|
|
305
337
|
:total="total"
|
|
306
338
|
:page-sizes="[10, 20, 50, 100]"
|
|
307
|
-
:selection-reset-key="
|
|
339
|
+
:selection-reset-key="tableSelectionResetKey"
|
|
308
340
|
:append-to="overlayContainer || undefined"
|
|
309
341
|
table-key="foreign-currency-settlement-flow-info"
|
|
310
342
|
row-key="tranRefNo"
|
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
onMounted,
|
|
7
7
|
reactive,
|
|
8
8
|
ref,
|
|
9
|
+
watch,
|
|
9
10
|
} from 'vue'
|
|
11
|
+
import { storeToRefs } from 'pinia'
|
|
12
|
+
import { ElMessageBox } from 'element-plus'
|
|
10
13
|
import {
|
|
11
14
|
CircleCheck,
|
|
12
15
|
DataAnalysis,
|
|
@@ -39,6 +42,7 @@ import {
|
|
|
39
42
|
toForeignSettlementAmountText,
|
|
40
43
|
} from '../utils'
|
|
41
44
|
import { useScopedMessage } from '../../ForecastInfo/useScopedMessage'
|
|
45
|
+
import { useForeignSettlementStore } from '../store'
|
|
42
46
|
|
|
43
47
|
/**
|
|
44
48
|
* 外币预报信息业务面板。
|
|
@@ -48,6 +52,7 @@ const props = defineProps<{
|
|
|
48
52
|
layout: ForeignSettlementCardLayout
|
|
49
53
|
layoutOptions: ForeignSettlementLayoutOption[]
|
|
50
54
|
isFullscreen: boolean
|
|
55
|
+
isActive: boolean
|
|
51
56
|
overlayContainer: HTMLElement | null
|
|
52
57
|
}>()
|
|
53
58
|
|
|
@@ -57,14 +62,20 @@ const emit = defineEmits<{
|
|
|
57
62
|
}>()
|
|
58
63
|
|
|
59
64
|
const pageMessage = useScopedMessage(() => props.overlayContainer)
|
|
65
|
+
const foreignSettlementStore = useForeignSettlementStore()
|
|
66
|
+
const {
|
|
67
|
+
forecastSelectedRows: selectedRows,
|
|
68
|
+
tableSelectionResetKey,
|
|
69
|
+
listRefreshKey,
|
|
70
|
+
activeOperation,
|
|
71
|
+
operationLoading,
|
|
72
|
+
} = storeToRefs(foreignSettlementStore)
|
|
60
73
|
const filterForm = reactive(createDefaultForeignSettlementFilter())
|
|
61
74
|
const page = ref(1)
|
|
62
75
|
const pageSize = ref(10)
|
|
63
76
|
const loading = ref(false)
|
|
64
77
|
const total = ref(0)
|
|
65
78
|
const rows = ref<ForeignSettlementForecastRow[]>([])
|
|
66
|
-
const selectedRows = ref<ForeignSettlementForecastRow[]>([])
|
|
67
|
-
const selectionResetKey = ref(0)
|
|
68
79
|
const filterDrawerVisible = ref(false)
|
|
69
80
|
|
|
70
81
|
type TableOverlayController = {
|
|
@@ -74,7 +85,20 @@ type TableOverlayController = {
|
|
|
74
85
|
const forecastTable = ref<TableOverlayController | null>(null)
|
|
75
86
|
|
|
76
87
|
let requestController: AbortController | null = null
|
|
77
|
-
let panelActive =
|
|
88
|
+
let panelActive = props.isActive
|
|
89
|
+
let pendingOperationRefresh = false
|
|
90
|
+
|
|
91
|
+
function activatePanel() {
|
|
92
|
+
panelActive = props.isActive
|
|
93
|
+
if (!panelActive || !pendingOperationRefresh) return
|
|
94
|
+
pendingOperationRefresh = false
|
|
95
|
+
void loadForecasts()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function deactivatePanel() {
|
|
99
|
+
panelActive = false
|
|
100
|
+
closeTransientOverlays()
|
|
101
|
+
}
|
|
78
102
|
|
|
79
103
|
function buildQuery(): ForeignSettlementForecastQuery {
|
|
80
104
|
const [startAmount, endAmount] = filterForm.amountRange
|
|
@@ -116,8 +140,7 @@ function validateFilter() {
|
|
|
116
140
|
}
|
|
117
141
|
|
|
118
142
|
function resetSelection() {
|
|
119
|
-
|
|
120
|
-
selectedRows.value = []
|
|
143
|
+
foreignSettlementStore.resetAllTableSelections()
|
|
121
144
|
}
|
|
122
145
|
|
|
123
146
|
function cancelPendingRequest() {
|
|
@@ -128,6 +151,7 @@ function cancelPendingRequest() {
|
|
|
128
151
|
|
|
129
152
|
async function loadForecasts(showSuccessMessage = false) {
|
|
130
153
|
requestController?.abort()
|
|
154
|
+
resetSelection()
|
|
131
155
|
const controller = new AbortController()
|
|
132
156
|
requestController = controller
|
|
133
157
|
loading.value = true
|
|
@@ -144,7 +168,6 @@ async function loadForecasts(showSuccessMessage = false) {
|
|
|
144
168
|
|
|
145
169
|
rows.value = result.resultList
|
|
146
170
|
total.value = result.totalCount
|
|
147
|
-
resetSelection()
|
|
148
171
|
if (showSuccessMessage) pageMessage.success('已查询预报信息')
|
|
149
172
|
return true
|
|
150
173
|
} catch (error) {
|
|
@@ -182,7 +205,67 @@ function handlePaginationChange(pagination: { page: number; pageSize: number })
|
|
|
182
205
|
}
|
|
183
206
|
|
|
184
207
|
function handleSelectionChange(selection: ForeignSettlementForecastRow[]) {
|
|
185
|
-
|
|
208
|
+
foreignSettlementStore.setForecastSelectedRows(selection)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async function handleForecastVerify() {
|
|
212
|
+
const validation = foreignSettlementStore.validateVerifySelectedRows()
|
|
213
|
+
if (!validation.success) {
|
|
214
|
+
pageMessage.warning(validation.message)
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
try {
|
|
219
|
+
await ElMessageBox.confirm('您是否确定核销?', '提示', {
|
|
220
|
+
appendTo: props.overlayContainer || undefined,
|
|
221
|
+
confirmButtonText: '确定',
|
|
222
|
+
cancelButtonText: '取消',
|
|
223
|
+
type: 'warning',
|
|
224
|
+
})
|
|
225
|
+
} catch {
|
|
226
|
+
return
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
try {
|
|
230
|
+
const result = await foreignSettlementStore.verifySelectedRows()
|
|
231
|
+
if (!panelActive) return
|
|
232
|
+
pageMessage[result.success ? 'success' : 'warning'](result.message)
|
|
233
|
+
} catch (error) {
|
|
234
|
+
foreignSettlementStore.refreshOperationLists()
|
|
235
|
+
if (panelActive) {
|
|
236
|
+
pageMessage.error(error instanceof Error ? error.message : '核销失败,请稍后重试')
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async function handleForecastCancelVerify() {
|
|
242
|
+
const validation = foreignSettlementStore.validateCancelVerifySelectedRows()
|
|
243
|
+
if (!validation.success) {
|
|
244
|
+
pageMessage.warning(validation.message)
|
|
245
|
+
return
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
try {
|
|
249
|
+
await ElMessageBox.confirm('您是否确定撤销核销?', '提示', {
|
|
250
|
+
appendTo: props.overlayContainer || undefined,
|
|
251
|
+
confirmButtonText: '确定',
|
|
252
|
+
cancelButtonText: '取消',
|
|
253
|
+
type: 'warning',
|
|
254
|
+
})
|
|
255
|
+
} catch {
|
|
256
|
+
return
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
try {
|
|
260
|
+
const result = await foreignSettlementStore.cancelVerifySelectedRows()
|
|
261
|
+
if (!panelActive) return
|
|
262
|
+
pageMessage[result.success ? 'success' : 'warning'](result.message)
|
|
263
|
+
} catch (error) {
|
|
264
|
+
foreignSettlementStore.refreshOperationLists()
|
|
265
|
+
if (panelActive) {
|
|
266
|
+
pageMessage.error(error instanceof Error ? error.message : '撤销核销失败,请稍后重试')
|
|
267
|
+
}
|
|
268
|
+
}
|
|
186
269
|
}
|
|
187
270
|
|
|
188
271
|
function getSequence(index: number) {
|
|
@@ -192,6 +275,7 @@ function getSequence(index: number) {
|
|
|
192
275
|
function closeTransientOverlays() {
|
|
193
276
|
cancelPendingRequest()
|
|
194
277
|
filterDrawerVisible.value = false
|
|
278
|
+
ElMessageBox.close()
|
|
195
279
|
forecastTable.value?.closeTransientOverlays()
|
|
196
280
|
pageMessage.closeAll()
|
|
197
281
|
}
|
|
@@ -199,18 +283,30 @@ function closeTransientOverlays() {
|
|
|
199
283
|
defineExpose({ closeTransientOverlays })
|
|
200
284
|
|
|
201
285
|
onMounted(() => {
|
|
202
|
-
void loadForecasts()
|
|
203
|
-
})
|
|
204
|
-
onActivated(() => {
|
|
205
|
-
panelActive = true
|
|
286
|
+
if (panelActive) void loadForecasts()
|
|
206
287
|
})
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
288
|
+
onActivated(activatePanel)
|
|
289
|
+
onDeactivated(deactivatePanel)
|
|
290
|
+
onBeforeUnmount(deactivatePanel)
|
|
291
|
+
|
|
292
|
+
watch(
|
|
293
|
+
() => props.isActive,
|
|
294
|
+
(active) => {
|
|
295
|
+
if (!active) {
|
|
296
|
+
deactivatePanel()
|
|
297
|
+
return
|
|
298
|
+
}
|
|
299
|
+
activatePanel()
|
|
300
|
+
},
|
|
301
|
+
{ flush: 'sync' },
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
watch(listRefreshKey, () => {
|
|
305
|
+
if (!panelActive) {
|
|
306
|
+
pendingOperationRefresh = true
|
|
307
|
+
return
|
|
308
|
+
}
|
|
309
|
+
void loadForecasts()
|
|
214
310
|
})
|
|
215
311
|
</script>
|
|
216
312
|
|
|
@@ -314,7 +410,7 @@ onBeforeUnmount(() => {
|
|
|
314
410
|
:data="rows"
|
|
315
411
|
:total="total"
|
|
316
412
|
:page-sizes="[10, 20, 50, 100]"
|
|
317
|
-
:selection-reset-key="
|
|
413
|
+
:selection-reset-key="tableSelectionResetKey"
|
|
318
414
|
:append-to="overlayContainer || undefined"
|
|
319
415
|
table-key="foreign-currency-settlement-forecast-info"
|
|
320
416
|
row-key="predRefNo"
|
|
@@ -329,21 +425,33 @@ onBeforeUnmount(() => {
|
|
|
329
425
|
@pagination-change="handlePaginationChange"
|
|
330
426
|
>
|
|
331
427
|
<template #toolbar>
|
|
332
|
-
<el-tooltip content="
|
|
428
|
+
<el-tooltip content="待提供外币匡算接口后启用" placement="top" :append-to="overlayContainer || undefined">
|
|
333
429
|
<span class="foreign-currency-settlement-disabled-action">
|
|
334
430
|
<el-button type="primary" plain size="small" :icon="DataAnalysis" disabled>匡算</el-button>
|
|
335
431
|
</span>
|
|
336
432
|
</el-tooltip>
|
|
337
|
-
<el-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
433
|
+
<el-button
|
|
434
|
+
type="success"
|
|
435
|
+
plain
|
|
436
|
+
size="small"
|
|
437
|
+
:icon="CircleCheck"
|
|
438
|
+
:loading="activeOperation === 'verify'"
|
|
439
|
+
:disabled="operationLoading"
|
|
440
|
+
@click="handleForecastVerify"
|
|
441
|
+
>
|
|
442
|
+
核销
|
|
443
|
+
</el-button>
|
|
444
|
+
<el-button
|
|
445
|
+
type="danger"
|
|
446
|
+
plain
|
|
447
|
+
size="small"
|
|
448
|
+
:icon="RefreshLeft"
|
|
449
|
+
:loading="activeOperation === 'cancelVerify'"
|
|
450
|
+
:disabled="operationLoading"
|
|
451
|
+
@click="handleForecastCancelVerify"
|
|
452
|
+
>
|
|
453
|
+
撤销核销
|
|
454
|
+
</el-button>
|
|
347
455
|
|
|
348
456
|
<span v-if="selectedRows.length" class="foreign-currency-settlement-selection-count">
|
|
349
457
|
已选 {{ selectedRows.length }} 笔
|
|
@@ -24,6 +24,7 @@ import type {
|
|
|
24
24
|
ForeignSettlementLayoutOption,
|
|
25
25
|
} from './types'
|
|
26
26
|
import { useScopedMessage } from '../ForecastInfo/useScopedMessage'
|
|
27
|
+
import { useForeignSettlementStore } from './store'
|
|
27
28
|
import '../ForecastInfo/forecast-info.css'
|
|
28
29
|
import './foreign-currency-settlement.css'
|
|
29
30
|
|
|
@@ -31,7 +32,23 @@ const layoutOptions: ForeignSettlementLayoutOption[] = [
|
|
|
31
32
|
{ label: '上下卡片', value: 'vertical', icon: Menu },
|
|
32
33
|
{ label: '左右卡片', value: 'horizontal', icon: Grid },
|
|
33
34
|
]
|
|
34
|
-
const
|
|
35
|
+
const CARD_LAYOUT_STORAGE_KEY = 'foreign-currency-settlement:card-layout'
|
|
36
|
+
const DEFAULT_CARD_LAYOUT: ForeignSettlementCardLayout = 'horizontal'
|
|
37
|
+
|
|
38
|
+
function restoreCardLayout(): ForeignSettlementCardLayout {
|
|
39
|
+
if (typeof window === 'undefined') return DEFAULT_CARD_LAYOUT
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const storedLayout = window.localStorage.getItem(CARD_LAYOUT_STORAGE_KEY)
|
|
43
|
+
if (storedLayout === 'horizontal' || storedLayout === 'vertical') return storedLayout
|
|
44
|
+
} catch {
|
|
45
|
+
// 浏览器禁用本地存储时继续使用默认布局,不影响页面进入。
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return DEFAULT_CARD_LAYOUT
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const cardLayout = ref<ForeignSettlementCardLayout>(restoreCardLayout())
|
|
35
52
|
|
|
36
53
|
/**
|
|
37
54
|
* 与人民币手工核销保持相同的父子职责:路由页只组合两个业务组件,
|
|
@@ -44,6 +61,7 @@ const pageContainer = ref<HTMLElement | null>(null)
|
|
|
44
61
|
const overlayContainer = ref<HTMLElement | null>(null)
|
|
45
62
|
const isFullscreen = ref(false)
|
|
46
63
|
const pageMessage = useScopedMessage(() => overlayContainer.value)
|
|
64
|
+
const foreignSettlementStore = useForeignSettlementStore()
|
|
47
65
|
let isListeningFullscreenChange = false
|
|
48
66
|
let fullscreenOperationGeneration = 0
|
|
49
67
|
|
|
@@ -111,12 +129,19 @@ async function toggleFullscreen() {
|
|
|
111
129
|
|
|
112
130
|
function setCardLayout(layout: ForeignSettlementCardLayout) {
|
|
113
131
|
cardLayout.value = layout
|
|
132
|
+
|
|
133
|
+
try {
|
|
134
|
+
window.localStorage.setItem(CARD_LAYOUT_STORAGE_KEY, layout)
|
|
135
|
+
} catch {
|
|
136
|
+
// 本地存储不可用时仅保留本次页面状态。
|
|
137
|
+
}
|
|
114
138
|
}
|
|
115
139
|
|
|
116
140
|
function closePageTransientOverlays() {
|
|
117
141
|
fullscreenOperationGeneration += 1
|
|
118
142
|
const cleanupTasks = [
|
|
119
143
|
() => pageMessage.closeAll(),
|
|
144
|
+
() => foreignSettlementStore.resetAllTableSelections(),
|
|
120
145
|
() => forecastPanel.value?.closeTransientOverlays(),
|
|
121
146
|
() => flowPanel.value?.closeTransientOverlays(),
|
|
122
147
|
]
|
|
@@ -185,6 +210,7 @@ onBeforeUnmount(() => {
|
|
|
185
210
|
:layout-options="layoutOptions"
|
|
186
211
|
:overlay-container="overlayContainer"
|
|
187
212
|
:is-fullscreen="isFullscreen"
|
|
213
|
+
:is-active="isCurrentRoute"
|
|
188
214
|
@change-layout="setCardLayout"
|
|
189
215
|
@toggle-fullscreen="toggleFullscreen"
|
|
190
216
|
/>
|
|
@@ -194,6 +220,7 @@ onBeforeUnmount(() => {
|
|
|
194
220
|
:layout-options="layoutOptions"
|
|
195
221
|
:overlay-container="overlayContainer"
|
|
196
222
|
:is-fullscreen="isFullscreen"
|
|
223
|
+
:is-active="isCurrentRoute"
|
|
197
224
|
@change-layout="setCardLayout"
|
|
198
225
|
@toggle-fullscreen="toggleFullscreen"
|
|
199
226
|
/>
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { computed, ref } from 'vue'
|
|
2
|
+
import { acceptHMRUpdate, defineStore } from 'pinia'
|
|
3
|
+
import {
|
|
4
|
+
cancelVerifyForeignSettlements,
|
|
5
|
+
verifyForeignSettlements,
|
|
6
|
+
} from './api'
|
|
7
|
+
import type {
|
|
8
|
+
ForeignSettlementCancelVerifyRequest,
|
|
9
|
+
ForeignSettlementFlowRow,
|
|
10
|
+
ForeignSettlementForecastRow,
|
|
11
|
+
ForeignSettlementOperationResult,
|
|
12
|
+
ForeignSettlementVerifyRequest,
|
|
13
|
+
} from './types'
|
|
14
|
+
import {
|
|
15
|
+
normalizeVerifyStatus,
|
|
16
|
+
toForeignSettlementOperationAmount,
|
|
17
|
+
toForeignSettlementOperationDate,
|
|
18
|
+
toForeignSettlementProtocolVerifyStatus,
|
|
19
|
+
} from './utils'
|
|
20
|
+
|
|
21
|
+
type VerificationAction = 'verify' | 'cancelVerify'
|
|
22
|
+
const cancelVerifyForecastStatuses = new Set(['VS02', 'VS03'])
|
|
23
|
+
|
|
24
|
+
function hasText(value: unknown) {
|
|
25
|
+
return String(value ?? '').trim().length > 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getLastSelectedRow<T>(rows: T[]) {
|
|
29
|
+
return rows[rows.length - 1]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** JSP 使用字符串大于号按预报流水号升序排列,五个预报平行字段必须共用同一顺序。 */
|
|
33
|
+
function sortForecastRows(rows: ForeignSettlementForecastRow[]) {
|
|
34
|
+
return [...rows].sort((left, right) => {
|
|
35
|
+
const leftRefNo = String(left.predRefNo ?? '')
|
|
36
|
+
const rightRefNo = String(right.predRefNo ?? '')
|
|
37
|
+
if (leftRefNo > rightRefNo) return 1
|
|
38
|
+
if (leftRefNo < rightRefNo) return -1
|
|
39
|
+
return 0
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function normalizeLegacyComparisonValue(value: unknown) {
|
|
44
|
+
return value === undefined || value === null ? null : String(value).trim()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function hasCompleteForecastSnapshot(row: ForeignSettlementForecastRow) {
|
|
48
|
+
return [
|
|
49
|
+
row.predRefNo,
|
|
50
|
+
row.predAmt,
|
|
51
|
+
row.verifyAmt,
|
|
52
|
+
toForeignSettlementProtocolVerifyStatus(row.verifyStatus),
|
|
53
|
+
row.tranDate,
|
|
54
|
+
].every(hasText)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function hasCompleteFlowSnapshot(row: ForeignSettlementFlowRow) {
|
|
58
|
+
return [
|
|
59
|
+
row.tranRefNo,
|
|
60
|
+
row.notVerifyAmt,
|
|
61
|
+
toForeignSettlementProtocolVerifyStatus(row.verifyStatus),
|
|
62
|
+
row.valueDate,
|
|
63
|
+
].every(hasText)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const useForeignSettlementStore = defineStore('foreign-currency-settlement', () => {
|
|
67
|
+
const forecastSelectedRows = ref<ForeignSettlementForecastRow[]>([])
|
|
68
|
+
const flowSelectedRows = ref<ForeignSettlementFlowRow[]>([])
|
|
69
|
+
const tableSelectionResetKey = ref(0)
|
|
70
|
+
const listRefreshKey = ref(0)
|
|
71
|
+
const activeOperation = ref<VerificationAction | null>(null)
|
|
72
|
+
|
|
73
|
+
const forecastHasSelectedRows = computed(() => forecastSelectedRows.value.length > 0)
|
|
74
|
+
const operationLoading = computed(() => activeOperation.value !== null)
|
|
75
|
+
|
|
76
|
+
function setForecastSelectedRows(rows: ForeignSettlementForecastRow[]) {
|
|
77
|
+
forecastSelectedRows.value = rows
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function setFlowSelectedRows(rows: ForeignSettlementFlowRow[]) {
|
|
81
|
+
flowSelectedRows.value = rows
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** 任一列表数据发生替换时,两张表的跨表选择必须一起失效。 */
|
|
85
|
+
function resetAllTableSelections() {
|
|
86
|
+
forecastSelectedRows.value = []
|
|
87
|
+
flowSelectedRows.value = []
|
|
88
|
+
tableSelectionResetKey.value += 1
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function validateSelection(action: VerificationAction): ForeignSettlementOperationResult {
|
|
92
|
+
if (forecastSelectedRows.value.length === 0) {
|
|
93
|
+
return {
|
|
94
|
+
success: false,
|
|
95
|
+
message: action === 'verify'
|
|
96
|
+
? '请至少选择一条预报记录!'
|
|
97
|
+
: '请勾选一条已核销预报信息后撤销!',
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (
|
|
101
|
+
action === 'verify'
|
|
102
|
+
&& forecastSelectedRows.value.some((row) => normalizeVerifyStatus(row.verifyStatus) === 'VS03')
|
|
103
|
+
) {
|
|
104
|
+
return {
|
|
105
|
+
success: false,
|
|
106
|
+
message: '不允许选择已核销的预报记录!',
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (flowSelectedRows.value.length === 0) {
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
message: action === 'verify'
|
|
113
|
+
? '请至少选择一条流水记录!'
|
|
114
|
+
: '请勾选一条已核销流水信息后撤销!',
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (action === 'cancelVerify' && forecastSelectedRows.value.length !== 1) {
|
|
118
|
+
return { success: false, message: '不能选择多行预报!' }
|
|
119
|
+
}
|
|
120
|
+
if (
|
|
121
|
+
action === 'verify'
|
|
122
|
+
&& flowSelectedRows.value.some((row) => normalizeVerifyStatus(row.verifyStatus) === 'VS03')
|
|
123
|
+
) {
|
|
124
|
+
return {
|
|
125
|
+
success: false,
|
|
126
|
+
message: '不允许选择已核销的流水记录!',
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (action === 'verify') {
|
|
131
|
+
// 老 JSP 的三个辅助函数均返回选择数组的最后一条,仅比较两表最后一条记录。
|
|
132
|
+
const forecast = getLastSelectedRow(forecastSelectedRows.value)
|
|
133
|
+
const flow = getLastSelectedRow(flowSelectedRows.value)
|
|
134
|
+
const forecastDirection = normalizeLegacyComparisonValue(forecast?.payDirec)
|
|
135
|
+
const flowDirection = normalizeLegacyComparisonValue(flow?.direction)
|
|
136
|
+
if (
|
|
137
|
+
forecastDirection !== null
|
|
138
|
+
&& flowDirection !== null
|
|
139
|
+
&& forecastDirection !== flowDirection
|
|
140
|
+
) {
|
|
141
|
+
return { success: false, message: '收支方向不统一!' }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const forecastCurrency = normalizeLegacyComparisonValue(forecast?.ccy)
|
|
145
|
+
const flowCurrency = normalizeLegacyComparisonValue(flow?.ccy)
|
|
146
|
+
if (
|
|
147
|
+
forecastCurrency !== null
|
|
148
|
+
&& flowCurrency !== null
|
|
149
|
+
&& forecastCurrency !== flowCurrency
|
|
150
|
+
) {
|
|
151
|
+
return { success: false, message: '币种不一致!' }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const forecastValueDate = normalizeLegacyComparisonValue(forecast?.tranDate)
|
|
155
|
+
const flowValueDate = normalizeLegacyComparisonValue(flow?.valueDate)
|
|
156
|
+
if (
|
|
157
|
+
forecastValueDate !== null
|
|
158
|
+
&& flowValueDate !== null
|
|
159
|
+
&& forecastValueDate !== flowValueDate
|
|
160
|
+
) {
|
|
161
|
+
return { success: false, message: '起息日不一致!' }
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (
|
|
166
|
+
action === 'cancelVerify'
|
|
167
|
+
&& !cancelVerifyForecastStatuses.has(
|
|
168
|
+
normalizeVerifyStatus(forecastSelectedRows.value[0]?.verifyStatus),
|
|
169
|
+
)
|
|
170
|
+
) {
|
|
171
|
+
return { success: false, message: '请勾选一条已核销预报信息后撤销!' }
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (action === 'verify' && forecastSelectedRows.value.some((row) => !hasCompleteForecastSnapshot(row))) {
|
|
175
|
+
return { success: false, message: '所选预报信息缺少核销接口必填字段,请刷新后重试' }
|
|
176
|
+
}
|
|
177
|
+
if (action === 'verify' && flowSelectedRows.value.some((row) => !hasCompleteFlowSnapshot(row))) {
|
|
178
|
+
return { success: false, message: '所选流水信息缺少核销接口必填字段,请刷新后重试' }
|
|
179
|
+
}
|
|
180
|
+
if (
|
|
181
|
+
action === 'cancelVerify'
|
|
182
|
+
&& (!hasText(forecastSelectedRows.value[0]?.predRefNo)
|
|
183
|
+
|| !hasText(forecastSelectedRows.value[0]?.verifyAmt)
|
|
184
|
+
|| flowSelectedRows.value.some((row) => !hasText(row.tranRefNo)))
|
|
185
|
+
) {
|
|
186
|
+
return { success: false, message: '所选数据缺少撤销核销接口必填字段,请刷新后重试' }
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return { success: true, message: '' }
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function buildVerifyRequest(): ForeignSettlementVerifyRequest {
|
|
193
|
+
const forecasts = sortForecastRows(forecastSelectedRows.value)
|
|
194
|
+
const flows = flowSelectedRows.value
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
predIds: forecasts.map((row) => String(row.predRefNo).trim()).join(','),
|
|
198
|
+
tranSeqIds: flows.map((row) => String(row.tranRefNo).trim()).join(','),
|
|
199
|
+
predAmts: forecasts.map((row) => toForeignSettlementOperationAmount(row.predAmt)).join(','),
|
|
200
|
+
verifyAmts: forecasts.map((row) => toForeignSettlementOperationAmount(row.verifyAmt)).join(','),
|
|
201
|
+
tranAmts: flows.map((row) => toForeignSettlementOperationAmount(row.notVerifyAmt)).join(','),
|
|
202
|
+
preStatus: forecasts.map((row) => toForeignSettlementProtocolVerifyStatus(row.verifyStatus)).join(','),
|
|
203
|
+
seqVerifyStatus: flows.map((row) => toForeignSettlementProtocolVerifyStatus(row.verifyStatus)).join(','),
|
|
204
|
+
tranValueDates: flows.map((row) => toForeignSettlementOperationDate(row.valueDate)).join(','),
|
|
205
|
+
predValueDates: forecasts.map((row) => toForeignSettlementOperationDate(row.tranDate)).join(','),
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function buildCancelVerifyRequest(): ForeignSettlementCancelVerifyRequest {
|
|
210
|
+
const forecast = forecastSelectedRows.value[0]
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
predAmt: toForeignSettlementOperationAmount(forecast?.verifyAmt),
|
|
214
|
+
predRefNo: String(forecast?.predRefNo ?? '').trim(),
|
|
215
|
+
tranRefNos: flowSelectedRows.value.map((row) => String(row.tranRefNo ?? '').trim()).join(','),
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** 老页面在核销请求失败时也会重新加载列表,统一由该入口清理选择并刷新两张表。 */
|
|
220
|
+
function refreshOperationLists() {
|
|
221
|
+
resetAllTableSelections()
|
|
222
|
+
listRefreshKey.value += 1
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function runOperation(action: VerificationAction): Promise<ForeignSettlementOperationResult> {
|
|
226
|
+
if (operationLoading.value) {
|
|
227
|
+
return { success: false, message: '核销操作正在处理中,请稍候' }
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const validation = validateSelection(action)
|
|
231
|
+
if (!validation.success) return validation
|
|
232
|
+
|
|
233
|
+
activeOperation.value = action
|
|
234
|
+
try {
|
|
235
|
+
if (action === 'verify') await verifyForeignSettlements(buildVerifyRequest())
|
|
236
|
+
else await cancelVerifyForeignSettlements(buildCancelVerifyRequest())
|
|
237
|
+
|
|
238
|
+
refreshOperationLists()
|
|
239
|
+
return {
|
|
240
|
+
success: true,
|
|
241
|
+
message: action === 'verify' ? '手动核销成功!' : '撤销核销成功!',
|
|
242
|
+
}
|
|
243
|
+
} finally {
|
|
244
|
+
activeOperation.value = null
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function verifySelectedRows() {
|
|
249
|
+
return runOperation('verify')
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function cancelVerifySelectedRows() {
|
|
253
|
+
return runOperation('cancelVerify')
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function validateVerifySelectedRows() {
|
|
257
|
+
return validateSelection('verify')
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function validateCancelVerifySelectedRows() {
|
|
261
|
+
return validateSelection('cancelVerify')
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return {
|
|
265
|
+
forecastSelectedRows,
|
|
266
|
+
flowSelectedRows,
|
|
267
|
+
forecastHasSelectedRows,
|
|
268
|
+
tableSelectionResetKey,
|
|
269
|
+
listRefreshKey,
|
|
270
|
+
activeOperation,
|
|
271
|
+
operationLoading,
|
|
272
|
+
setForecastSelectedRows,
|
|
273
|
+
setFlowSelectedRows,
|
|
274
|
+
resetAllTableSelections,
|
|
275
|
+
refreshOperationLists,
|
|
276
|
+
validateVerifySelectedRows,
|
|
277
|
+
validateCancelVerifySelectedRows,
|
|
278
|
+
verifySelectedRows,
|
|
279
|
+
cancelVerifySelectedRows,
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
/** 开发环境热更新时同步替换 action,同时保留当前表格勾选状态。 */
|
|
284
|
+
if (import.meta.hot) {
|
|
285
|
+
import.meta.hot.accept(acceptHMRUpdate(useForeignSettlementStore, import.meta.hot))
|
|
286
|
+
}
|
|
@@ -180,3 +180,30 @@ export type ForeignSettlementQueryResult<T> = {
|
|
|
180
180
|
totalCount: number
|
|
181
181
|
totalPage: number
|
|
182
182
|
}
|
|
183
|
+
|
|
184
|
+
/** 120202002 外币核销业务体:预报按流水号升序,流水按勾选顺序使用逗号拼接。 */
|
|
185
|
+
export type ForeignSettlementVerifyRequest = {
|
|
186
|
+
predIds: string
|
|
187
|
+
tranSeqIds: string
|
|
188
|
+
predAmts: string
|
|
189
|
+
verifyAmts: string
|
|
190
|
+
/** 沿用旧字段名,实际传递各流水当前未核销金额 notVerifyAmt。 */
|
|
191
|
+
tranAmts: string
|
|
192
|
+
preStatus: string
|
|
193
|
+
seqVerifyStatus: string
|
|
194
|
+
tranValueDates: string
|
|
195
|
+
predValueDates: string
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** 120202003 外币撤销核销业务体:接口一次只接收一条预报。 */
|
|
199
|
+
export type ForeignSettlementCancelVerifyRequest = {
|
|
200
|
+
/** 沿用旧字段名,实际传递预报当前已核销金额 verifyAmt。 */
|
|
201
|
+
predAmt: string
|
|
202
|
+
predRefNo: string
|
|
203
|
+
tranRefNos: string
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type ForeignSettlementOperationResult = {
|
|
207
|
+
success: boolean
|
|
208
|
+
message: string
|
|
209
|
+
}
|
|
@@ -52,6 +52,23 @@ export function normalizeVerifyStatus(value: unknown) {
|
|
|
52
52
|
return status
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/** 操作接口只接收 1/2/3,兼容列表直接返回数字或 VS01/VS02/VS03。 */
|
|
56
|
+
export function toForeignSettlementProtocolVerifyStatus(value: unknown) {
|
|
57
|
+
const status = normalizeVerifyStatus(value)
|
|
58
|
+
const match = /^VS0([1-3])$/.exec(status)
|
|
59
|
+
return match?.[1] ?? ''
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** CSV 业务体不能保留金额千分位,否则会被接口误识别为多条数据。 */
|
|
63
|
+
export function toForeignSettlementOperationAmount(value: unknown) {
|
|
64
|
+
return String(value ?? '').trim().replaceAll(',', '')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** 核销接口要求保留起息日期原格式,不转换成查询接口使用的 YYYYMMDD。 */
|
|
68
|
+
export function toForeignSettlementOperationDate(value: unknown) {
|
|
69
|
+
return String(value ?? '').trim().replace('T', ' ')
|
|
70
|
+
}
|
|
71
|
+
|
|
55
72
|
function formatDateValue(value: unknown, includeTime = false) {
|
|
56
73
|
const text = String(value ?? '').trim().replace('T', ' ')
|
|
57
74
|
if (!text) return '-'
|