From 3471eeaf92a2ea32aa06ddfb231ee6c6d8b60bad Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 01 十二月 2025 08:41:12 +0800
Subject: [PATCH] 新增监管任务界面巡查人员统计信息
---
src/utils/time-util.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/utils/time-util.js b/src/utils/time-util.js
index e126941..cac41e8 100644
--- a/src/utils/time-util.js
+++ b/src/utils/time-util.js
@@ -29,7 +29,15 @@
}
},
- formatYMDH(date) {
+ formatYMDHM(date) {
+ if (date) {
+ return this.format(date, 'YYYY-MM-DD HH:mm');
+ } else {
+ return '----/--/-- --:--';
+ }
+ },
+
+ formatYMDHMS(date) {
if (date) {
return this.format(date, 'YYYY-MM-DD HH:mm:ss');
} else {
@@ -51,5 +59,47 @@
format +
(date < 10 ? '0' + date : date)
);
+ },
+
+ /**
+ * 灏嗙鏁拌浆鎹负涓枃鎻忚堪鏍煎紡
+ * @param {number} seconds - 绉掓暟
+ * @returns {string} 涓枃鏃堕棿鎻忚堪
+ */
+ formatSecondsToChinese(seconds) {
+ if (!seconds || seconds < 0 || isNaN(seconds)) {
+ return '--';
+ }
+
+ // 瀹氫箟鏃堕棿鍗曚綅鍜屽搴旂殑绉掓暟
+ const units = [
+ { unit: '澶�', value: 24 * 60 * 60 },
+ { unit: '灏忔椂', value: 60 * 60 },
+ { unit: '鍒�', value: 60 },
+ { unit: '绉�', value: 1 }
+ ];
+
+ let remainingSeconds = Math.floor(seconds);
+ let result = '';
+
+ // 閬嶅巻鏃堕棿鍗曚綅锛岃绠楁瘡涓崟浣嶇殑鏁伴噺
+ for (const { unit, value } of units) {
+ if (remainingSeconds >= value) {
+ const count = Math.floor(remainingSeconds / value);
+ result += `${count}${unit}`;
+ remainingSeconds %= value;
+
+ // // 濡傛灉鍓╀綑绉掓暟涓�0锛屼笖宸茬粡鏈夌粨鏋滐紝灏卞彲浠ョ粨鏉熶簡
+ // if (remainingSeconds === 0 && result) {
+ // break;
+ // }
+ // 濡傛灉宸茬粡鏈夌粨鏋滐紝灏卞彲浠ョ粨鏉熶簡
+ if (result) {
+ break;
+ }
+ }
+ }
+
+ return result;
}
-};
+};
\ No newline at end of file
--
Gitblit v1.9.3