diff --git a/src/api/tool.js b/src/api/tool.js
index bf5a90b..c7c3f57 100644
--- a/src/api/tool.js
+++ b/src/api/tool.js
@@ -46,4 +46,24 @@ export const GetFileInfoByMd5Service = (Data) => {
'token': Data.token,
}
})
+}
+
+export const GetMonitorDeviceInfoService = (Data) => {
+ return request.get('/tool/get_monitor_list')
+}
+
+export const UpdateMonitorDeviceInfoService = (Data) => {
+ return request.post('/tool/update_monitor', Data,{
+ headers: {
+ 'token': Data.token, // 闂佽绻愭蹇涘箯閿燂拷 token 闂備礁鎼ú锔锯偓绗涘啰鏆﹂柛娆忣槺閳绘棃鏌i幋鐏活亝绂嶉崼鏇熺厽闁靛ǹ鍎遍褔鏌熼煬鎻掆偓婵嬪箖瑜忔禒锔炬喆閿濆懍澹曢梺璺ㄥ櫐閹凤拷
+ }
+ })
+}
+
+export const DelMonitorDeviceInfoService = (Data) => {
+ return request.post('/tool/del_monitor', Data,{
+ headers: {
+ 'token': Data.token, // 闂佽绻愭蹇涘箯閿燂拷 token 闂備礁鎼ú锔锯偓绗涘啰鏆﹂柛娆忣槺閳绘棃鏌i幋鐏活亝绂嶉崼鏇熺厽闁靛ǹ鍎遍褔鏌熼煬鎻掆偓婵嬪箖瑜忔禒锔炬喆閿濆懍澹曢梺璺ㄥ櫐閹凤拷
+ }
+ })
}
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 55ae99c..47c7288 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -17,6 +17,7 @@ import Shell from "@/views/ShellList.vue"
import callback from "@/views/callback.vue";
import projectSelect from "@/views/project-select.vue";
+
const routes = [
{
path: '/login',
diff --git a/src/views/ShellList.vue b/src/views/ShellList.vue
index b27f815..2466d4f 100644
--- a/src/views/ShellList.vue
+++ b/src/views/ShellList.vue
@@ -7,6 +7,9 @@ import { getConfigShellListService } from "@/api/shell.js";
import { addConfigShellService } from "@/api/shell.js";
import { deleteConfigShellService } from "@/api/shell.js";
import { updateConfigShellService } from "@/api/shell.js";
+import { GetMonitorDeviceInfoService } from "@/api/tool.js";
+import { UpdateMonitorDeviceInfoService } from "@/api/tool.js";
+import { DelMonitorDeviceInfoService } from "@/api/tool.js";
export default {
data() {
@@ -15,6 +18,7 @@ export default {
tableData: [],
loading: false,
search_id: 2002,
+ dialogVisible: false,
ConfigShellUpdateForm: {},
keyword: "",
updateDialogVisible: false,
@@ -35,6 +39,10 @@ export default {
{ label: "阿里云服务器", value: "aliyun_vp_server" },
{ label:"azure服务器", value:"azure_vp_server" }
],
+ monitor_list: [],
+ monitor_add_update_visible: false,
+ monitor_update_add: {},
+
role: "",
tokenData: {
@@ -164,6 +172,10 @@ export default {
this.ConfigShellUpdateForm = cf;
this.updateDialogVisible = true;
},
+ showMonitorList() {
+ this.dialogVisible = true;
+ this.getMonitorDeviceList();
+ },
async createAgain(index) {
let cf = this.ConfigFileCurrentPageData[index];
this.addForm.shell_name = cf.ShellName;
@@ -209,6 +221,73 @@ export default {
toVideoList() {
router.push("/videoList");
},
+ async getMonitorDeviceList(){
+ try {
+ let req = {
+ token: this.tokenData.token,
+ type: "all",
+ };
+ let result = await GetMonitorDeviceInfoService(req);
+ if (result.code === 0) {
+ this.monitor_list = result.data;
+ console.log("monitor_list:", this.monitor_list);
+ this.dialogVisible = true; // 打开设备监控对话框
+ } else {
+ ElMessage.error("获取设备列表失败");
+ }
+ } catch (e) {
+ console.log(e);
+ }
+ },
+ updateMonitorShow(index) {
+ this.monitor_add_update_visible = true;
+ this.monitor_update_add = { ...this.monitor_list[index] }; // 深拷贝,避免直接修改原数据
+ },
+ //确定添加或修改设备
+ async addUpdateMonitor(){
+ let req = {
+ "token": this.tokenData.token,
+ "devices": [this.monitor_update_add],
+ };
+ req.devices[0].expire =parseInt(req.devices[0].expire);
+ try{
+ let result = await UpdateMonitorDeviceInfoService(req);
+ if (result.code === 0) {
+ ElMessage.success("设备信息更新成功");
+ this.monitor_add_update_visible = false;
+ } else {
+ ElMessage.error("设备信息更新失败");
+ }
+
+ }catch (e) {
+ console.log(e);
+ }
+ },
+
+ async DelMonitor(index) {
+ let isDelete = confirm("是否删除?");
+ if (!isDelete) {
+ return;
+ }
+ let req = {
+ token: this.tokenData.token,
+ devices: [this.monitor_list[index]],
+ };
+ try {
+
+ let result = await DelMonitorDeviceInfoService(req);
+ if (result.code === 0) {
+ ElMessage.success("设备删除成功");
+ this.getMonitorDeviceList();
+ } else {
+ ElMessage.error("设备删除失败");
+ }
+ } catch (e) {
+ console.log(e);
+ }
+ },
+
+
// 修改条纹颜色
tableRowClassName({ row, rowIndex }) {
switch (row.Status) {
@@ -334,6 +413,14 @@ export default {
>创建命令
+
+ 设备监控
+
@@ -394,6 +481,105 @@ export default {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+ {{ scope.row.status === "1" ? '在线' : '离线' }}
+
+
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+ 取消
+
+