verce-vue-test 0.0.124 → 0.0.125
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
|
|
@@ -99,12 +92,6 @@ type TamDetailResponse = {
|
|
|
99
92
|
body?: TamResultInfo
|
|
100
93
|
}
|
|
101
94
|
|
|
102
|
-
type ApiErrorResponse = {
|
|
103
|
-
error?: {
|
|
104
|
-
message?: string
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
95
|
type ForeignPositionForecastOperationResponse = {
|
|
109
96
|
success: boolean
|
|
110
97
|
message: string
|
|
@@ -126,6 +113,7 @@ export type ForeignPositionForecastQueryResult = {
|
|
|
126
113
|
totalPage: number
|
|
127
114
|
}
|
|
128
115
|
|
|
116
|
+
/** 将前端状态码数组转换为 TAM 接口要求的逗号分隔数字。 */
|
|
129
117
|
function toProtocolStatusList(values: string[], prefix: 'PS' | 'VS') {
|
|
130
118
|
return values
|
|
131
119
|
.map((value) => value.replace(prefix, ''))
|
|
@@ -133,15 +121,18 @@ function toProtocolStatusList(values: string[], prefix: 'PS' | 'VS') {
|
|
|
133
121
|
.join(',')
|
|
134
122
|
}
|
|
135
123
|
|
|
124
|
+
/** 将接口金额转换为可安全使用的数字。 */
|
|
136
125
|
function toNumber(value: unknown) {
|
|
137
126
|
const number = Number(String(value ?? '').replaceAll(',', ''))
|
|
138
127
|
return Number.isFinite(number) ? number : 0
|
|
139
128
|
}
|
|
140
129
|
|
|
130
|
+
/** 将接口预报方式转换为前端枚举。 */
|
|
141
131
|
function toForecastWay(value: string | undefined): ForecastWay {
|
|
142
132
|
return value === 'PW02' || value === 'PW03' ? value : 'PW01'
|
|
143
133
|
}
|
|
144
134
|
|
|
135
|
+
/** 将接口预报状态转换为前端枚举。 */
|
|
145
136
|
function toForecastStatus(value: string | undefined): ForecastStatus {
|
|
146
137
|
const number = Number(String(value || '').replace(/^PS/i, ''))
|
|
147
138
|
return number >= 1 && number <= 8
|
|
@@ -149,10 +140,12 @@ function toForecastStatus(value: string | undefined): ForecastStatus {
|
|
|
149
140
|
: 'PS01'
|
|
150
141
|
}
|
|
151
142
|
|
|
143
|
+
/** 将接口预报类型转换为前端枚举。 */
|
|
152
144
|
function toForecastType(value: string | undefined): ForecastType {
|
|
153
145
|
return value === 'PT02' || value === 'PT03' ? value : 'PT01'
|
|
154
146
|
}
|
|
155
147
|
|
|
148
|
+
/** 将接口核销状态转换为前端枚举。 */
|
|
156
149
|
function toVerifyStatus(value: string | undefined): VerifyStatus {
|
|
157
150
|
const number = Number(String(value || '').replace(/^VS/i, ''))
|
|
158
151
|
return number >= 1 && number <= 3
|
|
@@ -160,26 +153,31 @@ function toVerifyStatus(value: string | undefined): VerifyStatus {
|
|
|
160
153
|
: 'VS01'
|
|
161
154
|
}
|
|
162
155
|
|
|
156
|
+
/** 将接口业务类型转换为前端枚举。 */
|
|
163
157
|
function toBusinessType(value: string | undefined): BusinessType {
|
|
164
158
|
return value === '11' || value === '12' || value === '13' ? value : '10'
|
|
165
159
|
}
|
|
166
160
|
|
|
161
|
+
/** 将接口原币购汇类型转换为前端枚举。 */
|
|
167
162
|
function toForeignExchangeType(value: string | undefined): '' | ForeignExchangeType {
|
|
168
163
|
return value === '01' || value === '02' || value === '03' ? value : ''
|
|
169
164
|
}
|
|
170
165
|
|
|
166
|
+
/** 兼容接口客户类型的数字值和前端枚举值。 */
|
|
171
167
|
function toClientType(value: string | undefined): '' | ClientType {
|
|
172
168
|
if (value === 'CT01' || value === '1') return 'CT01'
|
|
173
169
|
if (value === 'CT02' || value === '2') return 'CT02'
|
|
174
170
|
return ''
|
|
175
171
|
}
|
|
176
172
|
|
|
173
|
+
/** 兼容接口汇款路线的数字值和前端枚举值。 */
|
|
177
174
|
function toPaymentRoute(value: string | undefined): ForeignPositionForecast['paymentRoute'] {
|
|
178
175
|
if (value === '02' || value === '2') return '02'
|
|
179
176
|
if (value === '03' || value === '3') return '03'
|
|
180
177
|
return '01'
|
|
181
178
|
}
|
|
182
179
|
|
|
180
|
+
/** 将接口日期转换为前端展示日期。 */
|
|
183
181
|
function toFrontendDate(value: string | undefined) {
|
|
184
182
|
const text = String(value || '').trim()
|
|
185
183
|
if (/^\d{8}$/.test(text)) {
|
|
@@ -188,6 +186,7 @@ function toFrontendDate(value: string | undefined) {
|
|
|
188
186
|
return text.slice(0, 10)
|
|
189
187
|
}
|
|
190
188
|
|
|
189
|
+
/** 将 TAM 返回记录转换为页面使用的预报数据。 */
|
|
191
190
|
function toFrontendRow(row: TamResultInfo): ForeignPositionForecast {
|
|
192
191
|
const organizationCode = String(row.groundBranch || '')
|
|
193
192
|
const clientName = String(row.clientName || '')
|
|
@@ -233,38 +232,16 @@ function toFrontendRow(row: TamResultInfo): ForeignPositionForecast {
|
|
|
233
232
|
}
|
|
234
233
|
}
|
|
235
234
|
|
|
235
|
+
/** 获取 TAM 返回消息,不存在时使用默认文案。 */
|
|
236
236
|
function getResponseMessage(payload: TamResponse, fallback: string) {
|
|
237
237
|
return payload.head?.retMsg || fallback
|
|
238
238
|
}
|
|
239
239
|
|
|
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
|
-
|
|
240
|
+
/** 查询指定编号的外币头寸预报详情。 */
|
|
264
241
|
export async function getForeignPositionForecast(predRefNo: string, signal?: AbortSignal) {
|
|
265
242
|
const normalizedPredRefNo = predRefNo.trim()
|
|
266
243
|
const payload = await baseHttpClient.post<TamDetailResponse>(
|
|
267
|
-
|
|
244
|
+
'/TAM/0001/140201004',
|
|
268
245
|
{ predRefNo: normalizedPredRefNo },
|
|
269
246
|
{ signal },
|
|
270
247
|
)
|
|
@@ -284,10 +261,12 @@ export function queryForeignPositionOrganizationTree(signal?: AbortSignal) {
|
|
|
284
261
|
return baseHttpClient.get<{ data?: unknown }>('/uaa/org/tree', { signal })
|
|
285
262
|
}
|
|
286
263
|
|
|
264
|
+
/** 将前端日期转换为 TAM 报文日期。 */
|
|
287
265
|
function toMutationDate(value: string) {
|
|
288
266
|
return value.trim().slice(0, 10).replaceAll('-', '')
|
|
289
267
|
}
|
|
290
268
|
|
|
269
|
+
/** 构建新增和修改共用的外币头寸预报请求体。 */
|
|
291
270
|
function buildForeignPositionForecastMutationBody(value: ForecastEditorValue) {
|
|
292
271
|
return {
|
|
293
272
|
bankAcct: value.bankAccount.trim(),
|
|
@@ -321,9 +300,10 @@ function buildForeignPositionForecastMutationBody(value: ForecastEditorValue) {
|
|
|
321
300
|
}
|
|
322
301
|
}
|
|
323
302
|
|
|
303
|
+
/** 新增外币头寸预报。 */
|
|
324
304
|
export function createForeignPositionForecast(value: ForecastEditorValue) {
|
|
325
305
|
return baseHttpClient.post<ForeignPositionForecastMutationResponse>(
|
|
326
|
-
|
|
306
|
+
'/TAM/0001/120201001',
|
|
327
307
|
{
|
|
328
308
|
authoFlag: '',
|
|
329
309
|
...buildForeignPositionForecastMutationBody(value),
|
|
@@ -331,9 +311,10 @@ export function createForeignPositionForecast(value: ForecastEditorValue) {
|
|
|
331
311
|
)
|
|
332
312
|
}
|
|
333
313
|
|
|
314
|
+
/** 修改指定编号的外币头寸预报。 */
|
|
334
315
|
export function updateForeignPositionForecast(predRefNo: string, value: ForecastEditorValue) {
|
|
335
316
|
return baseHttpClient.post<ForeignPositionForecastMutationResponse>(
|
|
336
|
-
|
|
317
|
+
'/TAM/0001/120201002',
|
|
337
318
|
{
|
|
338
319
|
...buildForeignPositionForecastMutationBody(value),
|
|
339
320
|
junge: '',
|
|
@@ -342,20 +323,22 @@ export function updateForeignPositionForecast(predRefNo: string, value: Forecast
|
|
|
342
323
|
)
|
|
343
324
|
}
|
|
344
325
|
|
|
326
|
+
/** 删除指定编号的外币头寸预报。 */
|
|
345
327
|
export function deleteForeignPositionForecast(predRefNo: string) {
|
|
346
|
-
return
|
|
328
|
+
return baseHttpClient.delete<ForeignPositionForecast>(
|
|
347
329
|
`/foreign-position-forecasts/${encodeURIComponent(predRefNo)}`,
|
|
348
|
-
{ method: 'DELETE' },
|
|
349
330
|
)
|
|
350
331
|
}
|
|
351
332
|
|
|
333
|
+
/** 批量通过或拒绝选中的外币头寸预报。 */
|
|
352
334
|
export function approveForeignPositionForecasts(predRefNos: string[], approved: boolean) {
|
|
353
|
-
return
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
335
|
+
return baseHttpClient.post<ForeignPositionForecastOperationResponse>(
|
|
336
|
+
'/foreign-position-forecasts/approval',
|
|
337
|
+
{ predRefNos, approved },
|
|
338
|
+
)
|
|
357
339
|
}
|
|
358
340
|
|
|
341
|
+
/** 更新指定外币头寸预报的授权状态。 */
|
|
359
342
|
export async function updateForeignPositionForecastAuthorization(
|
|
360
343
|
predRefNo: string,
|
|
361
344
|
authorization: ForeignPositionForecast['authirization'],
|
|
@@ -363,7 +346,7 @@ export async function updateForeignPositionForecastAuthorization(
|
|
|
363
346
|
pageSize: number,
|
|
364
347
|
) {
|
|
365
348
|
const payload = await baseHttpClient.post<TamResponse>(
|
|
366
|
-
|
|
349
|
+
'/TAM/0001/120201006',
|
|
367
350
|
{
|
|
368
351
|
authorization,
|
|
369
352
|
predRefNos: predRefNo,
|
|
@@ -374,6 +357,7 @@ export async function updateForeignPositionForecastAuthorization(
|
|
|
374
357
|
return getResponseMessage(payload, authorization === '1' ? '授权成功' : '取消授权成功')
|
|
375
358
|
}
|
|
376
359
|
|
|
360
|
+
/** 按筛选、排序和分页条件查询外币头寸预报。 */
|
|
377
361
|
export async function queryForeignPositionForecasts(
|
|
378
362
|
filters: ForeignPositionForecastQuery,
|
|
379
363
|
pageIndex: number,
|
|
@@ -386,7 +370,7 @@ export async function queryForeignPositionForecasts(
|
|
|
386
370
|
signal?: AbortSignal,
|
|
387
371
|
): Promise<ForeignPositionForecastQueryResult> {
|
|
388
372
|
const payload = await baseHttpClient.post<TamResponse>(
|
|
389
|
-
|
|
373
|
+
'/TAM/0001/140201001',
|
|
390
374
|
{
|
|
391
375
|
orgName: filters.organizationName.trim(),
|
|
392
376
|
clientName: filters.clientName.trim(),
|
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
|
|