From 744ddc3550c2bdbe61f7326e4ab7c00dfa3ac51f Mon Sep 17 00:00:00 2001
From: yaozc <unbelievers@yeah.net>
Date: Tue, 21 Feb 2023 03:43:24 +0000
Subject: [PATCH] Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into yaozc

---
 eladmin-web-master/src/components/Crud/crud.js |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/eladmin-web-master/src/components/Crud/crud.js b/eladmin-web-master/src/components/Crud/crud.js
index 146cfc8..bfe0be2 100644
--- a/eladmin-web-master/src/components/Crud/crud.js
+++ b/eladmin-web-master/src/components/Crud/crud.js
@@ -560,6 +560,20 @@
       }
     },
     /**
+     * 月日格式化
+     * @param {Object} timestamp 时间戳
+     */
+    toMonthDay(timestamp) {
+      if (timestamp == null) {
+        return
+      } else {
+        const system = new Date(timestamp)
+        const month = system.getMonth() + 1 < 10 ? '0' + (system.getMonth() + 1) : system.getMonth() + 1
+        const date = system.getDate() < 10 ? '0' + system.getDate() : system.getDate()
+        return month + '-' + date
+      }
+    },
+    /**
      * 时间格式化
      * @param {Object} timestamp
      */
@@ -590,6 +604,15 @@
       if (cents < 10) { cents = '0' + cents }
       for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) { num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3)) }
       return (((sign) ? '' : '-') + num + '.' + cents)
+    },
+    /**
+     * 最大两位小数格式
+     * @param {Object} num
+     */
+    toMaxTwoDecimalPlaces(num) {
+      const numList = num.toString().split('.')
+      num = numList.length > 1 ? numList[1].length > 1 ? num.toFixed(2) : num : num
+      return num
     }
   }
   const crud = Object.assign({}, data)

--
Gitblit v1.9.3