verce-vue-test 0.0.100 → 0.0.102
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/components/element-rewrite/NumberRange.vue +44 -1
- package/src/views/ForecastInfo/RmbPositionSettlement.vue +95 -547
- package/src/views/ForecastInfo/api.ts +13 -16
- package/src/views/ForecastInfo/config.ts +169 -0
- package/src/views/ForecastInfo/useForecastInfoState.ts +371 -0
package/package.json
CHANGED
|
@@ -189,9 +189,52 @@ function normalizeNumber(val: number): number {
|
|
|
189
189
|
return Number.isInteger(val) ? val : Number(val.toFixed(12))
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
function toDecimalParts(val: number): { integer: bigint; scale: number } {
|
|
193
|
+
const match = val
|
|
194
|
+
.toString()
|
|
195
|
+
.match(/^(-?)(\d+)(?:\.(\d+))?(?:e([+-]?\d+))?$/i)
|
|
196
|
+
|
|
197
|
+
if (!match) {
|
|
198
|
+
return { integer: BigInt(val), scale: 0 }
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const [, sign = "", integerPart = "0", decimalPart = "", exponent = "0"] =
|
|
202
|
+
match
|
|
203
|
+
let integer = BigInt(`${sign}${integerPart}${decimalPart}`)
|
|
204
|
+
let scale = decimalPart.length - Number(exponent)
|
|
205
|
+
|
|
206
|
+
if (scale < 0) {
|
|
207
|
+
integer *= 10n ** BigInt(-scale)
|
|
208
|
+
scale = 0
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return { integer, scale }
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function fromDecimalParts(integer: bigint, scale: number): number {
|
|
215
|
+
const negative = integer < 0n
|
|
216
|
+
const digits = (negative ? -integer : integer).toString().padStart(scale + 1, "0")
|
|
217
|
+
const decimal =
|
|
218
|
+
scale === 0
|
|
219
|
+
? digits
|
|
220
|
+
: `${digits.slice(0, -scale)}.${digits.slice(-scale)}`
|
|
221
|
+
|
|
222
|
+
return Number(negative ? `-${decimal}` : decimal)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function multiplyPrecisely(value: number, multiplier: number): number {
|
|
226
|
+
const valueParts = toDecimalParts(value)
|
|
227
|
+
const multiplierParts = toDecimalParts(multiplier)
|
|
228
|
+
|
|
229
|
+
return fromDecimalParts(
|
|
230
|
+
valueParts.integer * multiplierParts.integer,
|
|
231
|
+
valueParts.scale + multiplierParts.scale
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
192
235
|
function toActualNum(val: number | null): number | null {
|
|
193
236
|
if (val === null) return null
|
|
194
|
-
return
|
|
237
|
+
return multiplyPrecisely(val, unitMultiplier.value)
|
|
195
238
|
}
|
|
196
239
|
|
|
197
240
|
function toDisplayNum(val: number | null): number | null {
|
|
@@ -10,6 +10,7 @@ export default {
|
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<script setup lang="ts">
|
|
13
|
+
// 页面入口只负责筛选表单、浮层和路由生命周期,业务状态由 composable 管理。
|
|
13
14
|
import {
|
|
14
15
|
computed,
|
|
15
16
|
onActivated,
|
|
@@ -35,21 +36,39 @@ import {
|
|
|
35
36
|
Tickets,
|
|
36
37
|
WarningFilled,
|
|
37
38
|
} from '@element-plus/icons-vue'
|
|
38
|
-
import type { RangeValue } from '@/components/element-rewrite/NumberRange.vue'
|
|
39
39
|
import { formatThousands } from '@/utils/formatters'
|
|
40
|
-
import
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
type ForecastInfoRow,
|
|
46
|
-
type VerificationRequestParams,
|
|
40
|
+
import type {
|
|
41
|
+
FlowInfoQueryParams,
|
|
42
|
+
FlowInfoRow,
|
|
43
|
+
ForecastInfoQueryParams,
|
|
44
|
+
ForecastInfoRow,
|
|
47
45
|
} from './api'
|
|
46
|
+
import {
|
|
47
|
+
amountColumnProps,
|
|
48
|
+
businessTypeOptions,
|
|
49
|
+
channelOptions,
|
|
50
|
+
createDefaultFlowForm,
|
|
51
|
+
createDefaultForecastForm,
|
|
52
|
+
flowColumns,
|
|
53
|
+
flowDirectionOptions,
|
|
54
|
+
flowStatusOptions,
|
|
55
|
+
flowVerifyStatusMap,
|
|
56
|
+
forecastColumns,
|
|
57
|
+
forecastDirectionOptions,
|
|
58
|
+
forecastVerifyStatusFilterOptions,
|
|
59
|
+
forecastVerifyStatusMap,
|
|
60
|
+
groundBranchOptions,
|
|
61
|
+
organizationOptions,
|
|
62
|
+
releaseStatusMap,
|
|
63
|
+
} from './config'
|
|
64
|
+
import {
|
|
65
|
+
parseAmount,
|
|
66
|
+
useForecastInfoState,
|
|
67
|
+
type ForecastInfoCardLayout,
|
|
68
|
+
} from './useForecastInfoState'
|
|
48
69
|
import { useScopedMessage } from './useScopedMessage'
|
|
49
70
|
import './forecast-info.css'
|
|
50
71
|
|
|
51
|
-
type ForecastInfoCardLayout = 'vertical' | 'horizontal'
|
|
52
|
-
|
|
53
72
|
/**
|
|
54
73
|
* 预报信息页面的布局切换配置。
|
|
55
74
|
* 页面及两个业务卡片共用同一个局部布局状态,点击任一张卡片右上角的图标都会同步切换整体排列。
|
|
@@ -59,394 +78,7 @@ const layoutOptions: Array<{ label: string; value: ForecastInfoCardLayout; icon:
|
|
|
59
78
|
{ label: '左右卡片', value: 'horizontal', icon: Grid },
|
|
60
79
|
]
|
|
61
80
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
type TableSelectionState = {
|
|
65
|
-
forecastInfo: ForecastInfoRow[]
|
|
66
|
-
flowInfo: FlowInfoRow[]
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
type ForecastCalculationSummary = {
|
|
70
|
-
forecastAmount: string
|
|
71
|
-
forecastVerifiedAmount: string
|
|
72
|
-
forecastUnverifiedAmount: string
|
|
73
|
-
flowAmount: string
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function defaultForecastQueryParams(): ForecastInfoQueryParams {
|
|
77
|
-
return {
|
|
78
|
-
busiType: '',
|
|
79
|
-
clientName: '',
|
|
80
|
-
competName: '',
|
|
81
|
-
endTransAmt: '',
|
|
82
|
-
groundBranch: '',
|
|
83
|
-
groundBranchName: '',
|
|
84
|
-
ourAcct: '',
|
|
85
|
-
payChannel: '',
|
|
86
|
-
payDirec: '',
|
|
87
|
-
startTransAmt: '',
|
|
88
|
-
tranDate: '',
|
|
89
|
-
verifyStatus: '',
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function defaultFlowQueryParams(): FlowInfoQueryParams {
|
|
94
|
-
return {
|
|
95
|
-
clientName: '',
|
|
96
|
-
competName: '',
|
|
97
|
-
endTransAmt: '',
|
|
98
|
-
groundBranch: '',
|
|
99
|
-
groundBranchName: '',
|
|
100
|
-
payChannel: '',
|
|
101
|
-
payDirec: '',
|
|
102
|
-
startTransAmt: '',
|
|
103
|
-
tranDate: '',
|
|
104
|
-
verifyStatus: '',
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function createCalculationSummary(): ForecastCalculationSummary {
|
|
109
|
-
return {
|
|
110
|
-
forecastAmount: '0',
|
|
111
|
-
forecastVerifiedAmount: '0',
|
|
112
|
-
forecastUnverifiedAmount: '0',
|
|
113
|
-
flowAmount: '0',
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function parseAmount(value: unknown) {
|
|
118
|
-
const amount = Number(String(value ?? '').trim().replace(/,/g, ''))
|
|
119
|
-
return Number.isFinite(amount) ? amount : 0
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function formatCalculationAmount(value: number) {
|
|
123
|
-
const roundedValue = Math.round((value + Number.EPSILON) * 100) / 100
|
|
124
|
-
if (Object.is(roundedValue, -0)) return '0'
|
|
125
|
-
if (Number.isInteger(roundedValue)) return String(roundedValue)
|
|
126
|
-
return String(roundedValue).replace(/(\.\d*?)0+$/, '$1').replace(/\.$/, '')
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function sumAmount<T extends object>(rows: T[], key: keyof T) {
|
|
130
|
-
return rows.reduce((total, row) => total + parseAmount(row[key]), 0)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function normalizeTotalCount<T>(response: { resultList: T[]; totalCount: string | number }) {
|
|
134
|
-
const total = Number(response.totalCount)
|
|
135
|
-
return Number.isFinite(total) ? total : response.resultList.length
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const verificationAllowedStatuses = {
|
|
139
|
-
verify: new Set(['1', '3']),
|
|
140
|
-
cancelVerify: new Set(['2', '3']),
|
|
141
|
-
} satisfies Record<'verify' | 'cancelVerify', Set<string>>
|
|
142
|
-
|
|
143
|
-
function canChangeVerificationStatus(
|
|
144
|
-
row: { verifyStatus?: string },
|
|
145
|
-
action: 'verify' | 'cancelVerify',
|
|
146
|
-
) {
|
|
147
|
-
return verificationAllowedStatuses[action].has(String(row.verifyStatus ?? '').trim())
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function toRequestText(value: unknown) {
|
|
151
|
-
return value === null || value === undefined ? '' : String(value)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* forecast-info 页面专属状态。
|
|
156
|
-
* 三个组件合并后不再需要跨组件容器,改为随路由页面实例创建和销毁的局部状态。
|
|
157
|
-
*/
|
|
158
|
-
function createForecastInfoState() {
|
|
159
|
-
const cardLayout = ref<ForecastInfoCardLayout>('horizontal')
|
|
160
|
-
|
|
161
|
-
const forecastRows = ref<ForecastInfoRow[]>([])
|
|
162
|
-
const forecastTotal = ref(0)
|
|
163
|
-
const forecastPage = ref(1)
|
|
164
|
-
const forecastPageSize = ref(10)
|
|
165
|
-
const forecastLoading = ref(false)
|
|
166
|
-
const forecastQueryParams = ref<ForecastInfoQueryParams>(defaultForecastQueryParams())
|
|
167
|
-
|
|
168
|
-
const flowRows = ref<FlowInfoRow[]>([])
|
|
169
|
-
const flowTotal = ref(0)
|
|
170
|
-
const flowPage = ref(1)
|
|
171
|
-
const flowPageSize = ref(10)
|
|
172
|
-
const flowLoading = ref(false)
|
|
173
|
-
const flowQueryParams = ref<FlowInfoQueryParams>(defaultFlowQueryParams())
|
|
174
|
-
|
|
175
|
-
const tableSelectedRows = ref<TableSelectionState>({
|
|
176
|
-
forecastInfo: [],
|
|
177
|
-
flowInfo: [],
|
|
178
|
-
})
|
|
179
|
-
/** 两张表分别维护重置标识,查询单表时不影响另一张表的勾选。 */
|
|
180
|
-
const forecastSelectionResetKey = ref(0)
|
|
181
|
-
const flowSelectionResetKey = ref(0)
|
|
182
|
-
const forecastSelectedRows = computed(() => tableSelectedRows.value.forecastInfo)
|
|
183
|
-
const flowSelectedRows = computed(() => tableSelectedRows.value.flowInfo)
|
|
184
|
-
const forecastHasSelectedRows = computed(() => forecastSelectedRows.value.length > 0)
|
|
185
|
-
const flowHasSelectedRows = computed(() => flowSelectedRows.value.length > 0)
|
|
186
|
-
const calculationSummary = ref<ForecastCalculationSummary>(createCalculationSummary())
|
|
187
|
-
const calculationDialogVisible = ref(false)
|
|
188
|
-
|
|
189
|
-
/** 两张表各自维护请求代次,避免旧请求交叉覆盖新结果。 */
|
|
190
|
-
let forecastRequestGeneration = 0
|
|
191
|
-
let flowRequestGeneration = 0
|
|
192
|
-
|
|
193
|
-
function setCardLayout(layout: ForecastInfoCardLayout) {
|
|
194
|
-
cardLayout.value = layout
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function setTableSelectedRows(key: 'forecastInfo', rows: ForecastInfoRow[]): void
|
|
198
|
-
function setTableSelectedRows(key: 'flowInfo', rows: FlowInfoRow[]): void
|
|
199
|
-
function setTableSelectedRows(
|
|
200
|
-
key: ForecastInfoSelectionKey,
|
|
201
|
-
rows: ForecastInfoRow[] | FlowInfoRow[],
|
|
202
|
-
) {
|
|
203
|
-
if (key === 'forecastInfo') {
|
|
204
|
-
tableSelectedRows.value.forecastInfo = rows as ForecastInfoRow[]
|
|
205
|
-
return
|
|
206
|
-
}
|
|
207
|
-
tableSelectedRows.value.flowInfo = rows as FlowInfoRow[]
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function clearTableSelectedRows(key: ForecastInfoSelectionKey) {
|
|
211
|
-
if (key === 'forecastInfo') {
|
|
212
|
-
tableSelectedRows.value.forecastInfo = []
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
tableSelectedRows.value.flowInfo = []
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function clearAllTableSelectedRows() {
|
|
219
|
-
tableSelectedRows.value.forecastInfo = []
|
|
220
|
-
tableSelectedRows.value.flowInfo = []
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function resetTableSelection(key: ForecastInfoSelectionKey) {
|
|
224
|
-
clearTableSelectedRows(key)
|
|
225
|
-
if (key === 'forecastInfo') {
|
|
226
|
-
forecastSelectionResetKey.value += 1
|
|
227
|
-
return
|
|
228
|
-
}
|
|
229
|
-
flowSelectionResetKey.value += 1
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function resetAllTableSelections() {
|
|
233
|
-
clearAllTableSelectedRows()
|
|
234
|
-
forecastSelectionResetKey.value += 1
|
|
235
|
-
flowSelectionResetKey.value += 1
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function cancelPendingRequests() {
|
|
239
|
-
forecastRequestGeneration += 1
|
|
240
|
-
flowRequestGeneration += 1
|
|
241
|
-
forecastLoading.value = false
|
|
242
|
-
flowLoading.value = false
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function hasTableSelectedRows(key: ForecastInfoSelectionKey) {
|
|
246
|
-
return tableSelectedRows.value[key].length > 0
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function handleForecastSelectionChange(rows: ForecastInfoRow[]) {
|
|
250
|
-
console.log('预报信息 selection-change', rows)
|
|
251
|
-
setTableSelectedRows('forecastInfo', rows)
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function handleFlowSelectionChange(rows: FlowInfoRow[]) {
|
|
255
|
-
console.log('流水信息 selection-change', rows)
|
|
256
|
-
setTableSelectedRows('flowInfo', rows)
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function calculateSelectedSummary(): ForecastInfoOperationResult {
|
|
260
|
-
if (!forecastHasSelectedRows.value) {
|
|
261
|
-
return { success: false, message: '请选择预报信息数据' }
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const forecastAmount = sumAmount(forecastSelectedRows.value, 'predAmt')
|
|
265
|
-
const forecastVerifiedAmount = sumAmount(forecastSelectedRows.value, 'verifyAmt')
|
|
266
|
-
const flowAmount = sumAmount(flowSelectedRows.value, 'amt')
|
|
267
|
-
calculationSummary.value = {
|
|
268
|
-
forecastAmount: formatCalculationAmount(forecastAmount),
|
|
269
|
-
forecastVerifiedAmount: formatCalculationAmount(forecastVerifiedAmount),
|
|
270
|
-
forecastUnverifiedAmount: formatCalculationAmount(forecastAmount - forecastVerifiedAmount),
|
|
271
|
-
flowAmount: formatCalculationAmount(flowAmount),
|
|
272
|
-
}
|
|
273
|
-
return { success: true, message: '' }
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function validateVerificationSelection(
|
|
277
|
-
action: 'verify' | 'cancelVerify',
|
|
278
|
-
): ForecastInfoOperationResult {
|
|
279
|
-
const actionLabel = action === 'verify' ? '核销' : '撤销核销'
|
|
280
|
-
|
|
281
|
-
if (!forecastHasSelectedRows.value) {
|
|
282
|
-
if (flowHasSelectedRows.value) {
|
|
283
|
-
return {
|
|
284
|
-
success: false,
|
|
285
|
-
message: `流水信息不能单独${actionLabel},请至少选择一条预报信息数据`,
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return { success: false, message: '请选择预报信息数据' }
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (forecastSelectedRows.value.some((row) => !canChangeVerificationStatus(row, action))) {
|
|
292
|
-
return { success: false, message: `所选预报信息中包含不可${actionLabel}的数据,请重新选择` }
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if (flowSelectedRows.value.some((row) => !canChangeVerificationStatus(row, action))) {
|
|
296
|
-
return { success: false, message: `所选流水信息中包含不可${actionLabel}的数据,请重新选择` }
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
return { success: true, message: '' }
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function buildVerificationRequestParams(): VerificationRequestParams {
|
|
303
|
-
return {
|
|
304
|
-
predList: forecastSelectedRows.value.map((row) => ({
|
|
305
|
-
predAmt: toRequestText(row.predAmt),
|
|
306
|
-
predRefNo: toRequestText(row.predRefNo),
|
|
307
|
-
verifyAmt: toRequestText(row.verifyAmt),
|
|
308
|
-
verifyStatus: toRequestText(row.verifyStatus),
|
|
309
|
-
})),
|
|
310
|
-
tranList: flowSelectedRows.value.map((row) => ({
|
|
311
|
-
amt: toRequestText(row.amt),
|
|
312
|
-
refNo: toRequestText(row.refNo),
|
|
313
|
-
verifyStatus: toRequestText(row.verifyStatus),
|
|
314
|
-
})),
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function verifySelectedForecastRows() {
|
|
319
|
-
return validateVerificationSelection('verify')
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function cancelVerifySelectedForecastRows() {
|
|
323
|
-
return validateVerificationSelection('cancelVerify')
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function handleCalculationSummary() {
|
|
327
|
-
const result = calculateSelectedSummary()
|
|
328
|
-
if (result.success) calculationDialogVisible.value = true
|
|
329
|
-
return result
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
async function loadForecastInfoList(params: ForecastInfoQueryParams = forecastQueryParams.value) {
|
|
333
|
-
const generation = ++forecastRequestGeneration
|
|
334
|
-
const queryParams = { ...params }
|
|
335
|
-
const pageParams = { pageNum: forecastPage.value, pageSize: forecastPageSize.value }
|
|
336
|
-
forecastLoading.value = true
|
|
337
|
-
forecastQueryParams.value = queryParams
|
|
338
|
-
|
|
339
|
-
try {
|
|
340
|
-
const response = await forecastInfoApi.forecastQueryAPI({ ...queryParams, ...pageParams })
|
|
341
|
-
if (generation !== forecastRequestGeneration) return false
|
|
342
|
-
forecastRows.value = response.resultList.map((item) => ({ ...item }))
|
|
343
|
-
forecastTotal.value = normalizeTotalCount(response)
|
|
344
|
-
resetTableSelection('forecastInfo')
|
|
345
|
-
return true
|
|
346
|
-
} finally {
|
|
347
|
-
if (generation === forecastRequestGeneration) forecastLoading.value = false
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
async function loadFlowInfoList(params: FlowInfoQueryParams = flowQueryParams.value) {
|
|
352
|
-
const generation = ++flowRequestGeneration
|
|
353
|
-
const queryParams = { ...params }
|
|
354
|
-
const pageParams = { pageNum: flowPage.value, pageSize: flowPageSize.value }
|
|
355
|
-
flowLoading.value = true
|
|
356
|
-
flowQueryParams.value = queryParams
|
|
357
|
-
|
|
358
|
-
try {
|
|
359
|
-
const response = await forecastInfoApi.flowQueryAPI({ ...queryParams, ...pageParams })
|
|
360
|
-
if (generation !== flowRequestGeneration) return false
|
|
361
|
-
flowRows.value = response.resultList.map((item) => ({ ...item }))
|
|
362
|
-
flowTotal.value = normalizeTotalCount(response)
|
|
363
|
-
resetTableSelection('flowInfo')
|
|
364
|
-
return true
|
|
365
|
-
} finally {
|
|
366
|
-
if (generation === flowRequestGeneration) flowLoading.value = false
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/** 核销完成后固定使用操作发起时的两份查询快照并发刷新。 */
|
|
371
|
-
async function refreshVerificationLists(
|
|
372
|
-
forecastSnapshot: ForecastInfoQueryParams,
|
|
373
|
-
flowSnapshot: FlowInfoQueryParams,
|
|
374
|
-
) {
|
|
375
|
-
const results = await Promise.all([
|
|
376
|
-
loadForecastInfoList(forecastSnapshot),
|
|
377
|
-
loadFlowInfoList(flowSnapshot),
|
|
378
|
-
])
|
|
379
|
-
if (!results.every(Boolean)) return false
|
|
380
|
-
resetAllTableSelections()
|
|
381
|
-
return true
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
async function handleForecastVerify() {
|
|
385
|
-
const validationResult = verifySelectedForecastRows()
|
|
386
|
-
if (!validationResult.success) return validationResult
|
|
387
|
-
const forecastSnapshot = { ...forecastQueryParams.value }
|
|
388
|
-
const flowSnapshot = { ...flowQueryParams.value }
|
|
389
|
-
const response = await forecastInfoApi.verifyAPI(buildVerificationRequestParams())
|
|
390
|
-
if (!(await refreshVerificationLists(forecastSnapshot, flowSnapshot))) return null
|
|
391
|
-
return response
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
async function handleForecastCancelVerify() {
|
|
395
|
-
const validationResult = cancelVerifySelectedForecastRows()
|
|
396
|
-
if (!validationResult.success) return validationResult
|
|
397
|
-
const forecastSnapshot = { ...forecastQueryParams.value }
|
|
398
|
-
const flowSnapshot = { ...flowQueryParams.value }
|
|
399
|
-
const response = await forecastInfoApi.cancelVerifyAPI(buildVerificationRequestParams())
|
|
400
|
-
if (!(await refreshVerificationLists(forecastSnapshot, flowSnapshot))) return null
|
|
401
|
-
return response
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
return {
|
|
405
|
-
cardLayout,
|
|
406
|
-
forecastRows,
|
|
407
|
-
forecastTotal,
|
|
408
|
-
forecastPage,
|
|
409
|
-
forecastPageSize,
|
|
410
|
-
forecastLoading,
|
|
411
|
-
forecastQueryParams,
|
|
412
|
-
flowRows,
|
|
413
|
-
flowTotal,
|
|
414
|
-
flowPage,
|
|
415
|
-
flowPageSize,
|
|
416
|
-
flowLoading,
|
|
417
|
-
flowQueryParams,
|
|
418
|
-
tableSelectedRows,
|
|
419
|
-
forecastSelectionResetKey,
|
|
420
|
-
flowSelectionResetKey,
|
|
421
|
-
forecastSelectedRows,
|
|
422
|
-
flowSelectedRows,
|
|
423
|
-
forecastHasSelectedRows,
|
|
424
|
-
flowHasSelectedRows,
|
|
425
|
-
calculationSummary,
|
|
426
|
-
calculationDialogVisible,
|
|
427
|
-
setCardLayout,
|
|
428
|
-
setTableSelectedRows,
|
|
429
|
-
clearTableSelectedRows,
|
|
430
|
-
clearAllTableSelectedRows,
|
|
431
|
-
resetTableSelection,
|
|
432
|
-
resetAllTableSelections,
|
|
433
|
-
cancelPendingRequests,
|
|
434
|
-
hasTableSelectedRows,
|
|
435
|
-
handleForecastSelectionChange,
|
|
436
|
-
handleFlowSelectionChange,
|
|
437
|
-
calculateSelectedSummary,
|
|
438
|
-
buildVerificationRequestParams,
|
|
439
|
-
verifySelectedForecastRows,
|
|
440
|
-
cancelVerifySelectedForecastRows,
|
|
441
|
-
handleCalculationSummary,
|
|
442
|
-
handleForecastVerify,
|
|
443
|
-
handleForecastCancelVerify,
|
|
444
|
-
loadForecastInfoList,
|
|
445
|
-
loadFlowInfoList,
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
const forecastInfoStore = createForecastInfoState()
|
|
81
|
+
const forecastInfoStore = useForecastInfoState()
|
|
450
82
|
const {
|
|
451
83
|
cardLayout,
|
|
452
84
|
forecastRows,
|
|
@@ -493,150 +125,8 @@ type TableOverlayController = {
|
|
|
493
125
|
closeTransientOverlays: () => void
|
|
494
126
|
}
|
|
495
127
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
label: string
|
|
499
|
-
minWidth: number
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
const forecastDirectionOptions = [
|
|
503
|
-
{ label: '收入', value: '1' },
|
|
504
|
-
{ label: '支出', value: '2' },
|
|
505
|
-
]
|
|
506
|
-
|
|
507
|
-
const flowDirectionOptions = [
|
|
508
|
-
{ label: '收入', value: '1' },
|
|
509
|
-
{ label: '支出', value: '0' },
|
|
510
|
-
]
|
|
511
|
-
|
|
512
|
-
const forecastStatusOptions = [
|
|
513
|
-
{ label: '待核销', value: '1,3' },
|
|
514
|
-
{ label: '已核销', value: '2' },
|
|
515
|
-
]
|
|
516
|
-
|
|
517
|
-
const flowStatusOptions = [
|
|
518
|
-
{ label: '未核销', value: '1' },
|
|
519
|
-
{ label: '已核销', value: '2' },
|
|
520
|
-
]
|
|
521
|
-
|
|
522
|
-
const businessTypeOptions = [
|
|
523
|
-
{ label: '对公/个人客户收付', value: '1' },
|
|
524
|
-
{ label: '本票签发/兑付', value: '2' },
|
|
525
|
-
{ label: '三省一市汇票签发/兑付', value: '3' },
|
|
526
|
-
{ label: '分行资金调拨', value: '4' },
|
|
527
|
-
{ label: '同业业务', value: '5' },
|
|
528
|
-
{ label: '资金业务', value: '6' },
|
|
529
|
-
{ label: '理财业务', value: '7' },
|
|
530
|
-
{ label: '债券承销业务', value: '8' },
|
|
531
|
-
{ label: '司库业务', value: '9' },
|
|
532
|
-
{ label: '现金出入库', value: '10' },
|
|
533
|
-
{ label: '财政准备金退缴', value: '11' },
|
|
534
|
-
{ label: '同业清算款项收付', value: '12' },
|
|
535
|
-
{ label: '财政零余额业务', value: '13' },
|
|
536
|
-
{ label: '银行承兑汇票', value: '14' },
|
|
537
|
-
{ label: '托管业务', value: '15' },
|
|
538
|
-
{ label: '票据业务', value: '16' },
|
|
539
|
-
]
|
|
540
|
-
|
|
541
|
-
const channelOptions = [
|
|
542
|
-
{ label: '大额支付', value: '1' },
|
|
543
|
-
{ label: '小额支付', value: '2' },
|
|
544
|
-
{ label: '票据交换', value: '3' },
|
|
545
|
-
{ label: '同城支付', value: '4' },
|
|
546
|
-
{ label: '网联支付', value: '7' },
|
|
547
|
-
]
|
|
548
|
-
|
|
549
|
-
const organizationOptions = [
|
|
550
|
-
{ label: '总行营业部', value: 'head-office' },
|
|
551
|
-
{ label: '上海分行', value: 'shanghai' },
|
|
552
|
-
{ label: '深圳分行', value: 'shenzhen' },
|
|
553
|
-
]
|
|
554
|
-
|
|
555
|
-
const groundBranchOptions = [
|
|
556
|
-
{ label: '总行营业部', value: 'head-office' },
|
|
557
|
-
{ label: '上海分行', value: 'shanghai' },
|
|
558
|
-
{ label: '深圳分行', value: 'shenzhen' },
|
|
559
|
-
]
|
|
560
|
-
|
|
561
|
-
const releaseStatusMap: Record<string, string> = {
|
|
562
|
-
'0': '未释放',
|
|
563
|
-
'1': '已释放',
|
|
564
|
-
}
|
|
565
|
-
const flowVerifyStatusMap: Record<string, string> = Object.fromEntries(
|
|
566
|
-
flowStatusOptions.map((option) => [option.value, option.label]),
|
|
567
|
-
)
|
|
568
|
-
const amountColumnProps = new Set(['predAmt', 'verifyAmt'])
|
|
569
|
-
|
|
570
|
-
const forecastColumns: TableColumn[] = [
|
|
571
|
-
{ prop: 'predStatus', label: '预报状态', minWidth: 90 },
|
|
572
|
-
{ prop: 'payDirec', label: '收支方向', minWidth: 90 },
|
|
573
|
-
{ prop: 'predAmt', label: '预报金额', minWidth: 110 },
|
|
574
|
-
{ prop: 'verifyAmt', label: '已核销金额', minWidth: 118 },
|
|
575
|
-
{ prop: 'verifyStatus', label: '核销状态', minWidth: 90 },
|
|
576
|
-
{ prop: 'relsFlag', label: '释放状态', minWidth: 90 },
|
|
577
|
-
{ prop: 'payChannel', label: '支付渠道', minWidth: 96 },
|
|
578
|
-
{ prop: 'clientName', label: '客户名称', minWidth: 100 },
|
|
579
|
-
{ prop: 'clientType', label: '客户类型', minWidth: 96 },
|
|
580
|
-
{ prop: 'competName', label: '交易对手名称', minWidth: 124 },
|
|
581
|
-
{ prop: 'competAcct', label: '交易对手账号', minWidth: 132 },
|
|
582
|
-
{ prop: 'standardName', label: '标准名称', minWidth: 100 },
|
|
583
|
-
{ prop: 'billNo', label: '票号', minWidth: 82 },
|
|
584
|
-
{ prop: 'billDate', label: '出票日期', minWidth: 96 },
|
|
585
|
-
{ prop: 'tranDate', label: '交易日期', minWidth: 96 },
|
|
586
|
-
{ prop: 'busiType', label: '业务类型', minWidth: 96 },
|
|
587
|
-
{ prop: 'predDate', label: '预报日期', minWidth: 96 },
|
|
588
|
-
{ prop: 'predCode', label: '预报人员编号', minWidth: 118 },
|
|
589
|
-
{ prop: 'predRefNo', label: '预报流水号', minWidth: 118 },
|
|
590
|
-
{ prop: 'groundBranch', label: '落地机构', minWidth: 100 },
|
|
591
|
-
{ prop: 'groundBranchCode', label: '机构代码', minWidth: 96 },
|
|
592
|
-
]
|
|
593
|
-
|
|
594
|
-
const flowColumns: TableColumn[] = [
|
|
595
|
-
{ prop: 'amt', label: '金额', minWidth: 96 },
|
|
596
|
-
{ prop: 'billDate', label: '出票日期', minWidth: 96 },
|
|
597
|
-
{ prop: 'billNo', label: '票号', minWidth: 82 },
|
|
598
|
-
{ prop: 'busiType', label: '支付系统业务类型', minWidth: 138 },
|
|
599
|
-
{ prop: 'clientAcct', label: '我方账号', minWidth: 112 },
|
|
600
|
-
{ prop: 'clientName', label: '我方户名', minWidth: 100 },
|
|
601
|
-
{ prop: 'competAcct', label: '对方账号', minWidth: 112 },
|
|
602
|
-
{ prop: 'competName', label: '对方户名', minWidth: 100 },
|
|
603
|
-
{ prop: 'groundBranch', label: '我方机构', minWidth: 100 },
|
|
604
|
-
{ prop: 'payChannel', label: '支付渠道', minWidth: 92 },
|
|
605
|
-
{ prop: 'payDirec', label: '收支方向', minWidth: 90 },
|
|
606
|
-
{ prop: 'refNo', label: '流水号', minWidth: 118 },
|
|
607
|
-
{ prop: 'standardName', label: '标准名称', minWidth: 100 },
|
|
608
|
-
{ prop: 'tranDate', label: '交易日期', minWidth: 96 },
|
|
609
|
-
{ prop: 'tranTimeStamp', label: '清算时间', minWidth: 128 },
|
|
610
|
-
{ prop: 'verifyStatus', label: '核销状态', minWidth: 90 },
|
|
611
|
-
]
|
|
612
|
-
|
|
613
|
-
const defaultForecastForm = () => ({
|
|
614
|
-
tradeDate: '2026-07-07',
|
|
615
|
-
direction: '',
|
|
616
|
-
businessType: '',
|
|
617
|
-
amountRange: [100_000_000, null] as RangeValue,
|
|
618
|
-
channel: '',
|
|
619
|
-
verification: '',
|
|
620
|
-
clientName: '',
|
|
621
|
-
counterpartyName: '',
|
|
622
|
-
ourAccount: '',
|
|
623
|
-
organizationKeyword: '',
|
|
624
|
-
organization: '',
|
|
625
|
-
})
|
|
626
|
-
|
|
627
|
-
const defaultFlowForm = () => ({
|
|
628
|
-
tranDate: '2026-07-07',
|
|
629
|
-
payDirec: '',
|
|
630
|
-
clientName: '',
|
|
631
|
-
competName: '',
|
|
632
|
-
payChannel: '',
|
|
633
|
-
transAmtRange: [100_000_000, null] as RangeValue,
|
|
634
|
-
verifyStatus: '',
|
|
635
|
-
groundBranch: '',
|
|
636
|
-
})
|
|
637
|
-
|
|
638
|
-
const forecastForm = reactive(defaultForecastForm())
|
|
639
|
-
const flowForm = reactive(defaultFlowForm())
|
|
128
|
+
const forecastForm = reactive(createDefaultForecastForm())
|
|
129
|
+
const flowForm = reactive(createDefaultFlowForm())
|
|
640
130
|
const forecastDrawerVisible = ref(false)
|
|
641
131
|
const flowDrawerVisible = ref(false)
|
|
642
132
|
const modifyDialogVisible = ref(false)
|
|
@@ -733,11 +223,11 @@ function closeFlowTransientOverlays() {
|
|
|
733
223
|
}
|
|
734
224
|
|
|
735
225
|
function resetForecastForm() {
|
|
736
|
-
Object.assign(forecastForm,
|
|
226
|
+
Object.assign(forecastForm, createDefaultForecastForm())
|
|
737
227
|
}
|
|
738
228
|
|
|
739
229
|
function resetFlowForm() {
|
|
740
|
-
Object.assign(flowForm,
|
|
230
|
+
Object.assign(flowForm, createDefaultFlowForm())
|
|
741
231
|
}
|
|
742
232
|
|
|
743
233
|
function buildForecastQueryParams(): ForecastInfoQueryParams {
|
|
@@ -1142,7 +632,7 @@ onBeforeUnmount(() => {
|
|
|
1142
632
|
</div>
|
|
1143
633
|
</header>
|
|
1144
634
|
|
|
1145
|
-
<!--
|
|
635
|
+
<!-- 左右布局仅显示交易日期;上下布局展示四个常用筛选条件。 -->
|
|
1146
636
|
<div class="forecast-info-filter" :class="{ 'forecast-info-filter--horizontal': cardLayout === 'horizontal' }">
|
|
1147
637
|
<div class="forecast-info-filter__grid">
|
|
1148
638
|
<label class="forecast-info-filter__item">
|
|
@@ -1172,6 +662,38 @@ onBeforeUnmount(() => {
|
|
|
1172
662
|
<el-option v-for="option in forecastDirectionOptions" :key="option.value" v-bind="option" />
|
|
1173
663
|
</el-select>
|
|
1174
664
|
</label>
|
|
665
|
+
|
|
666
|
+
<label v-if="cardLayout === 'vertical'" class="forecast-info-filter__item">
|
|
667
|
+
<span>业务类型</span>
|
|
668
|
+
<el-select
|
|
669
|
+
v-model="forecastForm.businessType"
|
|
670
|
+
:append-to="overlayContainer || undefined"
|
|
671
|
+
:persistent="false"
|
|
672
|
+
size="small"
|
|
673
|
+
placeholder="请选择"
|
|
674
|
+
clearable
|
|
675
|
+
>
|
|
676
|
+
<el-option v-for="option in businessTypeOptions" :key="option.value" v-bind="option" />
|
|
677
|
+
</el-select>
|
|
678
|
+
</label>
|
|
679
|
+
|
|
680
|
+
<label v-if="cardLayout === 'vertical'" class="forecast-info-filter__item">
|
|
681
|
+
<span>核销状态</span>
|
|
682
|
+
<el-select
|
|
683
|
+
v-model="forecastForm.verification"
|
|
684
|
+
:append-to="overlayContainer || undefined"
|
|
685
|
+
:persistent="false"
|
|
686
|
+
size="small"
|
|
687
|
+
placeholder="请选择"
|
|
688
|
+
clearable
|
|
689
|
+
>
|
|
690
|
+
<el-option
|
|
691
|
+
v-for="option in forecastVerifyStatusFilterOptions"
|
|
692
|
+
:key="option.value"
|
|
693
|
+
v-bind="option"
|
|
694
|
+
/>
|
|
695
|
+
</el-select>
|
|
696
|
+
</label>
|
|
1175
697
|
</div>
|
|
1176
698
|
|
|
1177
699
|
<div class="forecast-info-filter__actions">
|
|
@@ -1297,6 +819,9 @@ onBeforeUnmount(() => {
|
|
|
1297
819
|
<template v-if="amountColumnProps.has(column.prop)" #default="{ row }">
|
|
1298
820
|
{{ formatThousands(row[column.prop]) }}
|
|
1299
821
|
</template>
|
|
822
|
+
<template v-else-if="column.prop === 'verifyStatus'" #default="{ row }">
|
|
823
|
+
{{ forecastVerifyStatusMap[String(row.verifyStatus)] ?? row.verifyStatus ?? '-' }}
|
|
824
|
+
</template>
|
|
1300
825
|
<template v-else-if="column.prop === 'relsFlag'" #default="{ row }">
|
|
1301
826
|
{{ releaseStatusMap[String(row.relsFlag)] ?? row.relsFlag ?? '-' }}
|
|
1302
827
|
</template>
|
|
@@ -1554,7 +1079,11 @@ onBeforeUnmount(() => {
|
|
|
1554
1079
|
placeholder="请选择"
|
|
1555
1080
|
clearable
|
|
1556
1081
|
>
|
|
1557
|
-
<el-option
|
|
1082
|
+
<el-option
|
|
1083
|
+
v-for="option in forecastVerifyStatusFilterOptions"
|
|
1084
|
+
:key="option.value"
|
|
1085
|
+
v-bind="option"
|
|
1086
|
+
/>
|
|
1558
1087
|
</el-select>
|
|
1559
1088
|
</label>
|
|
1560
1089
|
|
|
@@ -1651,7 +1180,7 @@ onBeforeUnmount(() => {
|
|
|
1651
1180
|
</div>
|
|
1652
1181
|
</header>
|
|
1653
1182
|
|
|
1654
|
-
<!--
|
|
1183
|
+
<!-- 左右布局仅显示交易日期;上下布局展示四个常用筛选条件。 -->
|
|
1655
1184
|
<div class="forecast-info-filter" :class="{ 'forecast-info-filter--horizontal': cardLayout === 'horizontal' }">
|
|
1656
1185
|
<div class="forecast-info-filter__grid">
|
|
1657
1186
|
<label class="forecast-info-filter__item">
|
|
@@ -1681,6 +1210,25 @@ onBeforeUnmount(() => {
|
|
|
1681
1210
|
<el-option v-for="option in flowDirectionOptions" :key="option.value" v-bind="option" />
|
|
1682
1211
|
</el-select>
|
|
1683
1212
|
</label>
|
|
1213
|
+
|
|
1214
|
+
<label v-if="cardLayout === 'vertical'" class="forecast-info-filter__item">
|
|
1215
|
+
<span>支付渠道</span>
|
|
1216
|
+
<el-input v-model="flowForm.payChannel" size="small" placeholder="请输入" clearable />
|
|
1217
|
+
</label>
|
|
1218
|
+
|
|
1219
|
+
<label v-if="cardLayout === 'vertical'" class="forecast-info-filter__item">
|
|
1220
|
+
<span>核销状态</span>
|
|
1221
|
+
<el-select
|
|
1222
|
+
v-model="flowForm.verifyStatus"
|
|
1223
|
+
:append-to="overlayContainer || undefined"
|
|
1224
|
+
:persistent="false"
|
|
1225
|
+
size="small"
|
|
1226
|
+
placeholder="请选择"
|
|
1227
|
+
clearable
|
|
1228
|
+
>
|
|
1229
|
+
<el-option v-for="option in flowStatusOptions" :key="option.value" v-bind="option" />
|
|
1230
|
+
</el-select>
|
|
1231
|
+
</label>
|
|
1684
1232
|
</div>
|
|
1685
1233
|
|
|
1686
1234
|
<div class="forecast-info-filter__actions">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import baseHttpClient from '@/utils/baseHttpClient'
|
|
1
|
+
import baseHttpClient, { type TamResponse } from '@/utils/baseHttpClient'
|
|
2
2
|
|
|
3
|
+
// `/forecast-info` 使用的 TAM 请求参数、响应结构和接口方法。
|
|
3
4
|
/** 预报信息查询参数。未选择的字段仍以空字符串传给后端。 */
|
|
4
5
|
export type ForecastInfoQueryParams = {
|
|
5
6
|
busiType: string
|
|
@@ -100,9 +101,9 @@ type QueryPageParams = {
|
|
|
100
101
|
pageSize: number
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
type
|
|
104
|
-
resultList
|
|
105
|
-
totalCount
|
|
104
|
+
export type ForecastInfoListResponse<T> = {
|
|
105
|
+
resultList?: T[] | null
|
|
106
|
+
totalCount?: string | number | null
|
|
106
107
|
totalPage?: string | number
|
|
107
108
|
}
|
|
108
109
|
|
|
@@ -112,39 +113,35 @@ type ListResponse<T> = {
|
|
|
112
113
|
*/
|
|
113
114
|
const API = {
|
|
114
115
|
/** 分页查询预报信息。 */
|
|
115
|
-
forecastQueryAPI:
|
|
116
|
-
|
|
116
|
+
forecastQueryAPI: (params: ForecastInfoQueryParams & QueryPageParams) => {
|
|
117
|
+
return baseHttpClient.post<TamResponse<ForecastInfoListResponse<ForecastInfoRow>>>(
|
|
117
118
|
'/TAM/0001/140102001',
|
|
118
119
|
params,
|
|
119
120
|
)
|
|
120
|
-
return response.body
|
|
121
121
|
},
|
|
122
122
|
|
|
123
123
|
/** 分页查询流水信息。 */
|
|
124
|
-
flowQueryAPI:
|
|
125
|
-
|
|
124
|
+
flowQueryAPI: (params: FlowInfoQueryParams & QueryPageParams) => {
|
|
125
|
+
return baseHttpClient.post<TamResponse<ForecastInfoListResponse<FlowInfoRow>>>(
|
|
126
126
|
'/TAM/0001/140102002',
|
|
127
127
|
params,
|
|
128
128
|
)
|
|
129
|
-
return response.body
|
|
130
129
|
},
|
|
131
130
|
|
|
132
131
|
/** 核销所选预报信息及关联流水信息。 */
|
|
133
|
-
verifyAPI:
|
|
134
|
-
|
|
132
|
+
verifyAPI: (params: VerificationRequestParams) => {
|
|
133
|
+
return baseHttpClient.post<TamResponse<ForecastInfoOperationResult>>(
|
|
135
134
|
'/TAM/0001/120102001',
|
|
136
135
|
params,
|
|
137
136
|
)
|
|
138
|
-
return response.body
|
|
139
137
|
},
|
|
140
138
|
|
|
141
139
|
/** 撤销所选预报信息及关联流水信息的核销。 */
|
|
142
|
-
cancelVerifyAPI:
|
|
143
|
-
|
|
140
|
+
cancelVerifyAPI: (params: VerificationRequestParams) => {
|
|
141
|
+
return baseHttpClient.post<TamResponse<ForecastInfoOperationResult>>(
|
|
144
142
|
'/TAM/0001/120102002',
|
|
145
143
|
params,
|
|
146
144
|
)
|
|
147
|
-
return response.body
|
|
148
145
|
},
|
|
149
146
|
}
|
|
150
147
|
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { RangeValue } from '@/components/element-rewrite/NumberRange.vue'
|
|
2
|
+
|
|
3
|
+
// 页面筛选选项、表格列及默认筛选值。
|
|
4
|
+
/** 动态表格列的基础配置。 */
|
|
5
|
+
export type TableColumn = {
|
|
6
|
+
prop: string
|
|
7
|
+
label: string
|
|
8
|
+
minWidth: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** 预报与流水的收支方向编码不同,分别维护。 */
|
|
12
|
+
export const forecastDirectionOptions = [
|
|
13
|
+
{ label: '收入', value: '1' },
|
|
14
|
+
{ label: '支出', value: '2' },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
export const flowDirectionOptions = [
|
|
18
|
+
{ label: '收入', value: '1' },
|
|
19
|
+
{ label: '支出', value: '0' },
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
/** 预报列表核销状态:每个后端状态值独立展示。 */
|
|
23
|
+
export const forecastVerifyStatusOptions = [
|
|
24
|
+
{ label: '未核销', value: '1' },
|
|
25
|
+
{ label: '已核销', value: '2' },
|
|
26
|
+
{ label: '部分核销', value: '3' },
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
/** 预报筛选核销状态:“待核销”同时查询未核销和部分核销。 */
|
|
30
|
+
export const forecastVerifyStatusFilterOptions = [
|
|
31
|
+
{ label: '待核销', value: '1,3' },
|
|
32
|
+
{ label: '已核销', value: '2' },
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
export const flowStatusOptions = [
|
|
36
|
+
{ label: '未核销', value: '1' },
|
|
37
|
+
{ label: '已核销', value: '2' },
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
/** 更多筛选区域使用的业务类型和渠道选项。 */
|
|
41
|
+
export const businessTypeOptions = [
|
|
42
|
+
{ label: '对公/个人客户收付', value: '1' },
|
|
43
|
+
{ label: '本票签发/兑付', value: '2' },
|
|
44
|
+
{ label: '三省一市汇票签发/兑付', value: '3' },
|
|
45
|
+
{ label: '分行资金调拨', value: '4' },
|
|
46
|
+
{ label: '同业业务', value: '5' },
|
|
47
|
+
{ label: '资金业务', value: '6' },
|
|
48
|
+
{ label: '理财业务', value: '7' },
|
|
49
|
+
{ label: '债券承销业务', value: '8' },
|
|
50
|
+
{ label: '司库业务', value: '9' },
|
|
51
|
+
{ label: '现金出入库', value: '10' },
|
|
52
|
+
{ label: '财政准备金退缴', value: '11' },
|
|
53
|
+
{ label: '同业清算款项收付', value: '12' },
|
|
54
|
+
{ label: '财政零余额业务', value: '13' },
|
|
55
|
+
{ label: '银行承兑汇票', value: '14' },
|
|
56
|
+
{ label: '托管业务', value: '15' },
|
|
57
|
+
{ label: '票据业务', value: '16' },
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
export const channelOptions = [
|
|
61
|
+
{ label: '大额支付', value: '1' },
|
|
62
|
+
{ label: '小额支付', value: '2' },
|
|
63
|
+
{ label: '票据交换', value: '3' },
|
|
64
|
+
{ label: '同城支付', value: '4' },
|
|
65
|
+
{ label: '网联支付', value: '7' },
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
export const organizationOptions = [
|
|
69
|
+
{ label: '总行营业部', value: 'head-office' },
|
|
70
|
+
{ label: '上海分行', value: 'shanghai' },
|
|
71
|
+
{ label: '深圳分行', value: 'shenzhen' },
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
export const groundBranchOptions = [
|
|
75
|
+
{ label: '总行营业部', value: 'head-office' },
|
|
76
|
+
{ label: '上海分行', value: 'shanghai' },
|
|
77
|
+
{ label: '深圳分行', value: 'shenzhen' },
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
/** 表格状态字段的显示文案。 */
|
|
81
|
+
export const releaseStatusMap: Record<string, string> = {
|
|
82
|
+
'0': '未释放',
|
|
83
|
+
'1': '已释放',
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const flowVerifyStatusMap: Record<string, string> = Object.fromEntries(
|
|
87
|
+
flowStatusOptions.map((option) => [option.value, option.label]),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
export const forecastVerifyStatusMap: Record<string, string> = Object.fromEntries(
|
|
91
|
+
forecastVerifyStatusOptions.map((option) => [option.value, option.label]),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
export const amountColumnProps = new Set(['predAmt', 'verifyAmt'])
|
|
95
|
+
|
|
96
|
+
/** 预报信息表格列。 */
|
|
97
|
+
export const forecastColumns: TableColumn[] = [
|
|
98
|
+
{ prop: 'predStatus', label: '预报状态', minWidth: 90 },
|
|
99
|
+
{ prop: 'payDirec', label: '收支方向', minWidth: 90 },
|
|
100
|
+
{ prop: 'predAmt', label: '预报金额', minWidth: 110 },
|
|
101
|
+
{ prop: 'verifyAmt', label: '已核销金额', minWidth: 118 },
|
|
102
|
+
{ prop: 'verifyStatus', label: '核销状态', minWidth: 90 },
|
|
103
|
+
{ prop: 'relsFlag', label: '释放状态', minWidth: 90 },
|
|
104
|
+
{ prop: 'payChannel', label: '支付渠道', minWidth: 96 },
|
|
105
|
+
{ prop: 'clientName', label: '客户名称', minWidth: 100 },
|
|
106
|
+
{ prop: 'clientType', label: '客户类型', minWidth: 96 },
|
|
107
|
+
{ prop: 'competName', label: '交易对手名称', minWidth: 124 },
|
|
108
|
+
{ prop: 'competAcct', label: '交易对手账号', minWidth: 132 },
|
|
109
|
+
{ prop: 'standardName', label: '标准名称', minWidth: 100 },
|
|
110
|
+
{ prop: 'billNo', label: '票号', minWidth: 82 },
|
|
111
|
+
{ prop: 'billDate', label: '出票日期', minWidth: 96 },
|
|
112
|
+
{ prop: 'tranDate', label: '交易日期', minWidth: 96 },
|
|
113
|
+
{ prop: 'busiType', label: '业务类型', minWidth: 96 },
|
|
114
|
+
{ prop: 'predDate', label: '预报日期', minWidth: 96 },
|
|
115
|
+
{ prop: 'predCode', label: '预报人员编号', minWidth: 118 },
|
|
116
|
+
{ prop: 'predRefNo', label: '预报流水号', minWidth: 118 },
|
|
117
|
+
{ prop: 'groundBranch', label: '落地机构', minWidth: 100 },
|
|
118
|
+
{ prop: 'groundBranchCode', label: '机构代码', minWidth: 96 },
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
/** 流水信息表格列。 */
|
|
122
|
+
export const flowColumns: TableColumn[] = [
|
|
123
|
+
{ prop: 'amt', label: '金额', minWidth: 96 },
|
|
124
|
+
{ prop: 'billDate', label: '出票日期', minWidth: 96 },
|
|
125
|
+
{ prop: 'billNo', label: '票号', minWidth: 82 },
|
|
126
|
+
{ prop: 'busiType', label: '支付系统业务类型', minWidth: 138 },
|
|
127
|
+
{ prop: 'clientAcct', label: '我方账号', minWidth: 112 },
|
|
128
|
+
{ prop: 'clientName', label: '我方户名', minWidth: 100 },
|
|
129
|
+
{ prop: 'competAcct', label: '对方账号', minWidth: 112 },
|
|
130
|
+
{ prop: 'competName', label: '对方户名', minWidth: 100 },
|
|
131
|
+
{ prop: 'groundBranch', label: '我方机构', minWidth: 100 },
|
|
132
|
+
{ prop: 'payChannel', label: '支付渠道', minWidth: 92 },
|
|
133
|
+
{ prop: 'payDirec', label: '收支方向', minWidth: 90 },
|
|
134
|
+
{ prop: 'refNo', label: '流水号', minWidth: 118 },
|
|
135
|
+
{ prop: 'standardName', label: '标准名称', minWidth: 100 },
|
|
136
|
+
{ prop: 'tranDate', label: '交易日期', minWidth: 96 },
|
|
137
|
+
{ prop: 'tranTimeStamp', label: '清算时间', minWidth: 128 },
|
|
138
|
+
{ prop: 'verifyStatus', label: '核销状态', minWidth: 90 },
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
/** 创建全新的默认筛选值,避免重置时复用同一个数组引用。 */
|
|
142
|
+
export function createDefaultForecastForm() {
|
|
143
|
+
return {
|
|
144
|
+
tradeDate: '2026-07-07',
|
|
145
|
+
direction: '',
|
|
146
|
+
businessType: '',
|
|
147
|
+
amountRange: [100_000_000, null] as RangeValue,
|
|
148
|
+
channel: '',
|
|
149
|
+
verification: '',
|
|
150
|
+
clientName: '',
|
|
151
|
+
counterpartyName: '',
|
|
152
|
+
ourAccount: '',
|
|
153
|
+
organizationKeyword: '',
|
|
154
|
+
organization: '',
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function createDefaultFlowForm() {
|
|
159
|
+
return {
|
|
160
|
+
tranDate: '2026-07-07',
|
|
161
|
+
payDirec: '',
|
|
162
|
+
clientName: '',
|
|
163
|
+
competName: '',
|
|
164
|
+
payChannel: '',
|
|
165
|
+
transAmtRange: [100_000_000, null] as RangeValue,
|
|
166
|
+
verifyStatus: '',
|
|
167
|
+
groundBranch: '',
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { computed, ref } from 'vue'
|
|
2
|
+
import forecastInfoApi, {
|
|
3
|
+
type FlowInfoQueryParams,
|
|
4
|
+
type FlowInfoRow,
|
|
5
|
+
type ForecastInfoOperationResult,
|
|
6
|
+
type ForecastInfoQueryParams,
|
|
7
|
+
type ForecastInfoRow,
|
|
8
|
+
type VerificationRequestParams,
|
|
9
|
+
} from './api'
|
|
10
|
+
|
|
11
|
+
// 页面实例内的列表、选择、核销和卡片布局状态。
|
|
12
|
+
export type ForecastInfoCardLayout = 'vertical' | 'horizontal'
|
|
13
|
+
export type ForecastInfoSelectionKey = 'forecastInfo' | 'flowInfo'
|
|
14
|
+
|
|
15
|
+
/** 卡片布局仅保存布局类型,不持久化临时弹窗或表格选择。 */
|
|
16
|
+
const CARD_LAYOUT_STORAGE_KEY = 'forecast-info:card-layout'
|
|
17
|
+
const DEFAULT_CARD_LAYOUT: ForecastInfoCardLayout = 'horizontal'
|
|
18
|
+
|
|
19
|
+
export type ForecastCalculationSummary = {
|
|
20
|
+
forecastAmount: string
|
|
21
|
+
forecastVerifiedAmount: string
|
|
22
|
+
forecastUnverifiedAmount: string
|
|
23
|
+
flowAmount: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function restoreCardLayout(): ForecastInfoCardLayout {
|
|
27
|
+
if (typeof window === 'undefined') return DEFAULT_CARD_LAYOUT
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const storedLayout = window.localStorage.getItem(CARD_LAYOUT_STORAGE_KEY)
|
|
31
|
+
if (storedLayout === 'horizontal' || storedLayout === 'vertical') return storedLayout
|
|
32
|
+
} catch {
|
|
33
|
+
// 浏览器禁用本地存储时继续使用默认布局,不影响页面进入。
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return DEFAULT_CARD_LAYOUT
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function defaultForecastQueryParams(): ForecastInfoQueryParams {
|
|
40
|
+
return {
|
|
41
|
+
busiType: '',
|
|
42
|
+
clientName: '',
|
|
43
|
+
competName: '',
|
|
44
|
+
endTransAmt: '',
|
|
45
|
+
groundBranch: '',
|
|
46
|
+
groundBranchName: '',
|
|
47
|
+
ourAcct: '',
|
|
48
|
+
payChannel: '',
|
|
49
|
+
payDirec: '',
|
|
50
|
+
startTransAmt: '',
|
|
51
|
+
tranDate: '',
|
|
52
|
+
verifyStatus: '',
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function defaultFlowQueryParams(): FlowInfoQueryParams {
|
|
57
|
+
return {
|
|
58
|
+
clientName: '',
|
|
59
|
+
competName: '',
|
|
60
|
+
endTransAmt: '',
|
|
61
|
+
groundBranch: '',
|
|
62
|
+
groundBranchName: '',
|
|
63
|
+
payChannel: '',
|
|
64
|
+
payDirec: '',
|
|
65
|
+
startTransAmt: '',
|
|
66
|
+
tranDate: '',
|
|
67
|
+
verifyStatus: '',
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function createCalculationSummary(): ForecastCalculationSummary {
|
|
72
|
+
return {
|
|
73
|
+
forecastAmount: '0',
|
|
74
|
+
forecastVerifiedAmount: '0',
|
|
75
|
+
forecastUnverifiedAmount: '0',
|
|
76
|
+
flowAmount: '0',
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function parseAmount(value: unknown) {
|
|
81
|
+
const amount = Number(String(value ?? '').trim().replace(/,/g, ''))
|
|
82
|
+
return Number.isFinite(amount) ? amount : 0
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function formatCalculationAmount(value: number) {
|
|
86
|
+
const roundedValue = Math.round((value + Number.EPSILON) * 100) / 100
|
|
87
|
+
if (Object.is(roundedValue, -0)) return '0'
|
|
88
|
+
if (Number.isInteger(roundedValue)) return String(roundedValue)
|
|
89
|
+
return String(roundedValue).replace(/(\.\d*?)0+$/, '$1').replace(/\.$/, '')
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function sumAmount<T extends object>(rows: T[], key: keyof T) {
|
|
93
|
+
return rows.reduce((total, row) => total + parseAmount(row[key]), 0)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** 列表字段缺失时统一回退为空数组。 */
|
|
97
|
+
function normalizeListResponse<T>(response: {
|
|
98
|
+
resultList?: T[] | null
|
|
99
|
+
totalCount?: string | number | null
|
|
100
|
+
}) {
|
|
101
|
+
const resultList = Array.isArray(response.resultList) ? response.resultList : []
|
|
102
|
+
const totalText = String(response.totalCount ?? '').trim()
|
|
103
|
+
const total = totalText ? Number(totalText) : Number.NaN
|
|
104
|
+
return {
|
|
105
|
+
resultList,
|
|
106
|
+
totalCount: Number.isFinite(total) ? total : resultList.length,
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** 核销与撤销核销各自允许处理的状态。 */
|
|
111
|
+
const verificationAllowedStatuses = {
|
|
112
|
+
verify: new Set(['1', '3']),
|
|
113
|
+
cancelVerify: new Set(['2', '3']),
|
|
114
|
+
} satisfies Record<'verify' | 'cancelVerify', Set<string>>
|
|
115
|
+
|
|
116
|
+
function canChangeVerificationStatus(
|
|
117
|
+
row: { verifyStatus?: string },
|
|
118
|
+
action: 'verify' | 'cancelVerify',
|
|
119
|
+
) {
|
|
120
|
+
return verificationAllowedStatuses[action].has(String(row.verifyStatus ?? '').trim())
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function toRequestText(value: unknown) {
|
|
124
|
+
return value === null || value === undefined ? '' : String(value)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* forecast-info 路由实例内的业务状态。
|
|
129
|
+
* 只负责列表、选择和核销,不处理页面浮层、消息或路由生命周期。
|
|
130
|
+
*/
|
|
131
|
+
export function useForecastInfoState() {
|
|
132
|
+
const cardLayout = ref<ForecastInfoCardLayout>(restoreCardLayout())
|
|
133
|
+
|
|
134
|
+
const forecastRows = ref<ForecastInfoRow[]>([])
|
|
135
|
+
const forecastTotal = ref(0)
|
|
136
|
+
const forecastPage = ref(1)
|
|
137
|
+
const forecastPageSize = ref(10)
|
|
138
|
+
const forecastLoading = ref(false)
|
|
139
|
+
const forecastQueryParams = ref<ForecastInfoQueryParams>(defaultForecastQueryParams())
|
|
140
|
+
|
|
141
|
+
const flowRows = ref<FlowInfoRow[]>([])
|
|
142
|
+
const flowTotal = ref(0)
|
|
143
|
+
const flowPage = ref(1)
|
|
144
|
+
const flowPageSize = ref(10)
|
|
145
|
+
const flowLoading = ref(false)
|
|
146
|
+
const flowQueryParams = ref<FlowInfoQueryParams>(defaultFlowQueryParams())
|
|
147
|
+
|
|
148
|
+
const forecastSelectedRows = ref<ForecastInfoRow[]>([])
|
|
149
|
+
const flowSelectedRows = ref<FlowInfoRow[]>([])
|
|
150
|
+
const forecastSelectionResetKey = ref(0)
|
|
151
|
+
const flowSelectionResetKey = ref(0)
|
|
152
|
+
const forecastHasSelectedRows = computed(() => forecastSelectedRows.value.length > 0)
|
|
153
|
+
const flowHasSelectedRows = computed(() => flowSelectedRows.value.length > 0)
|
|
154
|
+
const calculationSummary = ref<ForecastCalculationSummary>(createCalculationSummary())
|
|
155
|
+
const calculationDialogVisible = ref(false)
|
|
156
|
+
|
|
157
|
+
/** 两张表各自维护请求代次,避免较早返回的请求覆盖新结果。 */
|
|
158
|
+
let forecastRequestGeneration = 0
|
|
159
|
+
let flowRequestGeneration = 0
|
|
160
|
+
|
|
161
|
+
function setCardLayout(layout: ForecastInfoCardLayout) {
|
|
162
|
+
cardLayout.value = layout
|
|
163
|
+
try {
|
|
164
|
+
window.localStorage.setItem(CARD_LAYOUT_STORAGE_KEY, layout)
|
|
165
|
+
} catch {
|
|
166
|
+
// 本地存储不可用时仅保留本次页面状态。
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function handleForecastSelectionChange(rows: ForecastInfoRow[]) {
|
|
171
|
+
forecastSelectedRows.value = rows
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function handleFlowSelectionChange(rows: FlowInfoRow[]) {
|
|
175
|
+
flowSelectedRows.value = rows
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function resetTableSelection(key: ForecastInfoSelectionKey) {
|
|
179
|
+
if (key === 'forecastInfo') {
|
|
180
|
+
forecastSelectedRows.value = []
|
|
181
|
+
forecastSelectionResetKey.value += 1
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
flowSelectedRows.value = []
|
|
185
|
+
flowSelectionResetKey.value += 1
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function cancelPendingRequests() {
|
|
189
|
+
forecastRequestGeneration += 1
|
|
190
|
+
flowRequestGeneration += 1
|
|
191
|
+
forecastLoading.value = false
|
|
192
|
+
flowLoading.value = false
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function calculateSelectedSummary(): ForecastInfoOperationResult {
|
|
196
|
+
if (!forecastHasSelectedRows.value) {
|
|
197
|
+
return { success: false, message: '请选择预报信息数据' }
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const forecastAmount = sumAmount(forecastSelectedRows.value, 'predAmt')
|
|
201
|
+
const forecastVerifiedAmount = sumAmount(forecastSelectedRows.value, 'verifyAmt')
|
|
202
|
+
const flowAmount = sumAmount(flowSelectedRows.value, 'amt')
|
|
203
|
+
calculationSummary.value = {
|
|
204
|
+
forecastAmount: formatCalculationAmount(forecastAmount),
|
|
205
|
+
forecastVerifiedAmount: formatCalculationAmount(forecastVerifiedAmount),
|
|
206
|
+
forecastUnverifiedAmount: formatCalculationAmount(forecastAmount - forecastVerifiedAmount),
|
|
207
|
+
flowAmount: formatCalculationAmount(flowAmount),
|
|
208
|
+
}
|
|
209
|
+
return { success: true, message: '' }
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function validateVerificationSelection(
|
|
213
|
+
action: 'verify' | 'cancelVerify',
|
|
214
|
+
): ForecastInfoOperationResult {
|
|
215
|
+
const actionLabel = action === 'verify' ? '核销' : '撤销核销'
|
|
216
|
+
|
|
217
|
+
if (!forecastHasSelectedRows.value) {
|
|
218
|
+
if (flowHasSelectedRows.value) {
|
|
219
|
+
return {
|
|
220
|
+
success: false,
|
|
221
|
+
message: `流水信息不能单独${actionLabel},请至少选择一条预报信息数据`,
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return { success: false, message: '请选择预报信息数据' }
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (forecastSelectedRows.value.some((row) => !canChangeVerificationStatus(row, action))) {
|
|
228
|
+
return { success: false, message: `所选预报信息中包含不可${actionLabel}的数据,请重新选择` }
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (flowSelectedRows.value.some((row) => !canChangeVerificationStatus(row, action))) {
|
|
232
|
+
return { success: false, message: `所选流水信息中包含不可${actionLabel}的数据,请重新选择` }
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return { success: true, message: '' }
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function buildVerificationRequestParams(): VerificationRequestParams {
|
|
239
|
+
return {
|
|
240
|
+
predList: forecastSelectedRows.value.map((row) => ({
|
|
241
|
+
predAmt: toRequestText(row.predAmt),
|
|
242
|
+
predRefNo: toRequestText(row.predRefNo),
|
|
243
|
+
verifyAmt: toRequestText(row.verifyAmt),
|
|
244
|
+
verifyStatus: toRequestText(row.verifyStatus),
|
|
245
|
+
})),
|
|
246
|
+
tranList: flowSelectedRows.value.map((row) => ({
|
|
247
|
+
amt: toRequestText(row.amt),
|
|
248
|
+
refNo: toRequestText(row.refNo),
|
|
249
|
+
verifyStatus: toRequestText(row.verifyStatus),
|
|
250
|
+
})),
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
async function loadForecastInfoList(params: ForecastInfoQueryParams = forecastQueryParams.value) {
|
|
255
|
+
const generation = ++forecastRequestGeneration
|
|
256
|
+
const queryParams = { ...params }
|
|
257
|
+
forecastLoading.value = true
|
|
258
|
+
forecastQueryParams.value = queryParams
|
|
259
|
+
|
|
260
|
+
try {
|
|
261
|
+
const response = await forecastInfoApi.forecastQueryAPI({
|
|
262
|
+
...queryParams,
|
|
263
|
+
pageNum: forecastPage.value,
|
|
264
|
+
pageSize: forecastPageSize.value,
|
|
265
|
+
})
|
|
266
|
+
if (generation !== forecastRequestGeneration) return false
|
|
267
|
+
const { resultList, totalCount } = normalizeListResponse(response.body)
|
|
268
|
+
forecastRows.value = resultList.map((item) => ({ ...item }))
|
|
269
|
+
forecastTotal.value = totalCount
|
|
270
|
+
resetTableSelection('forecastInfo')
|
|
271
|
+
return true
|
|
272
|
+
} finally {
|
|
273
|
+
if (generation === forecastRequestGeneration) forecastLoading.value = false
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async function loadFlowInfoList(params: FlowInfoQueryParams = flowQueryParams.value) {
|
|
278
|
+
const generation = ++flowRequestGeneration
|
|
279
|
+
const queryParams = { ...params }
|
|
280
|
+
flowLoading.value = true
|
|
281
|
+
flowQueryParams.value = queryParams
|
|
282
|
+
|
|
283
|
+
try {
|
|
284
|
+
const response = await forecastInfoApi.flowQueryAPI({
|
|
285
|
+
...queryParams,
|
|
286
|
+
pageNum: flowPage.value,
|
|
287
|
+
pageSize: flowPageSize.value,
|
|
288
|
+
})
|
|
289
|
+
if (generation !== flowRequestGeneration) return false
|
|
290
|
+
const { resultList, totalCount } = normalizeListResponse(response.body)
|
|
291
|
+
flowRows.value = resultList.map((item) => ({ ...item }))
|
|
292
|
+
flowTotal.value = totalCount
|
|
293
|
+
resetTableSelection('flowInfo')
|
|
294
|
+
return true
|
|
295
|
+
} finally {
|
|
296
|
+
if (generation === flowRequestGeneration) flowLoading.value = false
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** 核销完成后固定使用操作发起时的两份查询快照并发刷新。 */
|
|
301
|
+
async function refreshVerificationLists(
|
|
302
|
+
forecastSnapshot: ForecastInfoQueryParams,
|
|
303
|
+
flowSnapshot: FlowInfoQueryParams,
|
|
304
|
+
) {
|
|
305
|
+
const results = await Promise.all([
|
|
306
|
+
loadForecastInfoList(forecastSnapshot),
|
|
307
|
+
loadFlowInfoList(flowSnapshot),
|
|
308
|
+
])
|
|
309
|
+
return results.every(Boolean)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
async function changeVerification(action: 'verify' | 'cancelVerify') {
|
|
313
|
+
const validationResult = validateVerificationSelection(action)
|
|
314
|
+
if (!validationResult.success) return validationResult
|
|
315
|
+
|
|
316
|
+
const forecastSnapshot = { ...forecastQueryParams.value }
|
|
317
|
+
const flowSnapshot = { ...flowQueryParams.value }
|
|
318
|
+
const requestParams = buildVerificationRequestParams()
|
|
319
|
+
const response = action === 'verify'
|
|
320
|
+
? await forecastInfoApi.verifyAPI(requestParams)
|
|
321
|
+
: await forecastInfoApi.cancelVerifyAPI(requestParams)
|
|
322
|
+
|
|
323
|
+
if (!(await refreshVerificationLists(forecastSnapshot, flowSnapshot))) return null
|
|
324
|
+
return response.body
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function handleCalculationSummary() {
|
|
328
|
+
const result = calculateSelectedSummary()
|
|
329
|
+
if (result.success) calculationDialogVisible.value = true
|
|
330
|
+
return result
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function handleForecastVerify() {
|
|
334
|
+
return changeVerification('verify')
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function handleForecastCancelVerify() {
|
|
338
|
+
return changeVerification('cancelVerify')
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return {
|
|
342
|
+
cardLayout,
|
|
343
|
+
forecastRows,
|
|
344
|
+
forecastTotal,
|
|
345
|
+
forecastPage,
|
|
346
|
+
forecastPageSize,
|
|
347
|
+
forecastLoading,
|
|
348
|
+
flowRows,
|
|
349
|
+
flowTotal,
|
|
350
|
+
flowPage,
|
|
351
|
+
flowPageSize,
|
|
352
|
+
flowLoading,
|
|
353
|
+
forecastSelectionResetKey,
|
|
354
|
+
flowSelectionResetKey,
|
|
355
|
+
forecastSelectedRows,
|
|
356
|
+
flowSelectedRows,
|
|
357
|
+
forecastHasSelectedRows,
|
|
358
|
+
calculationSummary,
|
|
359
|
+
calculationDialogVisible,
|
|
360
|
+
setCardLayout,
|
|
361
|
+
resetTableSelection,
|
|
362
|
+
cancelPendingRequests,
|
|
363
|
+
handleForecastSelectionChange,
|
|
364
|
+
handleFlowSelectionChange,
|
|
365
|
+
handleCalculationSummary,
|
|
366
|
+
handleForecastVerify,
|
|
367
|
+
handleForecastCancelVerify,
|
|
368
|
+
loadForecastInfoList,
|
|
369
|
+
loadFlowInfoList,
|
|
370
|
+
}
|
|
371
|
+
}
|