🎨新增客户端离线通知选项配置以及监听任务

This commit is contained in:
2024-06-13 14:34:03 +08:00
parent 67f394f136
commit 6f249d20b0
18 changed files with 155 additions and 132 deletions

View File

@@ -1,9 +1,11 @@
<script setup lang="ts">
import {
deleteClient,
downloadClient, generateClientIP,
downloadClient,
generateClientIP,
getClients,
saveClient
saveClient,
sendMail
} from "@/api/clients";
import { h, reactive, ref } from "vue";
import { addDialog } from "@/components/ReDialog/index";
@@ -14,6 +16,7 @@ import "plus-pro-components/es/components/search/style/css";
import { storageLocal } from "@pureadmin/utils";
import { ArrowDown } from "@element-plus/icons-vue";
import { ElMessageBox } from "element-plus";
import { message } from "@/utils/message";
defineOptions({
// name 作为一种规范最好必须写上并且和路由的name保持一致
@@ -151,7 +154,7 @@ const openAddClientDialog = () => {
}
});
const serverInfo = storageLocal().getItem("server-info");
const restartRule = storageLocal().getItem("restart-rule") ? 1 : 0;
const restartRule = !storageLocal().getItem("restart-rule") ? 1 : 0;
addDialog({
width: "40%",
title: "新增",
@@ -174,7 +177,8 @@ const openAddClientDialog = () => {
publicKey: "",
presharedKey: ""
},
enabled: 1
enabled: 1,
offlineMonitoring: 0
}
},
beforeSure: (done, { options }) => {
@@ -213,7 +217,8 @@ const openEditClientDialog = (client?: any) => {
useServerDNS: client.useServerDNS,
enableAfterCreation: client.enableAfterCreation,
keys: client.keys,
enabled: Number(client.enabled)
enabled: Number(client.enabled),
offlineMonitoring: client.offlineMonitoring
}
},
beforeSure: (done, { options }) => {
@@ -279,6 +284,15 @@ const ellipsis = (str: string) => {
return str;
};
// 发送到邮件
const sendToEmail = (clientID: string) => {
sendMail(clientID).then(res => {
if (res.code === 200) {
message("发送邮件成功", { type: "success" });
}
});
};
getClientsApi(clientSearchForm.value);
</script>
@@ -309,7 +323,10 @@ getClientsApi(clientSearchForm.value);
</div>
<div class="content">
<el-card body-style="padding: inherit" shadow="hover">
<div class="flex flex-wrap gap-4" style="display: flex;justify-content: center;">
<div
class="flex flex-wrap gap-4"
style="display: flex; justify-content: center"
>
<el-card
v-for="val in clientsList.data"
style="float: left; width: 500px"
@@ -338,6 +355,11 @@ getClientsApi(clientSearchForm.value);
>下载</el-button
>
</el-dropdown-item>
<el-dropdown-item>
<el-button type="success" @click="sendToEmail(val.id)"
>邮件</el-button
>
</el-dropdown-item>
<el-dropdown-item>
<el-button
type="danger"
@@ -418,7 +440,10 @@ getClientsApi(clientSearchForm.value);
</el-form>
</el-card>
</div>
<div class="paginate" style="background-color: #ffffff; margin-top: 5px">
<div
class="paginate"
style="background-color: #ffffff; margin-top: 5px"
>
<el-card>
<el-pagination
small