From 6789050c488dc2c41fa02f7b664df9f08dac8f7a Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期二, 18 二月 2025 14:23:11 +0800
Subject: [PATCH] var

---
 src/utils/util.ts |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/utils/util.ts b/src/utils/util.ts
index b378009..a317c29 100644
--- a/src/utils/util.ts
+++ b/src/utils/util.ts
@@ -1,4 +1,4 @@
-import { ElMessage, ElMessageBox } from 'element-plus';
+import { ElMessage, ElMessageBox, ElMessageBoxOptions } from 'element-plus';
 import JSONbig from 'json-bigint';
 
 import { storeToRefs } from 'pinia';
@@ -110,8 +110,8 @@
 
 export const getImg = (name) => `src/assets/images/${name}`;
 
-export const downloadJSON = (jsonData: Object, fileName: String) => {
-	const dataStr = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(jsonData));
+export const downloadJSON = (jsonData: string, fileName: String) => {
+	const dataStr = 'data:text/json;charset=utf-8,' + encodeURIComponent(jsonData);
 	const downloadAnchorNode = document.createElement('a');
 	downloadAnchorNode.setAttribute('href', dataStr);
 	downloadAnchorNode.setAttribute('download', fileName + '.json');
@@ -470,6 +470,7 @@
 	const startDate = new Date();
 	startDate.setTime(startDate.getTime() - 3600 * 1000 * 24 * dates);
 	startDate.setHours(0, 0, 0, 0);
+	endDate.setHours(23, 59, 59, 59);
 	return [startDate, endDate];
 };
 
@@ -744,3 +745,18 @@
 	}
 	return decodedData;
 }
+
+export const elConfirm = (
+	message,
+	options: ElMessageBoxOptions = {
+		confirmButtonText: '纭畾',
+		cancelButtonText: '鍙栨秷',
+		type: 'warning',
+	}
+) => {
+	return new Promise((resolve, reject) => {
+		ElMessageBox.confirm(message, '鎻愮ず', options)
+			.then(() => resolve(true))
+			.catch(() => reject(false));
+	});
+};

--
Gitblit v1.9.3