From 92d7e1c399cec9744e52900d1c1fe6487efa3d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=BF=97=E6=B5=A9?= <5601808+su_zhi_hao@user.noreply.gitee.com> Date: Thu, 31 Aug 2023 16:37:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=99=A8=E5=A2=9E=E5=BC=BA-=E6=96=B0=E5=A2=9E=E6=94=AF?= =?UTF-8?q?=E6=8C=81type=3Dnumber?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/plugins/inputSpinner/InputSpinner.js | 50 +++++++++++++++++++ .../resources/templates/index-topnav.html | 1 + .../src/main/resources/templates/index.html | 1 + .../resources/templates/tool/gen/edit.html | 1 + .../src/main/resources/vm/html/add.html.vm | 7 +++ .../src/main/resources/vm/html/edit.html.vm | 7 +++ 6 files changed, 67 insertions(+) create mode 100644 ruoyi-admin/src/main/resources/static/js/plugins/inputSpinner/InputSpinner.js diff --git a/ruoyi-admin/src/main/resources/static/js/plugins/inputSpinner/InputSpinner.js b/ruoyi-admin/src/main/resources/static/js/plugins/inputSpinner/InputSpinner.js new file mode 100644 index 000000000..bfd52d2fb --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/js/plugins/inputSpinner/InputSpinner.js @@ -0,0 +1,50 @@ +/** + * Author and copyright: Stefan Haack (https://shaack.com) + * Repository: https://github.com/shaack/bootstrap-input-spinner + * License: MIT, see file 'LICENSE' + */ + + + // the default editor for parsing and rendering +const I18nEditor = function (props, element) { + const locale = props.locale || "en-US" + + this.parse = function (customFormat) { + const numberFormat = new Intl.NumberFormat(locale) + const thousandSeparator = numberFormat.format(11111).replace(/1/g, '') || '.' + const decimalSeparator = numberFormat.format(1.1).replace(/1/g, '') + return parseFloat(customFormat + .replace(new RegExp(' ', 'g'), '') + .replace(new RegExp('\\' + thousandSeparator, 'g'), '') + .replace(new RegExp('\\' + decimalSeparator), '.') + ) + } + + this.render = function (number) { + const decimals = parseInt(element.getAttribute("data-decimals")) || 0 + const digitGrouping = !(element.getAttribute("data-digit-grouping") === "false") + const numberFormat = new Intl.NumberFormat(locale, { + minimumFractionDigits: decimals, + maximumFractionDigits: decimals, + useGrouping: digitGrouping + }) + return numberFormat.format(number) + } + } + +let triggerKeyPressed = false +const originalVal = $.fn.val +$.fn.val = function (value) { + if (arguments.length >= 1) { + for (let i = 0; i < this.length; i++) { + if (this[i]["bootstrap-input-spinner"] && this[i].setValue) { + const element = this[i] + setTimeout(function () { + element.setValue(value) + }) + } + } + } + return originalVal.apply(this, arguments) +} + diff --git a/ruoyi-admin/src/main/resources/templates/index-topnav.html b/ruoyi-admin/src/main/resources/templates/index-topnav.html index b4e7c4bad..14cbb9a33 100644 --- a/ruoyi-admin/src/main/resources/templates/index-topnav.html +++ b/ruoyi-admin/src/main/resources/templates/index-topnav.html @@ -315,6 +315,7 @@ + diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index b08c4ea39..761389182 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -261,6 +261,7 @@ + diff --git a/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html b/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html index fee2b3604..420c401d6 100644 --- a/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html +++ b/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html @@ -598,6 +598,7 @@ + diff --git a/ruoyi-generator/src/main/resources/vm/html/add.html.vm b/ruoyi-generator/src/main/resources/vm/html/add.html.vm index c64ccd9da..c9c9e5b0b 100644 --- a/ruoyi-generator/src/main/resources/vm/html/add.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/add.html.vm @@ -58,6 +58,13 @@ +#elseif($column.htmlType == "number") +
+ +
+ +
+
#elseif($column.htmlType == "upload")
diff --git a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm index cddfe1d68..365475e59 100644 --- a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm @@ -58,6 +58,13 @@
+#elseif($column.htmlType == "number") +
+ +
+ +
+
#elseif($column.htmlType == "upload")
From 068e47128c7d978bcd1d2fb50541da7406ba00a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=BF=97=E6=B5=A9?= <5601808+su_zhi_hao@user.noreply.gitee.com> Date: Thu, 31 Aug 2023 16:55:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E6=BC=94=E7=A4=BA-?= =?UTF-8?q?=E8=A1=A8=E5=8D=95-=E5=9F=BA=E6=9C=AC=E8=A1=A8=E5=8D=95-?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=B0=E5=AD=97=E6=A1=86demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/templates/demo/form/basic.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/basic.html b/ruoyi-admin/src/main/resources/templates/demo/form/basic.html index 0bfef4a81..0fe215904 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/form/basic.html +++ b/ruoyi-admin/src/main/resources/templates/demo/form/basic.html @@ -536,6 +536,14 @@
+
+ + +
+ +
+
+
From 45ece6653642159dd37073af657772691fb35b18 Mon Sep 17 00:00:00 2001 From: suzhihao Date: Sat, 16 Sep 2023 08:01:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?add/edit.html.vm=E6=A0=BC=E5=BC=8F=E7=BC=A9?= =?UTF-8?q?=E8=BF=9B=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/vm/html/add.html.vm | 12 ++++++------ .../src/main/resources/vm/html/edit.html.vm | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/html/add.html.vm b/ruoyi-generator/src/main/resources/vm/html/add.html.vm index c9c9e5b0b..634fbf9a3 100644 --- a/ruoyi-generator/src/main/resources/vm/html/add.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/add.html.vm @@ -59,12 +59,12 @@
#elseif($column.htmlType == "number") -
- -
- -
-
+
+ +
+ +
+
#elseif($column.htmlType == "upload")
diff --git a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm index 365475e59..c6b5824d4 100644 --- a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm @@ -59,12 +59,12 @@
#elseif($column.htmlType == "number") -
- -
- -
-
+
+ +
+ +
+
#elseif($column.htmlType == "upload")