feat(monitor): ✨ 新增暂停1小时监测功能
This commit is contained in:
parent
305fcfae06
commit
aa01a63fcd
|
|
@ -32,7 +32,12 @@ export function useTray() {
|
||||||
const { addLog } = useLogStore();
|
const { addLog } = useLogStore();
|
||||||
const monitorStore = useMonitorStore();
|
const monitorStore = useMonitorStore();
|
||||||
const { isMonitoring, isPostponed, ticketCounts } = storeToRefs(monitorStore);
|
const { isMonitoring, isPostponed, ticketCounts } = storeToRefs(monitorStore);
|
||||||
const { startMonitoring, stopMonitoring } = monitorStore;
|
const {
|
||||||
|
startMonitoring,
|
||||||
|
stopMonitoring,
|
||||||
|
postponeMonitoring,
|
||||||
|
resumeMonitoring,
|
||||||
|
} = monitorStore;
|
||||||
const appName = import.meta.env.VITE_APP_NAME;
|
const appName = import.meta.env.VITE_APP_NAME;
|
||||||
// 当前托盘图标实例,null 表示尚未初始化
|
// 当前托盘图标实例,null 表示尚未初始化
|
||||||
let trayIconInstance: TrayIcon | null = null;
|
let trayIconInstance: TrayIcon | null = null;
|
||||||
|
|
@ -201,6 +206,22 @@ export function useTray() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
await MenuItem.new({
|
||||||
|
id: "pause_1h",
|
||||||
|
text: "暂停1小时",
|
||||||
|
enabled: isMonitoring.value && !isPostponed.value,
|
||||||
|
action: () => {
|
||||||
|
postponeMonitoring();
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
await MenuItem.new({
|
||||||
|
id: "resume_monitor",
|
||||||
|
text: "恢复监测",
|
||||||
|
enabled: isMonitoring.value && isPostponed.value,
|
||||||
|
action: () => {
|
||||||
|
resumeMonitoring();
|
||||||
|
},
|
||||||
|
}),
|
||||||
await MenuItem.new({
|
await MenuItem.new({
|
||||||
id: "open_website",
|
id: "open_website",
|
||||||
text: "打开工单网站",
|
text: "打开工单网站",
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,16 @@ import {
|
||||||
BellOutlined,
|
BellOutlined,
|
||||||
WifiOutlined,
|
WifiOutlined,
|
||||||
ClockCircleOutlined,
|
ClockCircleOutlined,
|
||||||
|
PauseCircleOutlined,
|
||||||
|
PlayCircleOutlined,
|
||||||
|
LinkOutlined,
|
||||||
} from "@ant-design/icons-vue";
|
} from "@ant-design/icons-vue";
|
||||||
|
import { openUrl } from "@tauri-apps/plugin-opener";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import duration from "dayjs/plugin/duration";
|
import duration from "dayjs/plugin/duration";
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
import { ref, onMounted, onUnmounted } from "vue";
|
||||||
import { useTray } from "@/composables/useTray";
|
import { useTray } from "@/composables/useTray";
|
||||||
|
import { CRM_URL } from "@/constants/app";
|
||||||
import { useMonitorStore } from "@/stores/monitor";
|
import { useMonitorStore } from "@/stores/monitor";
|
||||||
import { useNetworkStore } from "@/stores/network";
|
import { useNetworkStore } from "@/stores/network";
|
||||||
|
|
||||||
|
|
@ -31,6 +36,10 @@ async function handleMinimizeToTray() {
|
||||||
await minimizeToTray();
|
await minimizeToTray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleOpenCrmWebsite() {
|
||||||
|
await openUrl(CRM_URL);
|
||||||
|
}
|
||||||
|
|
||||||
const countdown = ref("");
|
const countdown = ref("");
|
||||||
let countdownTimer: ReturnType<typeof setInterval> | null = null;
|
let countdownTimer: ReturnType<typeof setInterval> | null = null;
|
||||||
|
|
||||||
|
|
@ -107,12 +116,35 @@ onUnmounted(() => {
|
||||||
</template>
|
</template>
|
||||||
手动检查
|
手动检查
|
||||||
</a-button>
|
</a-button>
|
||||||
|
<a-button :disabled="!store.isMonitoring || store.isPostponed" @click="store.postponeMonitoring()">
|
||||||
|
<template #icon>
|
||||||
|
<PauseCircleOutlined />
|
||||||
|
</template>
|
||||||
|
暂停1小时
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
:disabled="!store.isMonitoring || !store.isPostponed"
|
||||||
|
type="primary"
|
||||||
|
ghost
|
||||||
|
@click="store.resumeMonitoring()"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<PlayCircleOutlined />
|
||||||
|
</template>
|
||||||
|
恢复监测
|
||||||
|
</a-button>
|
||||||
<a-button @click="networkStore.checkNetworkStatus()">
|
<a-button @click="networkStore.checkNetworkStatus()">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<WifiOutlined />
|
<WifiOutlined />
|
||||||
</template>
|
</template>
|
||||||
网络检测
|
网络检测
|
||||||
</a-button>
|
</a-button>
|
||||||
|
<a-button @click="handleOpenCrmWebsite()">
|
||||||
|
<template #icon>
|
||||||
|
<LinkOutlined />
|
||||||
|
</template>
|
||||||
|
打开工单网站
|
||||||
|
</a-button>
|
||||||
<a-button @click="store.testNotification()">
|
<a-button @click="store.testNotification()">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<BellOutlined />
|
<BellOutlined />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue