verce-vue-test 0.0.75 → 0.0.76

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.
@@ -0,0 +1,990 @@
1
+ <script setup lang="ts">
2
+ import { computed, onBeforeUnmount, reactive, ref } from 'vue'
3
+ import { Search } from '@element-plus/icons-vue'
4
+ import { ElMessage } from 'element-plus'
5
+ import {
6
+ requestRmbPositionEstimation,
7
+ type ProtocolAmount,
8
+ type RmbPositionAmountField,
9
+ type RmbPositionEstimationRequestBody,
10
+ type RmbPositionEstimationResponseBody,
11
+ } from './rmb-position-estimation/api'
12
+
13
+ const YUAN_PER_YI = 100_000_000n
14
+ const YUAN_PER_YI_CENT = 1_000_000n
15
+
16
+ type ManualAmountKey =
17
+ | 'overAmt'
18
+ | 'fzAmtIn'
19
+ | 'fzAmtOut'
20
+ | 'bepsAmtIn'
21
+ | 'bepsAmtOut'
22
+ | 'othAmtIn'
23
+ | 'othAmtOut'
24
+ | 'ysAmtIn'
25
+ | 'ysAmtOut'
26
+
27
+ type RemarkKey = 'fzAmtRmk' | 'bepsAmtRmk' | 'othAmtRmk' | 'ysAmtRmk'
28
+ type FormState = { tranDate: string } & Record<ManualAmountKey | RemarkKey, string>
29
+ type PairPrefix = 'hg' | 'zq' | 'pj' | 'tg' | 'ty' | 'fzh' | 'lc' | 'qt' | 'zj'
30
+
31
+ type AmountCells = {
32
+ income: RmbPositionAmountField
33
+ expense: RmbPositionAmountField
34
+ net: RmbPositionAmountField
35
+ }
36
+
37
+ type PairSection = {
38
+ key: PairPrefix
39
+ label: string
40
+ shortLabel: string
41
+ prediction: AmountCells
42
+ unverified: AmountCells
43
+ }
44
+
45
+ type ManualRow = {
46
+ key: string
47
+ label: string
48
+ incomeKey: ManualAmountKey
49
+ expenseKey: ManualAmountKey
50
+ remarkKey: RemarkKey
51
+ }
52
+
53
+ type SingleResultRow = {
54
+ key: string
55
+ label: string
56
+ cells: AmountCells
57
+ }
58
+
59
+ type LinkedCell = {
60
+ id: string
61
+ index: number
62
+ field: RmbPositionAmountField
63
+ }
64
+
65
+ function pad(value: number) {
66
+ return String(value).padStart(2, '0')
67
+ }
68
+
69
+ function compactDate(date: Date) {
70
+ return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}`
71
+ }
72
+
73
+ function isValidCompactDate(value: string) {
74
+ if (!/^\d{8}$/.test(value)) return false
75
+ const year = Number(value.slice(0, 4))
76
+ const month = Number(value.slice(4, 6))
77
+ const day = Number(value.slice(6, 8))
78
+ const date = new Date(year, month - 1, day)
79
+ return compactDate(date) === value
80
+ }
81
+
82
+ function initialBusinessDate() {
83
+ const configuredDate = String(import.meta.env.VITE_SYSTEM_WORK_DATE || '').trim()
84
+ return isValidCompactDate(configuredDate) ? configuredDate : compactDate(new Date())
85
+ }
86
+
87
+ function createAmountCells(prefix: PairPrefix, type: 'Pred' | 'Unverify'): AmountCells {
88
+ return {
89
+ income: `${prefix}${type}AmtIn` as RmbPositionAmountField,
90
+ expense: `${prefix}${type}AmtOut` as RmbPositionAmountField,
91
+ net: `${prefix}${type}AmtNet` as RmbPositionAmountField,
92
+ }
93
+ }
94
+
95
+ function createPairSection(
96
+ key: PairPrefix,
97
+ shortLabel: string,
98
+ label: string,
99
+ ): PairSection {
100
+ return {
101
+ key,
102
+ shortLabel,
103
+ label,
104
+ prediction: createAmountCells(key, 'Pred'),
105
+ unverified: createAmountCells(key, 'Unverify'),
106
+ }
107
+ }
108
+
109
+ const pairSections: PairSection[] = [
110
+ createPairSection('hg', '回购', '回购(拆借)到期,CD发行、投资及到期'),
111
+ createPairSection('zq', '债券', '债券承销'),
112
+ createPairSection('pj', '票据', '票据业务'),
113
+ createPairSection('tg', '托管', '托管业务'),
114
+ createPairSection('ty', '同业', '同业业务'),
115
+ createPairSection('fzh', '支行', '支行、营业部大额收付报备合计(3亿及以上)'),
116
+ createPairSection('lc', '理财', '理财业务发生额及到期'),
117
+ createPairSection('qt', '其他', '其他'),
118
+ ]
119
+
120
+ const fundSection = createPairSection('zj', '资金', '今日资金交易新业务收付合计')
121
+
122
+ const manualRows: ManualRow[] = [
123
+ {
124
+ key: 'reserve',
125
+ label: '法定准备金退/缴款及其他来走款',
126
+ incomeKey: 'fzAmtIn',
127
+ expenseKey: 'fzAmtOut',
128
+ remarkKey: 'fzAmtRmk',
129
+ },
130
+ {
131
+ key: 'beps',
132
+ label: '小额来走款',
133
+ incomeKey: 'bepsAmtIn',
134
+ expenseKey: 'bepsAmtOut',
135
+ remarkKey: 'bepsAmtRmk',
136
+ },
137
+ {
138
+ key: 'other',
139
+ label: '其他来走款',
140
+ incomeKey: 'othAmtIn',
141
+ expenseKey: 'othAmtOut',
142
+ remarkKey: 'othAmtRmk',
143
+ },
144
+ ]
145
+
146
+ const singleResultRows: SingleResultRow[] = [
147
+ {
148
+ key: 'cash-message',
149
+ label: '现金出入库、净额轧差业务、财政准备金退缴报文【606报文】',
150
+ cells: { income: 'xjAmtIn', expense: 'xjAmtOut', net: 'xjAmtNet' },
151
+ },
152
+ {
153
+ key: 'under-one-hundred-million',
154
+ label: '1亿以下未核销大/小额业务流水【除606以外的报文】',
155
+ cells: { income: 'unVerifyAmtIn1', expense: 'unVerifyAmtOut1', net: 'unVerifyAmtNet1' },
156
+ },
157
+ {
158
+ key: 'over-one-hundred-million',
159
+ label: '1亿及以上未核销大/小额业务流水【除606以外的报文】',
160
+ cells: { income: 'unVerifyAmtIn', expense: 'unVerifyAmtOut', net: 'unVerifyAmtNet' },
161
+ },
162
+ ]
163
+
164
+ const linkedCellMap = new Map<RmbPositionAmountField, LinkedCell>()
165
+
166
+ function registerLinkedCell(field: RmbPositionAmountField, id: string, index: number) {
167
+ linkedCellMap.set(field, { id, index, field })
168
+ }
169
+
170
+ pairSections.forEach((section, sectionIndex) => {
171
+ const predictionRow = 5 + sectionIndex * 2
172
+ const unverifiedRow = predictionRow + 1
173
+ const startIndex = sectionIndex * 4
174
+
175
+ registerLinkedCell(section.prediction.income, `C${predictionRow}`, startIndex)
176
+ registerLinkedCell(section.prediction.expense, `D${predictionRow}`, startIndex + 1)
177
+ registerLinkedCell(section.unverified.income, `C${unverifiedRow}`, startIndex + 2)
178
+ registerLinkedCell(section.unverified.expense, `D${unverifiedRow}`, startIndex + 3)
179
+ })
180
+
181
+ singleResultRows.forEach((row, rowIndex) => {
182
+ const tableRow = 24 + rowIndex
183
+ const startIndex = 32 + rowIndex * 2
184
+
185
+ registerLinkedCell(row.cells.income, `C${tableRow}`, startIndex)
186
+ registerLinkedCell(row.cells.expense, `D${tableRow}`, startIndex + 1)
187
+ })
188
+
189
+ registerLinkedCell(fundSection.prediction.income, 'C31', 38)
190
+ registerLinkedCell(fundSection.prediction.expense, 'D31', 39)
191
+ registerLinkedCell(fundSection.unverified.income, 'C32', 40)
192
+ registerLinkedCell(fundSection.unverified.expense, 'D32', 41)
193
+
194
+ const predictionIncomeFields = pairSections.map((section) => section.prediction.income)
195
+ const predictionExpenseFields = pairSections.map((section) => section.prediction.expense)
196
+ const subtotalResultIncomeFields: RmbPositionAmountField[] = [
197
+ ...predictionIncomeFields,
198
+ 'xjAmtIn',
199
+ 'unVerifyAmtIn1',
200
+ 'unVerifyAmtIn',
201
+ ]
202
+ const subtotalResultExpenseFields: RmbPositionAmountField[] = [
203
+ ...predictionExpenseFields,
204
+ 'xjAmtOut',
205
+ 'unVerifyAmtOut1',
206
+ 'unVerifyAmtOut',
207
+ ]
208
+
209
+ const manualAmountKeys: ManualAmountKey[] = [
210
+ 'overAmt',
211
+ 'fzAmtIn',
212
+ 'fzAmtOut',
213
+ 'bepsAmtIn',
214
+ 'bepsAmtOut',
215
+ 'othAmtIn',
216
+ 'othAmtOut',
217
+ 'ysAmtIn',
218
+ 'ysAmtOut',
219
+ ]
220
+
221
+ const remarkKeys: RemarkKey[] = ['fzAmtRmk', 'bepsAmtRmk', 'othAmtRmk', 'ysAmtRmk']
222
+
223
+ const amountFieldLabels: Record<ManualAmountKey, string> = {
224
+ overAmt: '昨日超额备付余额',
225
+ fzAmtIn: '法定准备金等收入',
226
+ fzAmtOut: '法定准备金等支出',
227
+ bepsAmtIn: '小额来走款收入',
228
+ bepsAmtOut: '小额来走款支出',
229
+ othAmtIn: '其他来走款收入',
230
+ othAmtOut: '其他来走款支出',
231
+ ysAmtIn: '今日资金交易预计收入',
232
+ ysAmtOut: '今日资金交易预计支出',
233
+ }
234
+
235
+ const requiredPairs: Array<[ManualAmountKey, ManualAmountKey]> = [
236
+ ['fzAmtIn', 'fzAmtOut'],
237
+ ['bepsAmtIn', 'bepsAmtOut'],
238
+ ['othAmtIn', 'othAmtOut'],
239
+ ['ysAmtIn', 'ysAmtOut'],
240
+ ]
241
+
242
+ const form = reactive<FormState>({
243
+ tranDate: initialBusinessDate(),
244
+ overAmt: '',
245
+ fzAmtIn: '',
246
+ fzAmtOut: '',
247
+ fzAmtRmk: '',
248
+ bepsAmtIn: '',
249
+ bepsAmtOut: '',
250
+ bepsAmtRmk: '',
251
+ othAmtIn: '',
252
+ othAmtOut: '',
253
+ othAmtRmk: '',
254
+ ysAmtIn: '',
255
+ ysAmtOut: '',
256
+ ysAmtRmk: '',
257
+ })
258
+
259
+ const result = ref<RmbPositionEstimationResponseBody | null>(null)
260
+ const loading = ref(false)
261
+ let requestController: AbortController | null = null
262
+
263
+ function stripGrouping(value: string) {
264
+ return value.trim().replaceAll(',', '')
265
+ }
266
+
267
+ function isValidYiAmount(value: string) {
268
+ const original = value.trim()
269
+ if (!/^-?(?:(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d*)?|\.\d+)$/.test(original)) return false
270
+ const normalized = stripGrouping(original)
271
+ const decimalLength = normalized.split('.')[1]?.length || 0
272
+ return decimalLength <= 8
273
+ }
274
+
275
+ function yiTextToYuan(value: string) {
276
+ const normalized = stripGrouping(value)
277
+ if (!normalized) return 0n
278
+
279
+ const negative = normalized.startsWith('-')
280
+ const unsigned = negative ? normalized.slice(1) : normalized
281
+ const [integerPart = '0', decimalPart = ''] = unsigned.split('.')
282
+ const yuan = BigInt(integerPart || '0') * YUAN_PER_YI
283
+ + BigInt(decimalPart.padEnd(8, '0').slice(0, 8) || '0')
284
+
285
+ return negative ? -yuan : yuan
286
+ }
287
+
288
+ function yuanTextToBigInt(value: unknown) {
289
+ const normalized = String(value ?? '0').trim().replaceAll(',', '')
290
+ if (/^-?\d+$/.test(normalized)) return BigInt(normalized)
291
+
292
+ const match = normalized.match(/^(-?)(?:(\d+)(?:\.(\d*))?|\.(\d+))$/)
293
+ if (!match) return 0n
294
+
295
+ const integerPart = BigInt(match[2] || '0')
296
+ const decimalPart = match[3] ?? match[4] ?? ''
297
+ const roundedAbsolute = integerPart + (decimalPart.charAt(0) >= '5' ? 1n : 0n)
298
+
299
+ return match[1] === '-' ? -roundedAbsolute : roundedAbsolute
300
+ }
301
+
302
+ function groupInteger(value: string) {
303
+ return value.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
304
+ }
305
+
306
+ function divideAndRoundHalfUp(value: bigint, divisor: bigint) {
307
+ const negative = value < 0n
308
+ const absolute = negative ? -value : value
309
+ const rounded = (absolute + divisor / 2n) / divisor
310
+
311
+ return negative ? -rounded : rounded
312
+ }
313
+
314
+ function roundYuanToYiCent(value: bigint) {
315
+ return divideAndRoundHalfUp(value, YUAN_PER_YI_CENT) * YUAN_PER_YI_CENT
316
+ }
317
+
318
+ function formatYuanAsYi(value: bigint | string) {
319
+ const yuan = typeof value === 'bigint' ? value : yuanTextToBigInt(value)
320
+ const roundedYuan = roundYuanToYiCent(yuan)
321
+ const negative = roundedYuan < 0n
322
+ const absolute = negative ? -roundedYuan : roundedYuan
323
+ const roundedYiCents = absolute / YUAN_PER_YI_CENT
324
+ const integerPart = roundedYiCents / 100n
325
+ const decimalPart = roundedYiCents % 100n
326
+ const sign = negative && roundedYiCents !== 0n ? '-' : ''
327
+
328
+ return `${sign}${groupInteger(String(integerPart))}.${String(decimalPart).padStart(2, '0')}`
329
+ }
330
+
331
+ function displayResultValue(field: RmbPositionAmountField) {
332
+ if (!result.value) return ''
333
+
334
+ const value = result.value[field]
335
+ if (value === undefined || value === null || String(value).trim() === '') return '0.00'
336
+
337
+ return formatYuanAsYi(value)
338
+ }
339
+
340
+ function displayManualNet(incomeKey: ManualAmountKey, expenseKey: ManualAmountKey) {
341
+ if (!result.value) return ''
342
+ return formatYuanAsYi(yiTextToYuan(form[incomeKey]) - yiTextToYuan(form[expenseKey]))
343
+ }
344
+
345
+ function sumResultFields(fields: RmbPositionAmountField[]) {
346
+ if (!result.value) return 0n
347
+ return fields.reduce((sum, field) => sum + yuanTextToBigInt(result.value?.[field]), 0n)
348
+ }
349
+
350
+ const subtotalIncomeYuan = computed<bigint | null>(() => {
351
+ if (!result.value) return null
352
+ return sumResultFields(subtotalResultIncomeFields)
353
+ + yiTextToYuan(form.fzAmtIn)
354
+ + yiTextToYuan(form.bepsAmtIn)
355
+ + yiTextToYuan(form.othAmtIn)
356
+ })
357
+
358
+ const subtotalExpenseYuan = computed<bigint | null>(() => {
359
+ if (!result.value) return null
360
+ return sumResultFields(subtotalResultExpenseFields)
361
+ + yiTextToYuan(form.fzAmtOut)
362
+ + yiTextToYuan(form.bepsAmtOut)
363
+ + yiTextToYuan(form.othAmtOut)
364
+ })
365
+
366
+ const subtotalNetYuan = computed<bigint | null>(() => {
367
+ if (subtotalIncomeYuan.value === null || subtotalExpenseYuan.value === null) return null
368
+ return subtotalIncomeYuan.value - subtotalExpenseYuan.value
369
+ })
370
+
371
+ const openingAvailableYuan = computed<bigint | null>(() => {
372
+ if (subtotalNetYuan.value === null) return null
373
+ return yiTextToYuan(form.overAmt) + subtotalNetYuan.value
374
+ })
375
+
376
+ const estimatedBalanceYuan = computed<bigint | null>(() => {
377
+ if (openingAvailableYuan.value === null) return null
378
+ return openingAvailableYuan.value + yiTextToYuan(form.ysAmtIn) - yiTextToYuan(form.ysAmtOut)
379
+ })
380
+
381
+ function displaySummary(value: bigint | null) {
382
+ return value === null ? '' : formatYuanAsYi(value)
383
+ }
384
+
385
+ function clearResult() {
386
+ result.value = null
387
+ }
388
+
389
+ function normalizeAmountField(key: ManualAmountKey) {
390
+ const original = form[key]
391
+ if (isValidYiAmount(original)) form[key] = stripGrouping(original)
392
+ }
393
+
394
+ function resetManualInputs() {
395
+ manualAmountKeys.forEach((key) => {
396
+ form[key] = ''
397
+ })
398
+ remarkKeys.forEach((key) => {
399
+ form[key] = ''
400
+ })
401
+ }
402
+
403
+ function handleDateChange() {
404
+ requestController?.abort()
405
+ requestController = null
406
+ loading.value = false
407
+ resetManualInputs()
408
+ clearResult()
409
+ }
410
+
411
+ function openLink(field: RmbPositionAmountField) {
412
+ const cell = linkedCellMap.get(field)
413
+ if (!cell) return
414
+
415
+ console.log('人民币头寸匡算表格点击参数:', {
416
+ ...cell,
417
+ tranDate: form.tranDate,
418
+ })
419
+ }
420
+
421
+ function toProtocolAmount(key: ManualAmountKey): ProtocolAmount {
422
+ const yuan = yiTextToYuan(form[key])
423
+ if (yuan === 0n) return '0'
424
+
425
+ const amount = Number(yuan)
426
+ if (!Number.isSafeInteger(amount)) {
427
+ throw new Error(`${amountFieldLabels[key]}超出接口可安全处理的金额范围`)
428
+ }
429
+ return amount
430
+ }
431
+
432
+ function validateForm() {
433
+ if (!form.tranDate) {
434
+ ElMessage.warning('请选择交易日期')
435
+ return false
436
+ }
437
+ if (!form.overAmt.trim()) {
438
+ ElMessage.warning('请填写昨日超额备付余额')
439
+ return false
440
+ }
441
+
442
+ const emptyPair = requiredPairs.find(([incomeKey, expenseKey]) => (
443
+ !form[incomeKey].trim() && !form[expenseKey].trim()
444
+ ))
445
+ if (emptyPair) {
446
+ const pairLabel = amountFieldLabels[emptyPair[0]].replace(/收入$/, '')
447
+ ElMessage.warning(`${pairLabel}的收入、支出至少填写一项`)
448
+ return false
449
+ }
450
+
451
+ const invalidKey = manualAmountKeys.find((key) => (
452
+ form[key].trim() !== '' && !isValidYiAmount(form[key])
453
+ ))
454
+ if (invalidKey) {
455
+ ElMessage.warning(`${amountFieldLabels[invalidKey]}格式不正确,最多支持 8 位小数`)
456
+ return false
457
+ }
458
+
459
+ try {
460
+ manualAmountKeys.forEach(toProtocolAmount)
461
+ } catch (error) {
462
+ ElMessage.warning(error instanceof Error ? error.message : '输入金额超出允许范围')
463
+ return false
464
+ }
465
+ return true
466
+ }
467
+
468
+ function buildRequestBody(): RmbPositionEstimationRequestBody {
469
+ return {
470
+ overAmt: toProtocolAmount('overAmt'),
471
+ tranDate: form.tranDate,
472
+ fzAmtIn: toProtocolAmount('fzAmtIn'),
473
+ fzAmtOut: toProtocolAmount('fzAmtOut'),
474
+ fzAmtRmk: form.fzAmtRmk.trim(),
475
+ bepsAmtIn: toProtocolAmount('bepsAmtIn'),
476
+ bepsAmtOut: toProtocolAmount('bepsAmtOut'),
477
+ bepsAmtRmk: form.bepsAmtRmk.trim(),
478
+ othAmtIn: toProtocolAmount('othAmtIn'),
479
+ othAmtOut: toProtocolAmount('othAmtOut'),
480
+ othAmtRmk: form.othAmtRmk.trim(),
481
+ ysAmtIn: toProtocolAmount('ysAmtIn'),
482
+ ysAmtOut: toProtocolAmount('ysAmtOut'),
483
+ ysAmtRmk: form.ysAmtRmk.trim(),
484
+ }
485
+ }
486
+
487
+ function isAbortError(error: unknown) {
488
+ return error instanceof DOMException && error.name === 'AbortError'
489
+ }
490
+
491
+ async function queryEstimation() {
492
+ if (!validateForm()) return
493
+
494
+ requestController?.abort()
495
+ const controller = new AbortController()
496
+ requestController = controller
497
+ loading.value = true
498
+ clearResult()
499
+
500
+ try {
501
+ const response = await requestRmbPositionEstimation(buildRequestBody(), {
502
+ signal: controller.signal,
503
+ })
504
+ if (controller.signal.aborted || requestController !== controller) return
505
+ result.value = response.body
506
+ } catch (error) {
507
+ if (!isAbortError(error)) {
508
+ ElMessage.error(error instanceof Error ? error.message : '人民币头寸匡算失败')
509
+ }
510
+ } finally {
511
+ if (requestController === controller) {
512
+ loading.value = false
513
+ requestController = null
514
+ }
515
+ }
516
+ }
517
+
518
+ onBeforeUnmount(() => {
519
+ requestController?.abort()
520
+ })
521
+ </script>
522
+
523
+ <template>
524
+ <div class="rmb-position-estimation-page">
525
+ <div class="query-section">
526
+ <el-form
527
+ :model="form"
528
+ :inline="true"
529
+ size="small"
530
+ @submit.prevent="queryEstimation"
531
+ >
532
+ <el-form-item label="交易日期:">
533
+ <el-date-picker
534
+ v-model="form.tranDate"
535
+ type="date"
536
+ value-format="YYYYMMDD"
537
+ format="YYYY-MM-DD"
538
+ :clearable="false"
539
+ :disabled="loading"
540
+ placeholder="请选择交易日期"
541
+ @change="handleDateChange"
542
+ />
543
+ </el-form-item>
544
+ <el-form-item>
545
+ <el-button
546
+ type="primary"
547
+ native-type="submit"
548
+ :icon="Search"
549
+ :loading="loading"
550
+ >
551
+ 查询
552
+ </el-button>
553
+ </el-form-item>
554
+ </el-form>
555
+ </div>
556
+
557
+ <div
558
+ id="mainDiv"
559
+ v-loading="loading"
560
+ element-loading-text="正在进行头寸匡算…"
561
+ >
562
+ <table class="tab">
563
+ <colgroup>
564
+ <col class="col-name" />
565
+ <col class="col-type" />
566
+ <col class="col-money" />
567
+ <col class="col-money" />
568
+ <col class="col-money" />
569
+ <col class="col-remark" />
570
+ </colgroup>
571
+ <tbody>
572
+ <tr class="head-row">
573
+ <td colspan="2">昨日超额备付余额</td>
574
+ <td>
575
+ <el-input
576
+ v-model="form.overAmt"
577
+ class="intStyle"
578
+ inputmode="decimal"
579
+ maxlength="24"
580
+ :disabled="loading"
581
+ aria-label="昨日超额备付余额,单位亿元"
582
+ @input="clearResult"
583
+ @blur="normalizeAmountField('overAmt')"
584
+ />
585
+ </td>
586
+ <td></td>
587
+ <td>单位:亿</td>
588
+ <td rowspan="2" class="remark-head">备注</td>
589
+ </tr>
590
+ <tr class="head-row">
591
+ <td colspan="2">今日大额收付款报备情况</td>
592
+ <td>收入</td>
593
+ <td>支付</td>
594
+ <td>轧差</td>
595
+ </tr>
596
+
597
+ <template v-for="section in pairSections" :key="section.key">
598
+ <tr>
599
+ <td rowspan="2" class="section-name">{{ section.label }}</td>
600
+ <td>报备金额</td>
601
+ <td align="right" class="money-cell even">
602
+ <span class="result-value" @click="openLink(section.prediction.income)">
603
+ {{ displayResultValue(section.prediction.income) }}
604
+ </span>
605
+ </td>
606
+ <td align="right" class="money-cell even">
607
+ <span class="result-value" @click="openLink(section.prediction.expense)">
608
+ {{ displayResultValue(section.prediction.expense) }}
609
+ </span>
610
+ </td>
611
+ <td align="right" class="money-cell even">
612
+ <span>{{ displayResultValue(section.prediction.net) }}</span>
613
+ </td>
614
+ <td class="even"></td>
615
+ </tr>
616
+ <tr>
617
+ <td>未核销金额</td>
618
+ <td align="right" class="money-cell">
619
+ <span class="result-value" @click="openLink(section.unverified.income)">
620
+ {{ displayResultValue(section.unverified.income) }}
621
+ </span>
622
+ </td>
623
+ <td align="right" class="money-cell">
624
+ <span class="result-value" @click="openLink(section.unverified.expense)">
625
+ {{ displayResultValue(section.unverified.expense) }}
626
+ </span>
627
+ </td>
628
+ <td align="right" class="money-cell">
629
+ <span>{{ displayResultValue(section.unverified.net) }}</span>
630
+ </td>
631
+ <td></td>
632
+ </tr>
633
+ </template>
634
+
635
+ <tr v-for="row in manualRows" :key="row.key">
636
+ <td colspan="2">{{ row.label }}</td>
637
+ <td>
638
+ <el-input
639
+ v-model="form[row.incomeKey]"
640
+ class="intStyle"
641
+ inputmode="decimal"
642
+ maxlength="24"
643
+ :disabled="loading"
644
+ :aria-label="row.label + '收入,单位亿元'"
645
+ @input="clearResult"
646
+ @blur="normalizeAmountField(row.incomeKey)"
647
+ />
648
+ </td>
649
+ <td>
650
+ <el-input
651
+ v-model="form[row.expenseKey]"
652
+ class="intStyle"
653
+ inputmode="decimal"
654
+ maxlength="24"
655
+ :disabled="loading"
656
+ :aria-label="row.label + '支出,单位亿元'"
657
+ @input="clearResult"
658
+ @blur="normalizeAmountField(row.expenseKey)"
659
+ />
660
+ </td>
661
+ <td align="right" class="money-cell">
662
+ <span>{{ displayManualNet(row.incomeKey, row.expenseKey) }}</span>
663
+ </td>
664
+ <td>
665
+ <el-input
666
+ v-model="form[row.remarkKey]"
667
+ class="intStyle remark-input"
668
+ maxlength="80"
669
+ :disabled="loading"
670
+ :aria-label="row.label + '备注'"
671
+ />
672
+ </td>
673
+ </tr>
674
+
675
+ <tr v-for="row in singleResultRows" :key="row.key">
676
+ <td colspan="2">{{ row.label }}</td>
677
+ <td align="right" class="money-cell even">
678
+ <span class="result-value" @click="openLink(row.cells.income)">
679
+ {{ displayResultValue(row.cells.income) }}
680
+ </span>
681
+ </td>
682
+ <td align="right" class="money-cell even">
683
+ <span class="result-value" @click="openLink(row.cells.expense)">
684
+ {{ displayResultValue(row.cells.expense) }}
685
+ </span>
686
+ </td>
687
+ <td align="right" class="money-cell even">
688
+ <span>{{ displayResultValue(row.cells.net) }}</span>
689
+ </td>
690
+ <td class="even"></td>
691
+ </tr>
692
+
693
+ <tr class="summary-row">
694
+ <td colspan="2" class="red">小计</td>
695
+ <td align="right" class="money-cell strong-value">
696
+ <span>{{ displaySummary(subtotalIncomeYuan) }}</span>
697
+ </td>
698
+ <td align="right" class="money-cell strong-value">
699
+ <span>{{ displaySummary(subtotalExpenseYuan) }}</span>
700
+ </td>
701
+ <td align="right" class="money-cell">
702
+ <span>{{ displaySummary(subtotalNetYuan) }}</span>
703
+ </td>
704
+ <td></td>
705
+ </tr>
706
+ <tr class="total-row">
707
+ <td colspan="2" class="bold red">日初可用资金</td>
708
+ <td colspan="3" class="bold red">
709
+ <span>{{ displaySummary(openingAvailableYuan) }}</span>
710
+ </td>
711
+ <td></td>
712
+ </tr>
713
+ <tr class="spacer-row">
714
+ <td colspan="6"></td>
715
+ </tr>
716
+
717
+ <tr>
718
+ <td colspan="2" class="red">今日资金交易预计收付额</td>
719
+ <td>
720
+ <el-input
721
+ v-model="form.ysAmtIn"
722
+ class="intStyle"
723
+ inputmode="decimal"
724
+ maxlength="24"
725
+ :disabled="loading"
726
+ aria-label="今日资金交易预计收入,单位亿元"
727
+ @input="clearResult"
728
+ @blur="normalizeAmountField('ysAmtIn')"
729
+ />
730
+ </td>
731
+ <td>
732
+ <el-input
733
+ v-model="form.ysAmtOut"
734
+ class="intStyle"
735
+ inputmode="decimal"
736
+ maxlength="24"
737
+ :disabled="loading"
738
+ aria-label="今日资金交易预计支出,单位亿元"
739
+ @input="clearResult"
740
+ @blur="normalizeAmountField('ysAmtOut')"
741
+ />
742
+ </td>
743
+ <td align="right" class="money-cell">
744
+ <span>{{ displayManualNet('ysAmtIn', 'ysAmtOut') }}</span>
745
+ </td>
746
+ <td>
747
+ <el-input
748
+ v-model="form.ysAmtRmk"
749
+ class="intStyle remark-input"
750
+ maxlength="80"
751
+ :disabled="loading"
752
+ aria-label="今日资金交易预计收付额备注"
753
+ />
754
+ </td>
755
+ </tr>
756
+
757
+ <tr>
758
+ <td rowspan="2" class="section-name">{{ fundSection.label }}</td>
759
+ <td>报备金额</td>
760
+ <td align="right" class="money-cell even">
761
+ <span class="result-value" @click="openLink(fundSection.prediction.income)">
762
+ {{ displayResultValue(fundSection.prediction.income) }}
763
+ </span>
764
+ </td>
765
+ <td align="right" class="money-cell even">
766
+ <span class="result-value" @click="openLink(fundSection.prediction.expense)">
767
+ {{ displayResultValue(fundSection.prediction.expense) }}
768
+ </span>
769
+ </td>
770
+ <td align="right" class="money-cell even">
771
+ <span>{{ displayResultValue(fundSection.prediction.net) }}</span>
772
+ </td>
773
+ <td class="even"></td>
774
+ </tr>
775
+ <tr>
776
+ <td>未核销金额</td>
777
+ <td align="right" class="money-cell">
778
+ <span class="result-value" @click="openLink(fundSection.unverified.income)">
779
+ {{ displayResultValue(fundSection.unverified.income) }}
780
+ </span>
781
+ </td>
782
+ <td align="right" class="money-cell">
783
+ <span class="result-value" @click="openLink(fundSection.unverified.expense)">
784
+ {{ displayResultValue(fundSection.unverified.expense) }}
785
+ </span>
786
+ </td>
787
+ <td align="right" class="money-cell">
788
+ <span>{{ displayResultValue(fundSection.unverified.net) }}</span>
789
+ </td>
790
+ <td></td>
791
+ </tr>
792
+ <tr class="total-row">
793
+ <td colspan="2" class="bold red">今日超额备付金预计余额</td>
794
+ <td colspan="3" class="bold red">
795
+ <span>{{ displaySummary(estimatedBalanceYuan) }}</span>
796
+ </td>
797
+ <td></td>
798
+ </tr>
799
+ </tbody>
800
+ </table>
801
+ </div>
802
+ </div>
803
+ </template>
804
+
805
+ <style scoped>
806
+ .rmb-position-estimation-page {
807
+ width: calc(100% - 20px);
808
+ margin: 10px;
809
+ padding: 20px;
810
+ border-radius: 20px;
811
+ color: #1f2937;
812
+ background-color: #fff;
813
+ box-sizing: border-box;
814
+ }
815
+
816
+ #mainDiv {
817
+ width: 100%;
818
+ max-height: 760px;
819
+ padding: 6px;
820
+ overflow: auto;
821
+ background: #f5f7fb;
822
+ box-sizing: border-box;
823
+ }
824
+
825
+ .tab {
826
+ width: 100%;
827
+ min-width: 1180px;
828
+ table-layout: fixed;
829
+ border: 1px solid #cfd6e4;
830
+ border-collapse: collapse;
831
+ border-spacing: 0;
832
+ color: #1f2937;
833
+ background: #fff;
834
+ font: 11px/1.18 "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
835
+ }
836
+
837
+ .tab .col-name {
838
+ width: 330px;
839
+ }
840
+
841
+ .tab .col-type {
842
+ width: 94px;
843
+ }
844
+
845
+ .tab .col-money {
846
+ width: 145px;
847
+ }
848
+
849
+ .tab .col-remark {
850
+ width: 230px;
851
+ }
852
+
853
+ .tab td {
854
+ height: 21px;
855
+ padding: 1px 6px;
856
+ overflow: hidden;
857
+ border: 1px solid #cfd6e4;
858
+ box-sizing: border-box;
859
+ text-overflow: ellipsis;
860
+ vertical-align: middle;
861
+ }
862
+
863
+ .tab td:first-child,
864
+ .tab td[colspan="2"] {
865
+ white-space: normal;
866
+ word-break: break-all;
867
+ }
868
+
869
+ .tab td[align="right"] {
870
+ padding-right: 8px;
871
+ font-family: Consolas, "DIN Alternate", monospace;
872
+ text-align: right;
873
+ white-space: nowrap;
874
+ }
875
+
876
+ .head-row td,
877
+ .section-name {
878
+ color: #334155;
879
+ font-weight: 600;
880
+ background: #f8fafc;
881
+ }
882
+
883
+ .remark-head,
884
+ .tab td:last-child {
885
+ text-align: center;
886
+ }
887
+
888
+ .money-cell {
889
+ color: #111827;
890
+ font-size: 11px;
891
+ }
892
+
893
+ .even {
894
+ background: #f1f5f9;
895
+ }
896
+
897
+ .result-value {
898
+ display: inline-block;
899
+ min-width: 44px;
900
+ color: #2563eb;
901
+ font-weight: 600;
902
+ line-height: 15px;
903
+ cursor: pointer;
904
+ }
905
+
906
+ .result-value:hover {
907
+ border-radius: 3px;
908
+ color: #1d4ed8;
909
+ background: rgba(37, 99, 235, 0.08);
910
+ }
911
+
912
+ .strong-value {
913
+ color: #0f172a;
914
+ font-weight: 700;
915
+ }
916
+
917
+ .red {
918
+ color: #dc2626;
919
+ background: #fff7ed !important;
920
+ }
921
+
922
+ .bold {
923
+ font-weight: 700;
924
+ }
925
+
926
+ .total-row td {
927
+ height: 23px;
928
+ font-size: 12px;
929
+ }
930
+
931
+ .bold.red {
932
+ color: #b91c1c;
933
+ background: #fff1f2 !important;
934
+ }
935
+
936
+ .spacer-row td {
937
+ height: 6px;
938
+ padding: 0;
939
+ background: #fff;
940
+ }
941
+
942
+ .intStyle {
943
+ width: 100%;
944
+ }
945
+
946
+ .intStyle :deep(.el-input__wrapper) {
947
+ height: 18px;
948
+ min-height: 18px;
949
+ padding: 0;
950
+ border-radius: 4px;
951
+ background: transparent;
952
+ box-shadow: none;
953
+ }
954
+
955
+ .intStyle :deep(.el-input__wrapper:hover),
956
+ .intStyle :deep(.el-input__wrapper.is-focus) {
957
+ box-shadow: none !important;
958
+ }
959
+
960
+ .intStyle :deep(.el-input__inner) {
961
+ width: 100%;
962
+ height: 18px;
963
+ padding: 0 5px;
964
+ border: 1px solid #cbd5e1;
965
+ border-radius: 4px;
966
+ color: #111827;
967
+ font-size: 11px;
968
+ font-weight: 600;
969
+ line-height: 18px;
970
+ text-align: right;
971
+ background: #fff;
972
+ box-sizing: border-box;
973
+ }
974
+
975
+ .intStyle :deep(.el-input__inner:focus) {
976
+ border-color: #2563eb;
977
+ box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
978
+ }
979
+
980
+ .remark-input :deep(.el-input__inner) {
981
+ font-weight: 400;
982
+ text-align: left;
983
+ }
984
+
985
+ @media screen and (max-width: 1600px) {
986
+ #mainDiv {
987
+ overflow-x: auto;
988
+ }
989
+ }
990
+ </style>