verce-vue-test 0.0.67 → 0.0.69

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/env.d.ts CHANGED
@@ -1 +1,21 @@
1
1
  /// <reference types="vite/client" />
2
+
3
+ declare module 'vue' {
4
+ export interface GlobalComponents {
5
+ ElButtonPro: typeof import('./src/components/ElButtonPro.vue')['default']
6
+ ElFormDialog: typeof import('./src/components/ElFormDialog.vue')['default']
7
+ ElInputThousandth: typeof import('./src/components/ElInputThousandth.vue')['default']
8
+ ElTablePro: typeof import('./src/components/ElTablePro.vue')['default']
9
+ ElUploadButton: typeof import('./src/components/ElUploadButton.vue')['default']
10
+ LoginSuccessNotification: typeof import('./src/components/LoginSuccessNotification.vue')['default']
11
+ NumberRange: typeof import('./src/components/NumberRange.vue')['default']
12
+ WebsiteNoticeTitle: typeof import('./src/components/WebsiteNoticeTitle.vue')['default']
13
+ IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default']
14
+ IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default']
15
+ IconEcosystem: typeof import('./src/components/icons/IconEcosystem.vue')['default']
16
+ IconSupport: typeof import('./src/components/icons/IconSupport.vue')['default']
17
+ IconTooling: typeof import('./src/components/icons/IconTooling.vue')['default']
18
+ }
19
+ }
20
+
21
+ export {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verce-vue-test",
3
- "version": "0.0.67",
3
+ "version": "0.0.69",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -0,0 +1,38 @@
1
+ import type { App, Component } from 'vue'
2
+
3
+ import ElButtonPro from './ElButtonPro.vue'
4
+ import ElFormDialog from './ElFormDialog.vue'
5
+ import ElInputThousandth from './ElInputThousandth.vue'
6
+ import ElTablePro from './ElTablePro.vue'
7
+ import ElUploadButton from './ElUploadButton.vue'
8
+ import LoginSuccessNotification from './LoginSuccessNotification.vue'
9
+ import NumberRange from './NumberRange.vue'
10
+ import WebsiteNoticeTitle from './WebsiteNoticeTitle.vue'
11
+ import IconCommunity from './icons/IconCommunity.vue'
12
+ import IconDocumentation from './icons/IconDocumentation.vue'
13
+ import IconEcosystem from './icons/IconEcosystem.vue'
14
+ import IconSupport from './icons/IconSupport.vue'
15
+ import IconTooling from './icons/IconTooling.vue'
16
+
17
+ const globalComponents: Record<string, Component> = {
18
+ ElButtonPro,
19
+ ElFormDialog,
20
+ ElInputThousandth,
21
+ ElTablePro,
22
+ ElUploadButton,
23
+ LoginSuccessNotification,
24
+ NumberRange,
25
+ WebsiteNoticeTitle,
26
+ IconCommunity,
27
+ IconDocumentation,
28
+ IconEcosystem,
29
+ IconSupport,
30
+ IconTooling,
31
+ }
32
+
33
+ /** 注册 src/components 下的公共组件,页面模板中可直接使用。 */
34
+ export function registerGlobalComponents(app: App) {
35
+ Object.entries(globalComponents).forEach(([name, component]) => {
36
+ app.component(name, component)
37
+ })
38
+ }
package/src/main.ts CHANGED
@@ -6,6 +6,7 @@ import zhCn from 'element-plus/es/locale/lang/zh-cn'
6
6
  import './assets/reset.css'
7
7
 
8
8
  import App from './App.vue'
9
+ import { registerGlobalComponents } from './components'
9
10
  import router from './router'
10
11
 
11
12
  const app = createApp(App)
@@ -13,5 +14,6 @@ const app = createApp(App)
13
14
  app.use(createPinia())
14
15
  app.use(router)
15
16
  app.use(ElementPlus, { locale: zhCn })
17
+ registerGlobalComponents(app)
16
18
 
17
19
  app.mount('#app')
@@ -73,7 +73,7 @@ const router = createRouter({
73
73
  {
74
74
  path: '/forecast-info',
75
75
  name: 'forecastInfo',
76
- component: () => import('../views/ForecastInfo/index.vue'),
76
+ component: () => import('../views/ForecastInfo/RmbPositionSettlement.vue'),
77
77
  },
78
78
  {
79
79
  path: '/executive-management',
@@ -57,8 +57,6 @@
57
57
  <script setup lang="ts">
58
58
  import { ref, reactive, onMounted } from 'vue'
59
59
  import { ElMessage, ElMessageBox } from 'element-plus'
60
- import ElTablePro from '@/components/ElTablePro.vue'
61
- import ElFormDialog from '@/components/ElFormDialog.vue'
62
60
  import type { FormRules } from 'element-plus'
63
61
 
64
62
  type Employee = {
@@ -1,3 +1,13 @@
1
+ <script lang="ts">
2
+ /**
3
+ * Layout + KeepAlive 场景下,路由页必须具有唯一组件名。
4
+ * 主文件使用 index.vue 时,若依赖默认名称会被识别为通用 Index,可能与其他菜单页的缓存规则冲突。
5
+ */
6
+ export default {
7
+ name: 'RmbPositionSettlement',
8
+ }
9
+ </script>
10
+
1
11
  <script setup lang="ts">
2
12
  import { ref, type Component } from 'vue'
3
13
  import { storeToRefs } from 'pinia'
@@ -1,10 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { onBeforeUnmount, onDeactivated, reactive, ref, type Component } from 'vue'
2
+ import { computed, onBeforeUnmount, onDeactivated, reactive, ref, type Component } from 'vue'
3
3
  import { storeToRefs } from 'pinia'
4
4
  import { ElMessage } from 'element-plus'
5
5
  import { Search } from '@element-plus/icons-vue'
6
- import NumberRange, { type RangeValue } from '@/components/NumberRange.vue'
7
- import ElTablePro from '@/components/ElTablePro.vue'
6
+ import type { RangeValue } from '@/components/NumberRange.vue'
8
7
  import { formatThousands } from '@/utils/formatters'
9
8
  import {
10
9
  useForecastInfoStore,
@@ -101,7 +100,31 @@ const flowDrawerVisible = ref(false)
101
100
  /** 页面级 store 保存流水数据,也保存与预报表共享的多选结果。 */
102
101
  const forecastInfoStore = useForecastInfoStore()
103
102
  /** 分页、列表和最近一次查询参数从 Pinia 读取,翻页时不依赖组件局部状态。 */
104
- const { flowRows, flowTotal, flowPage, flowPageSize, flowLoading, flowQueryParams } = storeToRefs(forecastInfoStore)
103
+ const {
104
+ flowRows,
105
+ flowTotal,
106
+ flowPage,
107
+ flowPageSize,
108
+ flowLoading,
109
+ flowQueryParams,
110
+ flowSelectedRows,
111
+ } = storeToRefs(forecastInfoStore)
112
+
113
+ /**
114
+ * 所选流水的轧差金额:收入计正、支出计负。
115
+ * 金额统一保留至分后再展示,避免浮点运算产生无意义的小数位。
116
+ */
117
+ const flowNetAmount = computed(() => {
118
+ const amount = flowSelectedRows.value.reduce((total, row) => {
119
+ const normalizedAmount = Number(String(row.amt ?? '').trim().replace(/,/g, ''))
120
+ if (!Number.isFinite(normalizedAmount)) return total
121
+ if (row.payDirec === '1') return total + normalizedAmount
122
+ if (row.payDirec === '0') return total - normalizedAmount
123
+ return total
124
+ }, 0)
125
+
126
+ return formatThousands(Math.round((amount + Number.EPSILON) * 100) / 100, '0')
127
+ })
105
128
 
106
129
  /**
107
130
  * 关闭流水卡片的更多筛选抽屉。
@@ -262,6 +285,13 @@ function getFlowSequence(index: number) {
262
285
  @selection-change="forecastInfoStore.handleFlowSelectionChange"
263
286
  @pagination-change="handleFlowPaginationChange"
264
287
  >
288
+ <!-- 有选中流水时,在列配置同一行展示实时轧差金额。 -->
289
+ <template v-if="flowSelectedRows.length" #toolbar>
290
+ <div class="forecast-info-flow-net-amount" aria-live="polite">
291
+ <span>轧差金额(元):</span>
292
+ <strong>{{ flowNetAmount }}</strong>
293
+ </div>
294
+ </template>
265
295
  <!-- 勾选列保留行选择状态,事件入口位于 Pinia。 -->
266
296
  <el-table-column
267
297
  type="selection"
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { onBeforeUnmount, onDeactivated, reactive, ref, type Component } from 'vue'
2
+ import { computed, onBeforeUnmount, onDeactivated, reactive, ref, type Component } from 'vue'
3
3
  import { storeToRefs } from 'pinia'
4
4
  import { ElMessage, ElMessageBox } from 'element-plus'
5
5
  import {
@@ -12,8 +12,7 @@ import {
12
12
  Search,
13
13
  Tickets,
14
14
  } from '@element-plus/icons-vue'
15
- import NumberRange, { type RangeValue } from '@/components/NumberRange.vue'
16
- import ElTablePro from '@/components/ElTablePro.vue'
15
+ import type { RangeValue } from '@/components/NumberRange.vue'
17
16
  import { formatThousands } from '@/utils/formatters'
18
17
  import {
19
18
  useForecastInfoStore,
@@ -176,7 +175,7 @@ const modifyForm = reactive({
176
175
  /** 页面级 store 提供跨预报、流水表共享的业务状态与操作。 */
177
176
  const forecastInfoStore = useForecastInfoStore()
178
177
  /** 工具栏按钮仅在至少选择一条预报信息时可用。 */
179
- const { forecastHasSelectedRows } = storeToRefs(forecastInfoStore)
178
+ const { forecastHasSelectedRows, forecastSelectedRows } = storeToRefs(forecastInfoStore)
180
179
  /** 列表、分页、加载状态和匡算弹窗状态均从 Pinia 取值,避免布局切换后丢失。 */
181
180
  const {
182
181
  forecastRows,
@@ -188,6 +187,46 @@ const {
188
187
  calculationDialogVisible,
189
188
  } = storeToRefs(forecastInfoStore)
190
189
 
190
+ /** 将后端金额文本转换为可计算数字,兼容千分位格式。 */
191
+ function parseSummaryAmount(value: unknown) {
192
+ const amount = Number(String(value ?? '').trim().replace(/,/g, ''))
193
+ return Number.isFinite(amount) ? amount : 0
194
+ }
195
+
196
+ /** 汇总金额统一保留至分,并使用千分位展示。 */
197
+ function formatSummaryAmount(value: number) {
198
+ return formatThousands(Math.round((value + Number.EPSILON) * 100) / 100, '0')
199
+ }
200
+
201
+ /** 根据已选预报数据实时计算预报金额及核销金额的收支汇总和轧差。 */
202
+ const forecastSelectionSummary = computed(() => {
203
+ const summary = forecastSelectedRows.value.reduce(
204
+ (result, row) => {
205
+ const isIncome = row.payDirec === '1'
206
+ const isExpense = row.payDirec === '2'
207
+ if (!isIncome && !isExpense) return result
208
+
209
+ const directionKey = isIncome ? 'income' : 'expense'
210
+ result.pred[directionKey] += parseSummaryAmount(row.predAmt)
211
+ result.verified[directionKey] += parseSummaryAmount(row.verifyAmt)
212
+ return result
213
+ },
214
+ {
215
+ pred: { income: 0, expense: 0 },
216
+ verified: { income: 0, expense: 0 },
217
+ },
218
+ )
219
+
220
+ return {
221
+ predIncome: formatSummaryAmount(summary.pred.income),
222
+ predExpense: formatSummaryAmount(summary.pred.expense),
223
+ predNet: formatSummaryAmount(summary.pred.income - summary.pred.expense),
224
+ verifiedIncome: formatSummaryAmount(summary.verified.income),
225
+ verifiedExpense: formatSummaryAmount(summary.verified.expense),
226
+ verifiedNet: formatSummaryAmount(summary.verified.income - summary.verified.expense),
227
+ }
228
+ })
229
+
191
230
  /**
192
231
  * 关闭预报卡片创建的所有临时浮层。
193
232
  *
@@ -403,6 +442,32 @@ function handleForecastPaginationChange(_value: { page: number; pageSize: number
403
442
 
404
443
  <!-- 表格区域占据卡片剩余高度,ElTablePro 管理分页和工具栏。 -->
405
444
  <section class="forecast-info-table-area" aria-label="预报信息列表">
445
+ <div v-if="forecastSelectedRows.length" class="forecast-info-forecast-summary" aria-live="polite">
446
+ <div class="forecast-info-forecast-summary__item">
447
+ <span>预报收入总金额(元)</span>
448
+ <strong>{{ forecastSelectionSummary.predIncome }}</strong>
449
+ </div>
450
+ <div class="forecast-info-forecast-summary__item">
451
+ <span>预报支出总金额(元)</span>
452
+ <strong>{{ forecastSelectionSummary.predExpense }}</strong>
453
+ </div>
454
+ <div class="forecast-info-forecast-summary__item">
455
+ <span>预报轧差金额</span>
456
+ <strong>{{ forecastSelectionSummary.predNet }}</strong>
457
+ </div>
458
+ <div class="forecast-info-forecast-summary__item">
459
+ <span>核销收入总金额</span>
460
+ <strong>{{ forecastSelectionSummary.verifiedIncome }}</strong>
461
+ </div>
462
+ <div class="forecast-info-forecast-summary__item">
463
+ <span>核销支出总金额</span>
464
+ <strong>{{ forecastSelectionSummary.verifiedExpense }}</strong>
465
+ </div>
466
+ <div class="forecast-info-forecast-summary__item">
467
+ <span>核销轧差金额</span>
468
+ <strong>{{ forecastSelectionSummary.verifiedNet }}</strong>
469
+ </div>
470
+ </div>
406
471
  <ElTablePro
407
472
  v-model:page="forecastPage"
408
473
  v-model:page-size="forecastPageSize"
@@ -22,6 +22,7 @@
22
22
  /* 本页抽屉和弹窗的局部 Teleport 目标,不参与卡片网格,也不会覆盖其他路由。 */
23
23
  .forecast-info-overlay-host {
24
24
  position: fixed;
25
+ z-index: 3000;
25
26
  top: 0;
26
27
  left: 0;
27
28
  width: 0;
@@ -320,6 +321,71 @@
320
321
  flex-direction: column;
321
322
  }
322
323
 
324
+ .forecast-info-flow-net-amount {
325
+ display: inline-flex;
326
+ align-items: baseline;
327
+ gap: 2px;
328
+ color: #4a5668;
329
+ font-size: 11px;
330
+ }
331
+
332
+ .forecast-info-flow-net-amount strong {
333
+ color: #24344b;
334
+ font-size: 12px;
335
+ font-variant-numeric: tabular-nums;
336
+ }
337
+
338
+ .forecast-info-forecast-summary {
339
+ display: grid;
340
+ grid-template-columns: repeat(6, minmax(0, 1fr));
341
+ flex: 0 0 auto;
342
+ margin-bottom: 6px;
343
+ overflow: hidden;
344
+ border: 1px solid #e1e7f0;
345
+ border-radius: 5px;
346
+ background: #f7f9fc;
347
+ }
348
+
349
+ .forecast-info-page--horizontal .forecast-info-forecast-summary {
350
+ grid-template-columns: repeat(3, minmax(0, 1fr));
351
+ }
352
+
353
+ .forecast-info-forecast-summary__item {
354
+ display: flex;
355
+ min-width: 0;
356
+ flex-direction: column;
357
+ gap: 1px;
358
+ padding: 4px 8px;
359
+ border-left: 1px solid #e1e7f0;
360
+ color: #4a5668;
361
+ font-size: 11px;
362
+ }
363
+
364
+ .forecast-info-forecast-summary__item:first-child {
365
+ border-left: 0;
366
+ }
367
+
368
+ .forecast-info-page--horizontal .forecast-info-forecast-summary__item:nth-child(4) {
369
+ border-left: 0;
370
+ }
371
+
372
+ .forecast-info-page--horizontal .forecast-info-forecast-summary__item:nth-child(n + 4) {
373
+ border-top: 1px solid #e1e7f0;
374
+ }
375
+
376
+ .forecast-info-forecast-summary__item > span {
377
+ overflow: hidden;
378
+ text-overflow: ellipsis;
379
+ white-space: nowrap;
380
+ }
381
+
382
+ .forecast-info-forecast-summary__item strong {
383
+ color: #24344b;
384
+ font-size: 12px;
385
+ font-weight: 600;
386
+ font-variant-numeric: tabular-nums;
387
+ }
388
+
323
389
  .forecast-info-page .forecast-info-table-area > .el-table-plus > .forecast-info-table {
324
390
  flex: 1 1 auto;
325
391
  min-height: 0;
@@ -50,7 +50,7 @@
50
50
  <script setup lang="ts">
51
51
  import { reactive, ref } from 'vue'
52
52
  import { ElMessage } from 'element-plus'
53
- import NumberRange, { type RangeValue } from '@/components/NumberRange.vue'
53
+ import type { RangeValue } from '@/components/NumberRange.vue'
54
54
 
55
55
  const form = reactive({
56
56
  amountRange: [null, null] as RangeValue,
@@ -267,7 +267,6 @@
267
267
  <script setup lang="ts">
268
268
  import { ref } from 'vue'
269
269
  import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
270
- import ElButtonPro from '../components/ElButtonPro.vue'
271
270
  import {
272
271
  Promotion,
273
272
  OfficeBuilding,
@@ -8,7 +8,6 @@ import {
8
8
  RefreshRight,
9
9
  WarnTriangleFilled,
10
10
  } from '@element-plus/icons-vue'
11
- import WebsiteNoticeTitle from '@/components/WebsiteNoticeTitle.vue'
12
11
 
13
12
  type TodoCountField =
14
13
  | 'cbpsPrediTodoCount'
@@ -73,7 +73,6 @@
73
73
  <script setup lang="ts">
74
74
  import { ref, reactive, onMounted } from 'vue'
75
75
  import { ElMessage, ElMessageBox } from 'element-plus'
76
- import ElTablePro from '@/components/ElTablePro.vue'
77
76
  import { priceFormatter } from '@/utils/formatters'
78
77
 
79
78
  interface ColumnConfig {
@@ -45,7 +45,6 @@
45
45
  <script setup lang="ts">
46
46
  import { ref, reactive, onMounted } from 'vue'
47
47
  import { ElMessage, ElMessageBox } from 'element-plus'
48
- import ElTablePro from '@/components/ElTablePro.vue'
49
48
 
50
49
  const loading = ref(false)
51
50
  const total = ref(0)
@@ -36,7 +36,6 @@
36
36
  <script setup lang="ts">
37
37
  import { reactive } from 'vue'
38
38
  import { ElMessage } from 'element-plus'
39
- import ElInputThousandth from '@/components/ElInputThousandth.vue'
40
39
 
41
40
  const form = reactive({
42
41
  amount: undefined as number | undefined,