From 7dba00a80cee072bc9e193d5d2a75c1f7cf72d28 Mon Sep 17 00:00:00 2001 From: gaoluyang <gaoluyang@rengu.cc> Date: 星期四, 04 七月 2024 10:51:41 +0800 Subject: [PATCH] 表格输入框转换为科学计数法 --- src/main.js | 3 +++ src/components/do/b1-inspect-order-plan/Inspection.vue | 6 +++++- 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue index 9e6591a..110e6cb 100644 --- a/src/components/do/b1-inspect-order-plan/Inspection.vue +++ b/src/components/do/b1-inspect-order-plan/Inspection.vue @@ -1991,7 +1991,11 @@ return sum }, handleInput (n) { - n.v.v = n.v.v.replace(/[^\d.^]/g, ''); + if (n.v.v > 10000) { + let num2 = new this.$Big(n.v.v) + n.v.v = num2.toExponential() + } + n.v.v = n.v.v.replace(/[^\d.^e]/g, ''); }, getInspectionItemType(id) { for (var a in this.currentSample.insProduct) { diff --git a/src/main.js b/src/main.js index b63c198..c684668 100644 --- a/src/main.js +++ b/src/main.js @@ -10,6 +10,9 @@ import axios from 'axios' import api from './assets/api/controller.js' import swal from 'sweetalert' +import Big from 'big.js' + +Vue.prototype.$Big = Big; // 椤圭洰鍒囨崲 Vue.prototype.PROJECT = '妫�娴嬩腑蹇�' -- Gitblit v1.9.3