verce-vue-test 0.0.122 → 0.0.124
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verce-vue-test",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.124",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"author": "",
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"dayjs": "^1.11.20",
|
|
27
28
|
"echarts": "^6.1.0",
|
|
28
29
|
"element-plus": "2.2.27",
|
|
29
30
|
"pinia": "2.1.7",
|
|
@@ -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 机构树。 */
|
|
@@ -264,7 +306,8 @@ function buildForeignPositionForecastMutationBody(value: ForecastEditorValue) {
|
|
|
264
306
|
payDirec: value.payDirection.trim(),
|
|
265
307
|
paymentRoute: value.paymentRoute.trim(),
|
|
266
308
|
phoneNo: value.phoneNumber.trim(),
|
|
267
|
-
|
|
309
|
+
// 旧 JSP 去除千分位后仍保留两位小数,新增和修改报文保持相同格式。
|
|
310
|
+
predAmt: value.predAmount.toFixed(2),
|
|
268
311
|
predCode: value.forecasterCode.trim(),
|
|
269
312
|
predDate: toMutationDate(value.forecastTime),
|
|
270
313
|
predDept: value.forecastDepartment.trim(),
|
package/src/views/foreign-currency-position-forecast/components/ForeignPositionForecastEditor.vue
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import dayjs from 'dayjs'
|
|
2
3
|
import { computed, nextTick, onBeforeUnmount, reactive, ref } from 'vue'
|
|
3
4
|
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
|
4
5
|
import {
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
type AccountBankOption,
|
|
7
8
|
} from '@/api/account-bank'
|
|
8
9
|
import { queryForeignPositionOrganizationTree } from '../api'
|
|
10
|
+
import { formatChineseCurrency } from '../currency'
|
|
9
11
|
import type { ForecastEditorMode, ForecastEditorValue } from '../editor'
|
|
10
12
|
import {
|
|
11
13
|
formatDate,
|
|
@@ -29,7 +31,6 @@ import {
|
|
|
29
31
|
payDirectionOptions,
|
|
30
32
|
paymentRouteOptions,
|
|
31
33
|
} from '../options'
|
|
32
|
-
import { formatChineseCurrency } from '@/views/rmb-position-forecast/model'
|
|
33
34
|
|
|
34
35
|
type EditorFormState = {
|
|
35
36
|
predWay: ForecastWay
|
|
@@ -157,6 +158,17 @@ function createEditorForm(row?: ForeignPositionForecast | null): EditorFormState
|
|
|
157
158
|
const form = reactive<EditorFormState>(createEditorForm(props.initialRow))
|
|
158
159
|
|
|
159
160
|
const editorTitle = computed(() => (props.mode === 'add' ? '新增记录' : '修改记录'))
|
|
161
|
+
const bankAccountLabel = computed(() => (props.mode === 'add' ? '我方账户行' : '账户行'))
|
|
162
|
+
const counterpartyNameLabel = computed(() => (props.mode === 'add' ? '交易对手名称' : '收款人名称'))
|
|
163
|
+
const counterpartyAccountLabel = computed(() => (props.mode === 'add' ? '交易对手账号' : '收款账号'))
|
|
164
|
+
const receivingBankLabel = computed(() => (props.mode === 'add' ? '交易对手行名称' : '收款行名称'))
|
|
165
|
+
const receivingBankSwiftCodeLabel = computed(() => (
|
|
166
|
+
props.mode === 'add' ? '交易对手行 SwiftCode' : '收款行 SwiftCode'
|
|
167
|
+
))
|
|
168
|
+
// 旧新增页提供对公客户查询入口,旧修改页则使用普通文本框回填、修改客户名称。
|
|
169
|
+
const shouldUseCorporateCustomerSelector = computed(
|
|
170
|
+
() => props.mode === 'add' && form.clientType === 'CT01',
|
|
171
|
+
)
|
|
160
172
|
const forecastDate = computed(() => props.initialRow?.forecastTime.slice(0, 10) || formatDate(new Date()))
|
|
161
173
|
const forecasterName = computed(() => props.initialRow?.forecasterName || foreignPositionForecastBusinessContext.userName)
|
|
162
174
|
const forecasterCode = computed(() => props.initialRow?.forecasterCode || foreignPositionForecastBusinessContext.userCode)
|
|
@@ -306,7 +318,7 @@ const formRules = computed<FormRules>(() => ({
|
|
|
306
318
|
currency: [{ required: true, message: '请选择币种', trigger: 'change' }],
|
|
307
319
|
valueDate: [{ required: true, message: '请选择起息日', trigger: 'change' }],
|
|
308
320
|
paymentRoute: [{ required: true, message: '请选择汇款路径', trigger: 'change' }],
|
|
309
|
-
bankAccount: [{ required: true, message:
|
|
321
|
+
bankAccount: [{ required: true, message: `请选择${bankAccountLabel.value}`, trigger: 'change' }],
|
|
310
322
|
clientType: isLegacyFieldRequired('clientType')
|
|
311
323
|
? [{ required: true, message: '请选择客户类型', trigger: 'change' }]
|
|
312
324
|
: [],
|
|
@@ -317,16 +329,16 @@ const formRules = computed<FormRules>(() => ({
|
|
|
317
329
|
? [{ required: true, message: '请输入客户账号', trigger: 'blur' }]
|
|
318
330
|
: [],
|
|
319
331
|
counterpartyName: isLegacyFieldRequired('counterpartyName')
|
|
320
|
-
? [{ required: true, message:
|
|
332
|
+
? [{ required: true, message: `请输入${counterpartyNameLabel.value}`, trigger: 'blur' }]
|
|
321
333
|
: [],
|
|
322
334
|
counterpartyAccount: isLegacyFieldRequired('counterpartyAccount')
|
|
323
|
-
? [{ required: true, message:
|
|
335
|
+
? [{ required: true, message: `请输入${counterpartyAccountLabel.value}`, trigger: 'blur' }]
|
|
324
336
|
: [],
|
|
325
337
|
receivingBank: isLegacyFieldRequired('receivingBank')
|
|
326
|
-
? [{ required: true, message:
|
|
338
|
+
? [{ required: true, message: `请输入${receivingBankLabel.value}`, trigger: 'blur' }]
|
|
327
339
|
: [],
|
|
328
340
|
receivingBankSwiftCode: isLegacyFieldRequired('receivingBankSwiftCode')
|
|
329
|
-
? [{ required: true, message:
|
|
341
|
+
? [{ required: true, message: `请输入${receivingBankSwiftCodeLabel.value}`, trigger: 'blur' }]
|
|
330
342
|
: [],
|
|
331
343
|
foreignExchangeType: isLegacyFieldRequired('foreignExchangeType')
|
|
332
344
|
? [{ required: true, message: '请选择结汇/购汇/现汇', trigger: 'change' }]
|
|
@@ -520,16 +532,14 @@ function handleCorporateCustomerSelect() {
|
|
|
520
532
|
|
|
521
533
|
function handleValueDateChange(value: string) {
|
|
522
534
|
if (!value || !form.currency) return
|
|
523
|
-
const
|
|
524
|
-
if (
|
|
535
|
+
const weekday = dayjs(value).day()
|
|
536
|
+
if (weekday === 0 || weekday === 6) {
|
|
525
537
|
ElMessage.warning(`当前所选日期为币种 [${form.currency}] 的节假日`)
|
|
526
538
|
}
|
|
527
539
|
}
|
|
528
540
|
|
|
529
541
|
function disablePastDate(date: Date) {
|
|
530
|
-
|
|
531
|
-
today.setHours(0, 0, 0, 0)
|
|
532
|
-
return date.getTime() < today.getTime()
|
|
542
|
+
return dayjs(date).isBefore(dayjs(), 'day')
|
|
533
543
|
}
|
|
534
544
|
|
|
535
545
|
async function handleSubmit() {
|
|
@@ -537,7 +547,7 @@ async function handleSubmit() {
|
|
|
537
547
|
const valid = await formRef.value?.validate().catch(() => false)
|
|
538
548
|
if (!valid) return
|
|
539
549
|
|
|
540
|
-
if (forecastDate.value
|
|
550
|
+
if (dayjs(forecastDate.value).isAfter(dayjs(form.valueDate), 'day')) {
|
|
541
551
|
ElMessage.warning('预报日期不能晚于起息日')
|
|
542
552
|
return
|
|
543
553
|
}
|
|
@@ -622,6 +632,7 @@ onBeforeUnmount(() => {
|
|
|
622
632
|
filterable
|
|
623
633
|
remote
|
|
624
634
|
reserve-keyword
|
|
635
|
+
:allow-create="false"
|
|
625
636
|
:remote-method="searchOrganizations"
|
|
626
637
|
:loading="organizationLoading"
|
|
627
638
|
placeholder="请选择机构"
|
|
@@ -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 class="legacy-readonly-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 class="legacy-readonly-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 class="legacy-readonly-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 class="legacy-readonly-input" :model-value="phoneNumber" readonly />
|
|
653
664
|
</el-form-item>
|
|
654
665
|
|
|
655
666
|
<el-form-item label="起息日" prop="valueDate">
|
|
@@ -658,6 +669,7 @@ onBeforeUnmount(() => {
|
|
|
658
669
|
type="date"
|
|
659
670
|
value-format="YYYY-MM-DD"
|
|
660
671
|
format="YYYY-MM-DD"
|
|
672
|
+
:editable="false"
|
|
661
673
|
:disabled-date="disablePastDate"
|
|
662
674
|
placeholder="请选择"
|
|
663
675
|
@change="handleValueDateChange"
|
|
@@ -669,7 +681,13 @@ onBeforeUnmount(() => {
|
|
|
669
681
|
</el-form-item>
|
|
670
682
|
|
|
671
683
|
<el-form-item label="币种" prop="currency" class="editor-row-start">
|
|
672
|
-
<el-select
|
|
684
|
+
<el-select
|
|
685
|
+
v-model="form.currency"
|
|
686
|
+
filterable
|
|
687
|
+
:allow-create="false"
|
|
688
|
+
placeholder="请选择"
|
|
689
|
+
@change="handleCurrencyChange"
|
|
690
|
+
>
|
|
673
691
|
<el-option v-for="option in currencyOptions" :key="option.value" v-bind="option" />
|
|
674
692
|
</el-select>
|
|
675
693
|
</el-form-item>
|
|
@@ -708,7 +726,7 @@ onBeforeUnmount(() => {
|
|
|
708
726
|
|
|
709
727
|
<el-form-item label="客户名称" prop="clientName">
|
|
710
728
|
<CorporateCustomerSelect
|
|
711
|
-
v-if="
|
|
729
|
+
v-if="shouldUseCorporateCustomerSelector"
|
|
712
730
|
v-model="form.clientName"
|
|
713
731
|
v-model:customer-number="form.clientId"
|
|
714
732
|
:disabled="isLegacyFieldDisabled('clientName')"
|
|
@@ -732,34 +750,34 @@ onBeforeUnmount(() => {
|
|
|
732
750
|
/>
|
|
733
751
|
</el-form-item>
|
|
734
752
|
|
|
735
|
-
<el-form-item label="
|
|
753
|
+
<el-form-item :label="counterpartyNameLabel" prop="counterpartyName">
|
|
736
754
|
<el-input
|
|
737
755
|
v-model="form.counterpartyName"
|
|
738
756
|
:disabled="isLegacyFieldDisabled('counterpartyName')"
|
|
739
757
|
maxlength="80"
|
|
740
|
-
placeholder="
|
|
758
|
+
:placeholder="`请输入${counterpartyNameLabel}`"
|
|
741
759
|
/>
|
|
742
760
|
</el-form-item>
|
|
743
761
|
|
|
744
|
-
<el-form-item label="
|
|
762
|
+
<el-form-item :label="counterpartyAccountLabel" prop="counterpartyAccount">
|
|
745
763
|
<el-input
|
|
746
764
|
v-model="form.counterpartyAccount"
|
|
747
765
|
:disabled="isLegacyFieldDisabled('counterpartyAccount')"
|
|
748
766
|
maxlength="40"
|
|
749
|
-
placeholder="
|
|
767
|
+
:placeholder="`请输入${counterpartyAccountLabel}`"
|
|
750
768
|
/>
|
|
751
769
|
</el-form-item>
|
|
752
770
|
|
|
753
|
-
<el-form-item label="
|
|
771
|
+
<el-form-item :label="receivingBankLabel" prop="receivingBank">
|
|
754
772
|
<el-input
|
|
755
773
|
v-model="form.receivingBank"
|
|
756
774
|
:disabled="isLegacyFieldDisabled('receivingBank')"
|
|
757
775
|
maxlength="30"
|
|
758
|
-
placeholder="
|
|
776
|
+
:placeholder="`请输入${receivingBankLabel}`"
|
|
759
777
|
/>
|
|
760
778
|
</el-form-item>
|
|
761
779
|
|
|
762
|
-
<el-form-item label="
|
|
780
|
+
<el-form-item :label="receivingBankSwiftCodeLabel" prop="receivingBankSwiftCode">
|
|
763
781
|
<el-input
|
|
764
782
|
v-model="form.receivingBankSwiftCode"
|
|
765
783
|
:disabled="isLegacyFieldDisabled('receivingBankSwiftCode')"
|
|
@@ -805,13 +823,14 @@ onBeforeUnmount(() => {
|
|
|
805
823
|
/>
|
|
806
824
|
</el-form-item>
|
|
807
825
|
|
|
808
|
-
<el-form-item label="
|
|
826
|
+
<el-form-item :label="bankAccountLabel" prop="bankAccount">
|
|
809
827
|
<el-select
|
|
810
828
|
v-model="form.bankAccount"
|
|
811
829
|
:disabled="bankAccountDisabled"
|
|
812
830
|
:loading="accountBankLoading"
|
|
813
831
|
:placeholder="bankAccountDisabled ? '请先选择汇款路径' : '请选择'"
|
|
814
832
|
filterable
|
|
833
|
+
:allow-create="false"
|
|
815
834
|
clearable
|
|
816
835
|
:persistent="false"
|
|
817
836
|
@visible-change="handleAccountBankVisibleChange"
|
|
@@ -887,6 +906,13 @@ onBeforeUnmount(() => {
|
|
|
887
906
|
background: #f3f6fb;
|
|
888
907
|
}
|
|
889
908
|
|
|
909
|
+
.forecast-editor-form {
|
|
910
|
+
box-sizing: border-box;
|
|
911
|
+
width: 100%;
|
|
912
|
+
max-width: 1440px;
|
|
913
|
+
margin: 0 auto;
|
|
914
|
+
}
|
|
915
|
+
|
|
890
916
|
.editor-sections {
|
|
891
917
|
display: grid;
|
|
892
918
|
gap: 12px;
|
|
@@ -1012,6 +1038,17 @@ onBeforeUnmount(() => {
|
|
|
1012
1038
|
-webkit-text-fill-color: #8a94a3;
|
|
1013
1039
|
}
|
|
1014
1040
|
|
|
1041
|
+
.forecast-editor-form :deep(.legacy-readonly-input .el-input__wrapper) {
|
|
1042
|
+
cursor: not-allowed;
|
|
1043
|
+
background: #f7f9fc;
|
|
1044
|
+
box-shadow: 0 0 0 1px #e2e7ee inset;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
.forecast-editor-form :deep(.legacy-readonly-input .el-input__inner) {
|
|
1048
|
+
cursor: not-allowed;
|
|
1049
|
+
color: #8a94a3;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1015
1052
|
.forecast-editor-form :deep(.el-form-item__error) {
|
|
1016
1053
|
position: static;
|
|
1017
1054
|
box-sizing: border-box;
|
|
@@ -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
|
+
}
|