verce-vue-test 0.0.62 → 0.0.64
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/design-qa.md +28 -27
- package/package.json +1 -1
- package/src/App.vue +8 -0
- package/src/components/ElTablePro.vue +16 -5
- package/src/components/NumberRange.vue +145 -65
- package/src/router/index.ts +10 -0
- package/src/utils/formatters.ts +17 -0
- package/src/views/ForecastInfo/components/FlowInfoPanel.vue +373 -0
- package/src/views/ForecastInfo/components/ForecastInfoPanel.vue +715 -0
- package/src/views/ForecastInfo/forecast-info.css +787 -0
- package/src/views/ForecastInfo/index.vue +39 -0
- package/src/views/ForecastInfo/store.ts +1087 -0
- package/src/views/NumberRangeView.vue +114 -0
- package/output/playwright/home-1672x941.png +0 -0
- package/output/playwright/home-preview-1672x941.png +0 -0
- package/output/playwright/home-reference-vs-preview.png +0 -0
package/design-qa.md
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
**Findings**
|
|
2
|
-
- No actionable P0/P1/P2 findings remain.
|
|
2
|
+
- No actionable P0/P1/P2 findings remain for the `ElTablePro` table revision.
|
|
3
3
|
|
|
4
4
|
**Open Questions**
|
|
5
|
-
- None
|
|
5
|
+
- None.
|
|
6
6
|
|
|
7
7
|
**Implementation Checklist**
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- Verified production preview screenshots across wide, laptop, tablet landscape, and tablet portrait viewports.
|
|
8
|
+
- Replaced both native `el-table` blocks with `ElTablePro`.
|
|
9
|
+
- Replaced manual pagination footers with `ElTablePro` built-in pagination.
|
|
10
|
+
- Kept forecast CRUD actions in the `ElTablePro` toolbar slot.
|
|
11
|
+
- Enabled `ElTablePro` column configuration for both forecast and flow tables.
|
|
12
|
+
- Added `paginationSize` support to `ElTablePro` so this page can keep all pagination controls `small`.
|
|
13
|
+
- Forwarded the `empty` slot from `ElTablePro` to the inner `el-table` so empty-state illustrations still render.
|
|
15
14
|
|
|
16
15
|
**Follow-up Polish**
|
|
17
|
-
- [P3]
|
|
16
|
+
- [P3] When backend data is connected, wire `handleForecastPaginationChange` and `handleFlowPaginationChange` to reload their respective lists.
|
|
18
17
|
|
|
19
|
-
source visual truth path: `/var/folders/9_/635n2vmx5017pd592w50p_d80000gn/T/codex-clipboard-
|
|
18
|
+
source visual truth path: `/var/folders/9_/635n2vmx5017pd592w50p_d80000gn/T/codex-clipboard-2f217f68-ef5c-41ad-82fc-63dd8e80fd89.png`
|
|
20
19
|
|
|
21
|
-
implementation screenshot path: `/Users/bombingpig/WebstormProjects/verce-vue-test/output/playwright/
|
|
20
|
+
implementation screenshot path: `/Users/bombingpig/WebstormProjects/verce-vue-test/output/playwright/forecast-info-table-pro-1672x941.png`
|
|
22
21
|
|
|
23
|
-
viewport: `1672x941
|
|
22
|
+
viewport: `1672x941`
|
|
24
23
|
|
|
25
|
-
state: production preview,
|
|
24
|
+
state: production preview, `/forecast-info`, existing app shell, drawer-filter default state, `ElTablePro` tables
|
|
26
25
|
|
|
27
26
|
full-view comparison evidence:
|
|
28
|
-
- `/Users/bombingpig/WebstormProjects/verce-vue-test/output/playwright/
|
|
29
|
-
- `/Users/bombingpig/WebstormProjects/verce-vue-test/output/playwright/home-responsive-1366x768.png`
|
|
30
|
-
- `/Users/bombingpig/WebstormProjects/verce-vue-test/output/playwright/home-responsive-1024x768.png`
|
|
31
|
-
- `/Users/bombingpig/WebstormProjects/verce-vue-test/output/playwright/home-responsive-820x1180.png`
|
|
27
|
+
- `/Users/bombingpig/WebstormProjects/verce-vue-test/output/playwright/forecast-info-table-pro-1672x941.png`
|
|
32
28
|
|
|
33
|
-
focused region comparison evidence:
|
|
29
|
+
focused region comparison evidence:
|
|
30
|
+
- Forecast list: rendered through `ElTablePro`, toolbar actions appear above the table, column config is available, built-in pagination renders below.
|
|
31
|
+
- Flow list: rendered through `ElTablePro`, column config is available, built-in pagination renders below.
|
|
32
|
+
- Empty state: custom empty illustration/text still render inside `ElTablePro` through slot forwarding.
|
|
34
33
|
|
|
35
34
|
required fidelity surfaces:
|
|
36
|
-
- Fonts and typography:
|
|
37
|
-
- Spacing and layout rhythm:
|
|
38
|
-
- Colors and visual tokens:
|
|
39
|
-
- Image quality and asset fidelity:
|
|
40
|
-
- Copy and content:
|
|
35
|
+
- Fonts and typography: table headers, toolbar buttons, pagination text, and empty-state text remain compact and readable.
|
|
36
|
+
- Spacing and layout rhythm: table toolbar, column config button, table body, and pagination are aligned within each card.
|
|
37
|
+
- Colors and visual tokens: `ElTablePro` output preserves existing gray borders, light header rows, and blue primary pagination state.
|
|
38
|
+
- Image quality and asset fidelity: empty states use Element Plus' empty illustration; action icons use Element Plus icons.
|
|
39
|
+
- Copy and content: column labels, toolbar actions, empty text, pagination, and column config copy are present.
|
|
41
40
|
|
|
42
41
|
patches made since previous QA pass:
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
42
|
+
- Imported and used `ElTablePro` in `ForecastInfoView.vue`.
|
|
43
|
+
- Added separate page/page-size state and pagination callbacks for forecast and flow lists.
|
|
44
|
+
- Added `paginationSize` prop and empty-slot forwarding to `ElTablePro.vue`.
|
|
45
|
+
- Removed manual table pagination markup and related page-level CSS.
|
|
46
|
+
- Re-captured the page in production preview.
|
|
46
47
|
|
|
47
48
|
final result: passed
|
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -77,6 +77,10 @@ function toggleCollapse() {
|
|
|
77
77
|
<el-icon><EditPen /></el-icon>
|
|
78
78
|
<span>千分位输入</span>
|
|
79
79
|
</el-menu-item>
|
|
80
|
+
<el-menu-item index="/number-range">
|
|
81
|
+
<el-icon><DataLine /></el-icon>
|
|
82
|
+
<span>数字区间</span>
|
|
83
|
+
</el-menu-item>
|
|
80
84
|
<el-menu-item index="/position-forecast">
|
|
81
85
|
<el-icon><DataLine /></el-icon>
|
|
82
86
|
<span>头寸预报</span>
|
|
@@ -85,6 +89,10 @@ function toggleCollapse() {
|
|
|
85
89
|
<el-icon><DataLine /></el-icon>
|
|
86
90
|
<span>头寸预报执行</span>
|
|
87
91
|
</el-menu-item>
|
|
92
|
+
<el-menu-item index="/forecast-info">
|
|
93
|
+
<el-icon><DataLine /></el-icon>
|
|
94
|
+
<span>预报信息</span>
|
|
95
|
+
</el-menu-item>
|
|
88
96
|
<el-menu-item index="/executive-management">
|
|
89
97
|
<el-icon><TrendCharts /></el-icon>
|
|
90
98
|
<span>总行管理员首页</span>
|
|
@@ -49,6 +49,8 @@ const props = withDefaults(
|
|
|
49
49
|
pageSizes?: number[]
|
|
50
50
|
// 分页组件布局
|
|
51
51
|
layout?: string
|
|
52
|
+
// 分页尺寸
|
|
53
|
+
paginationSize?: 'large' | 'default' | 'small'
|
|
52
54
|
}>(),
|
|
53
55
|
{
|
|
54
56
|
columnConfig: true,
|
|
@@ -58,6 +60,7 @@ const props = withDefaults(
|
|
|
58
60
|
pageSize: 10,
|
|
59
61
|
pageSizes: () => [10, 20, 50, 100],
|
|
60
62
|
layout: 'total, sizes, prev, pager, next, jumper',
|
|
63
|
+
paginationSize: 'default',
|
|
61
64
|
},
|
|
62
65
|
)
|
|
63
66
|
|
|
@@ -357,6 +360,13 @@ initColumns()
|
|
|
357
360
|
v-for="column in visibleColumns"
|
|
358
361
|
:key="column.key"
|
|
359
362
|
/>
|
|
363
|
+
|
|
364
|
+
<template
|
|
365
|
+
v-if="$slots.empty"
|
|
366
|
+
#empty
|
|
367
|
+
>
|
|
368
|
+
<slot name="empty" />
|
|
369
|
+
</template>
|
|
360
370
|
</el-table>
|
|
361
371
|
|
|
362
372
|
<!-- 分页组件 -->
|
|
@@ -368,10 +378,11 @@ initColumns()
|
|
|
368
378
|
v-model:current-page="currentPage"
|
|
369
379
|
v-model:page-size="currentPageSize"
|
|
370
380
|
:total="total || data.length"
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
381
|
+
:page-sizes="pageSizes"
|
|
382
|
+
:layout="layout"
|
|
383
|
+
:size="paginationSize"
|
|
384
|
+
background
|
|
385
|
+
/>
|
|
375
386
|
</div>
|
|
376
387
|
|
|
377
388
|
<!-- 列配置弹窗 -->
|
|
@@ -559,4 +570,4 @@ initColumns()
|
|
|
559
570
|
background-color: #40A9FF;
|
|
560
571
|
border-color: #40A9FF;
|
|
561
572
|
}
|
|
562
|
-
</style>
|
|
573
|
+
</style>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
:class="{ 'is-error': showError }"
|
|
7
7
|
:placeholder="minPlaceholder"
|
|
8
8
|
:disabled="disabled"
|
|
9
|
+
:size="size"
|
|
9
10
|
clearable
|
|
10
11
|
@input="onMinInput"
|
|
11
12
|
@focus="onMinFocus"
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
:class="{ 'is-error': showError }"
|
|
20
21
|
:placeholder="maxPlaceholder"
|
|
21
22
|
:disabled="disabled"
|
|
23
|
+
:size="size"
|
|
22
24
|
clearable
|
|
23
25
|
@input="onMaxInput"
|
|
24
26
|
@focus="onMaxFocus"
|
|
@@ -29,53 +31,76 @@
|
|
|
29
31
|
</div>
|
|
30
32
|
</template>
|
|
31
33
|
|
|
32
|
-
<script setup lang="ts">
|
|
33
|
-
import { ref, watch, computed } from
|
|
34
|
+
<script setup lang="ts" name="NumberRange">
|
|
35
|
+
import { ref, watch, computed } from "vue"
|
|
34
36
|
|
|
35
37
|
export type RangeValue = [number | null, number | null]
|
|
36
|
-
type RangeInput =
|
|
37
|
-
|
|
38
|
-
const props = withDefaults(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
type RangeInput = any
|
|
39
|
+
|
|
40
|
+
const props = withDefaults(
|
|
41
|
+
defineProps<{
|
|
42
|
+
/** 数组模式绑定值 [min, max],接受字符串自动转换 */
|
|
43
|
+
modelValue?: RangeInput
|
|
44
|
+
/** 双字段模式 - 起始值,接受字符串自动转换 */
|
|
45
|
+
start?: number | string | null
|
|
46
|
+
/** 双字段模式 - 结束值,接受字符串自动转换 */
|
|
47
|
+
end?: number | string | null
|
|
48
|
+
minPlaceholder?: string
|
|
49
|
+
maxPlaceholder?: string
|
|
50
|
+
separator?: string
|
|
51
|
+
/** 小数位数限制 */
|
|
52
|
+
precision?: number
|
|
53
|
+
/** 输出单位,支持传入 "万"、"亿" 或直接传入倍率数字 */
|
|
54
|
+
unit?: string | number
|
|
55
|
+
size?: "large" | "default" | "small"
|
|
56
|
+
disabled?: boolean
|
|
57
|
+
/** 自定义错误提示 */
|
|
58
|
+
errorMessage?: string
|
|
59
|
+
}>(),
|
|
60
|
+
{
|
|
61
|
+
modelValue: undefined,
|
|
62
|
+
start: undefined,
|
|
63
|
+
end: undefined,
|
|
64
|
+
minPlaceholder: "最小值",
|
|
65
|
+
maxPlaceholder: "最大值",
|
|
66
|
+
separator: "到",
|
|
67
|
+
precision: undefined,
|
|
68
|
+
unit: "",
|
|
69
|
+
size: "default",
|
|
70
|
+
disabled: false,
|
|
71
|
+
errorMessage: "开始金额不能大于结束金额"
|
|
72
|
+
}
|
|
73
|
+
)
|
|
64
74
|
|
|
65
75
|
const emit = defineEmits<{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
"update:modelValue": [value: RangeValue]
|
|
77
|
+
"update:start": [value: number | null]
|
|
78
|
+
"update:end": [value: number | null]
|
|
69
79
|
/** 校验状态变化:true 表示通过,false 表示不通过 */
|
|
70
|
-
|
|
80
|
+
validate: [valid: boolean]
|
|
71
81
|
}>()
|
|
72
82
|
|
|
73
83
|
// 判断绑定模式
|
|
74
84
|
const isArrayMode = computed(() => props.modelValue !== undefined)
|
|
85
|
+
const unitMultiplier = computed(() => getUnitMultiplier(props.unit))
|
|
86
|
+
|
|
87
|
+
const UNIT_MULTIPLIERS: Record<string, number> = {
|
|
88
|
+
"": 1,
|
|
89
|
+
个: 1,
|
|
90
|
+
元: 1,
|
|
91
|
+
十: 10,
|
|
92
|
+
百: 100,
|
|
93
|
+
千: 1000,
|
|
94
|
+
千元: 1000,
|
|
95
|
+
万: 10000,
|
|
96
|
+
万元: 10000,
|
|
97
|
+
亿: 100000000,
|
|
98
|
+
亿元: 100000000
|
|
99
|
+
}
|
|
75
100
|
|
|
76
101
|
// 显示值
|
|
77
|
-
const minDisplay = ref(
|
|
78
|
-
const maxDisplay = ref(
|
|
102
|
+
const minDisplay = ref("")
|
|
103
|
+
const maxDisplay = ref("")
|
|
79
104
|
|
|
80
105
|
// 焦点状态
|
|
81
106
|
const minFocused = ref(false)
|
|
@@ -90,30 +115,49 @@ const rangeInvalid = computed(() => {
|
|
|
90
115
|
})
|
|
91
116
|
|
|
92
117
|
// 显示错误:两个输入框都失焦后且校验不通过
|
|
93
|
-
const showError = computed(
|
|
118
|
+
const showError = computed(
|
|
119
|
+
() =>
|
|
120
|
+
hasBlurred.value &&
|
|
121
|
+
!minFocused.value &&
|
|
122
|
+
!maxFocused.value &&
|
|
123
|
+
rangeInvalid.value
|
|
124
|
+
)
|
|
94
125
|
|
|
95
126
|
// 转换为数字
|
|
96
127
|
function toNum(val: unknown): number | null {
|
|
97
|
-
if (val === null || val === undefined
|
|
98
|
-
|
|
99
|
-
|
|
128
|
+
if (val === null || val === undefined) return null
|
|
129
|
+
|
|
130
|
+
if (typeof val === "number") {
|
|
131
|
+
return Number.isFinite(val) ? val : null
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (typeof val !== "string") return null
|
|
135
|
+
|
|
136
|
+
const value = val.trim()
|
|
137
|
+
if (!value || value === "-" || value === "." || value === "-.") return null
|
|
138
|
+
|
|
139
|
+
const n = Number(value)
|
|
140
|
+
return Number.isFinite(n) ? n : null
|
|
100
141
|
}
|
|
101
142
|
|
|
102
143
|
// 输入过滤
|
|
103
|
-
function sanitize(raw:
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
s
|
|
108
|
-
|
|
109
|
-
const
|
|
144
|
+
function sanitize(raw: unknown): string {
|
|
145
|
+
if (raw === null || raw === undefined) return ""
|
|
146
|
+
|
|
147
|
+
let s = String(raw).replace(/[^0-9.\-]/g, "")
|
|
148
|
+
if (!s) return ""
|
|
149
|
+
|
|
150
|
+
const negative = s.startsWith("-")
|
|
151
|
+
s = s.replace(/-/g, "")
|
|
152
|
+
if (negative) s = "-" + s
|
|
153
|
+
const dotIdx = s.indexOf(".")
|
|
110
154
|
if (dotIdx !== -1) {
|
|
111
155
|
const intPart = s.slice(0, dotIdx)
|
|
112
|
-
let decPart = s.slice(dotIdx + 1).replace(/\./g,
|
|
156
|
+
let decPart = s.slice(dotIdx + 1).replace(/\./g, "")
|
|
113
157
|
if (props.precision !== undefined) {
|
|
114
158
|
decPart = decPart.slice(0, props.precision)
|
|
115
159
|
}
|
|
116
|
-
s = intPart +
|
|
160
|
+
s = intPart + "." + decPart
|
|
117
161
|
}
|
|
118
162
|
return s
|
|
119
163
|
}
|
|
@@ -126,34 +170,69 @@ function formatNum(val: number | null): number | null {
|
|
|
126
170
|
return val
|
|
127
171
|
}
|
|
128
172
|
|
|
173
|
+
function getUnitMultiplier(unit: string | number): number {
|
|
174
|
+
if (typeof unit === "number") {
|
|
175
|
+
return Number.isFinite(unit) && unit > 0 ? unit : 1
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const normalizedUnit = unit.trim()
|
|
179
|
+
const mappedMultiplier = UNIT_MULTIPLIERS[normalizedUnit]
|
|
180
|
+
if (mappedMultiplier !== undefined) {
|
|
181
|
+
return mappedMultiplier
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const parsed = Number(normalizedUnit)
|
|
185
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 1
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function normalizeNumber(val: number): number {
|
|
189
|
+
return Number.isInteger(val) ? val : Number(val.toFixed(12))
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function toActualNum(val: number | null): number | null {
|
|
193
|
+
if (val === null) return null
|
|
194
|
+
return normalizeNumber(val * unitMultiplier.value)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function toDisplayNum(val: number | null): number | null {
|
|
198
|
+
if (val === null) return null
|
|
199
|
+
return normalizeNumber(val / unitMultiplier.value)
|
|
200
|
+
}
|
|
201
|
+
|
|
129
202
|
function emitValue() {
|
|
130
|
-
const minVal = formatNum(toNum(minDisplay.value))
|
|
131
|
-
const maxVal = formatNum(toNum(maxDisplay.value))
|
|
203
|
+
const minVal = toActualNum(formatNum(toNum(minDisplay.value)))
|
|
204
|
+
const maxVal = toActualNum(formatNum(toNum(maxDisplay.value)))
|
|
132
205
|
if (isArrayMode.value) {
|
|
133
|
-
emit(
|
|
206
|
+
emit("update:modelValue", [minVal, maxVal])
|
|
134
207
|
} else {
|
|
135
|
-
emit(
|
|
136
|
-
emit(
|
|
208
|
+
emit("update:start", minVal)
|
|
209
|
+
emit("update:end", maxVal)
|
|
137
210
|
}
|
|
138
211
|
// 发送校验状态
|
|
139
|
-
emit(
|
|
212
|
+
emit("validate", !rangeInvalid.value)
|
|
140
213
|
}
|
|
141
214
|
|
|
142
|
-
function onMinInput(val: string
|
|
143
|
-
minDisplay.value = sanitize(
|
|
215
|
+
function onMinInput(val: string) {
|
|
216
|
+
minDisplay.value = sanitize(val)
|
|
217
|
+
if (minDisplay.value === "") {
|
|
218
|
+
emitValue()
|
|
219
|
+
}
|
|
144
220
|
}
|
|
145
221
|
|
|
146
|
-
function onMaxInput(val: string
|
|
147
|
-
maxDisplay.value = sanitize(
|
|
222
|
+
function onMaxInput(val: string) {
|
|
223
|
+
maxDisplay.value = sanitize(val)
|
|
224
|
+
if (maxDisplay.value === "") {
|
|
225
|
+
emitValue()
|
|
226
|
+
}
|
|
148
227
|
}
|
|
149
228
|
|
|
150
229
|
function onMinClear() {
|
|
151
|
-
minDisplay.value =
|
|
230
|
+
minDisplay.value = ""
|
|
152
231
|
emitValue()
|
|
153
232
|
}
|
|
154
233
|
|
|
155
234
|
function onMaxClear() {
|
|
156
|
-
maxDisplay.value =
|
|
235
|
+
maxDisplay.value = ""
|
|
157
236
|
emitValue()
|
|
158
237
|
}
|
|
159
238
|
|
|
@@ -199,8 +278,8 @@ function validate(): boolean {
|
|
|
199
278
|
|
|
200
279
|
// 重置方法
|
|
201
280
|
function reset() {
|
|
202
|
-
minDisplay.value =
|
|
203
|
-
maxDisplay.value =
|
|
281
|
+
minDisplay.value = ""
|
|
282
|
+
maxDisplay.value = ""
|
|
204
283
|
hasBlurred.value = false
|
|
205
284
|
}
|
|
206
285
|
|
|
@@ -210,14 +289,15 @@ defineExpose({ validate, reset })
|
|
|
210
289
|
watch(
|
|
211
290
|
() => ({
|
|
212
291
|
isArrayMode: isArrayMode.value,
|
|
292
|
+
unitMultiplier: unitMultiplier.value,
|
|
213
293
|
min: isArrayMode.value ? props.modelValue?.[0] : props.start,
|
|
214
294
|
max: isArrayMode.value ? props.modelValue?.[1] : props.end
|
|
215
295
|
}),
|
|
216
296
|
({ min, max }) => {
|
|
217
297
|
const minNum = toNum(min)
|
|
218
298
|
const maxNum = toNum(max)
|
|
219
|
-
const newMin = minNum !== null ? String(formatNum(minNum)) :
|
|
220
|
-
const newMax = maxNum !== null ? String(formatNum(maxNum)) :
|
|
299
|
+
const newMin = minNum !== null ? String(formatNum(toDisplayNum(minNum))) : ""
|
|
300
|
+
const newMax = maxNum !== null ? String(formatNum(toDisplayNum(maxNum))) : ""
|
|
221
301
|
if (newMin !== minDisplay.value) minDisplay.value = newMin
|
|
222
302
|
if (newMax !== maxDisplay.value) maxDisplay.value = newMax
|
|
223
303
|
},
|
package/src/router/index.ts
CHANGED
|
@@ -55,6 +55,11 @@ const router = createRouter({
|
|
|
55
55
|
name: 'thousandth',
|
|
56
56
|
component: () => import('../views/ThousandthView.vue'),
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
path: '/number-range',
|
|
60
|
+
name: 'numberRange',
|
|
61
|
+
component: () => import('../views/NumberRangeView.vue'),
|
|
62
|
+
},
|
|
58
63
|
{
|
|
59
64
|
path: '/position-forecast',
|
|
60
65
|
name: 'positionForecast',
|
|
@@ -65,6 +70,11 @@ const router = createRouter({
|
|
|
65
70
|
name: 'positionForecastExecution',
|
|
66
71
|
component: () => import('../views/PositionForecastExecutionView.vue'),
|
|
67
72
|
},
|
|
73
|
+
{
|
|
74
|
+
path: '/forecast-info',
|
|
75
|
+
name: 'forecastInfo',
|
|
76
|
+
component: () => import('../views/ForecastInfo/index.vue'),
|
|
77
|
+
},
|
|
68
78
|
{
|
|
69
79
|
path: '/executive-management',
|
|
70
80
|
name: 'executiveManagement',
|
package/src/utils/formatters.ts
CHANGED
|
@@ -13,6 +13,23 @@ export const priceFormatter: FormatterFn = (
|
|
|
13
13
|
cellValue,
|
|
14
14
|
) => `¥${Number(cellValue).toLocaleString()}`
|
|
15
15
|
|
|
16
|
+
export function formatThousands(value: unknown, fallback = '') {
|
|
17
|
+
const rawValue = value === null || value === undefined ? '' : String(value).trim()
|
|
18
|
+
if (!rawValue) return fallback
|
|
19
|
+
|
|
20
|
+
const normalizedValue = rawValue.replace(/,/g, '')
|
|
21
|
+
if (!/^-?\d+(\.\d+)?$/.test(normalizedValue)) {
|
|
22
|
+
return rawValue
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const sign = normalizedValue.startsWith('-') ? '-' : ''
|
|
26
|
+
const unsignedValue = sign ? normalizedValue.slice(1) : normalizedValue
|
|
27
|
+
const [integerPart, decimalPart] = unsignedValue.split('.')
|
|
28
|
+
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
|
29
|
+
|
|
30
|
+
return `${sign}${formattedInteger}${decimalPart === undefined ? '' : `.${decimalPart}`}`
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
export const booleanFormatter = (
|
|
17
34
|
truthyText = '启用',
|
|
18
35
|
falsyText = '禁用',
|