verce-vue-test 0.0.122 → 0.0.123
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
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import type { ForecastEditorValue } from './editor'
|
|
14
14
|
|
|
15
15
|
const QUERY_TRAN_CODE = '/TAM/0001/140201001'
|
|
16
|
+
const DETAIL_TRAN_CODE = '/TAM/0001/140201004'
|
|
16
17
|
const CREATE_TRAN_CODE = '/TAM/0001/120201001'
|
|
17
18
|
const UPDATE_TRAN_CODE = '/TAM/0001/120201002'
|
|
18
19
|
const AUTHORIZATION_TRAN_CODE = '/TAM/0001/120201006'
|
|
@@ -47,14 +48,17 @@ type TamResultInfo = {
|
|
|
47
48
|
predStatus?: string
|
|
48
49
|
predType?: string
|
|
49
50
|
groundBranch?: string
|
|
51
|
+
groundBranchName?: string
|
|
50
52
|
payDirec?: string
|
|
51
53
|
bankAcct?: string
|
|
54
|
+
paymentRoute?: string
|
|
52
55
|
ccy?: string
|
|
53
56
|
predAmt?: string
|
|
54
57
|
tranDate?: string
|
|
55
58
|
verifyStatus?: string
|
|
56
59
|
verifyAmt?: string
|
|
57
60
|
tranType?: string
|
|
61
|
+
clientType?: string
|
|
58
62
|
clientName?: string
|
|
59
63
|
clientAcct?: string
|
|
60
64
|
competName?: string
|
|
@@ -66,12 +70,14 @@ type TamResultInfo = {
|
|
|
66
70
|
updateTime?: string
|
|
67
71
|
competAcctSc?: string
|
|
68
72
|
docbusinessno?: string
|
|
73
|
+
docBusinessno?: string
|
|
69
74
|
midBankSc?: string
|
|
70
75
|
predName?: string
|
|
71
76
|
predCode?: string
|
|
72
77
|
predDept?: string
|
|
73
78
|
phoneNo?: string
|
|
74
79
|
authorization?: string
|
|
80
|
+
purpose?: string
|
|
75
81
|
remark?: string
|
|
76
82
|
}
|
|
77
83
|
|
|
@@ -88,6 +94,11 @@ type TamResponse = {
|
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
96
|
|
|
97
|
+
type TamDetailResponse = {
|
|
98
|
+
head?: TamResponse['head']
|
|
99
|
+
body?: TamResultInfo
|
|
100
|
+
}
|
|
101
|
+
|
|
91
102
|
type ApiErrorResponse = {
|
|
92
103
|
error?: {
|
|
93
104
|
message?: string
|
|
@@ -157,6 +168,26 @@ function toForeignExchangeType(value: string | undefined): '' | ForeignExchangeT
|
|
|
157
168
|
return value === '01' || value === '02' || value === '03' ? value : ''
|
|
158
169
|
}
|
|
159
170
|
|
|
171
|
+
function toClientType(value: string | undefined): '' | ClientType {
|
|
172
|
+
if (value === 'CT01' || value === '1') return 'CT01'
|
|
173
|
+
if (value === 'CT02' || value === '2') return 'CT02'
|
|
174
|
+
return ''
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function toPaymentRoute(value: string | undefined): ForeignPositionForecast['paymentRoute'] {
|
|
178
|
+
if (value === '02' || value === '2') return '02'
|
|
179
|
+
if (value === '03' || value === '3') return '03'
|
|
180
|
+
return '01'
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function toFrontendDate(value: string | undefined) {
|
|
184
|
+
const text = String(value || '').trim()
|
|
185
|
+
if (/^\d{8}$/.test(text)) {
|
|
186
|
+
return `${text.slice(0, 4)}-${text.slice(4, 6)}-${text.slice(6, 8)}`
|
|
187
|
+
}
|
|
188
|
+
return text.slice(0, 10)
|
|
189
|
+
}
|
|
190
|
+
|
|
160
191
|
function toFrontendRow(row: TamResultInfo): ForeignPositionForecast {
|
|
161
192
|
const organizationCode = String(row.groundBranch || '')
|
|
162
193
|
const clientName = String(row.clientName || '')
|
|
@@ -168,18 +199,18 @@ function toFrontendRow(row: TamResultInfo): ForeignPositionForecast {
|
|
|
168
199
|
predWay: toForecastWay(row.predWay),
|
|
169
200
|
predStatus: toForecastStatus(row.predStatus),
|
|
170
201
|
predType: toForecastType(row.predType),
|
|
171
|
-
groundBranch: organizationCode,
|
|
202
|
+
groundBranch: String(row.groundBranchName || organizationCode),
|
|
172
203
|
groundBranchCode: organizationCode,
|
|
173
204
|
payDirection: row.payDirec === 'O' ? 'O' : 'I',
|
|
174
205
|
bankAccount: String(row.bankAcct || ''),
|
|
175
|
-
paymentRoute:
|
|
206
|
+
paymentRoute: toPaymentRoute(row.paymentRoute),
|
|
176
207
|
currency: String(row.ccy || ''),
|
|
177
208
|
predAmount: toNumber(row.predAmt),
|
|
178
|
-
valueDate:
|
|
209
|
+
valueDate: toFrontendDate(row.tranDate),
|
|
179
210
|
verifyStatus: toVerifyStatus(row.verifyStatus),
|
|
180
211
|
verifyAmount: toNumber(row.verifyAmt),
|
|
181
212
|
businessType: toBusinessType(row.tranType),
|
|
182
|
-
clientType: (clientName ? 'CT01' : '')
|
|
213
|
+
clientType: toClientType(row.clientType) || (clientName ? 'CT01' : ''),
|
|
183
214
|
clientId: '',
|
|
184
215
|
clientName,
|
|
185
216
|
clientAccount: String(row.clientAcct || ''),
|
|
@@ -189,9 +220,9 @@ function toFrontendRow(row: TamResultInfo): ForeignPositionForecast {
|
|
|
189
220
|
receivingBankSwiftCode: String(row.rcvBankSc || ''),
|
|
190
221
|
foreignExchangeType: toForeignExchangeType(row.originalForeign),
|
|
191
222
|
counterpartySwiftCode: String(row.competAcctSc || ''),
|
|
192
|
-
documentBusinessNo: String(row.docbusinessno || ''),
|
|
223
|
+
documentBusinessNo: String(row.docBusinessno || row.docbusinessno || ''),
|
|
193
224
|
intermediaryBankSwiftCode: String(row.midBankSc || ''),
|
|
194
|
-
purpose: '',
|
|
225
|
+
purpose: String(row.purpose || ''),
|
|
195
226
|
remark: String(row.remark || ''),
|
|
196
227
|
forecasterName: String(row.predName || ''),
|
|
197
228
|
forecasterCode: String(row.predCode || ''),
|
|
@@ -230,11 +261,22 @@ async function requestJson<T>(path: string, init: RequestInit = {}): Promise<T>
|
|
|
230
261
|
return payload as T
|
|
231
262
|
}
|
|
232
263
|
|
|
233
|
-
export function getForeignPositionForecast(predRefNo: string, signal?: AbortSignal) {
|
|
234
|
-
|
|
235
|
-
|
|
264
|
+
export async function getForeignPositionForecast(predRefNo: string, signal?: AbortSignal) {
|
|
265
|
+
const normalizedPredRefNo = predRefNo.trim()
|
|
266
|
+
const payload = await baseHttpClient.post<TamDetailResponse>(
|
|
267
|
+
DETAIL_TRAN_CODE,
|
|
268
|
+
{ predRefNo: normalizedPredRefNo },
|
|
236
269
|
{ signal },
|
|
237
270
|
)
|
|
271
|
+
|
|
272
|
+
if (!payload.body || typeof payload.body !== 'object') {
|
|
273
|
+
throw new Error('外币头寸预报详情接口返回结构不正确')
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return toFrontendRow({
|
|
277
|
+
...payload.body,
|
|
278
|
+
predRefNo: payload.body.predRefNo || normalizedPredRefNo,
|
|
279
|
+
})
|
|
238
280
|
}
|
|
239
281
|
|
|
240
282
|
/** 查询当前用户可用的 UAA 机构树。 */
|
package/src/views/foreign-currency-position-forecast/components/ForeignPositionForecastEditor.vue
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type AccountBankOption,
|
|
7
7
|
} from '@/api/account-bank'
|
|
8
8
|
import { queryForeignPositionOrganizationTree } from '../api'
|
|
9
|
+
import { formatChineseCurrency } from '../currency'
|
|
9
10
|
import type { ForecastEditorMode, ForecastEditorValue } from '../editor'
|
|
10
11
|
import {
|
|
11
12
|
formatDate,
|
|
@@ -29,7 +30,6 @@ import {
|
|
|
29
30
|
payDirectionOptions,
|
|
30
31
|
paymentRouteOptions,
|
|
31
32
|
} from '../options'
|
|
32
|
-
import { formatChineseCurrency } from '@/views/rmb-position-forecast/model'
|
|
33
33
|
|
|
34
34
|
type EditorFormState = {
|
|
35
35
|
predWay: ForecastWay
|
|
@@ -157,6 +157,17 @@ function createEditorForm(row?: ForeignPositionForecast | null): EditorFormState
|
|
|
157
157
|
const form = reactive<EditorFormState>(createEditorForm(props.initialRow))
|
|
158
158
|
|
|
159
159
|
const editorTitle = computed(() => (props.mode === 'add' ? '新增记录' : '修改记录'))
|
|
160
|
+
const bankAccountLabel = computed(() => (props.mode === 'add' ? '我方账户行' : '账户行'))
|
|
161
|
+
const counterpartyNameLabel = computed(() => (props.mode === 'add' ? '交易对手名称' : '收款人名称'))
|
|
162
|
+
const counterpartyAccountLabel = computed(() => (props.mode === 'add' ? '交易对手账号' : '收款账号'))
|
|
163
|
+
const receivingBankLabel = computed(() => (props.mode === 'add' ? '交易对手行名称' : '收款行名称'))
|
|
164
|
+
const receivingBankSwiftCodeLabel = computed(() => (
|
|
165
|
+
props.mode === 'add' ? '交易对手行 SwiftCode' : '收款行 SwiftCode'
|
|
166
|
+
))
|
|
167
|
+
// 旧新增页提供对公客户查询入口,旧修改页则使用普通文本框回填、修改客户名称。
|
|
168
|
+
const shouldUseCorporateCustomerSelector = computed(
|
|
169
|
+
() => props.mode === 'add' && form.clientType === 'CT01',
|
|
170
|
+
)
|
|
160
171
|
const forecastDate = computed(() => props.initialRow?.forecastTime.slice(0, 10) || formatDate(new Date()))
|
|
161
172
|
const forecasterName = computed(() => props.initialRow?.forecasterName || foreignPositionForecastBusinessContext.userName)
|
|
162
173
|
const forecasterCode = computed(() => props.initialRow?.forecasterCode || foreignPositionForecastBusinessContext.userCode)
|
|
@@ -306,7 +317,7 @@ const formRules = computed<FormRules>(() => ({
|
|
|
306
317
|
currency: [{ required: true, message: '请选择币种', trigger: 'change' }],
|
|
307
318
|
valueDate: [{ required: true, message: '请选择起息日', trigger: 'change' }],
|
|
308
319
|
paymentRoute: [{ required: true, message: '请选择汇款路径', trigger: 'change' }],
|
|
309
|
-
bankAccount: [{ required: true, message:
|
|
320
|
+
bankAccount: [{ required: true, message: `请选择${bankAccountLabel.value}`, trigger: 'change' }],
|
|
310
321
|
clientType: isLegacyFieldRequired('clientType')
|
|
311
322
|
? [{ required: true, message: '请选择客户类型', trigger: 'change' }]
|
|
312
323
|
: [],
|
|
@@ -317,16 +328,16 @@ const formRules = computed<FormRules>(() => ({
|
|
|
317
328
|
? [{ required: true, message: '请输入客户账号', trigger: 'blur' }]
|
|
318
329
|
: [],
|
|
319
330
|
counterpartyName: isLegacyFieldRequired('counterpartyName')
|
|
320
|
-
? [{ required: true, message:
|
|
331
|
+
? [{ required: true, message: `请输入${counterpartyNameLabel.value}`, trigger: 'blur' }]
|
|
321
332
|
: [],
|
|
322
333
|
counterpartyAccount: isLegacyFieldRequired('counterpartyAccount')
|
|
323
|
-
? [{ required: true, message:
|
|
334
|
+
? [{ required: true, message: `请输入${counterpartyAccountLabel.value}`, trigger: 'blur' }]
|
|
324
335
|
: [],
|
|
325
336
|
receivingBank: isLegacyFieldRequired('receivingBank')
|
|
326
|
-
? [{ required: true, message:
|
|
337
|
+
? [{ required: true, message: `请输入${receivingBankLabel.value}`, trigger: 'blur' }]
|
|
327
338
|
: [],
|
|
328
339
|
receivingBankSwiftCode: isLegacyFieldRequired('receivingBankSwiftCode')
|
|
329
|
-
? [{ required: true, message:
|
|
340
|
+
? [{ required: true, message: `请输入${receivingBankSwiftCodeLabel.value}`, trigger: 'blur' }]
|
|
330
341
|
: [],
|
|
331
342
|
foreignExchangeType: isLegacyFieldRequired('foreignExchangeType')
|
|
332
343
|
? [{ required: true, message: '请选择结汇/购汇/现汇', trigger: 'change' }]
|
|
@@ -637,19 +648,19 @@ onBeforeUnmount(() => {
|
|
|
637
648
|
</el-form-item>
|
|
638
649
|
|
|
639
650
|
<el-form-item label="预报人员">
|
|
640
|
-
<el-input :model-value="forecasterName"
|
|
651
|
+
<el-input :model-value="forecasterName" readonly />
|
|
641
652
|
</el-form-item>
|
|
642
653
|
|
|
643
654
|
<el-form-item label="预报机构">
|
|
644
|
-
<el-input :model-value="forecastDepartment"
|
|
655
|
+
<el-input :model-value="forecastDepartment" readonly />
|
|
645
656
|
</el-form-item>
|
|
646
657
|
|
|
647
658
|
<el-form-item label="预报日期">
|
|
648
|
-
<el-input :model-value="forecastDate"
|
|
659
|
+
<el-input :model-value="forecastDate" readonly />
|
|
649
660
|
</el-form-item>
|
|
650
661
|
|
|
651
662
|
<el-form-item label="联系电话">
|
|
652
|
-
<el-input :model-value="phoneNumber"
|
|
663
|
+
<el-input :model-value="phoneNumber" readonly />
|
|
653
664
|
</el-form-item>
|
|
654
665
|
|
|
655
666
|
<el-form-item label="起息日" prop="valueDate">
|
|
@@ -708,7 +719,7 @@ onBeforeUnmount(() => {
|
|
|
708
719
|
|
|
709
720
|
<el-form-item label="客户名称" prop="clientName">
|
|
710
721
|
<CorporateCustomerSelect
|
|
711
|
-
v-if="
|
|
722
|
+
v-if="shouldUseCorporateCustomerSelector"
|
|
712
723
|
v-model="form.clientName"
|
|
713
724
|
v-model:customer-number="form.clientId"
|
|
714
725
|
:disabled="isLegacyFieldDisabled('clientName')"
|
|
@@ -732,34 +743,34 @@ onBeforeUnmount(() => {
|
|
|
732
743
|
/>
|
|
733
744
|
</el-form-item>
|
|
734
745
|
|
|
735
|
-
<el-form-item label="
|
|
746
|
+
<el-form-item :label="counterpartyNameLabel" prop="counterpartyName">
|
|
736
747
|
<el-input
|
|
737
748
|
v-model="form.counterpartyName"
|
|
738
749
|
:disabled="isLegacyFieldDisabled('counterpartyName')"
|
|
739
750
|
maxlength="80"
|
|
740
|
-
placeholder="
|
|
751
|
+
:placeholder="`请输入${counterpartyNameLabel}`"
|
|
741
752
|
/>
|
|
742
753
|
</el-form-item>
|
|
743
754
|
|
|
744
|
-
<el-form-item label="
|
|
755
|
+
<el-form-item :label="counterpartyAccountLabel" prop="counterpartyAccount">
|
|
745
756
|
<el-input
|
|
746
757
|
v-model="form.counterpartyAccount"
|
|
747
758
|
:disabled="isLegacyFieldDisabled('counterpartyAccount')"
|
|
748
759
|
maxlength="40"
|
|
749
|
-
placeholder="
|
|
760
|
+
:placeholder="`请输入${counterpartyAccountLabel}`"
|
|
750
761
|
/>
|
|
751
762
|
</el-form-item>
|
|
752
763
|
|
|
753
|
-
<el-form-item label="
|
|
764
|
+
<el-form-item :label="receivingBankLabel" prop="receivingBank">
|
|
754
765
|
<el-input
|
|
755
766
|
v-model="form.receivingBank"
|
|
756
767
|
:disabled="isLegacyFieldDisabled('receivingBank')"
|
|
757
768
|
maxlength="30"
|
|
758
|
-
placeholder="
|
|
769
|
+
:placeholder="`请输入${receivingBankLabel}`"
|
|
759
770
|
/>
|
|
760
771
|
</el-form-item>
|
|
761
772
|
|
|
762
|
-
<el-form-item label="
|
|
773
|
+
<el-form-item :label="receivingBankSwiftCodeLabel" prop="receivingBankSwiftCode">
|
|
763
774
|
<el-input
|
|
764
775
|
v-model="form.receivingBankSwiftCode"
|
|
765
776
|
:disabled="isLegacyFieldDisabled('receivingBankSwiftCode')"
|
|
@@ -805,7 +816,7 @@ onBeforeUnmount(() => {
|
|
|
805
816
|
/>
|
|
806
817
|
</el-form-item>
|
|
807
818
|
|
|
808
|
-
<el-form-item label="
|
|
819
|
+
<el-form-item :label="bankAccountLabel" prop="bankAccount">
|
|
809
820
|
<el-select
|
|
810
821
|
v-model="form.bankAccount"
|
|
811
822
|
:disabled="bankAccountDisabled"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const chineseDigits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] as const
|
|
2
|
+
const chineseGroupUnits = ['', '万', '亿', '兆'] as const
|
|
3
|
+
const chineseWithinGroupUnits = ['仟', '佰', '拾', ''] as const
|
|
4
|
+
|
|
5
|
+
function formatChineseFourDigitGroup(value: number) {
|
|
6
|
+
const digits = String(value).padStart(4, '0')
|
|
7
|
+
let result = ''
|
|
8
|
+
let pendingZero = false
|
|
9
|
+
|
|
10
|
+
for (let index = 0; index < digits.length; index += 1) {
|
|
11
|
+
const digit = Number(digits[index])
|
|
12
|
+
if (digit === 0) {
|
|
13
|
+
if (result) pendingZero = true
|
|
14
|
+
continue
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (pendingZero) result += chineseDigits[0]
|
|
18
|
+
result += `${chineseDigits[digit] ?? ''}${chineseWithinGroupUnits[index] ?? ''}`
|
|
19
|
+
pendingZero = false
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return result
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function formatChineseInteger(value: number) {
|
|
26
|
+
const groups: number[] = []
|
|
27
|
+
let remaining = Math.trunc(value)
|
|
28
|
+
while (remaining > 0) {
|
|
29
|
+
groups.push(remaining % 10_000)
|
|
30
|
+
remaining = Math.floor(remaining / 10_000)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let result = ''
|
|
34
|
+
let pendingZero = false
|
|
35
|
+
for (let index = groups.length - 1; index >= 0; index -= 1) {
|
|
36
|
+
const group = groups[index] ?? 0
|
|
37
|
+
if (group === 0) {
|
|
38
|
+
if (result) pendingZero = true
|
|
39
|
+
continue
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (result && (pendingZero || group < 1_000)) result += chineseDigits[0]
|
|
43
|
+
result += `${formatChineseFourDigitGroup(group)}${chineseGroupUnits[index] ?? ''}`
|
|
44
|
+
pendingZero = false
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return result
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function formatChineseCurrency(value: number | undefined) {
|
|
51
|
+
if (!Number.isFinite(value) || Number(value) < 0) return ''
|
|
52
|
+
|
|
53
|
+
const roundedFen = Math.round(Number(value) * 100)
|
|
54
|
+
const yuan = Math.floor(roundedFen / 100)
|
|
55
|
+
const jiao = Math.floor((roundedFen % 100) / 10)
|
|
56
|
+
const fen = roundedFen % 10
|
|
57
|
+
const integerPart = yuan === 0 ? '零' : formatChineseInteger(yuan)
|
|
58
|
+
const decimalPart = jiao === 0 && fen === 0
|
|
59
|
+
? '整'
|
|
60
|
+
: `${jiao > 0 ? `${chineseDigits[jiao]}角` : fen > 0 ? '零' : ''}${fen > 0 ? `${chineseDigits[fen]}分` : ''}`
|
|
61
|
+
|
|
62
|
+
return `人民币${integerPart}元${decimalPart}`
|
|
63
|
+
}
|