From 58098e654240c7889dfa47c58f5bec213124d823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E6=9D=B0=E5=88=9A?= <1543758718@qq.com> Date: Tue, 25 Nov 2025 21:00:46 +0800 Subject: [PATCH] commit --- src/common/utils/datetime.ts | 40 +++ src/pages/dashboard/components/Editor.vue | 27 +- .../miningWorkshopDailyreport.vue | 333 ++++++++++++------ 3 files changed, 293 insertions(+), 107 deletions(-) diff --git a/src/common/utils/datetime.ts b/src/common/utils/datetime.ts index 563b95f..049e9a1 100644 --- a/src/common/utils/datetime.ts +++ b/src/common/utils/datetime.ts @@ -23,3 +23,43 @@ export function getSpecificDate(val: Date) { (endD < 10 ? "0" + endD : endD); return enddate; } +// 将时间转为年月日 +export function formatDateToChinese(dateString: any) { + const date = new Date(dateString); + const year = date.getFullYear(); + const month = date.getMonth() + 1; // 月份从0开始,需要+1 + const day = date.getDate(); + + return `${year}年${month}月${day}日`; + +} + +// 中文转英文函数 +export function formatChineseToEnglish(chineseDate: any) { + // 使用正则表达式提取年、月、日 + const match = chineseDate.match(/(\d{4})年(\d{1,2})月(\d{1,2})日/); + console.log(match); + + if (!match) { + throw new Error('日期格式不正确'); + } + + const year = parseInt(match[1]); + const month = parseInt(match[2]) - 1; // 月份从0开始,需要-1 + const day = parseInt(match[3]); + + const date = new Date(year, month, day); + + // 星期名称数组 + const weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; + // 月份名称数组 + const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + + const weekday = weekdays[date.getDay()]; + const monthName = months[date.getMonth()]; + + // 格式化日期部分,确保日为两位数 + const formattedDay = day < 10 ? '0' + day : day; + + return `${weekday} ${monthName} ${formattedDay} ${year} 00:00:00 GMT+0800`; +} diff --git a/src/pages/dashboard/components/Editor.vue b/src/pages/dashboard/components/Editor.vue index 6f9dae3..50dc5cc 100644 --- a/src/pages/dashboard/components/Editor.vue +++ b/src/pages/dashboard/components/Editor.vue @@ -116,7 +116,7 @@ export default {
12
@@ -126,7 +126,7 @@ export default {
0
@@ -136,7 +136,7 @@ export default {
0
@@ -146,7 +146,7 @@ export default {
0
@@ -176,7 +176,7 @@ export default { height: 100%; .function-bar { display: flex; - height: 30%; + height: 20%; margin: 10px; i { font-size: 36px; @@ -201,14 +201,29 @@ export default { } .one-box { margin-left: 0; + background: linear-gradient( + 135deg, + #c7e9fb, + #a6defa, + #80d4f9, + #5bc9f8, + #35bef7 + ); + } + .two-box { + background: linear-gradient(135deg, #f6d365, #fda085); + } + .three-box { + background: linear-gradient(135deg, #f69165, #f14115); } .four-box { margin-right: 0; + background: linear-gradient(135deg, #65e0f6, #0abbec); } } .echarts-bar { display: flex; - height: 65%; + height: 70%; // /* 卡片样式 */ .card { width: 50%; diff --git a/src/pages/demo/miningModule/miningWorkshopDailyreport.vue b/src/pages/demo/miningModule/miningWorkshopDailyreport.vue index 582291f..ceb5da4 100644 --- a/src/pages/demo/miningModule/miningWorkshopDailyreport.vue +++ b/src/pages/demo/miningModule/miningWorkshopDailyreport.vue @@ -1,63 +1,154 @@ -