From ad208889ad6ca2283a06d7bc440ecd289c535d83 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 03 四月 2025 17:26:29 +0800
Subject: [PATCH] 1. 添加显示问题整改的时间; 2. 新增巡查场景数、巡查点次、复查点次的统计; 3. 添加扬尘监测数据统计结果管理(待完成)

---
 src/utils/time-util.js |   46 +++++++++++++++++++++++++++++++---------------
 1 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/src/utils/time-util.js b/src/utils/time-util.js
index 951116b..dec4073 100644
--- a/src/utils/time-util.js
+++ b/src/utils/time-util.js
@@ -1,39 +1,55 @@
-import dayjs from "dayjs";
+import dayjs from 'dayjs';
 
 export default {
   format(date, template) {
-    return dayjs(date).format(template)
+    return dayjs(date).format(template);
   },
 
-  formatH(date){
+  formatH(date) {
     if (date) {
-      return this.format(date, 'HH:mm:ss')
+      return this.format(date, 'HH:mm:ss');
     } else {
-      return '--:--:--'
+      return '--:--:--';
     }
   },
 
-  formatYM(date){
+  formatYM(date) {
     if (date) {
-      return this.format(date, 'YYYY-MM')
+      return this.format(date, 'YYYY-MM');
     } else {
-      return '----/--'
+      return '----/--';
     }
   },
 
-  formatYMD(date){
+  formatYMD(date) {
     if (date) {
-      return this.format(date, 'YYYY-MM-DD')
+      return this.format(date, 'YYYY-MM-DD');
     } else {
-      return '----/--/--'
+      return '----/--/--';
     }
   },
 
-  formatYMDH(date){
+  formatYMDH(date) {
     if (date) {
-      return this.format(date, 'YYYY-MM-DD HH:mm:ss')
+      return this.format(date, 'YYYY-MM-DD HH:mm:ss');
     } else {
-      return '----/--/-- --:--:--'
+      return '----/--/-- --:--:--';
     }
   },
-}
\ No newline at end of file
+
+  formatDateFromExcel(num, format) {
+    const old = num - 1;
+    const t = Math.round((old - Math.floor(old)) * 24 * 60 * 60);
+    const time = new Date(1900, 0, old, 0, 0, t);
+    const year = time.getFullYear();
+    const month = time.getMonth() + 1;
+    const date = time.getDate();
+    return (
+      year +
+      format +
+      (month < 10 ? '0' + month : month) +
+      format +
+      (date < 10 ? '0' + date : date)
+    );
+  }
+};

--
Gitblit v1.9.3