htui-yllkbz 1.5.16 → 1.5.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -105442,7 +105442,7 @@ var TimeModes;
105442
105442
  * @Author: hutao
105443
105443
  * @Date: 2022-07-18 15:01:02
105444
105444
  * @LastEditors: hutao
105445
- * @LastEditTime: 2023-01-03 14:20:57
105445
+ * @LastEditTime: 2024-05-30 14:56:32
105446
105446
  */
105447
105447
 
105448
105448
 
@@ -105708,6 +105708,32 @@ var getTimeValues = function getTimeValues(cronExpression) {
105708
105708
  periodUnit: currentPeriodUnit
105709
105709
  };
105710
105710
  };
105711
+ /** 四舍六入五成双 */
105712
+
105713
+ var roundHalfToEven = function roundHalfToEven(num) {
105714
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
105715
+ // 将数字乘以10的precision次方,使其小数点后只剩下需要保留的位数
105716
+ var factor = Math.pow(10, precision);
105717
+ var tempNum = num * factor; // 判断是否需要进位
105718
+
105719
+ var digit = Math.round(tempNum) % 10;
105720
+
105721
+ if (digit >= 5 && digit <= 9) {
105722
+ tempNum = Math.ceil(tempNum); // 进位
105723
+ } else if (digit === 5) {
105724
+ // 检查后一位数字来决定是否进位
105725
+ var nextDigit = Math.floor(tempNum * 10 % 10);
105726
+
105727
+ if (nextDigit > 0) {
105728
+ tempNum = Math.ceil(tempNum); // 进位
105729
+ }
105730
+ } else {
105731
+ tempNum = Math.floor(tempNum); // 直接舍去
105732
+ } // 将结果除以10的precision次方,得到最终舍入后的结果
105733
+
105734
+
105735
+ return tempNum / factor;
105736
+ };
105711
105737
  // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/ts-loader??ref--15-3!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/packages/HtSelectOrg/index.vue?vue&type=script&lang=ts&
105712
105738
 
105713
105739
 
Binary file
package/lib/htui.umd.js CHANGED
@@ -105451,7 +105451,7 @@ var TimeModes;
105451
105451
  * @Author: hutao
105452
105452
  * @Date: 2022-07-18 15:01:02
105453
105453
  * @LastEditors: hutao
105454
- * @LastEditTime: 2023-01-03 14:20:57
105454
+ * @LastEditTime: 2024-05-30 14:56:32
105455
105455
  */
105456
105456
 
105457
105457
 
@@ -105717,6 +105717,32 @@ var getTimeValues = function getTimeValues(cronExpression) {
105717
105717
  periodUnit: currentPeriodUnit
105718
105718
  };
105719
105719
  };
105720
+ /** 四舍六入五成双 */
105721
+
105722
+ var roundHalfToEven = function roundHalfToEven(num) {
105723
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
105724
+ // 将数字乘以10的precision次方,使其小数点后只剩下需要保留的位数
105725
+ var factor = Math.pow(10, precision);
105726
+ var tempNum = num * factor; // 判断是否需要进位
105727
+
105728
+ var digit = Math.round(tempNum) % 10;
105729
+
105730
+ if (digit >= 5 && digit <= 9) {
105731
+ tempNum = Math.ceil(tempNum); // 进位
105732
+ } else if (digit === 5) {
105733
+ // 检查后一位数字来决定是否进位
105734
+ var nextDigit = Math.floor(tempNum * 10 % 10);
105735
+
105736
+ if (nextDigit > 0) {
105737
+ tempNum = Math.ceil(tempNum); // 进位
105738
+ }
105739
+ } else {
105740
+ tempNum = Math.floor(tempNum); // 直接舍去
105741
+ } // 将结果除以10的precision次方,得到最终舍入后的结果
105742
+
105743
+
105744
+ return tempNum / factor;
105745
+ };
105720
105746
  // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/ts-loader??ref--15-3!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/packages/HtSelectOrg/index.vue?vue&type=script&lang=ts&
105721
105747
 
105722
105748
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "htui-yllkbz",
3
- "version": "1.5.16",
3
+ "version": "1.5.17",
4
4
  "port": "8082",
5
5
  "typings": "types/index.d.ts",
6
6
  "main": "lib/htui.common.js",
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2022-07-18 15:01:02
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2023-01-03 14:20:57
7
+ * @LastEditTime: 2024-05-30 14:56:32
8
8
  */
9
9
  import moment from "moment";
10
10
  import { FormValues, TimeModes } from "./type";
@@ -218,3 +218,26 @@ export const getTimeValues = (cronExpression: string) => {
218
218
  const weekDay = +partitions[5] || 1;
219
219
  return { minute, hour, day, month, weekDay, periodUnit: currentPeriodUnit };
220
220
  };
221
+ /** 四舍六入五成双 */
222
+ export const roundHalfToEven = (num: number, precision = 2) => {
223
+ // 将数字乘以10的precision次方,使其小数点后只剩下需要保留的位数
224
+ const factor = Math.pow(10, precision);
225
+ let tempNum = num * factor;
226
+
227
+ // 判断是否需要进位
228
+ const digit = Math.round(tempNum) % 10;
229
+ if (digit >= 5 && digit <= 9) {
230
+ tempNum = Math.ceil(tempNum); // 进位
231
+ } else if (digit === 5) {
232
+ // 检查后一位数字来决定是否进位
233
+ const nextDigit = Math.floor((tempNum * 10) % 10);
234
+ if (nextDigit > 0) {
235
+ tempNum = Math.ceil(tempNum); // 进位
236
+ }
237
+ } else {
238
+ tempNum = Math.floor(tempNum); // 直接舍去
239
+ }
240
+
241
+ // 将结果除以10的precision次方,得到最终舍入后的结果
242
+ return tempNum / factor;
243
+ }