verce-vue-test 0.0.118 → 0.0.119
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/sftp-ftp-u.vue +0 -0
- package/src/views/rmb-position-forecast/api.ts +153 -7
- package/src/views/rmb-position-forecast/editor.ts +252 -0
- package/src/views/rmb-position-forecast/index.vue +1070 -158
- package/src/views/rmb-position-forecast/types.ts +6 -1
- package/1.3.0.vue +0 -0
- package/denglong.vue +0 -0
package/package.json
CHANGED
package/sftp-ftp-u.vue
ADDED
|
Binary file
|
|
@@ -11,6 +11,9 @@ const CREATE_TRAN_CODE = '/TAM/0001/120101001'
|
|
|
11
11
|
const UPDATE_TRAN_CODE = '/TAM/0001/120101002'
|
|
12
12
|
const DELETE_TRAN_CODE = '/TAM/0001/120101003'
|
|
13
13
|
const DETAIL_TRAN_CODE = '/TAM/0001/140101002'
|
|
14
|
+
const CUSTOMER_SEARCH_TRAN_CODE = '/TAM/0001/140000001'
|
|
15
|
+
const CUSTOMER_ACCOUNT_QUERY_TRAN_CODE = '/TAM/0001/140000002'
|
|
16
|
+
const ORGANIZATION_TREE_PATH = '/uaa/org/tree'
|
|
14
17
|
|
|
15
18
|
type RmbPositionForecastQueryParams = {
|
|
16
19
|
busiType: string
|
|
@@ -35,7 +38,11 @@ type RmbPositionForecastApiRow = {
|
|
|
35
38
|
clientType?: string
|
|
36
39
|
competAcct?: string
|
|
37
40
|
competName?: string
|
|
41
|
+
custInfoSeq?: string
|
|
42
|
+
custRefSeq?: string
|
|
38
43
|
eduFlag?: string
|
|
44
|
+
editFlag?: boolean | number | string
|
|
45
|
+
flag?: boolean | number | string
|
|
39
46
|
groundBranch?: string
|
|
40
47
|
groundBranchCode?: string
|
|
41
48
|
linkMan?: string
|
|
@@ -77,6 +84,8 @@ export type RmbPositionForecastMutationValue = {
|
|
|
77
84
|
counterpartyAccount: string
|
|
78
85
|
businessType: string
|
|
79
86
|
forecastDate: string
|
|
87
|
+
customerInfoSequence?: string
|
|
88
|
+
customerReferenceSequence?: string
|
|
80
89
|
billDate?: string
|
|
81
90
|
billNo?: string
|
|
82
91
|
linkMan?: string
|
|
@@ -87,6 +96,31 @@ export type RmbPositionForecastMutationValue = {
|
|
|
87
96
|
remark?: string
|
|
88
97
|
}
|
|
89
98
|
|
|
99
|
+
type RmbPositionCustomerApiRow = {
|
|
100
|
+
custBelongOrg?: string
|
|
101
|
+
custCnName?: string
|
|
102
|
+
custNum?: string
|
|
103
|
+
custSts?: string
|
|
104
|
+
orgCode?: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
type RmbPositionCustomerResponseBody = {
|
|
108
|
+
resultList?: RmbPositionCustomerApiRow[]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type RmbPositionCustomerOption = {
|
|
112
|
+
customerNumber: string
|
|
113
|
+
customerName: string
|
|
114
|
+
customerStatus: string
|
|
115
|
+
belongOrganization: string
|
|
116
|
+
organizationCode: string
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export type RmbPositionOrganizationOption = {
|
|
120
|
+
organizationCode: string
|
|
121
|
+
organizationName: string
|
|
122
|
+
}
|
|
123
|
+
|
|
90
124
|
function invalidField(field: string, value: unknown): never {
|
|
91
125
|
const displayValue = String(value ?? '').trim() || '空值'
|
|
92
126
|
throw new Error(`人民币头寸预报接口返回的 ${field} 无效:${displayValue}`)
|
|
@@ -127,7 +161,7 @@ function toVerifyStatus(value: unknown): RmbPositionForecastRow['verifyStatus']
|
|
|
127
161
|
|
|
128
162
|
function toClientType(value: unknown): RmbPositionForecastRow['clientType'] {
|
|
129
163
|
const clientType = String(value ?? '')
|
|
130
|
-
if (!['1', '2', '3', '4', '5'].includes(clientType)) {
|
|
164
|
+
if (!['', '1', '2', '3', '4', '5'].includes(clientType)) {
|
|
131
165
|
return invalidField('clientType', value)
|
|
132
166
|
}
|
|
133
167
|
return clientType as RmbPositionForecastRow['clientType']
|
|
@@ -166,6 +200,9 @@ function toFrontendRow(row: RmbPositionForecastApiRow): RmbPositionForecastRow {
|
|
|
166
200
|
counterpartyAccount: String(row.competAcct ?? ''),
|
|
167
201
|
businessType: toBusinessType(row.busiType),
|
|
168
202
|
forecastDate: String(row.predDate ?? ''),
|
|
203
|
+
editLocked: ['1', 'true', 'y', 'yes'].includes(
|
|
204
|
+
String(row.editFlag ?? row.flag ?? '').trim().toLowerCase(),
|
|
205
|
+
),
|
|
169
206
|
}
|
|
170
207
|
}
|
|
171
208
|
|
|
@@ -183,10 +220,15 @@ function toFrontendDetail(row: RmbPositionForecastApiRow): RmbPositionForecastDe
|
|
|
183
220
|
predName: String(row.predName ?? ''),
|
|
184
221
|
purpose: String(row.purpose ?? ''),
|
|
185
222
|
remark: String(row.remark ?? ''),
|
|
223
|
+
customerInfoSequence: String(row.custInfoSeq ?? ''),
|
|
224
|
+
customerReferenceSequence: String(row.custRefSeq ?? ''),
|
|
186
225
|
}
|
|
187
226
|
}
|
|
188
227
|
|
|
189
|
-
function toProtocolMutationBody(
|
|
228
|
+
function toProtocolMutationBody(
|
|
229
|
+
value: RmbPositionForecastMutationValue,
|
|
230
|
+
includeCreatorFields = true,
|
|
231
|
+
) {
|
|
190
232
|
return {
|
|
191
233
|
busiType: value.businessType,
|
|
192
234
|
clientName: value.clientName.trim(),
|
|
@@ -204,8 +246,10 @@ function toProtocolMutationBody(value: RmbPositionForecastMutationValue) {
|
|
|
204
246
|
...(value.billNo !== undefined ? { billNo: value.billNo } : {}),
|
|
205
247
|
...(value.linkMan !== undefined ? { linkMan: value.linkMan } : {}),
|
|
206
248
|
...(value.phoneNo !== undefined ? { phoneNo: value.phoneNo } : {}),
|
|
207
|
-
...(value.predName !== undefined ? { predName: value.predName } : {}),
|
|
208
|
-
...(value.predBranchName !== undefined
|
|
249
|
+
...(includeCreatorFields && value.predName !== undefined ? { predName: value.predName } : {}),
|
|
250
|
+
...(includeCreatorFields && value.predBranchName !== undefined
|
|
251
|
+
? { predOrgName: value.predBranchName }
|
|
252
|
+
: {}),
|
|
209
253
|
...(value.purpose !== undefined ? { purpose: value.purpose } : {}),
|
|
210
254
|
...(value.remark !== undefined ? { remark: value.remark } : {}),
|
|
211
255
|
}
|
|
@@ -266,7 +310,7 @@ export function createRmbPositionForecast(value: RmbPositionForecastMutationValu
|
|
|
266
310
|
CREATE_TRAN_CODE,
|
|
267
311
|
{
|
|
268
312
|
...toProtocolMutationBody(value),
|
|
269
|
-
custInfoSeq: '',
|
|
313
|
+
custInfoSeq: value.customerInfoSequence?.trim() || '',
|
|
270
314
|
},
|
|
271
315
|
)
|
|
272
316
|
}
|
|
@@ -275,17 +319,119 @@ export function createRmbPositionForecast(value: RmbPositionForecastMutationValu
|
|
|
275
319
|
export function updateRmbPositionForecast(value: RmbPositionForecastMutationValue) {
|
|
276
320
|
const predRefSeq = String(value.predRefNo ?? '').trim()
|
|
277
321
|
if (!predRefSeq) throw new Error('预报流水号不能为空')
|
|
322
|
+
const custRefSeq = value.customerReferenceSequence?.trim()
|
|
278
323
|
|
|
279
324
|
return baseHttpClient.post<TamResponse<Record<string, never>>>(
|
|
280
325
|
UPDATE_TRAN_CODE,
|
|
281
326
|
{
|
|
282
|
-
...toProtocolMutationBody(value),
|
|
283
|
-
custRefSeq:
|
|
327
|
+
...toProtocolMutationBody(value, false),
|
|
328
|
+
...(custRefSeq ? { custRefSeq } : {}),
|
|
284
329
|
predRefSeq,
|
|
285
330
|
},
|
|
286
331
|
)
|
|
287
332
|
}
|
|
288
333
|
|
|
334
|
+
/** 对公客户名称查询(140000001);custNum 用于继续发起 140000002 账号查询。 */
|
|
335
|
+
export async function searchRmbPositionCustomers(
|
|
336
|
+
keyword: string,
|
|
337
|
+
signal?: AbortSignal,
|
|
338
|
+
): Promise<RmbPositionCustomerOption[]> {
|
|
339
|
+
const custCnName = keyword.trim()
|
|
340
|
+
if (!custCnName) throw new Error('客户名称不能为空')
|
|
341
|
+
|
|
342
|
+
const response = await baseHttpClient.post<TamResponse<RmbPositionCustomerResponseBody>>(
|
|
343
|
+
CUSTOMER_SEARCH_TRAN_CODE,
|
|
344
|
+
{ custCnName },
|
|
345
|
+
{
|
|
346
|
+
signal,
|
|
347
|
+
tamHead: { pageIndex: 1, pageSize: 10 },
|
|
348
|
+
},
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
const resultList = Array.isArray(response.body.resultList) ? response.body.resultList : []
|
|
352
|
+
return resultList
|
|
353
|
+
.map((row) => ({
|
|
354
|
+
customerNumber: String(row.custNum ?? '').trim(),
|
|
355
|
+
customerName: String(row.custCnName ?? '').trim(),
|
|
356
|
+
customerStatus: String(row.custSts ?? '').trim(),
|
|
357
|
+
belongOrganization: String(row.custBelongOrg ?? '').trim(),
|
|
358
|
+
organizationCode: String(row.orgCode ?? '').trim(),
|
|
359
|
+
}))
|
|
360
|
+
.filter((row) => row.customerNumber && row.customerName)
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** 选中对公客户后发起客户账号查询,返回本次查询交易流水号。 */
|
|
364
|
+
export async function queryRmbPositionCustomerAccount(
|
|
365
|
+
clientId: string,
|
|
366
|
+
signal?: AbortSignal,
|
|
367
|
+
) {
|
|
368
|
+
const normalizedClientId = clientId.trim()
|
|
369
|
+
if (!normalizedClientId) throw new Error('客户编号不能为空')
|
|
370
|
+
|
|
371
|
+
const response = await baseHttpClient.post<TamResponse<{ consumerSeqNo?: string }>>(
|
|
372
|
+
CUSTOMER_ACCOUNT_QUERY_TRAN_CODE,
|
|
373
|
+
{ clientId: normalizedClientId },
|
|
374
|
+
{ signal },
|
|
375
|
+
)
|
|
376
|
+
const consumerSeqNo = String(response.body.consumerSeqNo ?? '').trim()
|
|
377
|
+
if (!consumerSeqNo) invalidField('consumerSeqNo', response.body.consumerSeqNo)
|
|
378
|
+
return consumerSeqNo
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function collectOrganizations(
|
|
382
|
+
node: unknown,
|
|
383
|
+
result: RmbPositionOrganizationOption[],
|
|
384
|
+
seenCodes: Set<string>,
|
|
385
|
+
) {
|
|
386
|
+
if (Array.isArray(node)) {
|
|
387
|
+
node.forEach((item) => collectOrganizations(item, result, seenCodes))
|
|
388
|
+
return
|
|
389
|
+
}
|
|
390
|
+
if (!node || typeof node !== 'object') return
|
|
391
|
+
|
|
392
|
+
const current = node as Record<string, unknown>
|
|
393
|
+
const attributes = current.attributes && typeof current.attributes === 'object'
|
|
394
|
+
? current.attributes as Record<string, unknown>
|
|
395
|
+
: {}
|
|
396
|
+
const organizationCode = String(
|
|
397
|
+
attributes.orgNo ?? attributes.orgId ?? current.id ?? '',
|
|
398
|
+
).trim()
|
|
399
|
+
const organizationName = String(attributes.orgName ?? current.text ?? '').trim()
|
|
400
|
+
|
|
401
|
+
if (
|
|
402
|
+
organizationCode
|
|
403
|
+
&& organizationCode !== '-1'
|
|
404
|
+
&& organizationName
|
|
405
|
+
&& !seenCodes.has(organizationCode)
|
|
406
|
+
) {
|
|
407
|
+
seenCodes.add(organizationCode)
|
|
408
|
+
result.push({ organizationCode, organizationName })
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
collectOrganizations(current.children, result, seenCodes)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/** 落地机构查询;从当前 UAA 机构树中按机构名称或代码筛选。 */
|
|
415
|
+
export async function searchRmbPositionOrganizations(
|
|
416
|
+
keyword: string,
|
|
417
|
+
signal?: AbortSignal,
|
|
418
|
+
): Promise<RmbPositionOrganizationOption[]> {
|
|
419
|
+
const normalizedKeyword = keyword.trim().toLocaleLowerCase('zh-CN')
|
|
420
|
+
if (!normalizedKeyword) throw new Error('机构名称不能为空')
|
|
421
|
+
|
|
422
|
+
const response = await baseHttpClient.get<{ data?: unknown }>(
|
|
423
|
+
ORGANIZATION_TREE_PATH,
|
|
424
|
+
{ signal },
|
|
425
|
+
)
|
|
426
|
+
const organizations: RmbPositionOrganizationOption[] = []
|
|
427
|
+
collectOrganizations(response.data, organizations, new Set<string>())
|
|
428
|
+
|
|
429
|
+
return organizations.filter((option) => (
|
|
430
|
+
option.organizationName.toLocaleLowerCase('zh-CN').includes(normalizedKeyword)
|
|
431
|
+
|| option.organizationCode.toLocaleLowerCase('zh-CN').includes(normalizedKeyword)
|
|
432
|
+
)).slice(0, 20)
|
|
433
|
+
}
|
|
434
|
+
|
|
289
435
|
/** 删除人民币头寸预报,文档字段名为 predRefSeqs(120101003)。 */
|
|
290
436
|
export function deleteRmbPositionForecast(predRefNos: string[]) {
|
|
291
437
|
const predRefSeqs = [...new Set(predRefNos.map((item) => item.trim()).filter(Boolean))]
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import type { RmbPositionForecastDetail } from './types'
|
|
2
|
+
|
|
3
|
+
export type EditorMode = 'add' | 'edit' | 'copy'
|
|
4
|
+
|
|
5
|
+
export type EditorForm = {
|
|
6
|
+
tradeDate: string
|
|
7
|
+
payDirection: string
|
|
8
|
+
payChannel: string
|
|
9
|
+
predAmount: number | undefined
|
|
10
|
+
groundBranch: string
|
|
11
|
+
groundBranchCode: string
|
|
12
|
+
clientType: string
|
|
13
|
+
clientName: string
|
|
14
|
+
selectedCustomerNumber: string
|
|
15
|
+
customerInfoSequence: string
|
|
16
|
+
customerReferenceSequence: string
|
|
17
|
+
counterpartyName: string
|
|
18
|
+
counterpartyAccount: string
|
|
19
|
+
standardName: string
|
|
20
|
+
businessType: string
|
|
21
|
+
billNo: string
|
|
22
|
+
billDate: string
|
|
23
|
+
linkMan: string
|
|
24
|
+
phoneNo: string
|
|
25
|
+
predName: string
|
|
26
|
+
predBranchName: string
|
|
27
|
+
purpose: string
|
|
28
|
+
remark: string
|
|
29
|
+
forecastDate: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type EditorContext = {
|
|
33
|
+
sysWorkDate: string
|
|
34
|
+
currentBranchName: string
|
|
35
|
+
currentBranchCode: string
|
|
36
|
+
currentUserName: string
|
|
37
|
+
currentPhoneNo: string
|
|
38
|
+
forecastDate: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type EditorControlledField =
|
|
42
|
+
| 'businessType'
|
|
43
|
+
| 'groundBranch'
|
|
44
|
+
| 'groundBranchCode'
|
|
45
|
+
| 'clientType'
|
|
46
|
+
| 'clientName'
|
|
47
|
+
| 'counterpartyName'
|
|
48
|
+
| 'counterpartyAccount'
|
|
49
|
+
| 'billNo'
|
|
50
|
+
| 'billDate'
|
|
51
|
+
| 'payChannel'
|
|
52
|
+
| 'payDirection'
|
|
53
|
+
| 'predAmount'
|
|
54
|
+
| 'tradeDate'
|
|
55
|
+
| 'standardName'
|
|
56
|
+
|
|
57
|
+
export type EditorFieldMode = 'required' | 'optional' | 'disabled'
|
|
58
|
+
export type EditorFieldPolicy = Record<EditorControlledField, EditorFieldMode>
|
|
59
|
+
|
|
60
|
+
const billBusinessTypes = new Set(['2', '3'])
|
|
61
|
+
|
|
62
|
+
/** 本票、三省一市汇票共用票据类联动。 */
|
|
63
|
+
export function isBillBusinessType(value: string) {
|
|
64
|
+
return billBusinessTypes.has(value)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** 旧页面以机构代码 25 开头判断核算中心。 */
|
|
68
|
+
export function isAccountingCenter(value: string) {
|
|
69
|
+
return value.trim().startsWith('25')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function createEditorForm(
|
|
73
|
+
context: EditorContext,
|
|
74
|
+
row?: Partial<RmbPositionForecastDetail> | null,
|
|
75
|
+
mode: EditorMode = 'add',
|
|
76
|
+
): EditorForm {
|
|
77
|
+
const sourceClientType = String(row?.clientType ?? '')
|
|
78
|
+
const clientType = mode === 'edit'
|
|
79
|
+
? ['3', '4'].includes(sourceClientType) ? '' : sourceClientType
|
|
80
|
+
: ['1', '2'].includes(sourceClientType) ? sourceClientType : ''
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
tradeDate: String(row?.tradeDate ?? context.sysWorkDate),
|
|
84
|
+
payDirection: String(row?.payDirection ?? ''),
|
|
85
|
+
payChannel: String(row?.payChannel ?? ''),
|
|
86
|
+
predAmount: row?.predAmount,
|
|
87
|
+
groundBranch: String(row?.groundBranch ?? context.currentBranchName),
|
|
88
|
+
groundBranchCode: String(row?.groundBranchCode ?? context.currentBranchCode),
|
|
89
|
+
clientType,
|
|
90
|
+
clientName: String(row?.clientName ?? ''),
|
|
91
|
+
selectedCustomerNumber: '',
|
|
92
|
+
customerInfoSequence: '',
|
|
93
|
+
customerReferenceSequence: mode === 'edit'
|
|
94
|
+
? String(row?.customerReferenceSequence || row?.customerInfoSequence || '')
|
|
95
|
+
: '',
|
|
96
|
+
counterpartyName: String(row?.counterpartyName ?? ''),
|
|
97
|
+
counterpartyAccount: String(row?.counterpartyAccount ?? ''),
|
|
98
|
+
standardName: String(row?.standardName ?? ''),
|
|
99
|
+
businessType: String(row?.businessType ?? ''),
|
|
100
|
+
billNo: String(row?.billNo ?? ''),
|
|
101
|
+
billDate: String(row?.billDate ?? ''),
|
|
102
|
+
linkMan: String(row?.linkMan ?? ''),
|
|
103
|
+
phoneNo: String(row?.phoneNo ?? context.currentPhoneNo),
|
|
104
|
+
// 修改页沿用旧页面语义:预报人员和预报机构显示当前页面上下文。
|
|
105
|
+
predName: context.currentUserName,
|
|
106
|
+
predBranchName: context.currentBranchName,
|
|
107
|
+
purpose: String(row?.purpose ?? ''),
|
|
108
|
+
remark: String(row?.remark ?? ''),
|
|
109
|
+
forecastDate: String(row?.forecastDate ?? context.forecastDate),
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 将新增页分散的 ExtJS readOnly/allowBlank 操作收口为确定性策略。
|
|
115
|
+
* 修改页单独返回固定字段权限,不复用新增页联动,避免回填值被清空。
|
|
116
|
+
*/
|
|
117
|
+
export function createEditorFieldPolicy(
|
|
118
|
+
form: EditorForm,
|
|
119
|
+
mode: EditorMode,
|
|
120
|
+
editAmountAndDateLocked: boolean,
|
|
121
|
+
): EditorFieldPolicy {
|
|
122
|
+
if (mode === 'edit') {
|
|
123
|
+
return {
|
|
124
|
+
businessType: 'disabled',
|
|
125
|
+
groundBranch: 'disabled',
|
|
126
|
+
groundBranchCode: 'disabled',
|
|
127
|
+
clientType: 'disabled',
|
|
128
|
+
clientName: 'optional',
|
|
129
|
+
counterpartyName: 'optional',
|
|
130
|
+
counterpartyAccount: 'disabled',
|
|
131
|
+
billNo: 'disabled',
|
|
132
|
+
billDate: 'disabled',
|
|
133
|
+
payChannel: 'disabled',
|
|
134
|
+
payDirection: 'disabled',
|
|
135
|
+
predAmount: editAmountAndDateLocked ? 'disabled' : 'required',
|
|
136
|
+
tradeDate: editAmountAndDateLocked ? 'disabled' : 'required',
|
|
137
|
+
standardName: 'disabled',
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const hasBusinessType = Boolean(form.businessType)
|
|
142
|
+
const hasGroundBranch = Boolean(form.groundBranch.trim() && form.groundBranchCode.trim())
|
|
143
|
+
const billBusiness = isBillBusinessType(form.businessType)
|
|
144
|
+
const accountingCenter = isAccountingCenter(form.groundBranchCode)
|
|
145
|
+
const linkageReady = hasBusinessType && hasGroundBranch
|
|
146
|
+
const clientEnabled = linkageReady && !billBusiness && !accountingCenter
|
|
147
|
+
const counterpartyEnabled = linkageReady && !billBusiness
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
businessType: 'required',
|
|
151
|
+
groundBranch: 'required',
|
|
152
|
+
groundBranchCode: 'required',
|
|
153
|
+
clientType: clientEnabled ? 'required' : 'disabled',
|
|
154
|
+
clientName: clientEnabled ? 'required' : 'disabled',
|
|
155
|
+
counterpartyName: counterpartyEnabled
|
|
156
|
+
? accountingCenter ? 'required' : 'optional'
|
|
157
|
+
: 'disabled',
|
|
158
|
+
counterpartyAccount: counterpartyEnabled ? 'optional' : 'disabled',
|
|
159
|
+
billNo: billBusiness ? 'required' : 'disabled',
|
|
160
|
+
billDate: billBusiness ? 'required' : 'disabled',
|
|
161
|
+
payChannel: billBusiness || !linkageReady ? 'disabled' : 'required',
|
|
162
|
+
payDirection: 'required',
|
|
163
|
+
predAmount: 'required',
|
|
164
|
+
tradeDate: 'required',
|
|
165
|
+
standardName: 'disabled',
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** 仅清理由当前新增/复制策略明确禁用的值,修改页不调用。 */
|
|
170
|
+
export function normalizeCreateEditorForm(form: EditorForm, policy: EditorFieldPolicy) {
|
|
171
|
+
if (policy.clientType === 'disabled') form.clientType = ''
|
|
172
|
+
if (policy.clientName === 'disabled') {
|
|
173
|
+
form.clientName = ''
|
|
174
|
+
form.selectedCustomerNumber = ''
|
|
175
|
+
form.customerInfoSequence = ''
|
|
176
|
+
}
|
|
177
|
+
if (policy.counterpartyName === 'disabled') form.counterpartyName = ''
|
|
178
|
+
if (policy.counterpartyAccount === 'disabled') form.counterpartyAccount = ''
|
|
179
|
+
if (policy.billNo === 'disabled') form.billNo = ''
|
|
180
|
+
if (policy.billDate === 'disabled') form.billDate = ''
|
|
181
|
+
|
|
182
|
+
if (isBillBusinessType(form.businessType)) {
|
|
183
|
+
form.payChannel = '2'
|
|
184
|
+
} else if (policy.payChannel === 'disabled') {
|
|
185
|
+
form.payChannel = ''
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const chineseDigits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] as const
|
|
190
|
+
const chineseGroupUnits = ['', '万', '亿', '兆'] as const
|
|
191
|
+
const chineseWithinGroupUnits = ['仟', '佰', '拾', ''] as const
|
|
192
|
+
|
|
193
|
+
function formatChineseFourDigitGroup(value: number) {
|
|
194
|
+
const digits = String(value).padStart(4, '0')
|
|
195
|
+
let result = ''
|
|
196
|
+
let pendingZero = false
|
|
197
|
+
|
|
198
|
+
for (let index = 0; index < digits.length; index += 1) {
|
|
199
|
+
const digit = Number(digits[index])
|
|
200
|
+
if (digit === 0) {
|
|
201
|
+
if (result) pendingZero = true
|
|
202
|
+
continue
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (pendingZero) result += chineseDigits[0]
|
|
206
|
+
result += `${chineseDigits[digit] ?? ''}${chineseWithinGroupUnits[index] ?? ''}`
|
|
207
|
+
pendingZero = false
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return result
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function formatChineseInteger(value: number) {
|
|
214
|
+
const groups: number[] = []
|
|
215
|
+
let remaining = Math.trunc(value)
|
|
216
|
+
while (remaining > 0) {
|
|
217
|
+
groups.push(remaining % 10_000)
|
|
218
|
+
remaining = Math.floor(remaining / 10_000)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
let result = ''
|
|
222
|
+
let pendingZero = false
|
|
223
|
+
for (let index = groups.length - 1; index >= 0; index -= 1) {
|
|
224
|
+
const group = groups[index] ?? 0
|
|
225
|
+
if (group === 0) {
|
|
226
|
+
if (result) pendingZero = true
|
|
227
|
+
continue
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (result && (pendingZero || group < 1_000)) result += chineseDigits[0]
|
|
231
|
+
result += `${formatChineseFourDigitGroup(group)}${chineseGroupUnits[index] ?? ''}`
|
|
232
|
+
pendingZero = false
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return result
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** 正确生成金额大写提示,替代旧页面中变量拼写错误且遗漏角分的实现。 */
|
|
239
|
+
export function formatChineseCurrency(value: number | undefined) {
|
|
240
|
+
if (!Number.isFinite(value) || Number(value) < 0) return ''
|
|
241
|
+
|
|
242
|
+
const roundedFen = Math.round(Number(value) * 100)
|
|
243
|
+
const yuan = Math.floor(roundedFen / 100)
|
|
244
|
+
const jiao = Math.floor((roundedFen % 100) / 10)
|
|
245
|
+
const fen = roundedFen % 10
|
|
246
|
+
const integerPart = yuan === 0 ? '零' : formatChineseInteger(yuan)
|
|
247
|
+
const decimalPart = jiao === 0 && fen === 0
|
|
248
|
+
? '整'
|
|
249
|
+
: `${jiao > 0 ? `${chineseDigits[jiao]}角` : fen > 0 ? '零' : ''}${fen > 0 ? `${chineseDigits[fen]}分` : ''}`
|
|
250
|
+
|
|
251
|
+
return `人民币${integerPart}元${decimalPart}`
|
|
252
|
+
}
|