From 446fa9a0d14e8d9c3d92563ea002606acaf56457 Mon Sep 17 00:00:00 2001 From: juzi <819872918@qq.com> Date: Fri, 25 Apr 2025 10:33:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=9B=91=E6=8E=A7=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/filter/code-filter.js | 2 +- src/main.js | 2 + src/utils/ruoyi.js | 12 +++ .../dataBoard/components/CenterBottomL.vue | 33 ++++++-- .../dataBoard/components/CenterBottomR.vue | 23 +++++- .../base/dataBoard/components/CenterTop.vue | 53 ++++++++++--- .../base/dataBoard/components/Header.vue | 8 +- .../base/dataBoard/components/LeftBottom.vue | 77 ++++++++++++++----- .../base/dataBoard/components/LeftTop.vue | 38 ++++++--- .../base/dataBoard/components/RightBottom.vue | 76 +++++++++++------- .../base/dataBoard/components/RightTop.vue | 75 +++++++++++------- src/views/base/dataBoard/index.vue | 69 +++++++++++++++-- 12 files changed, 354 insertions(+), 114 deletions(-) diff --git a/src/filter/code-filter.js b/src/filter/code-filter.js index 003d2792..1488f5e5 100644 --- a/src/filter/code-filter.js +++ b/src/filter/code-filter.js @@ -91,4 +91,4 @@ export default function (dictTable) { return function (val) { return table?.[dictTable]?.[val] } -} +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index eb160008..752a78f2 100644 --- a/src/main.js +++ b/src/main.js @@ -21,6 +21,7 @@ import { handleTree, addBeginAndEndTime, divide, + formatThousands } from '@/utils/ruoyi'; import Pagination from '@/components/Pagination'; // 自定义表格工具扩展 @@ -45,6 +46,7 @@ Vue.prototype.resetForm = resetForm; Vue.prototype.getDictDatas = getDictDatas; Vue.prototype.getDictDatas2 = getDictDatas2; Vue.prototype.getDictDataLabel = getDictDataLabel; +Vue.prototype.formatThousands = formatThousands; Vue.prototype.DICT_TYPE = DICT_TYPE; Vue.prototype.handleTree = handleTree; Vue.prototype.addBeginAndEndTime = addBeginAndEndTime; diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js index 7df60e4b..8e45a986 100644 --- a/src/utils/ruoyi.js +++ b/src/utils/ruoyi.js @@ -295,3 +295,15 @@ export function getPath(path) { } return Math.floor(divisor/dividend*100)/100; } + +// 通用千分位格式化函数 +export function formatThousands(value) { + if (value === null || value === undefined) return '0' + + // 清理已有逗号并转为数字 + const numValue = Number(String(value).replace(/,/g, '')) + if (isNaN(numValue)) return '0' + + // 支持小数处理 + return numValue.toLocaleString('en-US') +} \ No newline at end of file diff --git a/src/views/base/dataBoard/components/CenterBottomL.vue b/src/views/base/dataBoard/components/CenterBottomL.vue index d09e7ceb..9b026dbd 100644 --- a/src/views/base/dataBoard/components/CenterBottomL.vue +++ b/src/views/base/dataBoard/components/CenterBottomL.vue @@ -7,18 +7,20 @@

总投入片数 - -18% - + {{monthData?.inputNumChange || '-'}}% + +

-

261,938,984

+

{{monthData?.inputNum ? formatThousands(monthData.inputNum) : '-'}}

总生产片数 - +18% - + {{monthData?.outputNumChange || '-'}}% + +

-

82,261,938,984

+

{{monthData?.outputNum ? formatThousands(monthData.outputNum) : '-'}}

@@ -26,8 +28,25 @@