feat(utils): 添加数字格式化工具函数并应用至多个组件

添加 formatDecimal 函数用于格式化小数显示,去除末尾无效0和孤立小数点
在库存管理、采购、出入库等模块中应用该格式化函数,统一数字显示格式
调整仪表盘统计数据的精度显示为整数
优化采购截止日期的显示逻辑,增加状态判断和剩余天数计算
This commit is contained in:
砂糖
2026-01-31 14:39:53 +08:00
parent 42f6f83c3a
commit b4beb49f91
11 changed files with 175 additions and 30 deletions

View File

@@ -39,7 +39,11 @@
<el-table-column label="产品名称" align="center" prop="productName" />
<el-table-column label="产品规格" align="center" prop="spec" />
<el-table-column label="产品型号" align="center" prop="model" />
<el-table-column label="产品单价" align="center" prop="unitPrice" />
<el-table-column label="产品单价" align="center" prop="unitPrice">
<template #default="scope">
{{ formatDecimal(scope.row.unitPrice) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
@@ -95,7 +99,11 @@
<el-table-column label="配料型号" align="center" prop="model" />
<el-table-column label="厂家" align="center" prop="factory" />
<el-table-column label="计量单位" align="center" prop="unit" />
<el-table-column label="现存库存" align="center" prop="currentStock" />
<el-table-column label="现存库存" align="center" prop="currentStock">
<template #default="scope">
{{ formatDecimal(scope.row.currentStock) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
</el-table>
</div>
@@ -109,6 +117,7 @@
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mat/product";
import bom from "@/views/mat/components/bom.vue";
import StickyDragContainer from "@/components/StickyDragContainer/index.vue";
import { formatDecimal } from '@/utils/gear'
const bomOpen = ref(false);