verce-vue-test 0.0.81 → 0.0.82
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/ElTablePro.vue +15 -0
- package/src/utils/baseHttpClient.ts +15 -7
- package/src/views/ForecastInfo/components/FlowInfoPanel.vue +1 -0
- package/src/views/ForecastInfo/components/ForecastInfoPanel.vue +1 -0
- package/src/views/ForecastInfo/forecast-info.css +8 -0
- package/src/views/rmb-position-forecast/api.ts +180 -0
- package/src/views/rmb-position-forecast/index.vue +131 -246
package/package.json
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import {
|
|
7
7
|
computed,
|
|
8
|
+
nextTick,
|
|
8
9
|
ref,
|
|
9
10
|
useAttrs,
|
|
10
11
|
useId,
|
|
11
12
|
useSlots,
|
|
13
|
+
watch,
|
|
12
14
|
cloneVNode,
|
|
13
15
|
Fragment,
|
|
14
16
|
type VNode
|
|
@@ -52,6 +54,8 @@ const props = withDefaults(
|
|
|
52
54
|
layout?: string
|
|
53
55
|
barJustifyContent?: string
|
|
54
56
|
colBtnSize?: "" | "small" | "large" | "default" | undefined
|
|
57
|
+
// 外部递增该值时,清空表格内部保留的勾选状态
|
|
58
|
+
selectionResetKey?: string | number
|
|
55
59
|
}>(),
|
|
56
60
|
{
|
|
57
61
|
columnConfig: true,
|
|
@@ -90,6 +94,7 @@ const columnOrderTipId = useId()
|
|
|
90
94
|
*/
|
|
91
95
|
// 列配置弹窗可见性
|
|
92
96
|
const dialogVisible = ref(false)
|
|
97
|
+
const tableRef = ref<{ clearSelection: () => void } | null>(null)
|
|
93
98
|
|
|
94
99
|
// 列选项类型定义
|
|
95
100
|
type ColumnOption = {
|
|
@@ -119,6 +124,15 @@ const dragOverColumnKey = ref<string | null>(null)
|
|
|
119
124
|
const dropPlacement = ref<DropPlacement | null>(null)
|
|
120
125
|
const columnOrderAnnouncement = ref("")
|
|
121
126
|
|
|
127
|
+
watch(
|
|
128
|
+
() => props.selectionResetKey,
|
|
129
|
+
async (value, oldValue) => {
|
|
130
|
+
if (value === oldValue) return
|
|
131
|
+
await nextTick()
|
|
132
|
+
tableRef.value?.clearSelection()
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
|
|
122
136
|
/**
|
|
123
137
|
* 计算属性
|
|
124
138
|
*/
|
|
@@ -536,6 +550,7 @@ initColumns()
|
|
|
536
550
|
|
|
537
551
|
<!-- 表格主体 -->
|
|
538
552
|
<el-table
|
|
553
|
+
ref="tableRef"
|
|
539
554
|
v-bind="{
|
|
540
555
|
...attrs,
|
|
541
556
|
style: undefined // 明确排除 style
|
|
@@ -6,7 +6,14 @@ const tamBranchId = String(import.meta.env.VITE_TAM_BRANCH_ID || 'HQ001')
|
|
|
6
6
|
const tamUserId = String(import.meta.env.VITE_TAM_USER_ID || 'HQ00601')
|
|
7
7
|
const tamClientIp = String(import.meta.env.VITE_TAM_CLIENT_IP || '')
|
|
8
8
|
|
|
9
|
-
export type
|
|
9
|
+
export type TamRequestHeadOptions = {
|
|
10
|
+
pageIndex?: number | string
|
|
11
|
+
pageSize?: number | string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type HttpRequestOptions = Omit<RequestInit, 'body' | 'method'> & {
|
|
15
|
+
tamHead?: TamRequestHeadOptions
|
|
16
|
+
}
|
|
10
17
|
|
|
11
18
|
export type TamResponse<T> = {
|
|
12
19
|
head: {
|
|
@@ -47,7 +54,7 @@ function isTamPath(path: string) {
|
|
|
47
54
|
return path.startsWith('/TAM/')
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
function createTamRequest(path: string, body: unknown) {
|
|
57
|
+
function createTamRequest(path: string, body: unknown, headOptions: TamRequestHeadOptions = {}) {
|
|
51
58
|
const now = new Date()
|
|
52
59
|
|
|
53
60
|
return {
|
|
@@ -63,8 +70,8 @@ function createTamRequest(path: string, body: unknown) {
|
|
|
63
70
|
tranCode: path,
|
|
64
71
|
tranDate: compactDate(now),
|
|
65
72
|
tranTimestamp: compactTime(now),
|
|
66
|
-
pageSize: '10',
|
|
67
|
-
pageIndex: '1',
|
|
73
|
+
pageSize: String(headOptions.pageSize ?? '10'),
|
|
74
|
+
pageIndex: String(headOptions.pageIndex ?? '1'),
|
|
68
75
|
traceId: '',
|
|
69
76
|
spanId: '',
|
|
70
77
|
userId: tamUserId,
|
|
@@ -99,16 +106,17 @@ async function request<T>(
|
|
|
99
106
|
options: HttpRequestOptions = {},
|
|
100
107
|
): Promise<T> {
|
|
101
108
|
const tamRequest = isTamPath(path)
|
|
109
|
+
const { tamHead, ...fetchOptions } = options
|
|
102
110
|
const response = await fetch(resolveUrl(path), {
|
|
103
|
-
...
|
|
111
|
+
...fetchOptions,
|
|
104
112
|
method,
|
|
105
113
|
headers: {
|
|
106
114
|
'Content-Type': 'application/json',
|
|
107
|
-
...
|
|
115
|
+
...fetchOptions.headers,
|
|
108
116
|
},
|
|
109
117
|
body: data === undefined
|
|
110
118
|
? undefined
|
|
111
|
-
: JSON.stringify(tamRequest ? createTamRequest(path, data) : data),
|
|
119
|
+
: JSON.stringify(tamRequest ? createTamRequest(path, data, tamHead) : data),
|
|
112
120
|
})
|
|
113
121
|
|
|
114
122
|
let payload: unknown
|
|
@@ -465,6 +465,14 @@
|
|
|
465
465
|
padding: 0;
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
+
/* 表头与数据单元格保持单行完整显示,宽内容交由表格横向滚动承载。 */
|
|
469
|
+
.forecast-info-page[data-page-scope="rmb-position-settlement-forecast-info"] .forecast-info-table .el-table__cell .cell {
|
|
470
|
+
overflow: visible;
|
|
471
|
+
text-overflow: clip;
|
|
472
|
+
white-space: nowrap;
|
|
473
|
+
word-break: normal;
|
|
474
|
+
}
|
|
475
|
+
|
|
468
476
|
.forecast-info-page[data-page-scope="rmb-position-settlement-forecast-info"] .forecast-info-table .el-table__empty-block {
|
|
469
477
|
min-height: 86px;
|
|
470
478
|
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import baseHttpClient, { type TamResponse } from '@/utils/baseHttpClient'
|
|
2
|
+
import type {
|
|
3
|
+
RmbPositionForecastFilter,
|
|
4
|
+
RmbPositionForecastListResult,
|
|
5
|
+
RmbPositionForecastRow,
|
|
6
|
+
} from './types'
|
|
7
|
+
|
|
8
|
+
const QUERY_TRAN_CODE = '/TAM/0001/140101001'
|
|
9
|
+
|
|
10
|
+
type RmbPositionForecastQueryParams = {
|
|
11
|
+
busiType: string
|
|
12
|
+
clientName: string
|
|
13
|
+
competName: string
|
|
14
|
+
endTransAmt: string
|
|
15
|
+
groundBranch: string
|
|
16
|
+
payChannel: string
|
|
17
|
+
payDirec: string
|
|
18
|
+
predStatus: string
|
|
19
|
+
sortRule: string
|
|
20
|
+
startTransAmt: string
|
|
21
|
+
tranDate: string
|
|
22
|
+
verifyStatus: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type RmbPositionForecastApiRow = {
|
|
26
|
+
busiType?: string
|
|
27
|
+
clientName?: string
|
|
28
|
+
clientType?: string
|
|
29
|
+
competAcct?: string
|
|
30
|
+
competName?: string
|
|
31
|
+
groundBranch?: string
|
|
32
|
+
groundBranchCode?: string
|
|
33
|
+
payChannel?: string
|
|
34
|
+
payDirec?: string
|
|
35
|
+
predAmt?: string
|
|
36
|
+
predCode?: string
|
|
37
|
+
predDate?: string
|
|
38
|
+
predRefNo?: string
|
|
39
|
+
predStatus?: string
|
|
40
|
+
standardName?: string
|
|
41
|
+
tranDate?: string
|
|
42
|
+
verifyAmt?: string
|
|
43
|
+
verifyStatus?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type RmbPositionForecastResponseBody = {
|
|
47
|
+
resultList?: RmbPositionForecastApiRow[]
|
|
48
|
+
totalCount?: string | number
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function invalidField(field: string, value: unknown): never {
|
|
52
|
+
const displayValue = String(value ?? '').trim() || '空值'
|
|
53
|
+
throw new Error(`人民币头寸预报接口返回的 ${field} 无效:${displayValue}`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function toAmount(value: unknown) {
|
|
57
|
+
const amount = Number(String(value ?? '').replaceAll(',', ''))
|
|
58
|
+
return Number.isFinite(amount) ? amount : 0
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function toProtocolAmount(value: number | null) {
|
|
62
|
+
return value === null ? '' : String(Math.round(value * 10_000))
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function toForecastStatus(value: unknown): RmbPositionForecastRow['predStatus'] {
|
|
66
|
+
const status = String(value ?? '')
|
|
67
|
+
if (!['1', '2', '3', '4', '5', '7', '8'].includes(status)) {
|
|
68
|
+
return invalidField('predStatus', value)
|
|
69
|
+
}
|
|
70
|
+
return status as RmbPositionForecastRow['predStatus']
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function toPayChannel(value: unknown): RmbPositionForecastRow['payChannel'] {
|
|
74
|
+
const channel = String(value ?? '')
|
|
75
|
+
if (!['1', '2', '3', '4', '7'].includes(channel)) {
|
|
76
|
+
return invalidField('payChannel', value)
|
|
77
|
+
}
|
|
78
|
+
return channel as RmbPositionForecastRow['payChannel']
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function toVerifyStatus(value: unknown): RmbPositionForecastRow['verifyStatus'] {
|
|
82
|
+
const status = String(value ?? '')
|
|
83
|
+
if (!['1', '2', '3'].includes(status)) {
|
|
84
|
+
return invalidField('verifyStatus', value)
|
|
85
|
+
}
|
|
86
|
+
return status as RmbPositionForecastRow['verifyStatus']
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function toClientType(value: unknown): RmbPositionForecastRow['clientType'] {
|
|
90
|
+
const clientType = String(value ?? '')
|
|
91
|
+
if (!['1', '2', '3', '4', '5'].includes(clientType)) {
|
|
92
|
+
return invalidField('clientType', value)
|
|
93
|
+
}
|
|
94
|
+
return clientType as RmbPositionForecastRow['clientType']
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function toBusinessType(value: unknown): RmbPositionForecastRow['businessType'] {
|
|
98
|
+
const businessType = String(value ?? '')
|
|
99
|
+
const code = Number(businessType)
|
|
100
|
+
if (!Number.isInteger(code) || code < 1 || code > 16) {
|
|
101
|
+
return invalidField('busiType', value)
|
|
102
|
+
}
|
|
103
|
+
return businessType as RmbPositionForecastRow['businessType']
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function toFrontendRow(row: RmbPositionForecastApiRow): RmbPositionForecastRow {
|
|
107
|
+
const predRefNo = String(row.predRefNo ?? '').trim()
|
|
108
|
+
if (!predRefNo) invalidField('predRefNo', row.predRefNo)
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
predRefNo,
|
|
112
|
+
predStatus: toForecastStatus(row.predStatus),
|
|
113
|
+
tradeDate: String(row.tranDate ?? ''),
|
|
114
|
+
payDirection: row.payDirec === '1' || row.payDirec === '2'
|
|
115
|
+
? row.payDirec
|
|
116
|
+
: invalidField('payDirec', row.payDirec),
|
|
117
|
+
payChannel: toPayChannel(row.payChannel),
|
|
118
|
+
verifyStatus: toVerifyStatus(row.verifyStatus),
|
|
119
|
+
predAmount: toAmount(row.predAmt),
|
|
120
|
+
verifyAmount: toAmount(row.verifyAmt),
|
|
121
|
+
groundBranch: String(row.groundBranch ?? ''),
|
|
122
|
+
groundBranchCode: String(row.groundBranchCode ?? ''),
|
|
123
|
+
clientType: toClientType(row.clientType),
|
|
124
|
+
clientName: String(row.clientName ?? ''),
|
|
125
|
+
counterpartyName: String(row.competName ?? ''),
|
|
126
|
+
standardName: String(row.standardName ?? ''),
|
|
127
|
+
counterpartyAccount: String(row.competAcct ?? ''),
|
|
128
|
+
businessType: toBusinessType(row.busiType),
|
|
129
|
+
forecastDate: String(row.predDate ?? ''),
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function createQueryParams(filters: RmbPositionForecastFilter): RmbPositionForecastQueryParams {
|
|
134
|
+
const predStatus = filters.deleteStatus === '1'
|
|
135
|
+
? '3,4,5'
|
|
136
|
+
: filters.deleteStatus === '2'
|
|
137
|
+
? '1,2,7,8'
|
|
138
|
+
: ''
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
busiType: filters.businessType,
|
|
142
|
+
clientName: filters.clientName.trim(),
|
|
143
|
+
competName: filters.counterpartyName.trim(),
|
|
144
|
+
endTransAmt: toProtocolAmount(filters.maxAmountWan),
|
|
145
|
+
groundBranch: filters.groundBranch.trim(),
|
|
146
|
+
payChannel: filters.payChannel,
|
|
147
|
+
payDirec: filters.payDirection,
|
|
148
|
+
predStatus,
|
|
149
|
+
sortRule: filters.sortRule === '2' ? '3' : filters.sortRule,
|
|
150
|
+
startTransAmt: toProtocolAmount(filters.minAmountWan),
|
|
151
|
+
tranDate: filters.tradeDate,
|
|
152
|
+
verifyStatus: filters.verifyStatuses.join(','),
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export async function queryRmbPositionForecasts(
|
|
157
|
+
filters: RmbPositionForecastFilter,
|
|
158
|
+
pageIndex: number,
|
|
159
|
+
pageSize: number,
|
|
160
|
+
signal?: AbortSignal,
|
|
161
|
+
): Promise<RmbPositionForecastListResult> {
|
|
162
|
+
const response = await baseHttpClient.post<TamResponse<RmbPositionForecastResponseBody>>(
|
|
163
|
+
QUERY_TRAN_CODE,
|
|
164
|
+
createQueryParams(filters),
|
|
165
|
+
{
|
|
166
|
+
signal,
|
|
167
|
+
tamHead: { pageIndex, pageSize },
|
|
168
|
+
},
|
|
169
|
+
)
|
|
170
|
+
const resultList = Array.isArray(response.body.resultList) ? response.body.resultList : []
|
|
171
|
+
const totalCount = Number(response.body.totalCount)
|
|
172
|
+
if (!Number.isInteger(totalCount) || totalCount < 0) {
|
|
173
|
+
invalidField('totalCount', response.body.totalCount)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
result: resultList.map(toFrontendRow),
|
|
178
|
+
totalCount,
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, reactive, ref } from 'vue'
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
|
|
3
3
|
import {
|
|
4
4
|
ElMessage,
|
|
5
5
|
ElMessageBox,
|
|
@@ -32,10 +32,8 @@ import {
|
|
|
32
32
|
verifyStatusOptions,
|
|
33
33
|
type SelectOption,
|
|
34
34
|
} from './options'
|
|
35
|
-
import {
|
|
36
|
-
|
|
37
|
-
getLocalDateString,
|
|
38
|
-
} from './mock'
|
|
35
|
+
import { queryRmbPositionForecasts } from './api'
|
|
36
|
+
import { getLocalDateString } from './mock'
|
|
39
37
|
import type {
|
|
40
38
|
RmbPositionForecastFilter,
|
|
41
39
|
RmbPositionForecastRow,
|
|
@@ -112,14 +110,18 @@ const createEditorForm = (): EditorForm => ({
|
|
|
112
110
|
|
|
113
111
|
const filterForm = reactive<RmbPositionForecastFilter>(createInitialFilter())
|
|
114
112
|
const appliedFilters = ref<RmbPositionForecastFilter>(cloneFilter(filterForm))
|
|
115
|
-
const records = ref<RmbPositionForecastRow[]>(
|
|
113
|
+
const records = ref<RmbPositionForecastRow[]>([])
|
|
114
|
+
const totalCount = ref(0)
|
|
116
115
|
const selectedRows = ref<RmbPositionForecastRow[]>([])
|
|
117
116
|
const currentPage = ref(1)
|
|
118
117
|
const pageSize = ref(25)
|
|
118
|
+
const lastSuccessfulPage = ref(1)
|
|
119
|
+
const lastSuccessfulPageSize = ref(25)
|
|
119
120
|
const selectionResetKey = ref(0)
|
|
120
121
|
const filterCollapsed = ref(false)
|
|
121
122
|
const amountRangeValid = ref(true)
|
|
122
123
|
const isQuerying = ref(false)
|
|
124
|
+
let activeQueryController: AbortController | null = null
|
|
123
125
|
|
|
124
126
|
const detailVisible = ref(false)
|
|
125
127
|
const transactionVisible = ref(false)
|
|
@@ -167,10 +169,6 @@ function getOptionLabel(options: SelectOption[], value: string) {
|
|
|
167
169
|
return options.find((option) => option.value === value)?.label ?? value ?? '—'
|
|
168
170
|
}
|
|
169
171
|
|
|
170
|
-
function isDeleted(row: RmbPositionForecastRow) {
|
|
171
|
-
return deletedStatusCodes.has(row.predStatus)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
172
|
function hasAnyRole(...roles: string[]) {
|
|
175
173
|
return roles.some((role) => businessContext.roles.has(role))
|
|
176
174
|
}
|
|
@@ -192,55 +190,16 @@ function isWithinVerifyUpdateWindow() {
|
|
|
192
190
|
return currentTime > businessContext.verifyUpdateStart && currentTime < businessContext.verifyUpdateEnd
|
|
193
191
|
}
|
|
194
192
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const filteredRows = computed(() => {
|
|
200
|
-
const filters = appliedFilters.value
|
|
201
|
-
const minAmount = filters.minAmountWan === null ? null : filters.minAmountWan * 10_000
|
|
202
|
-
const maxAmount = filters.maxAmountWan === null ? null : filters.maxAmountWan * 10_000
|
|
203
|
-
|
|
204
|
-
const result = records.value.filter((row) => {
|
|
205
|
-
if (filters.tradeDate && row.tradeDate !== filters.tradeDate) return false
|
|
206
|
-
if (filters.payDirection && row.payDirection !== filters.payDirection) return false
|
|
207
|
-
if (filters.payChannel && row.payChannel !== filters.payChannel) return false
|
|
208
|
-
if (filters.groundBranch && !containsKeyword(row.groundBranch, filters.groundBranch)) return false
|
|
209
|
-
if (filters.deleteStatus === '1' && !isDeleted(row)) return false
|
|
210
|
-
if (filters.deleteStatus === '2' && isDeleted(row)) return false
|
|
211
|
-
if (filters.verifyStatuses.length && !filters.verifyStatuses.includes(row.verifyStatus)) return false
|
|
212
|
-
if (filters.clientName && !containsKeyword(row.clientName, filters.clientName)) return false
|
|
213
|
-
if (filters.counterpartyName && !containsKeyword(row.counterpartyName, filters.counterpartyName)) return false
|
|
214
|
-
if (filters.businessType && row.businessType !== filters.businessType) return false
|
|
215
|
-
if (minAmount !== null && row.predAmount < minAmount) return false
|
|
216
|
-
if (maxAmount !== null && row.predAmount > maxAmount) return false
|
|
217
|
-
return true
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
if (filters.sortRule === '2') {
|
|
221
|
-
return [...result].sort((a, b) => b.predAmount - a.predAmount)
|
|
222
|
-
}
|
|
223
|
-
if (filters.sortRule === '1') {
|
|
224
|
-
return [...result].sort((a, b) => b.forecastDate.localeCompare(a.forecastDate))
|
|
225
|
-
}
|
|
226
|
-
return result
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
const pagedRows = computed(() => {
|
|
230
|
-
const start = (currentPage.value - 1) * pageSize.value
|
|
231
|
-
return filteredRows.value.slice(start, start + pageSize.value)
|
|
232
|
-
})
|
|
233
|
-
|
|
234
|
-
const summary = computed(() => {
|
|
235
|
-
const income = filteredRows.value
|
|
193
|
+
const selectionSummary = computed(() => {
|
|
194
|
+
const income = selectedRows.value
|
|
236
195
|
.filter((row) => row.payDirection === '1')
|
|
237
196
|
.reduce((total, row) => total + row.predAmount, 0)
|
|
238
|
-
const expense =
|
|
197
|
+
const expense = selectedRows.value
|
|
239
198
|
.filter((row) => row.payDirection === '2')
|
|
240
199
|
.reduce((total, row) => total + row.predAmount, 0)
|
|
241
200
|
|
|
242
201
|
return {
|
|
243
|
-
count:
|
|
202
|
+
count: selectedRows.value.length,
|
|
244
203
|
income,
|
|
245
204
|
expense,
|
|
246
205
|
net: income - expense,
|
|
@@ -292,19 +251,47 @@ function handleSelectionChange(rows: RmbPositionForecastRow[]) {
|
|
|
292
251
|
selectedRows.value = rows
|
|
293
252
|
}
|
|
294
253
|
|
|
295
|
-
function
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
254
|
+
async function loadForecasts(
|
|
255
|
+
filters: RmbPositionForecastFilter,
|
|
256
|
+
page: number,
|
|
257
|
+
size: number,
|
|
258
|
+
) {
|
|
259
|
+
activeQueryController?.abort()
|
|
260
|
+
const controller = new AbortController()
|
|
261
|
+
activeQueryController = controller
|
|
262
|
+
isQuerying.value = true
|
|
263
|
+
|
|
264
|
+
try {
|
|
265
|
+
const response = await queryRmbPositionForecasts(filters, page, size, controller.signal)
|
|
266
|
+
if (activeQueryController !== controller) return
|
|
267
|
+
|
|
268
|
+
records.value = response.result
|
|
269
|
+
totalCount.value = response.totalCount
|
|
270
|
+
appliedFilters.value = cloneFilter(filters)
|
|
271
|
+
currentPage.value = page
|
|
272
|
+
pageSize.value = size
|
|
273
|
+
lastSuccessfulPage.value = page
|
|
274
|
+
lastSuccessfulPageSize.value = size
|
|
275
|
+
clearSelection()
|
|
276
|
+
} catch (error) {
|
|
277
|
+
if ((error as { name?: string }).name !== 'AbortError') {
|
|
278
|
+
currentPage.value = lastSuccessfulPage.value
|
|
279
|
+
pageSize.value = lastSuccessfulPageSize.value
|
|
280
|
+
ElMessage.error(error instanceof Error ? error.message : '人民币头寸预报查询失败')
|
|
281
|
+
}
|
|
282
|
+
} finally {
|
|
283
|
+
if (activeQueryController === controller) {
|
|
284
|
+
activeQueryController = null
|
|
285
|
+
isQuerying.value = false
|
|
286
|
+
}
|
|
303
287
|
}
|
|
304
|
-
return selectedRows.value[0] ?? null
|
|
305
288
|
}
|
|
306
289
|
|
|
307
290
|
async function handleQuery() {
|
|
291
|
+
if (!filterForm.tradeDate) {
|
|
292
|
+
ElMessage.warning('请选择交易日期')
|
|
293
|
+
return
|
|
294
|
+
}
|
|
308
295
|
if (!amountRangeValid.value) {
|
|
309
296
|
ElMessage.warning('输入的金额范围开始值不能大于结束值')
|
|
310
297
|
return
|
|
@@ -325,16 +312,9 @@ async function handleQuery() {
|
|
|
325
312
|
return
|
|
326
313
|
}
|
|
327
314
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
currentPage.value = 1
|
|
332
|
-
clearSelection()
|
|
333
|
-
} finally {
|
|
334
|
-
window.setTimeout(() => {
|
|
335
|
-
isQuerying.value = false
|
|
336
|
-
}, 180)
|
|
337
|
-
}
|
|
315
|
+
const nextFilters = cloneFilter(filterForm)
|
|
316
|
+
currentPage.value = 1
|
|
317
|
+
await loadForecasts(nextFilters, 1, pageSize.value)
|
|
338
318
|
}
|
|
339
319
|
|
|
340
320
|
function handleReset() {
|
|
@@ -342,25 +322,27 @@ function handleReset() {
|
|
|
342
322
|
amountRangeValid.value = true
|
|
343
323
|
}
|
|
344
324
|
|
|
345
|
-
function handlePaginationChange(
|
|
346
|
-
|
|
325
|
+
async function handlePaginationChange({
|
|
326
|
+
page,
|
|
327
|
+
pageSize: nextPageSize,
|
|
328
|
+
}: { page: number; pageSize: number }) {
|
|
329
|
+
await loadForecasts(cloneFilter(appliedFilters.value), page, nextPageSize)
|
|
347
330
|
}
|
|
348
331
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
detailRecord.value = row
|
|
353
|
-
detailVisible.value = true
|
|
354
|
-
}
|
|
332
|
+
onMounted(() => {
|
|
333
|
+
void handleQuery()
|
|
334
|
+
})
|
|
355
335
|
|
|
356
|
-
|
|
336
|
+
onBeforeUnmount(() => {
|
|
337
|
+
activeQueryController?.abort()
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
function openDetail(row: RmbPositionForecastRow) {
|
|
357
341
|
detailRecord.value = row
|
|
358
342
|
detailVisible.value = true
|
|
359
343
|
}
|
|
360
344
|
|
|
361
|
-
function openTransactionStatus() {
|
|
362
|
-
const row = requireSingle('查看对应交易状态')
|
|
363
|
-
if (!row) return
|
|
345
|
+
function openTransactionStatus(row: RmbPositionForecastRow) {
|
|
364
346
|
if (!operableStatusCodes.has(row.predStatus)) {
|
|
365
347
|
ElMessage.warning('已删除或未同步的预报无法查看对应交易状态')
|
|
366
348
|
return
|
|
@@ -396,9 +378,7 @@ function openAddEditor() {
|
|
|
396
378
|
editorVisible.value = true
|
|
397
379
|
}
|
|
398
380
|
|
|
399
|
-
function openEditEditor() {
|
|
400
|
-
const row = requireSingle('修改')
|
|
401
|
-
if (!row) return
|
|
381
|
+
function openEditEditor(row: RmbPositionForecastRow) {
|
|
402
382
|
if (!operableStatusCodes.has(row.predStatus)) {
|
|
403
383
|
ElMessage.warning('该预报不是可操作状态,无法修改')
|
|
404
384
|
return
|
|
@@ -425,9 +405,7 @@ function openEditEditor() {
|
|
|
425
405
|
editorVisible.value = true
|
|
426
406
|
}
|
|
427
407
|
|
|
428
|
-
function openCopyEditor() {
|
|
429
|
-
const row = requireSingle('复制')
|
|
430
|
-
if (!row) return
|
|
408
|
+
function openCopyEditor(row: RmbPositionForecastRow) {
|
|
431
409
|
if (!operableStatusCodes.has(row.predStatus)) {
|
|
432
410
|
ElMessage.warning('该预报不是可操作状态,无法复制')
|
|
433
411
|
return
|
|
@@ -496,27 +474,18 @@ async function submitEditor() {
|
|
|
496
474
|
clearSelection()
|
|
497
475
|
}
|
|
498
476
|
|
|
499
|
-
async function handleDelete() {
|
|
500
|
-
if (
|
|
501
|
-
ElMessage.warning(
|
|
502
|
-
return
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
const nonOperableRow = selectedRows.value.find((row) => !operableStatusCodes.has(row.predStatus))
|
|
506
|
-
if (nonOperableRow) {
|
|
507
|
-
ElMessage.warning(`预报 ${nonOperableRow.predRefNo} 不是可操作状态,无法删除`)
|
|
477
|
+
async function handleDelete(row: RmbPositionForecastRow) {
|
|
478
|
+
if (!operableStatusCodes.has(row.predStatus)) {
|
|
479
|
+
ElMessage.warning(`预报 ${row.predRefNo} 不是可操作状态,无法删除`)
|
|
508
480
|
return
|
|
509
481
|
}
|
|
510
482
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
ElMessage.warning(`预报 ${verifiedRow.predRefNo} 已核销或部分核销,无法删除`)
|
|
483
|
+
if (row.verifyStatus !== '1') {
|
|
484
|
+
ElMessage.warning(`预报 ${row.predRefNo} 已核销或部分核销,无法删除`)
|
|
514
485
|
return
|
|
515
486
|
}
|
|
516
487
|
|
|
517
|
-
const permissionError =
|
|
518
|
-
.map((row) => getAmountPermissionError(row))
|
|
519
|
-
.find(Boolean)
|
|
488
|
+
const permissionError = getAmountPermissionError(row)
|
|
520
489
|
if (permissionError) {
|
|
521
490
|
ElMessage.warning(permissionError)
|
|
522
491
|
return
|
|
@@ -524,7 +493,7 @@ async function handleDelete() {
|
|
|
524
493
|
|
|
525
494
|
try {
|
|
526
495
|
await ElMessageBox.confirm(
|
|
527
|
-
|
|
496
|
+
`是否确定删除预报记录 ${row.predRefNo}?`,
|
|
528
497
|
'删除确认',
|
|
529
498
|
{ type: 'warning', confirmButtonText: '确定', cancelButtonText: '取消' },
|
|
530
499
|
)
|
|
@@ -532,13 +501,12 @@ async function handleDelete() {
|
|
|
532
501
|
return
|
|
533
502
|
}
|
|
534
503
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
: row
|
|
504
|
+
records.value = records.value.map((record) => (
|
|
505
|
+
record.predRefNo === row.predRefNo
|
|
506
|
+
? { ...record, predStatus: '3' as RmbPositionForecastRow['predStatus'] }
|
|
507
|
+
: record
|
|
540
508
|
))
|
|
541
|
-
const maxPage = Math.max(1, Math.ceil(
|
|
509
|
+
const maxPage = Math.max(1, Math.ceil(totalCount.value / pageSize.value))
|
|
542
510
|
currentPage.value = Math.min(currentPage.value, maxPage)
|
|
543
511
|
clearSelection()
|
|
544
512
|
ElMessage.success('删除操作成功')
|
|
@@ -595,7 +563,7 @@ function escapeCsvCell(value: string | number) {
|
|
|
595
563
|
|
|
596
564
|
async function exportCsv() {
|
|
597
565
|
try {
|
|
598
|
-
await ElMessageBox.confirm('
|
|
566
|
+
await ElMessageBox.confirm('您是否确定导出当前页查询结果?', '导出确认', {
|
|
599
567
|
type: 'info',
|
|
600
568
|
confirmButtonText: '导出',
|
|
601
569
|
cancelButtonText: '取消',
|
|
@@ -609,7 +577,7 @@ async function exportCsv() {
|
|
|
609
577
|
'预报金额(元)', '已核销金额(元)', '落地机构', '客户类型', '客户名称',
|
|
610
578
|
'交易对手名称', '标准名称', '交易对手账号', '业务类型', '预报日期',
|
|
611
579
|
]
|
|
612
|
-
const lines =
|
|
580
|
+
const lines = records.value.map((row) => [
|
|
613
581
|
row.predRefNo,
|
|
614
582
|
getOptionLabel(forecastStatusOptions, row.predStatus),
|
|
615
583
|
row.tradeDate,
|
|
@@ -639,29 +607,12 @@ async function exportCsv() {
|
|
|
639
607
|
anchor.remove()
|
|
640
608
|
URL.revokeObjectURL(url)
|
|
641
609
|
}, 0)
|
|
642
|
-
ElMessage.success(
|
|
610
|
+
ElMessage.success(`已导出当前页 ${records.value.length} 条记录`)
|
|
643
611
|
}
|
|
644
612
|
</script>
|
|
645
613
|
|
|
646
614
|
<template>
|
|
647
615
|
<main class="rmb-position-page">
|
|
648
|
-
<header class="page-heading">
|
|
649
|
-
<div class="heading-copy">
|
|
650
|
-
<span class="heading-mark" aria-hidden="true">¥</span>
|
|
651
|
-
<div>
|
|
652
|
-
<div class="heading-title-line">
|
|
653
|
-
<h1>人民币头寸预报</h1>
|
|
654
|
-
<span>RMB POSITION FORECAST</span>
|
|
655
|
-
</div>
|
|
656
|
-
<p>统一查询、维护及跟踪人民币收支头寸预报</p>
|
|
657
|
-
</div>
|
|
658
|
-
</div>
|
|
659
|
-
<div class="heading-date">
|
|
660
|
-
<span>数据日期</span>
|
|
661
|
-
<strong>{{ appliedFilters.tradeDate ? formatCompactDate(appliedFilters.tradeDate) : '全部日期' }}</strong>
|
|
662
|
-
</div>
|
|
663
|
-
</header>
|
|
664
|
-
|
|
665
616
|
<section class="query-panel" aria-label="人民币头寸预报查询条件">
|
|
666
617
|
<el-form :model="filterForm" label-position="top" size="small" class="query-form" @submit.prevent="handleQuery">
|
|
667
618
|
<div class="query-grid" :class="{ 'is-collapsed': filterCollapsed }">
|
|
@@ -762,32 +713,35 @@ async function exportCsv() {
|
|
|
762
713
|
</el-form>
|
|
763
714
|
</section>
|
|
764
715
|
|
|
765
|
-
<section class="summary-strip" aria-label="
|
|
716
|
+
<section v-if="selectedRows.length" class="summary-strip" aria-label="已选数据汇总">
|
|
766
717
|
<div class="summary-item summary-count">
|
|
767
|
-
<span
|
|
768
|
-
<strong>{{
|
|
718
|
+
<span>已选数据</span>
|
|
719
|
+
<strong>{{ selectionSummary.count }}</strong>
|
|
769
720
|
<small>笔</small>
|
|
770
721
|
</div>
|
|
771
722
|
<div class="summary-item is-income">
|
|
772
723
|
<span>收入总额(元)</span>
|
|
773
|
-
<strong>{{ formatMoney(
|
|
724
|
+
<strong>{{ formatMoney(selectionSummary.income) }}</strong>
|
|
774
725
|
</div>
|
|
775
726
|
<div class="summary-item is-expense">
|
|
776
727
|
<span>支出总额(元)</span>
|
|
777
|
-
<strong>{{ formatMoney(
|
|
728
|
+
<strong>{{ formatMoney(selectionSummary.expense) }}</strong>
|
|
778
729
|
</div>
|
|
779
|
-
<div
|
|
730
|
+
<div
|
|
731
|
+
class="summary-item"
|
|
732
|
+
:class="selectionSummary.net >= 0 ? 'is-net-positive' : 'is-net-negative'"
|
|
733
|
+
>
|
|
780
734
|
<span>收支轧差(元)</span>
|
|
781
|
-
<strong>{{ formatSignedMoney(
|
|
735
|
+
<strong>{{ formatSignedMoney(selectionSummary.net) }}</strong>
|
|
782
736
|
</div>
|
|
783
737
|
</section>
|
|
784
738
|
|
|
785
|
-
<section class="table-panel" aria-label="人民币头寸预报列表">
|
|
739
|
+
<section v-loading="isQuerying" class="table-panel" aria-label="人民币头寸预报列表">
|
|
786
740
|
<ElTablePro
|
|
787
741
|
v-model:page="currentPage"
|
|
788
742
|
v-model:page-size="pageSize"
|
|
789
|
-
:data="
|
|
790
|
-
:total="
|
|
743
|
+
:data="records"
|
|
744
|
+
:total="totalCount"
|
|
791
745
|
:page-sizes="[10, 25, 50, 100]"
|
|
792
746
|
:selection-reset-key="selectionResetKey"
|
|
793
747
|
table-key="rmb-position-forecast"
|
|
@@ -797,21 +751,16 @@ async function exportCsv() {
|
|
|
797
751
|
height="430"
|
|
798
752
|
empty-text="暂无人民币头寸预报记录"
|
|
799
753
|
class="forecast-table"
|
|
754
|
+
col-btn-size="small"
|
|
800
755
|
layout="total, sizes, prev, pager, next, jumper"
|
|
801
756
|
pagination-size="small"
|
|
802
757
|
@selection-change="handleSelectionChange"
|
|
803
758
|
@pagination-change="handlePaginationChange"
|
|
804
|
-
@row-dblclick="
|
|
759
|
+
@row-dblclick="openDetail"
|
|
805
760
|
>
|
|
806
761
|
<template #toolbar>
|
|
807
762
|
<div class="table-toolbar-actions">
|
|
808
|
-
<el-button size="small" :icon="Document" @click="openDetail()">详细信息</el-button>
|
|
809
|
-
<el-button size="small" :icon="Tickets" @click="openTransactionStatus">对应交易状态</el-button>
|
|
810
|
-
<span class="operation-divider" aria-hidden="true"></span>
|
|
811
763
|
<el-button size="small" type="primary" :icon="Plus" @click="openAddEditor">新增</el-button>
|
|
812
|
-
<el-button size="small" :icon="EditPen" @click="openEditEditor">修改</el-button>
|
|
813
|
-
<el-button size="small" type="danger" plain :icon="Delete" @click="handleDelete">删除</el-button>
|
|
814
|
-
<el-button size="small" :icon="CopyDocument" @click="openCopyEditor">复制</el-button>
|
|
815
764
|
<span class="operation-divider" aria-hidden="true"></span>
|
|
816
765
|
<el-button size="small" :icon="UploadFilled" @click="openImportDialog">导入</el-button>
|
|
817
766
|
<el-dropdown trigger="click" @command="handleEndOfDayCommand">
|
|
@@ -891,6 +840,27 @@ async function exportCsv() {
|
|
|
891
840
|
<template #default="{ row }">{{ getOptionLabel(businessTypeOptions, row.businessType) }}</template>
|
|
892
841
|
</el-table-column>
|
|
893
842
|
<el-table-column prop="forecastDate" label="预报日期" width="168" show-overflow-tooltip />
|
|
843
|
+
<el-table-column label="操作" column-key="operations" width="410" fixed="right" align="center" disabled>
|
|
844
|
+
<template #default="{ row }">
|
|
845
|
+
<div class="row-actions">
|
|
846
|
+
<el-button link type="primary" size="small" :icon="Document" @click.stop="openDetail(row)">
|
|
847
|
+
详细信息
|
|
848
|
+
</el-button>
|
|
849
|
+
<el-button link type="primary" size="small" :icon="Tickets" @click.stop="openTransactionStatus(row)">
|
|
850
|
+
对应交易状态
|
|
851
|
+
</el-button>
|
|
852
|
+
<el-button link type="primary" size="small" :icon="EditPen" @click.stop="openEditEditor(row)">
|
|
853
|
+
修改
|
|
854
|
+
</el-button>
|
|
855
|
+
<el-button link type="danger" size="small" :icon="Delete" @click.stop="handleDelete(row)">
|
|
856
|
+
删除
|
|
857
|
+
</el-button>
|
|
858
|
+
<el-button link type="primary" size="small" :icon="CopyDocument" @click.stop="openCopyEditor(row)">
|
|
859
|
+
复制
|
|
860
|
+
</el-button>
|
|
861
|
+
</div>
|
|
862
|
+
</template>
|
|
863
|
+
</el-table-column>
|
|
894
864
|
</ElTablePro>
|
|
895
865
|
</section>
|
|
896
866
|
|
|
@@ -1041,93 +1011,6 @@ async function exportCsv() {
|
|
|
1041
1011
|
font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
1042
1012
|
}
|
|
1043
1013
|
|
|
1044
|
-
.page-heading {
|
|
1045
|
-
display: flex;
|
|
1046
|
-
align-items: center;
|
|
1047
|
-
justify-content: space-between;
|
|
1048
|
-
gap: 24px;
|
|
1049
|
-
margin-bottom: 10px;
|
|
1050
|
-
padding: 14px 18px;
|
|
1051
|
-
overflow: hidden;
|
|
1052
|
-
border: 1px solid #e2e7ef;
|
|
1053
|
-
border-radius: 7px;
|
|
1054
|
-
background:
|
|
1055
|
-
linear-gradient(90deg, rgba(165, 37, 52, .055), transparent 38%),
|
|
1056
|
-
#fff;
|
|
1057
|
-
box-shadow: 0 3px 12px rgba(30, 55, 90, .04);
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
.heading-copy,
|
|
1061
|
-
.heading-title-line,
|
|
1062
|
-
.heading-date {
|
|
1063
|
-
display: flex;
|
|
1064
|
-
align-items: center;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
.heading-copy {
|
|
1068
|
-
min-width: 0;
|
|
1069
|
-
gap: 13px;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
.heading-mark {
|
|
1073
|
-
display: grid;
|
|
1074
|
-
flex: 0 0 auto;
|
|
1075
|
-
width: 38px;
|
|
1076
|
-
height: 38px;
|
|
1077
|
-
border-radius: 8px;
|
|
1078
|
-
place-items: center;
|
|
1079
|
-
color: #fff;
|
|
1080
|
-
background: #a52939;
|
|
1081
|
-
box-shadow: 0 7px 16px rgba(165, 41, 57, .18);
|
|
1082
|
-
font-family: Georgia, serif;
|
|
1083
|
-
font-size: 22px;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
.heading-title-line {
|
|
1087
|
-
gap: 12px;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
.heading-title-line h1 {
|
|
1091
|
-
margin: 0;
|
|
1092
|
-
color: #172033;
|
|
1093
|
-
font-size: 19px;
|
|
1094
|
-
font-weight: 750;
|
|
1095
|
-
line-height: 1.3;
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
.heading-title-line span {
|
|
1099
|
-
color: #a52939;
|
|
1100
|
-
font-size: 10px;
|
|
1101
|
-
font-weight: 700;
|
|
1102
|
-
letter-spacing: .12em;
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
.heading-copy p {
|
|
1106
|
-
margin: 4px 0 0;
|
|
1107
|
-
color: #778195;
|
|
1108
|
-
font-size: 12px;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
.heading-date {
|
|
1112
|
-
flex: 0 0 auto;
|
|
1113
|
-
gap: 10px;
|
|
1114
|
-
padding: 7px 10px;
|
|
1115
|
-
border: 1px solid #e5e9f0;
|
|
1116
|
-
border-radius: 6px;
|
|
1117
|
-
background: rgba(248, 250, 252, .86);
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
.heading-date span {
|
|
1121
|
-
color: #7b8495;
|
|
1122
|
-
font-size: 11px;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
.heading-date strong {
|
|
1126
|
-
color: #344054;
|
|
1127
|
-
font-size: 12px;
|
|
1128
|
-
font-variant-numeric: tabular-nums;
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
1014
|
.query-panel,
|
|
1132
1015
|
.table-panel,
|
|
1133
1016
|
.summary-strip {
|
|
@@ -1312,6 +1195,18 @@ async function exportCsv() {
|
|
|
1312
1195
|
margin-left: 0;
|
|
1313
1196
|
}
|
|
1314
1197
|
|
|
1198
|
+
.row-actions {
|
|
1199
|
+
display: flex;
|
|
1200
|
+
align-items: center;
|
|
1201
|
+
justify-content: center;
|
|
1202
|
+
gap: 4px;
|
|
1203
|
+
white-space: nowrap;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
.row-actions .el-button + .el-button {
|
|
1207
|
+
margin-left: 0;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1315
1210
|
.operation-divider {
|
|
1316
1211
|
width: 1px;
|
|
1317
1212
|
height: 22px;
|
|
@@ -1470,16 +1365,6 @@ async function exportCsv() {
|
|
|
1470
1365
|
}
|
|
1471
1366
|
|
|
1472
1367
|
@media (max-width: 900px) {
|
|
1473
|
-
.page-heading {
|
|
1474
|
-
align-items: flex-start;
|
|
1475
|
-
flex-direction: column;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
.heading-date {
|
|
1479
|
-
align-self: stretch;
|
|
1480
|
-
justify-content: space-between;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
1368
|
.query-grid,
|
|
1484
1369
|
.query-grid.is-collapsed {
|
|
1485
1370
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|