verce-vue-test 0.0.124 → 0.0.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -12,13 +12,6 @@ import {
|
|
|
12
12
|
} from './model'
|
|
13
13
|
import type { ForecastEditorValue } from './editor'
|
|
14
14
|
|
|
15
|
-
const QUERY_TRAN_CODE = '/TAM/0001/140201001'
|
|
16
|
-
const DETAIL_TRAN_CODE = '/TAM/0001/140201004'
|
|
17
|
-
const CREATE_TRAN_CODE = '/TAM/0001/120201001'
|
|
18
|
-
const UPDATE_TRAN_CODE = '/TAM/0001/120201002'
|
|
19
|
-
const AUTHORIZATION_TRAN_CODE = '/TAM/0001/120201006'
|
|
20
|
-
const apiBaseUrl = String(import.meta.env.VITE_API_BASE_URL || 'http://localhost:3011/oms').replace(/\/+$/, '')
|
|
21
|
-
|
|
22
15
|
export type ForeignPositionForecastQuery = {
|
|
23
16
|
valueDate: string
|
|
24
17
|
payDirection: '' | PaymentDirection
|
|
@@ -42,6 +35,8 @@ export type ForeignPositionForecastSort = {
|
|
|
42
35
|
timeOrder: '' | '1' | '2'
|
|
43
36
|
}
|
|
44
37
|
|
|
38
|
+
export type ForeignPositionForecastSearchParams = ForeignPositionForecastQuery & ForeignPositionForecastSort
|
|
39
|
+
|
|
45
40
|
type TamResultInfo = {
|
|
46
41
|
predRefNo?: string
|
|
47
42
|
predWay?: string
|
|
@@ -99,12 +94,6 @@ type TamDetailResponse = {
|
|
|
99
94
|
body?: TamResultInfo
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
type ApiErrorResponse = {
|
|
103
|
-
error?: {
|
|
104
|
-
message?: string
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
97
|
type ForeignPositionForecastOperationResponse = {
|
|
109
98
|
success: boolean
|
|
110
99
|
message: string
|
|
@@ -126,6 +115,7 @@ export type ForeignPositionForecastQueryResult = {
|
|
|
126
115
|
totalPage: number
|
|
127
116
|
}
|
|
128
117
|
|
|
118
|
+
/** 将前端状态码数组转换为 TAM 接口要求的逗号分隔数字。 */
|
|
129
119
|
function toProtocolStatusList(values: string[], prefix: 'PS' | 'VS') {
|
|
130
120
|
return values
|
|
131
121
|
.map((value) => value.replace(prefix, ''))
|
|
@@ -133,15 +123,18 @@ function toProtocolStatusList(values: string[], prefix: 'PS' | 'VS') {
|
|
|
133
123
|
.join(',')
|
|
134
124
|
}
|
|
135
125
|
|
|
126
|
+
/** 将接口金额转换为可安全使用的数字。 */
|
|
136
127
|
function toNumber(value: unknown) {
|
|
137
128
|
const number = Number(String(value ?? '').replaceAll(',', ''))
|
|
138
129
|
return Number.isFinite(number) ? number : 0
|
|
139
130
|
}
|
|
140
131
|
|
|
132
|
+
/** 将接口预报方式转换为前端枚举。 */
|
|
141
133
|
function toForecastWay(value: string | undefined): ForecastWay {
|
|
142
134
|
return value === 'PW02' || value === 'PW03' ? value : 'PW01'
|
|
143
135
|
}
|
|
144
136
|
|
|
137
|
+
/** 将接口预报状态转换为前端枚举。 */
|
|
145
138
|
function toForecastStatus(value: string | undefined): ForecastStatus {
|
|
146
139
|
const number = Number(String(value || '').replace(/^PS/i, ''))
|
|
147
140
|
return number >= 1 && number <= 8
|
|
@@ -149,10 +142,12 @@ function toForecastStatus(value: string | undefined): ForecastStatus {
|
|
|
149
142
|
: 'PS01'
|
|
150
143
|
}
|
|
151
144
|
|
|
145
|
+
/** 将接口预报类型转换为前端枚举。 */
|
|
152
146
|
function toForecastType(value: string | undefined): ForecastType {
|
|
153
147
|
return value === 'PT02' || value === 'PT03' ? value : 'PT01'
|
|
154
148
|
}
|
|
155
149
|
|
|
150
|
+
/** 将接口核销状态转换为前端枚举。 */
|
|
156
151
|
function toVerifyStatus(value: string | undefined): VerifyStatus {
|
|
157
152
|
const number = Number(String(value || '').replace(/^VS/i, ''))
|
|
158
153
|
return number >= 1 && number <= 3
|
|
@@ -160,26 +155,31 @@ function toVerifyStatus(value: string | undefined): VerifyStatus {
|
|
|
160
155
|
: 'VS01'
|
|
161
156
|
}
|
|
162
157
|
|
|
158
|
+
/** 将接口业务类型转换为前端枚举。 */
|
|
163
159
|
function toBusinessType(value: string | undefined): BusinessType {
|
|
164
160
|
return value === '11' || value === '12' || value === '13' ? value : '10'
|
|
165
161
|
}
|
|
166
162
|
|
|
163
|
+
/** 将接口原币购汇类型转换为前端枚举。 */
|
|
167
164
|
function toForeignExchangeType(value: string | undefined): '' | ForeignExchangeType {
|
|
168
165
|
return value === '01' || value === '02' || value === '03' ? value : ''
|
|
169
166
|
}
|
|
170
167
|
|
|
168
|
+
/** 兼容接口客户类型的数字值和前端枚举值。 */
|
|
171
169
|
function toClientType(value: string | undefined): '' | ClientType {
|
|
172
170
|
if (value === 'CT01' || value === '1') return 'CT01'
|
|
173
171
|
if (value === 'CT02' || value === '2') return 'CT02'
|
|
174
172
|
return ''
|
|
175
173
|
}
|
|
176
174
|
|
|
175
|
+
/** 兼容接口汇款路线的数字值和前端枚举值。 */
|
|
177
176
|
function toPaymentRoute(value: string | undefined): ForeignPositionForecast['paymentRoute'] {
|
|
178
177
|
if (value === '02' || value === '2') return '02'
|
|
179
178
|
if (value === '03' || value === '3') return '03'
|
|
180
179
|
return '01'
|
|
181
180
|
}
|
|
182
181
|
|
|
182
|
+
/** 将接口日期转换为前端展示日期。 */
|
|
183
183
|
function toFrontendDate(value: string | undefined) {
|
|
184
184
|
const text = String(value || '').trim()
|
|
185
185
|
if (/^\d{8}$/.test(text)) {
|
|
@@ -188,6 +188,7 @@ function toFrontendDate(value: string | undefined) {
|
|
|
188
188
|
return text.slice(0, 10)
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
/** 将 TAM 返回记录转换为页面使用的预报数据。 */
|
|
191
192
|
function toFrontendRow(row: TamResultInfo): ForeignPositionForecast {
|
|
192
193
|
const organizationCode = String(row.groundBranch || '')
|
|
193
194
|
const clientName = String(row.clientName || '')
|
|
@@ -233,38 +234,16 @@ function toFrontendRow(row: TamResultInfo): ForeignPositionForecast {
|
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
|
|
237
|
+
/** 获取 TAM 返回消息,不存在时使用默认文案。 */
|
|
236
238
|
function getResponseMessage(payload: TamResponse, fallback: string) {
|
|
237
239
|
return payload.head?.retMsg || fallback
|
|
238
240
|
}
|
|
239
241
|
|
|
240
|
-
|
|
241
|
-
const response = await fetch(`${apiBaseUrl}${path}`, {
|
|
242
|
-
...init,
|
|
243
|
-
headers: {
|
|
244
|
-
'Content-Type': 'application/json',
|
|
245
|
-
...init.headers,
|
|
246
|
-
},
|
|
247
|
-
})
|
|
248
|
-
|
|
249
|
-
let payload: T | ApiErrorResponse
|
|
250
|
-
try {
|
|
251
|
-
payload = await response.json() as T | ApiErrorResponse
|
|
252
|
-
} catch {
|
|
253
|
-
throw new Error(`接口返回的不是有效 JSON(HTTP ${response.status})`)
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if (!response.ok) {
|
|
257
|
-
const message = (payload as ApiErrorResponse).error?.message
|
|
258
|
-
throw new Error(message || `请求失败(HTTP ${response.status})`)
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return payload as T
|
|
262
|
-
}
|
|
263
|
-
|
|
242
|
+
/** 查询指定编号的外币头寸预报详情。 */
|
|
264
243
|
export async function getForeignPositionForecast(predRefNo: string, signal?: AbortSignal) {
|
|
265
244
|
const normalizedPredRefNo = predRefNo.trim()
|
|
266
245
|
const payload = await baseHttpClient.post<TamDetailResponse>(
|
|
267
|
-
|
|
246
|
+
'/TAM/0001/140201004',
|
|
268
247
|
{ predRefNo: normalizedPredRefNo },
|
|
269
248
|
{ signal },
|
|
270
249
|
)
|
|
@@ -284,10 +263,12 @@ export function queryForeignPositionOrganizationTree(signal?: AbortSignal) {
|
|
|
284
263
|
return baseHttpClient.get<{ data?: unknown }>('/uaa/org/tree', { signal })
|
|
285
264
|
}
|
|
286
265
|
|
|
266
|
+
/** 将前端日期转换为 TAM 报文日期。 */
|
|
287
267
|
function toMutationDate(value: string) {
|
|
288
268
|
return value.trim().slice(0, 10).replaceAll('-', '')
|
|
289
269
|
}
|
|
290
270
|
|
|
271
|
+
/** 构建新增和修改共用的外币头寸预报请求体。 */
|
|
291
272
|
function buildForeignPositionForecastMutationBody(value: ForecastEditorValue) {
|
|
292
273
|
return {
|
|
293
274
|
bankAcct: value.bankAccount.trim(),
|
|
@@ -321,9 +302,10 @@ function buildForeignPositionForecastMutationBody(value: ForecastEditorValue) {
|
|
|
321
302
|
}
|
|
322
303
|
}
|
|
323
304
|
|
|
305
|
+
/** 新增外币头寸预报。 */
|
|
324
306
|
export function createForeignPositionForecast(value: ForecastEditorValue) {
|
|
325
307
|
return baseHttpClient.post<ForeignPositionForecastMutationResponse>(
|
|
326
|
-
|
|
308
|
+
'/TAM/0001/120201001',
|
|
327
309
|
{
|
|
328
310
|
authoFlag: '',
|
|
329
311
|
...buildForeignPositionForecastMutationBody(value),
|
|
@@ -331,9 +313,10 @@ export function createForeignPositionForecast(value: ForecastEditorValue) {
|
|
|
331
313
|
)
|
|
332
314
|
}
|
|
333
315
|
|
|
316
|
+
/** 修改指定编号的外币头寸预报。 */
|
|
334
317
|
export function updateForeignPositionForecast(predRefNo: string, value: ForecastEditorValue) {
|
|
335
318
|
return baseHttpClient.post<ForeignPositionForecastMutationResponse>(
|
|
336
|
-
|
|
319
|
+
'/TAM/0001/120201002',
|
|
337
320
|
{
|
|
338
321
|
...buildForeignPositionForecastMutationBody(value),
|
|
339
322
|
junge: '',
|
|
@@ -342,20 +325,22 @@ export function updateForeignPositionForecast(predRefNo: string, value: Forecast
|
|
|
342
325
|
)
|
|
343
326
|
}
|
|
344
327
|
|
|
328
|
+
/** 删除指定编号的外币头寸预报。 */
|
|
345
329
|
export function deleteForeignPositionForecast(predRefNo: string) {
|
|
346
|
-
return
|
|
330
|
+
return baseHttpClient.delete<ForeignPositionForecast>(
|
|
347
331
|
`/foreign-position-forecasts/${encodeURIComponent(predRefNo)}`,
|
|
348
|
-
{ method: 'DELETE' },
|
|
349
332
|
)
|
|
350
333
|
}
|
|
351
334
|
|
|
335
|
+
/** 批量通过或拒绝选中的外币头寸预报。 */
|
|
352
336
|
export function approveForeignPositionForecasts(predRefNos: string[], approved: boolean) {
|
|
353
|
-
return
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
337
|
+
return baseHttpClient.post<ForeignPositionForecastOperationResponse>(
|
|
338
|
+
'/foreign-position-forecasts/approval',
|
|
339
|
+
{ predRefNos, approved },
|
|
340
|
+
)
|
|
357
341
|
}
|
|
358
342
|
|
|
343
|
+
/** 更新指定外币头寸预报的授权状态。 */
|
|
359
344
|
export async function updateForeignPositionForecastAuthorization(
|
|
360
345
|
predRefNo: string,
|
|
361
346
|
authorization: ForeignPositionForecast['authirization'],
|
|
@@ -363,7 +348,7 @@ export async function updateForeignPositionForecastAuthorization(
|
|
|
363
348
|
pageSize: number,
|
|
364
349
|
) {
|
|
365
350
|
const payload = await baseHttpClient.post<TamResponse>(
|
|
366
|
-
|
|
351
|
+
'/TAM/0001/120201006',
|
|
367
352
|
{
|
|
368
353
|
authorization,
|
|
369
354
|
predRefNos: predRefNo,
|
|
@@ -374,37 +359,33 @@ export async function updateForeignPositionForecastAuthorization(
|
|
|
374
359
|
return getResponseMessage(payload, authorization === '1' ? '授权成功' : '取消授权成功')
|
|
375
360
|
}
|
|
376
361
|
|
|
362
|
+
/** 按筛选、排序和分页条件查询外币头寸预报。 */
|
|
377
363
|
export async function queryForeignPositionForecasts(
|
|
378
|
-
|
|
364
|
+
searchParams: ForeignPositionForecastSearchParams,
|
|
379
365
|
pageIndex: number,
|
|
380
366
|
pageSize: number,
|
|
381
|
-
sort: ForeignPositionForecastSort = {
|
|
382
|
-
amtOrder: '1',
|
|
383
|
-
predOrder: '',
|
|
384
|
-
timeOrder: '',
|
|
385
|
-
},
|
|
386
367
|
signal?: AbortSignal,
|
|
387
368
|
): Promise<ForeignPositionForecastQueryResult> {
|
|
388
369
|
const payload = await baseHttpClient.post<TamResponse>(
|
|
389
|
-
|
|
370
|
+
'/TAM/0001/140201001',
|
|
390
371
|
{
|
|
391
|
-
orgName:
|
|
392
|
-
clientName:
|
|
393
|
-
tranType:
|
|
394
|
-
ccy:
|
|
395
|
-
tranDate:
|
|
396
|
-
payDirec:
|
|
397
|
-
predStatus: toProtocolStatusList(
|
|
398
|
-
originalForeign:
|
|
399
|
-
predWay:
|
|
400
|
-
verifyStatus: toProtocolStatusList(
|
|
401
|
-
startAmt:
|
|
402
|
-
endAmt:
|
|
403
|
-
filter:
|
|
404
|
-
authorization:
|
|
405
|
-
amtOrder:
|
|
406
|
-
predOrder:
|
|
407
|
-
timeOrder:
|
|
372
|
+
orgName: searchParams.organizationName.trim(),
|
|
373
|
+
clientName: searchParams.clientName.trim(),
|
|
374
|
+
tranType: searchParams.businessType,
|
|
375
|
+
ccy: searchParams.currencies.join(','),
|
|
376
|
+
tranDate: searchParams.valueDate,
|
|
377
|
+
payDirec: searchParams.payDirection,
|
|
378
|
+
predStatus: toProtocolStatusList(searchParams.forecastStatuses, 'PS'),
|
|
379
|
+
originalForeign: searchParams.foreignExchangeType,
|
|
380
|
+
predWay: searchParams.forecastWay,
|
|
381
|
+
verifyStatus: toProtocolStatusList(searchParams.verifyStatuses, 'VS'),
|
|
382
|
+
startAmt: searchParams.minAmount === null ? '' : String(searchParams.minAmount),
|
|
383
|
+
endAmt: searchParams.maxAmount === null ? '' : String(searchParams.maxAmount),
|
|
384
|
+
filter: searchParams.ftuFilter,
|
|
385
|
+
authorization: searchParams.authirization,
|
|
386
|
+
amtOrder: searchParams.amtOrder,
|
|
387
|
+
predOrder: searchParams.predOrder,
|
|
388
|
+
timeOrder: searchParams.timeOrder,
|
|
408
389
|
},
|
|
409
390
|
{
|
|
410
391
|
signal,
|
package/src/views/foreign-currency-position-forecast/components/ForeignPositionForecastEditor.vue
CHANGED
|
@@ -523,10 +523,17 @@ function handleGroundBranchChange(value: string) {
|
|
|
523
523
|
function handleClientTypeChange() {
|
|
524
524
|
form.clientId = ''
|
|
525
525
|
form.clientName = ''
|
|
526
|
+
form.clientAccount = ''
|
|
526
527
|
clearValidation()
|
|
527
528
|
}
|
|
528
529
|
|
|
529
|
-
function handleCorporateCustomerSelect(
|
|
530
|
+
function handleCorporateCustomerSelect(customer: {
|
|
531
|
+
customerNumber: string
|
|
532
|
+
customerName: string
|
|
533
|
+
}) {
|
|
534
|
+
// 140000001 返回的 custNum 同时作为外币头寸预报提交字段 clientAcct。
|
|
535
|
+
form.clientId = customer.customerNumber
|
|
536
|
+
form.clientAccount = customer.customerNumber
|
|
530
537
|
clearValidation()
|
|
531
538
|
}
|
|
532
539
|
|
|
@@ -744,9 +751,11 @@ onBeforeUnmount(() => {
|
|
|
744
751
|
<el-form-item label="客户账号" prop="clientAccount">
|
|
745
752
|
<el-input
|
|
746
753
|
v-model="form.clientAccount"
|
|
754
|
+
:class="{ 'legacy-readonly-input': shouldUseCorporateCustomerSelector }"
|
|
747
755
|
:disabled="isLegacyFieldDisabled('clientAccount')"
|
|
756
|
+
:readonly="shouldUseCorporateCustomerSelector"
|
|
748
757
|
maxlength="40"
|
|
749
|
-
placeholder="请输入客户账号"
|
|
758
|
+
:placeholder="shouldUseCorporateCustomerSelector ? '选择客户名称后自动回填' : '请输入客户账号'"
|
|
750
759
|
/>
|
|
751
760
|
</el-form-item>
|
|
752
761
|
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
deleteForeignPositionForecast,
|
|
32
32
|
getForeignPositionForecast,
|
|
33
33
|
queryForeignPositionForecasts,
|
|
34
|
+
type ForeignPositionForecastSearchParams,
|
|
34
35
|
type ForeignPositionForecastSort,
|
|
35
36
|
updateForeignPositionForecast,
|
|
36
37
|
updateForeignPositionForecastAuthorization,
|
|
@@ -90,6 +91,10 @@ const forecastSort = ref<ForeignPositionForecastSort>({
|
|
|
90
91
|
predOrder: '',
|
|
91
92
|
timeOrder: '',
|
|
92
93
|
})
|
|
94
|
+
const sharedSearchParams = computed<ForeignPositionForecastSearchParams>(() => ({
|
|
95
|
+
...cloneFilters(appliedFilters.value),
|
|
96
|
+
...forecastSort.value,
|
|
97
|
+
}))
|
|
93
98
|
const tableDefaultSort = computed<{
|
|
94
99
|
prop: 'predAmount' | 'forecastTime' | 'approvalTime'
|
|
95
100
|
order: 'ascending' | 'descending'
|
|
@@ -166,10 +171,9 @@ async function loadForecastRows() {
|
|
|
166
171
|
|
|
167
172
|
try {
|
|
168
173
|
const response = await queryForeignPositionForecasts(
|
|
169
|
-
|
|
174
|
+
sharedSearchParams.value,
|
|
170
175
|
currentPage.value,
|
|
171
176
|
pageSize.value,
|
|
172
|
-
forecastSort.value,
|
|
173
177
|
controller.signal,
|
|
174
178
|
)
|
|
175
179
|
|
|
@@ -218,6 +222,10 @@ function handleReset() {
|
|
|
218
222
|
clearTableSelection()
|
|
219
223
|
}
|
|
220
224
|
|
|
225
|
+
function handleExport() {
|
|
226
|
+
console.log('外币头寸预报导出参数:', sharedSearchParams.value)
|
|
227
|
+
}
|
|
228
|
+
|
|
221
229
|
function handleSelectionChange(rows: ForeignPositionForecast[]) {
|
|
222
230
|
selectedRows.value = rows
|
|
223
231
|
}
|
|
@@ -710,7 +718,7 @@ onBeforeUnmount(() => {
|
|
|
710
718
|
>
|
|
711
719
|
审批拒绝
|
|
712
720
|
</el-button>
|
|
713
|
-
<el-button size="small" :icon="Download">导出</el-button>
|
|
721
|
+
<el-button size="small" :icon="Download" @click="handleExport">导出</el-button>
|
|
714
722
|
</div>
|
|
715
723
|
</template>
|
|
716
724
|
|