verce-vue-test 0.0.153 → 0.0.155
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/.vscode/file-notes.json +0 -1
- package/package.json +1 -1
- package/src/views/foreign-currency-position-forecast/api.ts +5 -14
- package/src/views/foreign-currency-position-forecast/components/ForeignPositionForecastEditor.vue +90 -119
- package/src/views/foreign-currency-position-forecast/currency.ts +3 -0
- package/src/views/foreign-currency-position-forecast/index.vue +209 -391
- package/src/views/foreign-currency-position-forecast/model.ts +17 -33
- package/src/views/foreign-currency-position-forecast/options.ts +11 -16
- package/src/views/foreign-currency-position-forecast/runtime.ts +3 -5
- package/src/views/foreign-currency-position-forecast/store.ts +18 -18
- package/src/views/foreign-currency-position-forecast/editor.ts +0 -4
package/.vscode/file-notes.json
CHANGED
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"src/views/foreign-currency-position-forecast/components": "外币头寸预报页面组件目录",
|
|
83
83
|
"src/views/foreign-currency-position-forecast/components/ForeignPositionForecastEditor.vue": "外币头寸预报编辑器组件",
|
|
84
84
|
"src/views/foreign-currency-position-forecast/currency.ts": "外币头寸预报币种配置与格式化工具",
|
|
85
|
-
"src/views/foreign-currency-position-forecast/editor.ts": "外币头寸预报编辑状态与表单辅助逻辑",
|
|
86
85
|
"src/views/foreign-currency-position-forecast/index.vue": "外币头寸预报列表页面",
|
|
87
86
|
"src/views/foreign-currency-position-forecast/model.ts": "外币头寸预报数据模型与表格类型",
|
|
88
87
|
"src/views/foreign-currency-position-forecast/options.ts": "外币头寸预报选项、状态与列配置",
|
package/package.json
CHANGED
|
@@ -112,11 +112,6 @@ export function toFrontendRow(row: any): ForeignPositionForecast {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
/** 获取 TAM 返回消息,不存在时使用默认文案。 */
|
|
116
|
-
function getResponseMessage(payload: any, fallback: string) {
|
|
117
|
-
return payload.head?.retMsg || fallback
|
|
118
|
-
}
|
|
119
|
-
|
|
120
115
|
/** 查询指定编号的外币头寸预报详情。 */
|
|
121
116
|
export async function getForeignPositionForecast(predRefNo: string) {
|
|
122
117
|
const normalizedPredRefNo = predRefNo.trim()
|
|
@@ -136,11 +131,6 @@ export function queryForeignPositionOrganizationTree() {
|
|
|
136
131
|
return baseHttpClient.get<any>('/uaa/org/tree')
|
|
137
132
|
}
|
|
138
133
|
|
|
139
|
-
export type ForeignPositionAccountBankOption = {
|
|
140
|
-
bankAcct: string
|
|
141
|
-
bankName: string
|
|
142
|
-
}
|
|
143
|
-
|
|
144
134
|
/** 根据币种、汇款路径和业务类型查询外币预报可用的我方账户行。 */
|
|
145
135
|
export async function queryForeignPositionAccountBanks(
|
|
146
136
|
params: any,
|
|
@@ -254,7 +244,7 @@ export function approveForeignPositionForecasts(predRefNos: string[], approved:
|
|
|
254
244
|
/** 更新指定外币头寸预报的授权状态。 */
|
|
255
245
|
export async function updateForeignPositionForecastAuthorization(
|
|
256
246
|
predRefNo: string,
|
|
257
|
-
authorization:
|
|
247
|
+
authorization: any,
|
|
258
248
|
pageIndex: number,
|
|
259
249
|
pageSize: number,
|
|
260
250
|
) {
|
|
@@ -263,11 +253,12 @@ export async function updateForeignPositionForecastAuthorization(
|
|
|
263
253
|
{
|
|
264
254
|
authorization,
|
|
265
255
|
predRefNos: predRefNo,
|
|
266
|
-
pageIndex,
|
|
267
|
-
|
|
256
|
+
pageIndex,
|
|
257
|
+
pageSize,
|
|
258
|
+
},
|
|
268
259
|
)
|
|
269
260
|
|
|
270
|
-
return
|
|
261
|
+
return payload.head?.retMsg || (authorization === '1' ? '授权成功' : '取消授权成功')
|
|
271
262
|
}
|
|
272
263
|
|
|
273
264
|
/** 按传入参数原样查询外币头寸预报。 */
|
package/src/views/foreign-currency-position-forecast/components/ForeignPositionForecastEditor.vue
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import dayjs from 'dayjs'
|
|
3
3
|
import { computed, nextTick, onBeforeUnmount, reactive, ref } from 'vue'
|
|
4
|
-
import { ElMessage
|
|
4
|
+
import { ElMessage } from 'element-plus'
|
|
5
5
|
import {
|
|
6
6
|
queryForeignPositionAccountBanks,
|
|
7
7
|
queryForeignPositionOrganizationTree,
|
|
8
|
-
type ForeignPositionAccountBankOption,
|
|
9
8
|
} from '../api'
|
|
10
9
|
import { formatChineseCurrency } from '../currency'
|
|
11
|
-
import type { ForecastEditorValue } from '../editor'
|
|
12
10
|
import {
|
|
13
11
|
formatDate,
|
|
14
12
|
toForeignPositionOrganizationOptions,
|
|
15
|
-
type ForeignPositionOrganizationOption,
|
|
16
13
|
} from '../model'
|
|
17
14
|
import { foreignPositionForecastBusinessContext } from '../runtime'
|
|
18
15
|
import {
|
|
@@ -24,37 +21,7 @@ import {
|
|
|
24
21
|
paymentRouteOptions,
|
|
25
22
|
} from '../options'
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
predWay: string
|
|
29
|
-
businessType: string
|
|
30
|
-
payDirection: string
|
|
31
|
-
groundBranch: string
|
|
32
|
-
groundBranchCode: string
|
|
33
|
-
predAmount: any
|
|
34
|
-
currency: string
|
|
35
|
-
valueDate: string
|
|
36
|
-
paymentRoute: string
|
|
37
|
-
bankAccount: string
|
|
38
|
-
clientType: string
|
|
39
|
-
clientId: string
|
|
40
|
-
clientName: string
|
|
41
|
-
clientAccount: string
|
|
42
|
-
counterpartyName: string
|
|
43
|
-
counterpartyAccount: string
|
|
44
|
-
receivingBank: string
|
|
45
|
-
receivingBankSwiftCode: string
|
|
46
|
-
foreignExchangeType: string
|
|
47
|
-
intermediaryBankSwiftCode: string
|
|
48
|
-
counterpartySwiftCode: string
|
|
49
|
-
documentBusinessNo: string
|
|
50
|
-
purpose: string
|
|
51
|
-
remark: string
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
type LegacyControlledField = string
|
|
55
|
-
type LegacyFieldPolicy = Record<string, string>
|
|
56
|
-
|
|
57
|
-
const defaultLegacyFieldPolicy: LegacyFieldPolicy = {
|
|
24
|
+
const defaultLegacyFieldPolicy: any = {
|
|
58
25
|
payDirection: 'optional',
|
|
59
26
|
clientType: 'optional',
|
|
60
27
|
clientName: 'optional',
|
|
@@ -80,19 +47,17 @@ const props = withDefaults(
|
|
|
80
47
|
},
|
|
81
48
|
)
|
|
82
49
|
|
|
83
|
-
const emit = defineEmits
|
|
84
|
-
back: []
|
|
85
|
-
submit: [value: ForecastEditorValue]
|
|
86
|
-
}>()
|
|
50
|
+
const emit = defineEmits(['back', 'submit'])
|
|
87
51
|
|
|
88
|
-
const formRef = ref<
|
|
89
|
-
const accountBankOptions = ref<
|
|
52
|
+
const formRef = ref<any>()
|
|
53
|
+
const accountBankOptions = ref<any[]>([])
|
|
90
54
|
const accountBankLoading = ref(false)
|
|
91
55
|
let accountBankRequestController: AbortController | null = null
|
|
92
|
-
const organizationOptions = ref<
|
|
56
|
+
const organizationOptions = ref<any[]>([])
|
|
93
57
|
const organizationLoading = ref(false)
|
|
94
58
|
let organizationRequestController: AbortController | null = null
|
|
95
59
|
|
|
60
|
+
/** 根据已有记录或当前用户上下文创建机构选项。 */
|
|
96
61
|
function createInitialOrganizationOption(row?: any) {
|
|
97
62
|
const organizationCode = row?.groundBranchCode || foreignPositionForecastBusinessContext.organizationCode
|
|
98
63
|
const organizationName = row?.groundBranch || foreignPositionForecastBusinessContext.department
|
|
@@ -105,7 +70,13 @@ function createInitialOrganizationOption(row?: any) {
|
|
|
105
70
|
|
|
106
71
|
organizationOptions.value = createInitialOrganizationOption(props.initialRow)
|
|
107
72
|
|
|
108
|
-
|
|
73
|
+
/** 将日期输入统一转换为 YYYYMMDD 字符串。 */
|
|
74
|
+
function toDateValue(value: any) {
|
|
75
|
+
return String(value || '').replace(/\D/g, '').slice(0, 8)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 创建新增和编辑共用的表单初始值。 */
|
|
79
|
+
function createEditorForm(row?: any) {
|
|
109
80
|
return {
|
|
110
81
|
predWay: row?.predWay ?? 'PW01',
|
|
111
82
|
businessType: row?.businessType ?? '',
|
|
@@ -114,7 +85,7 @@ function createEditorForm(row?: any): EditorFormState {
|
|
|
114
85
|
groundBranchCode: row?.groundBranchCode ?? foreignPositionForecastBusinessContext.organizationCode,
|
|
115
86
|
predAmount: row?.predAmount,
|
|
116
87
|
currency: row?.currency ?? '',
|
|
117
|
-
valueDate: row?.valueDate
|
|
88
|
+
valueDate: toDateValue(row?.valueDate) || toDateValue(formatDate(new Date())),
|
|
118
89
|
paymentRoute: row?.paymentRoute ?? '',
|
|
119
90
|
bankAccount: row?.bankAccount ?? '',
|
|
120
91
|
clientType: row?.clientType ?? 'CT01',
|
|
@@ -134,7 +105,7 @@ function createEditorForm(row?: any): EditorFormState {
|
|
|
134
105
|
}
|
|
135
106
|
}
|
|
136
107
|
|
|
137
|
-
const form = reactive<
|
|
108
|
+
const form = reactive<any>(createEditorForm(props.initialRow))
|
|
138
109
|
|
|
139
110
|
const editorTitle = computed(() => (props.mode === 'add' ? '新增记录' : '修改记录'))
|
|
140
111
|
const bankAccountLabel = computed(() => (props.mode === 'add' ? '我方账户行' : '账户行'))
|
|
@@ -148,7 +119,7 @@ const receivingBankSwiftCodeLabel = computed(() => (
|
|
|
148
119
|
const shouldUseCorporateCustomerSelector = computed(
|
|
149
120
|
() => props.mode === 'add' && form.clientType === 'CT01',
|
|
150
121
|
)
|
|
151
|
-
const forecastDate = computed(() => props.initialRow?.forecastTime
|
|
122
|
+
const forecastDate = computed(() => props.initialRow?.forecastTime?.slice(0, 10) || formatDate(new Date()))
|
|
152
123
|
const forecasterName = computed(() => props.initialRow?.forecasterName || foreignPositionForecastBusinessContext.userName)
|
|
153
124
|
const forecasterCode = computed(() => props.initialRow?.forecasterCode || foreignPositionForecastBusinessContext.userCode)
|
|
154
125
|
const forecastDepartment = computed(() => props.initialRow?.forecastDepartment || foreignPositionForecastBusinessContext.department)
|
|
@@ -163,7 +134,7 @@ const predAmountChinese = computed(() => {
|
|
|
163
134
|
* 修改页则只通过 notAllowBlank / allowNullValue 调整必填状态并保留回填值,
|
|
164
135
|
* 因此两种模式必须分别处理。
|
|
165
136
|
*/
|
|
166
|
-
const legacyFieldPolicy = computed
|
|
137
|
+
const legacyFieldPolicy = computed(() => {
|
|
167
138
|
const policy = { ...defaultLegacyFieldPolicy }
|
|
168
139
|
const isAddMode = props.mode === 'add'
|
|
169
140
|
|
|
@@ -245,11 +216,13 @@ const legacyFieldPolicy = computed<LegacyFieldPolicy>(() => {
|
|
|
245
216
|
return policy
|
|
246
217
|
})
|
|
247
218
|
|
|
248
|
-
|
|
219
|
+
/** 判断字段在当前旧版业务规则下是否被禁用。 */
|
|
220
|
+
function isLegacyFieldDisabled(field: any) {
|
|
249
221
|
return legacyFieldPolicy.value[field] === 'disabled'
|
|
250
222
|
}
|
|
251
223
|
|
|
252
|
-
|
|
224
|
+
/** 判断字段在当前旧版业务规则下是否必填。 */
|
|
225
|
+
function isLegacyFieldRequired(field: any) {
|
|
253
226
|
return legacyFieldPolicy.value[field] === 'required'
|
|
254
227
|
}
|
|
255
228
|
|
|
@@ -268,24 +241,28 @@ const availableAccountBankOptions = computed(() => {
|
|
|
268
241
|
]
|
|
269
242
|
})
|
|
270
243
|
|
|
271
|
-
const currentForecastType = computed
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
if (
|
|
244
|
+
const currentForecastType = computed(() => {
|
|
245
|
+
const valueDate = dayjs(form.valueDate)
|
|
246
|
+
const today = dayjs()
|
|
247
|
+
if (valueDate.isAfter(today, 'day')) return 'PT01'
|
|
248
|
+
if (valueDate.isSame(today, 'day')) return 'PT02'
|
|
275
249
|
return 'PT03'
|
|
276
250
|
})
|
|
277
251
|
|
|
278
|
-
|
|
252
|
+
/** 按旧版字段策略生成动态必填校验规则。 */
|
|
253
|
+
function getLegacyRequiredRule(field: any, message: string, trigger = 'blur') {
|
|
254
|
+
return isLegacyFieldRequired(field) ? [{ required: true, message, trigger }] : []
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const formRules = computed<any>(() => ({
|
|
279
258
|
businessType: [{ required: true, message: '请选择业务类型', trigger: 'change' }],
|
|
280
|
-
payDirection:
|
|
281
|
-
? [{ required: true, message: '请选择收支方向', trigger: 'change' }]
|
|
282
|
-
: [],
|
|
259
|
+
payDirection: getLegacyRequiredRule('payDirection', '请选择收支方向', 'change'),
|
|
283
260
|
groundBranch: [{ required: true, message: '请选择落地机构', trigger: 'change' }],
|
|
284
261
|
predAmount: [
|
|
285
262
|
{ required: true, message: '请输入预报金额', trigger: 'blur' },
|
|
286
263
|
{
|
|
287
264
|
trigger: 'blur',
|
|
288
|
-
validator: (_rule, value, callback) => {
|
|
265
|
+
validator: (_rule: any, value: any, callback: any) => {
|
|
289
266
|
if (!Number.isFinite(Number(value)) || Number(value) <= 0) {
|
|
290
267
|
callback(new Error('预报金额必须大于 0'))
|
|
291
268
|
return
|
|
@@ -298,42 +275,28 @@ const formRules = computed<FormRules>(() => ({
|
|
|
298
275
|
valueDate: [{ required: true, message: '请选择起息日', trigger: 'change' }],
|
|
299
276
|
paymentRoute: [{ required: true, message: '请选择汇款路径', trigger: 'change' }],
|
|
300
277
|
bankAccount: [{ required: true, message: `请选择${bankAccountLabel.value}`, trigger: 'change' }],
|
|
301
|
-
clientType:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
counterpartyName: isLegacyFieldRequired('counterpartyName')
|
|
311
|
-
? [{ required: true, message: `请输入${counterpartyNameLabel.value}`, trigger: 'blur' }]
|
|
312
|
-
: [],
|
|
313
|
-
counterpartyAccount: isLegacyFieldRequired('counterpartyAccount')
|
|
314
|
-
? [{ required: true, message: `请输入${counterpartyAccountLabel.value}`, trigger: 'blur' }]
|
|
315
|
-
: [],
|
|
316
|
-
receivingBank: isLegacyFieldRequired('receivingBank')
|
|
317
|
-
? [{ required: true, message: `请输入${receivingBankLabel.value}`, trigger: 'blur' }]
|
|
318
|
-
: [],
|
|
319
|
-
receivingBankSwiftCode: isLegacyFieldRequired('receivingBankSwiftCode')
|
|
320
|
-
? [{ required: true, message: `请输入${receivingBankSwiftCodeLabel.value}`, trigger: 'blur' }]
|
|
321
|
-
: [],
|
|
322
|
-
foreignExchangeType: isLegacyFieldRequired('foreignExchangeType')
|
|
323
|
-
? [{ required: true, message: '请选择结汇/购汇/现汇', trigger: 'change' }]
|
|
324
|
-
: [],
|
|
325
|
-
documentBusinessNo: isLegacyFieldRequired('documentBusinessNo')
|
|
326
|
-
? [{ required: true, message: '请输入单证业务编号', trigger: 'blur' }]
|
|
327
|
-
: [],
|
|
278
|
+
clientType: getLegacyRequiredRule('clientType', '请选择客户类型', 'change'),
|
|
279
|
+
clientName: getLegacyRequiredRule('clientName', '请输入客户名称'),
|
|
280
|
+
clientAccount: getLegacyRequiredRule('clientAccount', '请输入客户账号'),
|
|
281
|
+
counterpartyName: getLegacyRequiredRule('counterpartyName', `请输入${counterpartyNameLabel.value}`),
|
|
282
|
+
counterpartyAccount: getLegacyRequiredRule('counterpartyAccount', `请输入${counterpartyAccountLabel.value}`),
|
|
283
|
+
receivingBank: getLegacyRequiredRule('receivingBank', `请输入${receivingBankLabel.value}`),
|
|
284
|
+
receivingBankSwiftCode: getLegacyRequiredRule('receivingBankSwiftCode', `请输入${receivingBankSwiftCodeLabel.value}`),
|
|
285
|
+
foreignExchangeType: getLegacyRequiredRule('foreignExchangeType', '请选择结汇/购汇/现汇', 'change'),
|
|
286
|
+
documentBusinessNo: getLegacyRequiredRule('documentBusinessNo', '请输入单证业务编号'),
|
|
328
287
|
}))
|
|
329
288
|
|
|
289
|
+
/** 批量清空表单字段。 */
|
|
290
|
+
function clearFields(...fields: string[]) {
|
|
291
|
+
fields.forEach((field) => { form[field] = '' })
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** 清空交易对手基础信息。 */
|
|
330
295
|
function clearCounterpartyBaseFields() {
|
|
331
|
-
|
|
332
|
-
form.counterpartyAccount = ''
|
|
333
|
-
form.receivingBank = ''
|
|
334
|
-
form.receivingBankSwiftCode = ''
|
|
296
|
+
clearFields('counterpartyName', 'counterpartyAccount', 'receivingBank', 'receivingBankSwiftCode')
|
|
335
297
|
}
|
|
336
298
|
|
|
299
|
+
/** 取消账户行请求并清理账户行状态。 */
|
|
337
300
|
function clearAccountBankState() {
|
|
338
301
|
accountBankRequestController?.abort()
|
|
339
302
|
accountBankRequestController = null
|
|
@@ -342,43 +305,40 @@ function clearAccountBankState() {
|
|
|
342
305
|
form.bankAccount = ''
|
|
343
306
|
}
|
|
344
307
|
|
|
308
|
+
/** 清空币种、汇款路径及其账户行依赖。 */
|
|
345
309
|
function clearTransferDependencies() {
|
|
346
|
-
|
|
347
|
-
form.paymentRoute = ''
|
|
310
|
+
clearFields('currency', 'paymentRoute')
|
|
348
311
|
clearAccountBankState()
|
|
349
312
|
}
|
|
350
313
|
|
|
314
|
+
/** 根据当前业务规则清空新增页中的禁用字段。 */
|
|
351
315
|
function normalizeLegacyDisabledFields() {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
if (isLegacyFieldDisabled('clientAccount')) form.clientAccount = ''
|
|
358
|
-
if (isLegacyFieldDisabled('counterpartyName')) form.counterpartyName = ''
|
|
359
|
-
if (isLegacyFieldDisabled('counterpartyAccount')) form.counterpartyAccount = ''
|
|
360
|
-
if (isLegacyFieldDisabled('receivingBank')) form.receivingBank = ''
|
|
361
|
-
if (isLegacyFieldDisabled('receivingBankSwiftCode')) form.receivingBankSwiftCode = ''
|
|
362
|
-
if (isLegacyFieldDisabled('foreignExchangeType')) form.foreignExchangeType = ''
|
|
363
|
-
if (isLegacyFieldDisabled('intermediaryBankSwiftCode')) form.intermediaryBankSwiftCode = ''
|
|
316
|
+
Object.entries(legacyFieldPolicy.value).forEach(([field, state]) => {
|
|
317
|
+
if (state === 'disabled') form[field] = ''
|
|
318
|
+
})
|
|
319
|
+
if (isLegacyFieldDisabled('clientName')) form.clientId = ''
|
|
364
320
|
}
|
|
365
321
|
|
|
322
|
+
/** 清除表单校验提示。 */
|
|
366
323
|
function clearValidation() {
|
|
367
324
|
nextTick(() => formRef.value?.clearValidate())
|
|
368
325
|
}
|
|
369
326
|
|
|
327
|
+
/** 处理业务类型变化并同步关联字段。 */
|
|
370
328
|
function handleBusinessTypeChange(value: string) {
|
|
371
329
|
if (props.mode === 'edit') {
|
|
372
330
|
clearValidation()
|
|
373
331
|
return
|
|
374
332
|
}
|
|
375
333
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
334
|
+
clearFields(
|
|
335
|
+
'payDirection',
|
|
336
|
+
'documentBusinessNo',
|
|
337
|
+
'foreignExchangeType',
|
|
338
|
+
'clientId',
|
|
339
|
+
'clientName',
|
|
340
|
+
'clientAccount',
|
|
341
|
+
)
|
|
382
342
|
|
|
383
343
|
// notAllowBlank 对客户类型是唯一不清值的字段;10/11 需保留当前 CT01/CT02。
|
|
384
344
|
if (value === '12' || value === '13') form.clientType = ''
|
|
@@ -389,6 +349,7 @@ function handleBusinessTypeChange(value: string) {
|
|
|
389
349
|
clearValidation()
|
|
390
350
|
}
|
|
391
351
|
|
|
352
|
+
/** 处理收支方向变化并刷新关联账户信息。 */
|
|
392
353
|
function handlePayDirectionChange() {
|
|
393
354
|
if (props.mode === 'add') {
|
|
394
355
|
clearTransferDependencies()
|
|
@@ -397,6 +358,7 @@ function handlePayDirectionChange() {
|
|
|
397
358
|
clearValidation()
|
|
398
359
|
}
|
|
399
360
|
|
|
361
|
+
/** 处理币种变化并清空旧账户行数据。 */
|
|
400
362
|
function handleCurrencyChange() {
|
|
401
363
|
if (props.mode === 'add') {
|
|
402
364
|
form.paymentRoute = ''
|
|
@@ -405,6 +367,7 @@ function handleCurrencyChange() {
|
|
|
405
367
|
clearValidation()
|
|
406
368
|
}
|
|
407
369
|
|
|
370
|
+
/** 查询当前业务条件下可用的我方账户行。 */
|
|
408
371
|
async function loadAccountBanks() {
|
|
409
372
|
accountBankRequestController?.abort()
|
|
410
373
|
const controller = new AbortController()
|
|
@@ -432,6 +395,7 @@ async function loadAccountBanks() {
|
|
|
432
395
|
}
|
|
433
396
|
}
|
|
434
397
|
|
|
398
|
+
/** 处理汇款路径变化并按前置条件加载账户行。 */
|
|
435
399
|
async function handlePaymentRouteChange(value: string) {
|
|
436
400
|
clearAccountBankState()
|
|
437
401
|
const missingMessage = !form.currency
|
|
@@ -456,6 +420,7 @@ async function handlePaymentRouteChange(value: string) {
|
|
|
456
420
|
clearValidation()
|
|
457
421
|
}
|
|
458
422
|
|
|
423
|
+
/** 在账户行下拉框展开时按需加载数据。 */
|
|
459
424
|
async function handleAccountBankVisibleChange(visible: boolean) {
|
|
460
425
|
if (
|
|
461
426
|
!visible
|
|
@@ -467,6 +432,7 @@ async function handleAccountBankVisibleChange(visible: boolean) {
|
|
|
467
432
|
await loadAccountBanks()
|
|
468
433
|
}
|
|
469
434
|
|
|
435
|
+
/** 按关键字异步搜索可用落地机构。 */
|
|
470
436
|
async function searchOrganizations(keyword: string) {
|
|
471
437
|
const normalizedKeyword = keyword.trim()
|
|
472
438
|
if (!normalizedKeyword) {
|
|
@@ -495,6 +461,7 @@ async function searchOrganizations(keyword: string) {
|
|
|
495
461
|
}
|
|
496
462
|
}
|
|
497
463
|
|
|
464
|
+
/** 同步落地机构名称并触发表单校验。 */
|
|
498
465
|
function handleGroundBranchChange(value: string) {
|
|
499
466
|
const organization = organizationOptions.value.find(
|
|
500
467
|
(option) => option.organizationCode === value,
|
|
@@ -503,23 +470,21 @@ function handleGroundBranchChange(value: string) {
|
|
|
503
470
|
void nextTick(() => formRef.value?.validateField('groundBranch'))
|
|
504
471
|
}
|
|
505
472
|
|
|
473
|
+
/** 清理客户类型变化后需要重新填写的客户信息。 */
|
|
506
474
|
function handleClientTypeChange() {
|
|
507
|
-
|
|
508
|
-
form.clientName = ''
|
|
509
|
-
form.clientAccount = ''
|
|
475
|
+
clearFields('clientId', 'clientName', 'clientAccount')
|
|
510
476
|
clearValidation()
|
|
511
477
|
}
|
|
512
478
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
customerName: string
|
|
516
|
-
}) {
|
|
479
|
+
/** 将对公客户选择结果回填到客户字段。 */
|
|
480
|
+
function handleCorporateCustomerSelect(customer: any) {
|
|
517
481
|
// 140000001 返回的 custNum 同时作为外币头寸预报提交字段 clientAcct。
|
|
518
482
|
form.clientId = customer.customerNumber
|
|
519
483
|
form.clientAccount = customer.customerNumber
|
|
520
484
|
clearValidation()
|
|
521
485
|
}
|
|
522
486
|
|
|
487
|
+
/** 检查起息日是否落在周末并提示用户。 */
|
|
523
488
|
function handleValueDateChange(value: string) {
|
|
524
489
|
if (!value || !form.currency) return
|
|
525
490
|
const weekday = dayjs(value).day()
|
|
@@ -528,10 +493,12 @@ function handleValueDateChange(value: string) {
|
|
|
528
493
|
}
|
|
529
494
|
}
|
|
530
495
|
|
|
496
|
+
/** 禁止选择早于当天的起息日。 */
|
|
531
497
|
function disablePastDate(date: Date) {
|
|
532
498
|
return dayjs(date).isBefore(dayjs(), 'day')
|
|
533
499
|
}
|
|
534
500
|
|
|
501
|
+
/** 校验并组装编辑器提交数据。 */
|
|
535
502
|
async function handleSubmit() {
|
|
536
503
|
if (props.mode === 'add') normalizeLegacyDisabledFields()
|
|
537
504
|
const valid = await formRef.value?.validate().catch(() => false)
|
|
@@ -542,7 +509,7 @@ async function handleSubmit() {
|
|
|
542
509
|
return
|
|
543
510
|
}
|
|
544
511
|
|
|
545
|
-
const value:
|
|
512
|
+
const value: any = {
|
|
546
513
|
predWay: form.predWay,
|
|
547
514
|
predType: currentForecastType.value,
|
|
548
515
|
businessType: form.businessType,
|
|
@@ -657,7 +624,7 @@ onBeforeUnmount(() => {
|
|
|
657
624
|
<el-date-picker
|
|
658
625
|
v-model="form.valueDate"
|
|
659
626
|
type="date"
|
|
660
|
-
value-format="
|
|
627
|
+
value-format="YYYYMMDD"
|
|
661
628
|
format="YYYY-MM-DD"
|
|
662
629
|
:editable="false"
|
|
663
630
|
:disabled-date="disablePastDate"
|
|
@@ -871,7 +838,11 @@ onBeforeUnmount(() => {
|
|
|
871
838
|
<footer class="editor-actions">
|
|
872
839
|
<div class="editor-actions-card" role="group" aria-label="表单操作">
|
|
873
840
|
<el-button :disabled="saving" @click="emit('back')">返回</el-button>
|
|
874
|
-
<el-button
|
|
841
|
+
<el-button
|
|
842
|
+
type="primary"
|
|
843
|
+
:loading="saving"
|
|
844
|
+
@click="handleSubmit"
|
|
845
|
+
>
|
|
875
846
|
{{ mode === 'add' ? '提交' : '保存修改' }}
|
|
876
847
|
</el-button>
|
|
877
848
|
</div>
|
|
@@ -2,6 +2,7 @@ const chineseDigits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '
|
|
|
2
2
|
const chineseGroupUnits = ['', '万', '亿', '兆'] as const
|
|
3
3
|
const chineseWithinGroupUnits = ['仟', '佰', '拾', ''] as const
|
|
4
4
|
|
|
5
|
+
/** 将四位数字分组转换为中文大写金额片段。 */
|
|
5
6
|
function formatChineseFourDigitGroup(value: number) {
|
|
6
7
|
const digits = String(value).padStart(4, '0')
|
|
7
8
|
let result = ''
|
|
@@ -22,6 +23,7 @@ function formatChineseFourDigitGroup(value: number) {
|
|
|
22
23
|
return result
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
/** 将整数按万、亿、兆分组转换为中文大写。 */
|
|
25
27
|
function formatChineseInteger(value: number) {
|
|
26
28
|
const groups: number[] = []
|
|
27
29
|
let remaining = Math.trunc(value)
|
|
@@ -47,6 +49,7 @@ function formatChineseInteger(value: number) {
|
|
|
47
49
|
return result
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
/** 将金额转换为人民币大写文本。 */
|
|
50
53
|
export function formatChineseCurrency(value: any) {
|
|
51
54
|
if (!Number.isFinite(value) || Number(value) < 0) return ''
|
|
52
55
|
|