From a969126ac530da96b1edb02152db87f0ad317f6e Mon Sep 17 00:00:00 2001
From: zmc <zmc_li@foxmail.com>
Date: 星期三, 22 十一月 2023 13:20:17 +0800
Subject: [PATCH] 1. 传递相对路径 2.使用循环展示异常卡片 3.飞行巡检写成组件
---
src/utils/common.js | 39 ++++++++++++++++++++++++++++-----------
1 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/utils/common.js b/src/utils/common.js
index d105ca4..f88dfe1 100644
--- a/src/utils/common.js
+++ b/src/utils/common.js
@@ -6,6 +6,7 @@
* @createTime:2023-08-18
* @returns锛氳秴杩囦竴涓湀杩斿洖true,涓嶈秴杩囦竴涓湀鍒欒繑鍥瀎alse
*/
+
function isExceedOneMonth(dateStr1, dateStr2) {
// 瓒呰繃涓�涓湀锛岃繑鍥濼rue锛屽惁鍒欒繑鍥濬alse
// 灏嗘棩鏈熷瓧绗︿覆杞负鏃ユ湡瀵硅薄
@@ -20,7 +21,6 @@
const year2 = date2.getFullYear();
const month2 = date2.getMonth();
const day2 = date2.getDate();
- console.log(month1, month2);
// 鍒ゆ柇涓や釜鏃ユ湡鏄惁鐩稿樊涓�涓湀
if (year1 === year2) {
@@ -48,8 +48,8 @@
return false;
}
- /**
- * description锛氱櫨鍒嗗彿姣旇緝澶у皬
+ /**
+ * 鐧惧垎鍙锋瘮杈冨ぇ灏�
* @param锛� a鏄惁澶т簬b
* @returns锛氬ぇ浜庯紝鍒欒繑鍥瀟rue銆傚惁鍒欒繑鍥瀎alse
*/
@@ -57,7 +57,7 @@
return Number(a.replace('%', '')) >= Number(b.replace('%', ''));
}
- /**
+ /**
*瀵煎嚭涓篹xcel
* @param锛� 琛ㄦ牸鏁版嵁锛屽緟瀵煎嚭鐨勮〃鏍煎垪锛宔xcel鍒楋紝excel鏂囦欢鍚�
* @returns
@@ -73,12 +73,6 @@
// 鍒涘缓xlsx瀵硅薄
const xls = XLSX.utils.json_to_sheet(itemsFormatted);
- // xls['A1'].v = '璁惧缂栧彿';
- // xls['B1'].v = '寮傚父绫诲瀷';
- // xls['C1'].v = '鍦板尯';
- // xls['D1'].v = '寮�濮嬫椂闂�';
- // xls['E1'].v = '缁撴潫鏃堕棿';
-
// 缂栬緫琛ㄥご琛� 淇敼琛ㄥご
excelColumnsName.forEach(item =>{
xls[item[0]].v = item[1]
@@ -91,6 +85,29 @@
}
- return {isExceedOneMonth,cmpp,exportToExcel}
+ /**
+ * description锛氳繑鍥炴椂闂存暟缁勶紝闂撮殧15鍒嗛挓銆�
+ * @param锛� 寮傚父鐨勫紑濮�,寮傚父缁撴潫鏃堕棿
+ * @createTime:2023-08-17
+ * @returns锛氭瘮濡�12:00:00-13:00:00 鎵�浠ヨ繑鍥炵殑鏁扮粍鍏冪礌鏄� 12:00:00 ,12:15:00,12:30:00,12:45:00锛�13:00:00
+ */
+ function descFiftyTime(begin, end) {
+ let time = [];
+ if (begin == end) {
+ time.push(begin);
+ return time;
+ }
+ time.push(begin);
+ let temp = dayjs(begin).add(15, 'minute').format('YYYY-MM-DD HH:mm:ss');
+ while (temp != end) {
+ time.push(temp);
+ temp = dayjs(temp).add(15, 'minute').format('YYYY-MM-DD HH:mm:ss');
+ }
+ // 鍔犱笂寮傚父鐨勭粨鏉熸椂闂�
+ time.push(temp);
+ return time;
+ }
+
+ return {isExceedOneMonth,cmpp,exportToExcel,descFiftyTime}
}
--
Gitblit v1.9.3