From 9f3bc47b98cbc51df7cfcea94d4aa0c35f40cbc5 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 13 十月 2026 14:09:06 +0800
Subject: [PATCH] feat: 添加数字格式化工具,支持去掉小数末尾多余的 0 和四舍五入功能
---
src/views/procurementManagement/procurementLedger/index.vue | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 05cd312..61852f4 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -761,6 +761,7 @@
import { modelList, productTreeList } from "@/api/basicData/product.js";
import dayjs from "dayjs";
import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+ import { trimZeros } from "@/utils/formatNumber.js";
const userStore = useUserStore();
@@ -1085,7 +1086,7 @@
};
const formattedNumber = (row, column, cellValue) => {
- return parseFloat(cellValue).toFixed(6);
+ return trimZeros(cellValue, 6);
};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -1205,11 +1206,11 @@
"futureTicketsAmount",
],
{
- taxInclusiveUnitPrice: { decimalPlaces: 6 },
- taxInclusiveTotalPrice: { decimalPlaces: 6 },
- taxExclusiveTotalPrice: { decimalPlaces: 6 },
- ticketsAmount: { decimalPlaces: 6 },
- futureTicketsAmount: { decimalPlaces: 6 },
+ taxInclusiveUnitPrice: { decimalPlaces: 6, trimZeros: true },
+ taxInclusiveTotalPrice: { decimalPlaces: 6, trimZeros: true },
+ taxExclusiveTotalPrice: { decimalPlaces: 6, trimZeros: true },
+ ticketsAmount: { decimalPlaces: 6, trimZeros: true },
+ futureTicketsAmount: { decimalPlaces: 6, trimZeros: true },
ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
}
@@ -1279,8 +1280,8 @@
param,
["contractAmount", "netContractAmount"],
{
- contractAmount: { decimalPlaces: 6 },
- netContractAmount: { decimalPlaces: 6 },
+ contractAmount: { decimalPlaces: 6, trimZeros: true },
+ netContractAmount: { decimalPlaces: 6, trimZeros: true },
}
);
};
@@ -1294,9 +1295,9 @@
"taxExclusiveTotalPrice",
],
{
- taxInclusiveUnitPrice: { decimalPlaces: 6 },
- taxInclusiveTotalPrice: { decimalPlaces: 6 },
- taxExclusiveTotalPrice: { decimalPlaces: 6 },
+ taxInclusiveUnitPrice: { decimalPlaces: 6, trimZeros: true },
+ taxInclusiveTotalPrice: { decimalPlaces: 6, trimZeros: true },
+ taxExclusiveTotalPrice: { decimalPlaces: 6, trimZeros: true },
}
);
};
--
Gitblit v1.9.3