From 6e99373c1c42bb950c911451178942a8808a5c98 Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Thu, 29 May 2025 16:01:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A9=BE=E9=A9=B6=E8=88=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/static.ts | 8 + src/utils/formatTime.ts | 34 +- src/views/cockpit/TerminalLog.vue | 50 +-- src/views/pqs/cockpit/homePage/index.vue | 8 +- .../pqs/cockpit/setUp/components/popup.vue | 34 +- .../pqs/cockpit/setUp/components/popup1.vue | 374 ------------------ .../pqs/cockpit/setUp/components/view.vue | 264 +++++++++++++ src/views/pqs/cockpit/setUp/index.vue | 17 +- .../setting/dictionary/component/add.vue | 13 +- 9 files changed, 383 insertions(+), 419 deletions(-) delete mode 100644 src/views/pqs/cockpit/setUp/components/popup1.vue create mode 100644 src/views/pqs/cockpit/setUp/components/view.vue diff --git a/src/router/static.ts b/src/router/static.ts index 43b2a0c7..4e0a36f1 100644 --- a/src/router/static.ts +++ b/src/router/static.ts @@ -232,6 +232,14 @@ export const adminBaseRoute = { meta: { title: pageTitle('router.popup') } + }, + { + path: 'view', + component: () => import('@/views/pqs/cockpit/setUp/components/view.vue'), + name: '预览项目', + meta: { + title: pageTitle('router.view') + } } ] }, diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index cfd958b1..06a51c40 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -1,5 +1,6 @@ import dayjs from 'dayjs' import type { TableColumnCtx } from 'element-plus' +import { sw } from 'element-plus/es/locale' /** * 日期快捷选项适用于 el-date-picker @@ -328,7 +329,36 @@ export function getDateRange(beginDate: dayjs.ConfigType, endDate: dayjs.ConfigT * 获取当月时间 * @param beginDate 开始日期 * @param endDate 截止日期 + * @param key 1:年 2:季 3:月 4:周 5:日 */ -export function getTimeOfTheMonth(): [string, string] { - return [formatDate(new Date(), 'YYYY-MM') + '-01', formatDate(new Date(), 'YYYY-MM-DD')] +export function getTimeOfTheMonth(key: string): [string, string] { + const now = new Date() + const year = now.getFullYear() + const month = now.getMonth() + + switch (key) { + case '1': // 年 + return [formatDate(new Date(year, 0, 1), 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')] + + case '2': // 季 + const quarterStartMonth = Math.floor(month / 3) * 3 + const quarterEndMonth = quarterStartMonth + 2 + + return [formatDate(new Date(year, quarterStartMonth, 1), 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')] + + case '3': // 月 + return [formatDate(new Date(year, month, 1), 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')] + + case '4': // 周 + const dayOfWeek = now.getDay() // 0是周日 + const diff = now.getDate() - dayOfWeek + (dayOfWeek === 0 ? -6 : 1) // 调整为周一 + const weekStart = new Date(year, month, diff) + return [formatDate(weekStart, 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')] + + case '5': // 日 + return [formatDate(now, 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')] + + default: + throw new Error('Invalid key') + } } diff --git a/src/views/cockpit/TerminalLog.vue b/src/views/cockpit/TerminalLog.vue index 0ea4e991..66566764 100644 --- a/src/views/cockpit/TerminalLog.vue +++ b/src/views/cockpit/TerminalLog.vue @@ -1,26 +1,12 @@ diff --git a/src/views/pqs/cockpit/homePage/index.vue b/src/views/pqs/cockpit/homePage/index.vue index 910bba19..0746d7a7 100644 --- a/src/views/pqs/cockpit/homePage/index.vue +++ b/src/views/pqs/cockpit/homePage/index.vue @@ -1,5 +1,6 @@ - - diff --git a/src/views/pqs/cockpit/setUp/components/view.vue b/src/views/pqs/cockpit/setUp/components/view.vue new file mode 100644 index 00000000..da48949f --- /dev/null +++ b/src/views/pqs/cockpit/setUp/components/view.vue @@ -0,0 +1,264 @@ + + + + + diff --git a/src/views/pqs/cockpit/setUp/index.vue b/src/views/pqs/cockpit/setUp/index.vue index 255cb5b3..baee025f 100644 --- a/src/views/pqs/cockpit/setUp/index.vue +++ b/src/views/pqs/cockpit/setUp/index.vue @@ -42,6 +42,15 @@ > 激活 + + 预览 + { const onSubmitadd = () => { push(`/admin/cockpit/popup`) } - +// 预览 +const preview = (e: any) => { + push(`/admin/cockpit/view?id=${e.id}`) +} // 修改 const editd = (e: any) => { push(`/admin/cockpit/popup?id=${e.id}`) diff --git a/src/views/setting/dictionary/component/add.vue b/src/views/setting/dictionary/component/add.vue index cc937dfc..40fe44df 100644 --- a/src/views/setting/dictionary/component/add.vue +++ b/src/views/setting/dictionary/component/add.vue @@ -23,11 +23,20 @@ + + + + + + + + + -
+
组件展示
@@ -68,6 +78,7 @@ const form = ref({ name: '', sort: 100, system: [], + timeKey: '3', code: '', path: '' })