verce-vue-test 0.0.75 → 0.0.77

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.
@@ -0,0 +1,1013 @@
1
+ <script setup lang="ts">
2
+ import { computed, nextTick, reactive, ref } from 'vue'
3
+ import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
4
+ import { ArrowLeft, Check, Search } from '@element-plus/icons-vue'
5
+ import { searchForeignPositionClients } from '../api'
6
+ import type { ForecastEditorMode, ForecastEditorValue } from '../editor'
7
+ import {
8
+ formatDate,
9
+ mockCurrentUser,
10
+ type BusinessType,
11
+ type ClientType,
12
+ type ForecastType,
13
+ type ForecastWay,
14
+ type ForeignExchangeType,
15
+ type ForeignPositionForecast,
16
+ type PaymentDirection,
17
+ type PaymentRoute,
18
+ } from '../mock'
19
+ import {
20
+ businessTypeOptions,
21
+ clientTypeOptions,
22
+ currencyOptions,
23
+ foreignExchangeTypeOptions,
24
+ organizationOptions,
25
+ payDirectionOptions,
26
+ paymentRouteOptions,
27
+ } from '../options'
28
+
29
+ type EditorFormState = {
30
+ predWay: ForecastWay
31
+ businessType: '' | BusinessType
32
+ payDirection: '' | PaymentDirection
33
+ groundBranch: string
34
+ groundBranchCode: string
35
+ predAmount: number | string | undefined
36
+ currency: string
37
+ valueDate: string
38
+ paymentRoute: '' | PaymentRoute
39
+ bankAccount: string
40
+ clientType: '' | ClientType
41
+ clientId: string
42
+ clientName: string
43
+ clientAccount: string
44
+ counterpartyName: string
45
+ counterpartyAccount: string
46
+ receivingBank: string
47
+ receivingBankSwiftCode: string
48
+ foreignExchangeType: '' | ForeignExchangeType
49
+ intermediaryBankSwiftCode: string
50
+ counterpartySwiftCode: string
51
+ documentBusinessNo: string
52
+ purpose: string
53
+ remark: string
54
+ }
55
+
56
+ type LegacyControlledField =
57
+ | 'payDirection'
58
+ | 'clientType'
59
+ | 'clientName'
60
+ | 'clientAccount'
61
+ | 'counterpartyName'
62
+ | 'counterpartyAccount'
63
+ | 'receivingBank'
64
+ | 'receivingBankSwiftCode'
65
+ | 'foreignExchangeType'
66
+ | 'intermediaryBankSwiftCode'
67
+ | 'documentBusinessNo'
68
+
69
+ type LegacyFieldMode = 'required' | 'optional' | 'disabled'
70
+ type LegacyFieldPolicy = Record<LegacyControlledField, LegacyFieldMode>
71
+
72
+ const defaultLegacyFieldPolicy: LegacyFieldPolicy = {
73
+ payDirection: 'optional',
74
+ clientType: 'optional',
75
+ clientName: 'optional',
76
+ clientAccount: 'optional',
77
+ counterpartyName: 'optional',
78
+ counterpartyAccount: 'optional',
79
+ receivingBank: 'optional',
80
+ receivingBankSwiftCode: 'optional',
81
+ foreignExchangeType: 'optional',
82
+ intermediaryBankSwiftCode: 'optional',
83
+ documentBusinessNo: 'optional',
84
+ }
85
+
86
+ const props = withDefaults(
87
+ defineProps<{
88
+ mode: ForecastEditorMode
89
+ initialRow?: ForeignPositionForecast | null
90
+ saving?: boolean
91
+ }>(),
92
+ {
93
+ initialRow: null,
94
+ saving: false,
95
+ },
96
+ )
97
+
98
+ const emit = defineEmits<{
99
+ back: []
100
+ submit: [value: ForecastEditorValue]
101
+ }>()
102
+
103
+ const formRef = ref<FormInstance>()
104
+ const clientSearching = ref(false)
105
+
106
+ function createEditorForm(row?: ForeignPositionForecast | null): EditorFormState {
107
+ return {
108
+ predWay: row?.predWay ?? 'PW01',
109
+ businessType: row?.businessType ?? '',
110
+ payDirection: row?.payDirection ?? '',
111
+ groundBranch: row?.groundBranch ?? mockCurrentUser.department,
112
+ groundBranchCode: row?.groundBranchCode ?? mockCurrentUser.organizationCode,
113
+ predAmount: row?.predAmount,
114
+ currency: row?.currency ?? '',
115
+ valueDate: row?.valueDate ?? formatDate(new Date()),
116
+ paymentRoute: row?.paymentRoute ?? '',
117
+ bankAccount: row?.bankAccount ?? '',
118
+ clientType: row?.clientType ?? 'CT01',
119
+ clientId: row?.clientId ?? '',
120
+ clientName: row?.clientName ?? '',
121
+ clientAccount: row?.clientAccount ?? '',
122
+ counterpartyName: row?.counterpartyName ?? '',
123
+ counterpartyAccount: row?.counterpartyAccount ?? '',
124
+ receivingBank: row?.receivingBank ?? '',
125
+ receivingBankSwiftCode: row?.receivingBankSwiftCode ?? '',
126
+ foreignExchangeType: row?.foreignExchangeType ?? '',
127
+ intermediaryBankSwiftCode: row?.intermediaryBankSwiftCode ?? '',
128
+ counterpartySwiftCode: row?.counterpartySwiftCode ?? '',
129
+ documentBusinessNo: row?.documentBusinessNo ?? '',
130
+ purpose: row?.purpose ?? '',
131
+ remark: row?.remark ?? '',
132
+ }
133
+ }
134
+
135
+ const form = reactive<EditorFormState>(createEditorForm(props.initialRow))
136
+
137
+ const editorTitle = computed(() => (props.mode === 'add' ? '新增记录' : '修改记录'))
138
+ const forecastDate = computed(() => props.initialRow?.forecastTime.slice(0, 10) || formatDate(new Date()))
139
+ const forecasterName = computed(() => props.initialRow?.forecasterName || mockCurrentUser.userName)
140
+ const forecastDepartment = computed(() => props.initialRow?.forecastDepartment || mockCurrentUser.department)
141
+ const phoneNumber = computed(() => props.initialRow?.phoneNumber || mockCurrentUser.phoneNumber)
142
+
143
+ /**
144
+ * 复刻旧 JSP 的字段状态。旧页面通过 readOnlyObj / allowNullValue /
145
+ * notAllowBlank 动态切换只读、选填和必填,这里统一收口,避免新增与修改
146
+ * 模式分别维护后出现规则漂移。
147
+ */
148
+ const legacyFieldPolicy = computed<LegacyFieldPolicy>(() => {
149
+ const policy = { ...defaultLegacyFieldPolicy }
150
+
151
+ if (form.businessType === '10') {
152
+ Object.assign(policy, {
153
+ payDirection: 'required',
154
+ clientType: 'required',
155
+ clientName: 'required',
156
+ clientAccount: 'required',
157
+ foreignExchangeType: 'required',
158
+ } satisfies Partial<LegacyFieldPolicy>)
159
+
160
+ if (form.payDirection === 'I') {
161
+ Object.assign(policy, {
162
+ counterpartyName: 'disabled',
163
+ counterpartyAccount: 'disabled',
164
+ receivingBank: 'disabled',
165
+ receivingBankSwiftCode: 'disabled',
166
+ } satisfies Partial<LegacyFieldPolicy>)
167
+ } else if (form.payDirection === 'O') {
168
+ Object.assign(policy, {
169
+ counterpartyName: 'required',
170
+ counterpartyAccount: 'required',
171
+ receivingBank: 'required',
172
+ receivingBankSwiftCode: 'required',
173
+ } satisfies Partial<LegacyFieldPolicy>)
174
+ }
175
+ } else if (form.businessType === '11') {
176
+ Object.assign(policy, {
177
+ payDirection: 'required',
178
+ clientType: 'required',
179
+ counterpartyName: 'disabled',
180
+ counterpartyAccount: 'disabled',
181
+ receivingBank: 'disabled',
182
+ receivingBankSwiftCode: 'disabled',
183
+ foreignExchangeType: 'required',
184
+ intermediaryBankSwiftCode: 'disabled',
185
+ documentBusinessNo: 'required',
186
+ } satisfies Partial<LegacyFieldPolicy>)
187
+ } else if (form.businessType === '12') {
188
+ Object.assign(policy, {
189
+ payDirection: 'required',
190
+ clientType: 'disabled',
191
+ clientName: 'disabled',
192
+ clientAccount: 'disabled',
193
+ counterpartyName: 'required',
194
+ foreignExchangeType: 'required',
195
+ // 旧 JSP 先设为必填、随后又恢复为选填,实际最终状态为选填。
196
+ intermediaryBankSwiftCode: 'optional',
197
+ } satisfies Partial<LegacyFieldPolicy>)
198
+ } else if (form.businessType === '13') {
199
+ Object.assign(policy, {
200
+ // 旧汇路加载流程仍强制要求收支方向,这里固定为必填,消除旧页的状态残留缺陷。
201
+ payDirection: 'required',
202
+ clientType: 'disabled',
203
+ clientName: 'disabled',
204
+ clientAccount: 'disabled',
205
+ counterpartyName: 'required',
206
+ counterpartyAccount: 'required',
207
+ receivingBank: 'required',
208
+ receivingBankSwiftCode: 'required',
209
+ foreignExchangeType: 'disabled',
210
+ } satisfies Partial<LegacyFieldPolicy>)
211
+ }
212
+
213
+ return policy
214
+ })
215
+
216
+ function isLegacyFieldDisabled(field: LegacyControlledField) {
217
+ return legacyFieldPolicy.value[field] === 'disabled'
218
+ }
219
+
220
+ function isLegacyFieldRequired(field: LegacyControlledField) {
221
+ return legacyFieldPolicy.value[field] === 'required'
222
+ }
223
+
224
+ const clientSearchVisible = computed(
225
+ () => !isLegacyFieldDisabled('clientName') && form.clientType === 'CT01',
226
+ )
227
+ const bankAccountDisabled = computed(
228
+ () => !form.businessType || !form.payDirection || !form.currency || !form.paymentRoute,
229
+ )
230
+
231
+ const currentForecastType = computed<ForecastType>(() => {
232
+ const today = formatDate(new Date())
233
+ if (form.valueDate > today) return 'PT01'
234
+ if (form.valueDate === today) return 'PT02'
235
+ return 'PT03'
236
+ })
237
+
238
+ const currencyClearingBanks: Record<string, string> = {
239
+ USD: '中国银行纽约分行',
240
+ EUR: '中国银行法兰克福分行',
241
+ HKD: '中国银行香港分行',
242
+ JPY: '中国银行东京分行',
243
+ GBP: '中国银行伦敦分行',
244
+ SGD: '中国银行新加坡分行',
245
+ AUD: '中国银行悉尼分行',
246
+ CAD: '中国银行多伦多分行',
247
+ CHF: '中国银行苏黎世分行',
248
+ }
249
+
250
+ const availableBankAccounts = computed(() => {
251
+ if (bankAccountDisabled.value) return []
252
+
253
+ const directBank = currencyClearingBanks[form.currency] ?? `${form.currency} 境外清算行`
254
+ const routeBanks: Record<PaymentRoute, string[]> = {
255
+ '01': [directBank],
256
+ '02': [`总行${form.currency}转汇清算账户`, directBank],
257
+ '03': [`${form.groundBranch}${form.currency}内部清算账户`],
258
+ }
259
+ const options = [...(routeBanks[form.paymentRoute as PaymentRoute] ?? [])]
260
+
261
+ if (form.bankAccount && !options.includes(form.bankAccount)) options.unshift(form.bankAccount)
262
+ return options
263
+ })
264
+
265
+ const formRules = computed<FormRules>(() => ({
266
+ businessType: [{ required: true, message: '请选择业务类型', trigger: 'change' }],
267
+ payDirection: isLegacyFieldRequired('payDirection')
268
+ ? [{ required: true, message: '请选择收支方向', trigger: 'change' }]
269
+ : [],
270
+ groundBranch: [{ required: true, message: '请选择落地机构', trigger: 'change' }],
271
+ predAmount: [
272
+ { required: true, message: '请输入预报金额', trigger: 'blur' },
273
+ {
274
+ trigger: 'blur',
275
+ validator: (_rule, value, callback) => {
276
+ if (!Number.isFinite(Number(value)) || Number(value) <= 0) {
277
+ callback(new Error('预报金额必须大于 0'))
278
+ return
279
+ }
280
+ callback()
281
+ },
282
+ },
283
+ ],
284
+ currency: [{ required: true, message: '请选择币种', trigger: 'change' }],
285
+ valueDate: [{ required: true, message: '请选择起息日', trigger: 'change' }],
286
+ paymentRoute: [{ required: true, message: '请选择汇款路径', trigger: 'change' }],
287
+ bankAccount: [{ required: true, message: '请选择我方账户行', trigger: 'change' }],
288
+ clientType: isLegacyFieldRequired('clientType')
289
+ ? [{ required: true, message: '请选择客户类型', trigger: 'change' }]
290
+ : [],
291
+ clientName: isLegacyFieldRequired('clientName')
292
+ ? [{ required: true, message: '请输入客户名称', trigger: 'blur' }]
293
+ : [],
294
+ clientAccount: isLegacyFieldRequired('clientAccount')
295
+ ? [{ required: true, message: '请输入客户账号', trigger: 'blur' }]
296
+ : [],
297
+ counterpartyName: isLegacyFieldRequired('counterpartyName')
298
+ ? [{ required: true, message: '请输入交易对手名称', trigger: 'blur' }]
299
+ : [],
300
+ counterpartyAccount: isLegacyFieldRequired('counterpartyAccount')
301
+ ? [{ required: true, message: '请输入交易对手账号', trigger: 'blur' }]
302
+ : [],
303
+ receivingBank: isLegacyFieldRequired('receivingBank')
304
+ ? [{ required: true, message: '请输入交易对手行名称', trigger: 'blur' }]
305
+ : [],
306
+ receivingBankSwiftCode: isLegacyFieldRequired('receivingBankSwiftCode')
307
+ ? [{ required: true, message: '请输入交易对手行 SwiftCode', trigger: 'blur' }]
308
+ : [],
309
+ foreignExchangeType: isLegacyFieldRequired('foreignExchangeType')
310
+ ? [{ required: true, message: '请选择结汇/购汇/现汇', trigger: 'change' }]
311
+ : [],
312
+ documentBusinessNo: isLegacyFieldRequired('documentBusinessNo')
313
+ ? [{ required: true, message: '请输入单证业务编号', trigger: 'blur' }]
314
+ : [],
315
+ }))
316
+
317
+ function clearCounterpartyBaseFields() {
318
+ form.counterpartyName = ''
319
+ form.counterpartyAccount = ''
320
+ form.receivingBank = ''
321
+ form.receivingBankSwiftCode = ''
322
+ }
323
+
324
+ function clearTransferDependencies() {
325
+ form.currency = ''
326
+ form.paymentRoute = ''
327
+ form.bankAccount = ''
328
+ }
329
+
330
+ function normalizeLegacyDisabledFields() {
331
+ if (isLegacyFieldDisabled('clientType')) form.clientType = ''
332
+ if (isLegacyFieldDisabled('clientName')) {
333
+ form.clientId = ''
334
+ form.clientName = ''
335
+ }
336
+ if (isLegacyFieldDisabled('clientAccount')) form.clientAccount = ''
337
+ if (isLegacyFieldDisabled('counterpartyName')) form.counterpartyName = ''
338
+ if (isLegacyFieldDisabled('counterpartyAccount')) form.counterpartyAccount = ''
339
+ if (isLegacyFieldDisabled('receivingBank')) form.receivingBank = ''
340
+ if (isLegacyFieldDisabled('receivingBankSwiftCode')) form.receivingBankSwiftCode = ''
341
+ if (isLegacyFieldDisabled('foreignExchangeType')) form.foreignExchangeType = ''
342
+ if (isLegacyFieldDisabled('intermediaryBankSwiftCode')) form.intermediaryBankSwiftCode = ''
343
+ }
344
+
345
+ // 修改页详情可能包含历史遗留值;旧 JSP 将只读字段同时清空,回填时也统一归一化。
346
+ if (props.mode === 'edit') normalizeLegacyDisabledFields()
347
+
348
+ function clearValidation() {
349
+ nextTick(() => formRef.value?.clearValidate())
350
+ }
351
+
352
+ function handleBusinessTypeChange(value: BusinessType) {
353
+ form.payDirection = ''
354
+ form.documentBusinessNo = ''
355
+ form.foreignExchangeType = ''
356
+ form.clientId = ''
357
+ form.clientName = ''
358
+ form.clientAccount = ''
359
+
360
+ // notAllowBlank 对客户类型是唯一不清值的字段;10/11 需保留当前 CT01/CT02。
361
+ if (value === '12' || value === '13') form.clientType = ''
362
+
363
+ clearCounterpartyBaseFields()
364
+ form.intermediaryBankSwiftCode = ''
365
+ normalizeLegacyDisabledFields()
366
+ clearValidation()
367
+ }
368
+
369
+ function handlePayDirectionChange() {
370
+ clearTransferDependencies()
371
+ if (form.businessType === '10') clearCounterpartyBaseFields()
372
+ clearValidation()
373
+ }
374
+
375
+ function handleCurrencyChange() {
376
+ form.paymentRoute = ''
377
+ form.bankAccount = ''
378
+ clearValidation()
379
+ }
380
+
381
+ function handlePaymentRouteChange(value: PaymentRoute) {
382
+ form.bankAccount = ''
383
+ const missingMessage = !form.currency
384
+ ? '请选择币种!'
385
+ : !value
386
+ ? '请选择汇款路径!'
387
+ : !form.businessType
388
+ ? '请选择业务类型!'
389
+ : !form.payDirection
390
+ ? '请选择收支方向!'
391
+ : ''
392
+
393
+ if (missingMessage) {
394
+ // 旧页面前置条件不足时会清空交易对手行 SwiftCode 和账户行数据源。
395
+ form.receivingBankSwiftCode = ''
396
+ ElMessage.warning(missingMessage)
397
+ }
398
+ clearValidation()
399
+ }
400
+
401
+ function handleGroundBranchChange(value: string) {
402
+ form.groundBranchCode = organizationOptions.find((option) => option.value === value)?.code ?? ''
403
+ }
404
+
405
+ function handleClientTypeChange() {
406
+ form.clientId = ''
407
+ form.clientName = ''
408
+ clearValidation()
409
+ }
410
+
411
+ async function handleClientSearch() {
412
+ const keyword = form.clientName.trim()
413
+ if (!keyword) {
414
+ ElMessage.warning('客户名称不能为空')
415
+ return
416
+ }
417
+
418
+ clientSearching.value = true
419
+ try {
420
+ const clients = await searchForeignPositionClients(keyword)
421
+ const normalizedKeyword = keyword.toLocaleLowerCase('zh-CN')
422
+ const match = clients.find((client) => (
423
+ client.name.toLocaleLowerCase('zh-CN').includes(normalizedKeyword)
424
+ ))
425
+ ?? clients[0]
426
+ if (!match) {
427
+ ElMessage.info('未查询到匹配客户,可继续手工录入')
428
+ return
429
+ }
430
+
431
+ form.clientId = match.id
432
+ form.clientName = match.name
433
+ ElMessage.success('客户信息已匹配,请继续填写客户账号')
434
+ clearValidation()
435
+ } catch (error) {
436
+ ElMessage.error(error instanceof Error ? error.message : '客户名称查询失败')
437
+ } finally {
438
+ clientSearching.value = false
439
+ }
440
+ }
441
+
442
+ function handleValueDateChange(value: string) {
443
+ if (!value || !form.currency) return
444
+ const date = new Date(`${value}T12:00:00`)
445
+ if (date.getDay() === 0 || date.getDay() === 6) {
446
+ ElMessage.warning(`当前所选日期为币种 [${form.currency}] 的节假日`)
447
+ }
448
+ }
449
+
450
+ function disablePastDate(date: Date) {
451
+ const today = new Date()
452
+ today.setHours(0, 0, 0, 0)
453
+ return date.getTime() < today.getTime()
454
+ }
455
+
456
+ async function handleSubmit() {
457
+ normalizeLegacyDisabledFields()
458
+ const valid = await formRef.value?.validate().catch(() => false)
459
+ if (!valid) return
460
+
461
+ if (forecastDate.value > form.valueDate) {
462
+ ElMessage.warning('预报日期不能晚于起息日')
463
+ return
464
+ }
465
+
466
+ const organization = organizationOptions.find((option) => option.value === form.groundBranch)
467
+ const value: ForecastEditorValue = {
468
+ predWay: form.predWay,
469
+ predType: currentForecastType.value,
470
+ businessType: form.businessType as BusinessType,
471
+ payDirection: form.payDirection as PaymentDirection,
472
+ groundBranch: form.groundBranch.trim(),
473
+ groundBranchCode: organization?.code ?? form.groundBranchCode,
474
+ predAmount: Number(form.predAmount),
475
+ currency: form.currency,
476
+ valueDate: form.valueDate,
477
+ paymentRoute: form.paymentRoute as PaymentRoute,
478
+ bankAccount: form.bankAccount,
479
+ clientType: form.clientType,
480
+ clientId: form.clientId.trim(),
481
+ clientName: form.clientName.trim(),
482
+ clientAccount: form.clientAccount.trim(),
483
+ counterpartyName: form.counterpartyName.trim(),
484
+ counterpartyAccount: form.counterpartyAccount.trim(),
485
+ receivingBank: form.receivingBank.trim(),
486
+ receivingBankSwiftCode: form.receivingBankSwiftCode.trim(),
487
+ foreignExchangeType: form.foreignExchangeType,
488
+ intermediaryBankSwiftCode: form.intermediaryBankSwiftCode.trim(),
489
+ counterpartySwiftCode: form.counterpartySwiftCode.trim(),
490
+ documentBusinessNo: form.documentBusinessNo.trim(),
491
+ purpose: form.purpose.trim(),
492
+ remark: form.remark.trim(),
493
+ }
494
+
495
+ emit('submit', value)
496
+ }
497
+ </script>
498
+
499
+ <template>
500
+ <section class="forecast-editor-panel" :aria-label="editorTitle">
501
+ <div class="editor-body">
502
+ <el-form
503
+ ref="formRef"
504
+ :model="form"
505
+ :rules="formRules"
506
+ label-position="right"
507
+ label-width="108px"
508
+ size="default"
509
+ class="forecast-editor-form"
510
+ >
511
+ <div class="editor-sections">
512
+ <section class="editor-section" aria-labelledby="basic-information-title">
513
+ <h3 id="basic-information-title" class="editor-section-title">基本信息</h3>
514
+ <div class="editor-section-grid">
515
+ <el-form-item label="业务类型" prop="businessType">
516
+ <el-select v-model="form.businessType" placeholder="请选择" @change="handleBusinessTypeChange">
517
+ <el-option v-for="option in businessTypeOptions" :key="option.value" v-bind="option" />
518
+ </el-select>
519
+ </el-form-item>
520
+
521
+ <el-form-item label="收支方向" prop="payDirection">
522
+ <el-select v-model="form.payDirection" placeholder="请选择" @change="handlePayDirectionChange">
523
+ <el-option v-for="option in payDirectionOptions" :key="option.value" v-bind="option" />
524
+ </el-select>
525
+ </el-form-item>
526
+
527
+ <el-form-item label="落地机构" prop="groundBranch">
528
+ <el-select
529
+ v-model="form.groundBranch"
530
+ filterable
531
+ placeholder="请选择机构"
532
+ @change="handleGroundBranchChange"
533
+ >
534
+ <el-option
535
+ v-for="option in organizationOptions"
536
+ :key="option.code"
537
+ :label="option.label"
538
+ :value="option.value"
539
+ />
540
+ </el-select>
541
+ </el-form-item>
542
+
543
+ <el-form-item label="预报人员">
544
+ <el-input :model-value="forecasterName" disabled />
545
+ </el-form-item>
546
+
547
+ <el-form-item label="预报机构">
548
+ <el-input :model-value="forecastDepartment" disabled />
549
+ </el-form-item>
550
+
551
+ <el-form-item label="预报日期">
552
+ <el-input :model-value="forecastDate" disabled />
553
+ </el-form-item>
554
+
555
+ <el-form-item label="联系电话">
556
+ <el-input :model-value="phoneNumber" disabled />
557
+ </el-form-item>
558
+
559
+ <el-form-item label="汇款路径" prop="paymentRoute">
560
+ <el-select
561
+ v-model="form.paymentRoute"
562
+ placeholder="请选择"
563
+ @change="handlePaymentRouteChange"
564
+ >
565
+ <el-option v-for="option in paymentRouteOptions" :key="option.value" v-bind="option" />
566
+ </el-select>
567
+ </el-form-item>
568
+
569
+ <el-form-item label="起息日" prop="valueDate">
570
+ <el-date-picker
571
+ v-model="form.valueDate"
572
+ type="date"
573
+ value-format="YYYY-MM-DD"
574
+ format="YYYY-MM-DD"
575
+ :disabled-date="disablePastDate"
576
+ placeholder="请选择"
577
+ @change="handleValueDateChange"
578
+ />
579
+ </el-form-item>
580
+
581
+ <el-form-item label="预报金额(元)" prop="predAmount">
582
+ <ElInputThousandth v-model="form.predAmount" placeholder="请输入预报金额" />
583
+ </el-form-item>
584
+
585
+ <el-form-item label="单证业务编号" prop="documentBusinessNo">
586
+ <el-input v-model="form.documentBusinessNo" maxlength="80" placeholder="请输入" />
587
+ </el-form-item>
588
+
589
+ <el-form-item label="币种" prop="currency" class="editor-row-start">
590
+ <el-select v-model="form.currency" filterable placeholder="请选择" @change="handleCurrencyChange">
591
+ <el-option v-for="option in currencyOptions" :key="option.value" v-bind="option" />
592
+ </el-select>
593
+ </el-form-item>
594
+ </div>
595
+ </section>
596
+
597
+ <section class="editor-section editor-section--counterparty" aria-labelledby="counterparty-information-title">
598
+ <h3 id="counterparty-information-title" class="editor-section-title">客户与交易对手</h3>
599
+ <div class="editor-section-grid">
600
+ <el-form-item label="客户类型" prop="clientType">
601
+ <el-select
602
+ v-model="form.clientType"
603
+ :disabled="isLegacyFieldDisabled('clientType')"
604
+ placeholder="请选择"
605
+ @change="handleClientTypeChange"
606
+ >
607
+ <el-option v-for="option in clientTypeOptions" :key="option.value" v-bind="option" />
608
+ </el-select>
609
+ </el-form-item>
610
+
611
+ <el-form-item label="客户名称" prop="clientName">
612
+ <div class="control-with-action">
613
+ <el-input
614
+ v-model="form.clientName"
615
+ :disabled="isLegacyFieldDisabled('clientName')"
616
+ maxlength="80"
617
+ placeholder="请输入客户名称"
618
+ />
619
+ <el-button
620
+ v-if="clientSearchVisible"
621
+ :icon="Search"
622
+ :loading="clientSearching"
623
+ :disabled="isLegacyFieldDisabled('clientName')"
624
+ @click="handleClientSearch"
625
+ >
626
+ 查询
627
+ </el-button>
628
+ </div>
629
+ </el-form-item>
630
+
631
+ <el-form-item label="客户账号" prop="clientAccount">
632
+ <el-input
633
+ v-model="form.clientAccount"
634
+ :disabled="isLegacyFieldDisabled('clientAccount')"
635
+ maxlength="40"
636
+ placeholder="请输入客户账号"
637
+ />
638
+ </el-form-item>
639
+
640
+ <el-form-item label="交易对手名称" prop="counterpartyName">
641
+ <el-input
642
+ v-model="form.counterpartyName"
643
+ :disabled="isLegacyFieldDisabled('counterpartyName')"
644
+ maxlength="80"
645
+ placeholder="请输入交易对手名称"
646
+ />
647
+ </el-form-item>
648
+
649
+ <el-form-item label="交易对手账号" prop="counterpartyAccount">
650
+ <el-input
651
+ v-model="form.counterpartyAccount"
652
+ :disabled="isLegacyFieldDisabled('counterpartyAccount')"
653
+ maxlength="40"
654
+ placeholder="请输入交易对手账号"
655
+ />
656
+ </el-form-item>
657
+
658
+ <el-form-item label="交易对手行名称" prop="receivingBank">
659
+ <el-input
660
+ v-model="form.receivingBank"
661
+ :disabled="isLegacyFieldDisabled('receivingBank')"
662
+ maxlength="30"
663
+ placeholder="请输入交易对手行名称"
664
+ />
665
+ </el-form-item>
666
+
667
+ <el-form-item label="交易对手行 SwiftCode" prop="receivingBankSwiftCode">
668
+ <el-input
669
+ v-model="form.receivingBankSwiftCode"
670
+ :disabled="isLegacyFieldDisabled('receivingBankSwiftCode')"
671
+ maxlength="30"
672
+ placeholder="请输入 SwiftCode"
673
+ />
674
+ </el-form-item>
675
+ </div>
676
+ </section>
677
+
678
+ <section class="editor-section" aria-labelledby="bank-information-title">
679
+ <h3 id="bank-information-title" class="editor-section-title">银行与汇路信息</h3>
680
+ <div class="editor-section-grid">
681
+ <el-form-item label="结汇/购汇/现汇" prop="foreignExchangeType">
682
+ <el-select
683
+ v-model="form.foreignExchangeType"
684
+ :disabled="isLegacyFieldDisabled('foreignExchangeType')"
685
+ placeholder="请选择"
686
+ >
687
+ <el-option v-for="option in foreignExchangeTypeOptions" :key="option.value" v-bind="option" />
688
+ </el-select>
689
+ </el-form-item>
690
+
691
+ <el-form-item label="中间行 SwiftCode">
692
+ <el-input
693
+ v-model="form.intermediaryBankSwiftCode"
694
+ :disabled="isLegacyFieldDisabled('intermediaryBankSwiftCode')"
695
+ maxlength="30"
696
+ placeholder="选填"
697
+ />
698
+ </el-form-item>
699
+
700
+ <el-form-item label="我方账户行" prop="bankAccount">
701
+ <el-select
702
+ v-model="form.bankAccount"
703
+ filterable
704
+ :disabled="bankAccountDisabled"
705
+ :placeholder="bankAccountDisabled ? '请先选择汇款路径' : '请选择'"
706
+ >
707
+ <el-option v-for="bank in availableBankAccounts" :key="bank" :label="bank" :value="bank" />
708
+ </el-select>
709
+ </el-form-item>
710
+
711
+ <el-form-item label="交易对手 SwiftCode">
712
+ <el-input v-model="form.counterpartySwiftCode" maxlength="30" placeholder="选填" />
713
+ </el-form-item>
714
+ </div>
715
+ </section>
716
+
717
+ <section class="editor-section editor-section--description" aria-labelledby="description-information-title">
718
+ <h3 id="description-information-title" class="editor-section-title">说明信息</h3>
719
+ <div class="editor-section-grid">
720
+ <el-form-item label="用途/原因" class="editor-full-row">
721
+ <el-input v-model="form.purpose" maxlength="255" placeholder="请输入用途或原因" />
722
+ </el-form-item>
723
+
724
+ <el-form-item label="备注" class="editor-full-row">
725
+ <el-input
726
+ v-model="form.remark"
727
+ type="textarea"
728
+ :rows="2"
729
+ maxlength="255"
730
+ show-word-limit
731
+ placeholder="请输入备注"
732
+ />
733
+ </el-form-item>
734
+ </div>
735
+ </section>
736
+ </div>
737
+ </el-form>
738
+ </div>
739
+
740
+ <footer class="editor-actions">
741
+ <div class="editor-actions-card" role="group" aria-label="表单操作">
742
+ <el-button :icon="ArrowLeft" :disabled="saving" @click="emit('back')">返回</el-button>
743
+ <el-button type="primary" :icon="Check" :loading="saving" @click="handleSubmit">
744
+ {{ mode === 'add' ? '提交' : '保存修改' }}
745
+ </el-button>
746
+ </div>
747
+ </footer>
748
+ </section>
749
+ </template>
750
+
751
+ <style scoped>
752
+ .forecast-editor-panel {
753
+ --editor-border: #dfe5ed;
754
+ --editor-ink: #172033;
755
+ --editor-blue: #1677ff;
756
+ display: flex;
757
+ flex-direction: column;
758
+ min-height: calc(100vh - 100px);
759
+ overflow: hidden;
760
+ border: 1px solid var(--editor-border);
761
+ border-radius: 8px;
762
+ color: var(--editor-ink);
763
+ background: #f5f7fa;
764
+ box-shadow: 0 4px 18px rgba(30, 55, 90, .06);
765
+ }
766
+
767
+ .editor-body {
768
+ flex: 1 1 auto;
769
+ min-width: 0;
770
+ padding: 16px 16px 104px;
771
+ background: #f5f7fa;
772
+ }
773
+
774
+ .editor-sections {
775
+ display: grid;
776
+ gap: 12px;
777
+ }
778
+
779
+ .editor-section {
780
+ min-width: 0;
781
+ padding: 14px 18px 2px;
782
+ border: 1px solid #dfe5ed;
783
+ border-radius: 7px;
784
+ background: #fff;
785
+ box-shadow: 0 2px 8px rgba(30, 55, 90, .04);
786
+ }
787
+
788
+ .editor-section-title {
789
+ margin: 0 0 13px 5px;
790
+ color: #25324a;
791
+ font-size: 16px;
792
+ font-weight: 700;
793
+ line-height: 24px;
794
+ }
795
+
796
+ .editor-section-grid {
797
+ display: grid;
798
+ grid-template-columns: repeat(3, minmax(0, 1fr));
799
+ column-gap: 24px;
800
+ }
801
+
802
+ .editor-row-start {
803
+ grid-column: 1;
804
+ }
805
+
806
+ .forecast-editor-form :deep(.el-form-item) {
807
+ align-items: flex-start;
808
+ min-width: 0;
809
+ margin-bottom: 14px;
810
+ }
811
+
812
+ .forecast-editor-form :deep(.el-form-item__label) {
813
+ height: 34px;
814
+ padding: 0 11px 0 0;
815
+ color: #344054;
816
+ font-size: 13px;
817
+ font-weight: 600;
818
+ line-height: 34px;
819
+ white-space: nowrap;
820
+ }
821
+
822
+ .editor-section--counterparty :deep(.el-form-item__label) {
823
+ width: 150px !important;
824
+ }
825
+
826
+ .forecast-editor-form :deep(.el-form-item__content) {
827
+ min-width: 0;
828
+ line-height: 34px;
829
+ }
830
+
831
+ .forecast-editor-form :deep(.el-input),
832
+ .forecast-editor-form :deep(.el-select),
833
+ .forecast-editor-form :deep(.el-date-editor),
834
+ .forecast-editor-form :deep(.el-input-number) {
835
+ width: 100%;
836
+ }
837
+
838
+ .forecast-editor-form :deep(.el-input__wrapper),
839
+ .forecast-editor-form :deep(.el-select__wrapper),
840
+ .forecast-editor-form :deep(.el-textarea__inner) {
841
+ min-height: 34px;
842
+ border-radius: 5px;
843
+ box-shadow: 0 0 0 1px #d7dee8 inset;
844
+ transition: box-shadow .18s ease, background-color .18s ease;
845
+ }
846
+
847
+ .forecast-editor-form :deep(.el-input__wrapper:hover),
848
+ .forecast-editor-form :deep(.el-select__wrapper:hover),
849
+ .forecast-editor-form :deep(.el-textarea__inner:hover) {
850
+ box-shadow: 0 0 0 1px #aebdd0 inset;
851
+ }
852
+
853
+ .forecast-editor-form :deep(.el-input__wrapper.is-focus),
854
+ .forecast-editor-form :deep(.el-select__wrapper.is-focused),
855
+ .forecast-editor-form :deep(.el-textarea__inner:focus) {
856
+ box-shadow: 0 0 0 1px var(--editor-blue) inset;
857
+ }
858
+
859
+ .forecast-editor-form :deep(.is-disabled .el-input__wrapper),
860
+ .forecast-editor-form :deep(.is-disabled.el-select__wrapper) {
861
+ background: #f5f7fa;
862
+ box-shadow: 0 0 0 1px #dfe4eb inset;
863
+ }
864
+
865
+ .forecast-editor-form :deep(.is-disabled .el-input__inner),
866
+ .forecast-editor-form :deep(.is-disabled .el-select__selected-item) {
867
+ color: #8a94a3;
868
+ -webkit-text-fill-color: #8a94a3;
869
+ }
870
+
871
+ .forecast-editor-form :deep(.el-form-item__error) {
872
+ padding-top: 3px;
873
+ font-size: 12px;
874
+ line-height: 15px;
875
+ }
876
+
877
+ .control-with-action {
878
+ display: flex;
879
+ width: 100%;
880
+ }
881
+
882
+ .control-with-action :deep(.el-input__wrapper) {
883
+ border-radius: 5px 0 0 5px;
884
+ }
885
+
886
+ .control-with-action > .el-button {
887
+ flex: 0 0 auto;
888
+ height: 34px;
889
+ margin-left: -1px;
890
+ border-radius: 0 5px 5px 0;
891
+ color: #344054;
892
+ background: #fff;
893
+ }
894
+
895
+ .editor-full-row {
896
+ grid-column: 1 / -1;
897
+ }
898
+
899
+ .editor-section--description :deep(.el-textarea__inner) {
900
+ min-height: 64px;
901
+ padding-top: 8px;
902
+ padding-bottom: 22px;
903
+ resize: vertical;
904
+ }
905
+
906
+ .editor-actions {
907
+ position: fixed;
908
+ bottom: 22px;
909
+ left: 50%;
910
+ z-index: 20;
911
+ width: max-content;
912
+ max-width: calc(100vw - 32px);
913
+ transform: translateX(-50%);
914
+ }
915
+
916
+ .editor-actions-card {
917
+ display: flex;
918
+ justify-content: center;
919
+ gap: 12px;
920
+ padding: 12px 16px;
921
+ border: 1px solid var(--editor-border);
922
+ border-radius: 8px;
923
+ background: #fff;
924
+ box-shadow: 0 10px 28px rgba(30, 55, 90, .16);
925
+ }
926
+
927
+ .editor-actions .el-button {
928
+ min-width: 116px;
929
+ height: 40px;
930
+ margin-left: 0;
931
+ border-radius: 5px;
932
+ font-size: 15px;
933
+ }
934
+
935
+ .editor-actions .el-button--primary {
936
+ border-color: var(--editor-blue);
937
+ background: var(--editor-blue);
938
+ box-shadow: 0 3px 8px rgba(22, 119, 255, .18);
939
+ }
940
+
941
+ @media (max-width: 1180px) {
942
+ .editor-section-grid {
943
+ grid-template-columns: repeat(2, minmax(0, 1fr));
944
+ }
945
+
946
+ .editor-row-start {
947
+ grid-column: auto;
948
+ }
949
+ }
950
+
951
+ @media (max-width: 760px) {
952
+ .forecast-editor-panel {
953
+ min-height: calc(100vh - 84px);
954
+ }
955
+
956
+ .editor-body {
957
+ padding: 10px 10px 92px;
958
+ }
959
+
960
+ .editor-section {
961
+ padding: 13px 12px 3px;
962
+ }
963
+
964
+ .editor-section-grid {
965
+ grid-template-columns: 1fr;
966
+ }
967
+
968
+ .forecast-editor-form :deep(.el-form-item) {
969
+ align-items: stretch;
970
+ flex-direction: column;
971
+ }
972
+
973
+ .forecast-editor-form :deep(.el-form-item__label) {
974
+ justify-content: flex-start;
975
+ width: auto !important;
976
+ height: 27px;
977
+ padding: 0;
978
+ line-height: 27px;
979
+ text-align: left;
980
+ }
981
+
982
+ .editor-section--counterparty :deep(.el-form-item__label) {
983
+ width: auto !important;
984
+ }
985
+
986
+ .forecast-editor-form :deep(.el-form-item__content) {
987
+ width: 100%;
988
+ margin-left: 0 !important;
989
+ }
990
+
991
+ .editor-full-row {
992
+ grid-column: auto;
993
+ }
994
+
995
+ .editor-actions {
996
+ bottom: 12px;
997
+ width: calc(100vw - 28px);
998
+ max-width: 380px;
999
+ }
1000
+
1001
+ .editor-actions-card {
1002
+ box-sizing: border-box;
1003
+ width: 100%;
1004
+ padding: 10px 12px;
1005
+ }
1006
+
1007
+ .editor-actions .el-button {
1008
+ flex: 1 1 0;
1009
+ min-width: 0;
1010
+ max-width: 180px;
1011
+ }
1012
+ }
1013
+ </style>