From ff33642d41ad33a867820039fb9420e8a0bd1ef5 Mon Sep 17 00:00:00 2001 From: Wangxin Date: Sun, 5 Oct 2025 20:39:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E3=80=90web=E3=80=91=20=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/device/deviceInformation.js | 3 +- ALOps_sys_fe/alops-ui/src/api/device/files.js | 2 +- .../alops-ui/src/api/device/supplier.js | 49 +++ ALOps_sys_fe/alops-ui/src/utils/request.js | 1 + ALOps_sys_fe/alops-ui/src/utils/ruoyi.js | 8 +- .../src/views/QandA/knowledge/index.vue | 4 - .../views/device/deviceInformation/index.vue | 203 +++---------- .../views/device/deviceManufacturer/index.vue | 8 +- .../src/views/device/deviceSupplier/index.vue | 4 - .../src/views/device/deviceType/index.vue | 10 - .../alops-ui/src/views/device/files/index.vue | 186 +++--------- .../src/views/device/supplier/index.vue | 282 ++++++------------ .../views/inMonitoring/assessment/index.vue | 4 - .../views/inMonitoring/devicesState/index.vue | 4 - .../views/inMonitoring/earlyWarning/index.vue | 4 - 15 files changed, 234 insertions(+), 538 deletions(-) create mode 100644 ALOps_sys_fe/alops-ui/src/api/device/supplier.js diff --git a/ALOps_sys_fe/alops-ui/src/api/device/deviceInformation.js b/ALOps_sys_fe/alops-ui/src/api/device/deviceInformation.js index 62409f3d..cbb6dbf0 100644 --- a/ALOps_sys_fe/alops-ui/src/api/device/deviceInformation.js +++ b/ALOps_sys_fe/alops-ui/src/api/device/deviceInformation.js @@ -6,8 +6,7 @@ export function addRule(data) { return request({ url: api + 'addRule', method: 'post', - data: data, - headers: { 'Content-Type': 'application/json' } + data: data }) } // 查询规则 diff --git a/ALOps_sys_fe/alops-ui/src/api/device/files.js b/ALOps_sys_fe/alops-ui/src/api/device/files.js index 1718d272..55f3a8c2 100644 --- a/ALOps_sys_fe/alops-ui/src/api/device/files.js +++ b/ALOps_sys_fe/alops-ui/src/api/device/files.js @@ -48,7 +48,7 @@ export function update(data) { // 删除 export function del(id) { return request({ - url: api + 'delete' + id, + url: api + id, method: 'delete' }) } diff --git a/ALOps_sys_fe/alops-ui/src/api/device/supplier.js b/ALOps_sys_fe/alops-ui/src/api/device/supplier.js new file mode 100644 index 00000000..17424568 --- /dev/null +++ b/ALOps_sys_fe/alops-ui/src/api/device/supplier.js @@ -0,0 +1,49 @@ +import request from '@/utils/request' +const api = '/device/supplier/' + +// 查询详细 +export function getDict() { + return request({ + url: '/sys_dict', + method: 'get' + }) +} + +// 查询列表 +export function list(query) { + return request({ + url: api + 'query', + method: 'get', + params: query + }) +} + +// 新增 +export function add(data) { + return request({ + url: api + 'add', + method: 'post', + data: data + }) +} + +// 修改 +export function update(data) { + return request({ + url: api + 'edit', + method: 'put', + data: data + }) +} + +// 删除 +export function del(id) { + return request({ + url: api + id, + method: 'delete' + }) +} + + + + diff --git a/ALOps_sys_fe/alops-ui/src/utils/request.js b/ALOps_sys_fe/alops-ui/src/utils/request.js index 7150ecb1..aa4947b7 100644 --- a/ALOps_sys_fe/alops-ui/src/utils/request.js +++ b/ALOps_sys_fe/alops-ui/src/utils/request.js @@ -42,6 +42,7 @@ service.interceptors.request.use(config => { data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, time: new Date().getTime() } + console.log("%c 🛑: requestObj ", "font-size:16px;background-color:#4408a2;color:white;", requestObj) const requestSize = Object.keys(JSON.stringify(requestObj)).length // 请求数据大小 const limitSize = 5 * 1024 * 1024 // 限制存放数据5M if (requestSize >= limitSize) { diff --git a/ALOps_sys_fe/alops-ui/src/utils/ruoyi.js b/ALOps_sys_fe/alops-ui/src/utils/ruoyi.js index 3de2d98d..f968d9c9 100644 --- a/ALOps_sys_fe/alops-ui/src/utils/ruoyi.js +++ b/ALOps_sys_fe/alops-ui/src/utils/ruoyi.js @@ -52,16 +52,16 @@ export function resetForm(refName) { } // 添加日期范围 -export function addDateRange(params, dateRange, propName) { +export function addDateRange(params, dateRange, propNameStart, propNameEnd) { let search = params search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {} dateRange = Array.isArray(dateRange) ? dateRange : [] - if (typeof (propName) === 'undefined') { + if (typeof (propNameStart) === 'undefined') { search.params['beginTime'] = dateRange[0] search.params['endTime'] = dateRange[1] } else { - search.params['begin' + propName] = dateRange[0] - search.params['end' + propName] = dateRange[1] + search.params[propNameStart] = dateRange[0] + search.params[propNameEnd] = dateRange[1] } return search } diff --git a/ALOps_sys_fe/alops-ui/src/views/QandA/knowledge/index.vue b/ALOps_sys_fe/alops-ui/src/views/QandA/knowledge/index.vue index f1ff3efb..19c41b1f 100644 --- a/ALOps_sys_fe/alops-ui/src/views/QandA/knowledge/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/QandA/knowledge/index.vue @@ -164,10 +164,6 @@ export default { }, created() { this.getList() - // this.getDeptTree() - this.getConfigKey("sys.user.initPassword").then(response => { - this.initPassword = response.msg - }) }, methods: { /** 查询类型列表 */ diff --git a/ALOps_sys_fe/alops-ui/src/views/device/deviceInformation/index.vue b/ALOps_sys_fe/alops-ui/src/views/device/deviceInformation/index.vue index 5d3aacf0..29c03bbf 100644 --- a/ALOps_sys_fe/alops-ui/src/views/device/deviceInformation/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/device/deviceInformation/index.vue @@ -5,44 +5,51 @@ - + - 间隔采集 - 固定时间采集 - 立即采集 + 间隔采集 + 固定时间采集 + 立即采集 - + - - + - + start-placeholder="开始日期" + end-placeholder="结束日期" + :picker-options="{ disabledDate: disablePastDate }" + > + - + - - + @@ -69,7 +76,6 @@ import "splitpanes/dist/splitpanes.css" export default { name: "User", - dicts: ['sys_normal_disable', 'sys_user_sex'], components: { Treeselect, Splitpanes, Pane }, data() { return { @@ -93,13 +99,15 @@ export default { title: "", // 是否显示弹出层 open: false, - // 日期范围 - dateRange: [new Date(), new Date()], // 参数 queryParams: { - ruleType: 1, + ruleType: 0, frequency: 1, gatherTime: null, + startTime: null, + endTime: null, + // 日期范围 + dateRange: [], }, // 表单校验 @@ -108,28 +116,9 @@ export default { { required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' } ], - nickName: [ + dateRange: [ { required: true, message: "用户昵称不能为空", trigger: "blur" } ], - password: [ - { required: true, message: "用户密码不能为空", trigger: "blur" }, - { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }, - { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } - ], - email: [ - { - type: "email", - message: "请输入正确的邮箱地址", - trigger: ["blur", "change"] - } - ], - phonenumber: [ - { - pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, - message: "请输入正确的手机号码", - trigger: "blur" - } - ] } } }, @@ -141,96 +130,22 @@ export default { }, created() { this.getList() - // this.getDeptTree() - this.getConfigKey("sys.user.initPassword").then(response => { - this.initPassword = response.msg - }) }, methods: { /** 查询用户列表 */ getList() { this.loading = true - queryRule(this.addDateRange(this.queryParams, this.dateRange)).then(response => { - this.userList = response.rows - this.total = response.total + queryRule().then(response => { + this.queryParams = {...this.queryParams,...response.data} this.loading = false } ) }, - handleTimeChange(val) { - console.log('时间范围:', val); // val为数组 [start, end] - const [startTime, endTime] = val; - this.queryParams.startTime = startTime - this.queryParams.endTime = endTime - // 可在此处将值分别存储到其他变量 - }, - // 过滤禁用的部门 - filterDisabledDept(deptList) { - return deptList.filter(dept => { - if (dept.disabled) { - return false - } - if (dept.children && dept.children.length) { - dept.children = this.filterDisabledDept(dept.children) - } - return true - }) - }, - // 筛选节点 - filterNode(value, data) { - if (!value) return true - return data.label.indexOf(value) !== -1 - }, - // 用户状态修改 - handleStatusChange(row) { - let text = row.status === "0" ? "启用" : "停用" - this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() { - return changeUserStatus(row.userId, row.status) - }).then(() => { - this.$modal.msgSuccess(text + "成功") - }).catch(function() { - row.status = row.status === "0" ? "1" : "0" - }) - }, - // 取消按钮 - cancel() { - this.open = false - this.reset() - }, - // 表单重置 - reset() { - this.form = { - userId: undefined, - deptId: undefined, - userName: undefined, - nickName: undefined, - password: undefined, - phonenumber: undefined, - email: undefined, - sex: undefined, - status: "0", - remark: undefined, - postIds: [], - roleIds: [] - } - this.resetForm("form") - }, - /** 新增按钮操作 */ - handleAdd() { - this.reset() - getUser().then(response => { - this.postOptions = response.posts - this.roleOptions = response.roles - this.open = true - this.title = "添加用户" - this.form.password = this.initPassword - }) - }, /** 提交按钮 */ submitForm: function() { this.$refs["form"].validate(valid => { if (valid) { - addRule(this.form).then(response => { + addRule(this.queryParams).then(response => { this.$modal.msgSuccess("新增成功") this.open = false this.getList() @@ -238,47 +153,21 @@ export default { } }) }, - /** 删除按钮操作 */ - handleDelete(row) { - const userIds = row.userId || this.ids - this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() { - return delUser(userIds) - }).then(() => { - this.getList() - this.$modal.msgSuccess("删除成功") - }).catch(() => {}) - }, - /** 导出按钮操作 */ - handleExport() { - this.download('system/user/export', { - ...this.queryParams - }, `user_${new Date().getTime()}.xlsx`) - }, - /** 导入按钮操作 */ - handleImport() { - this.upload.title = "用户导入" - this.upload.open = true - }, - /** 下载模板操作 */ - importTemplate() { - this.download('system/user/importTemplate', { - }, `user_template_${new Date().getTime()}.xlsx`) - }, - // 文件上传中处理 - handleFileUploadProgress(event, file, fileList) { - this.upload.isUploading = true - }, - // 文件上传成功处理 - handleFileSuccess(response, file, fileList) { - this.upload.open = false - this.upload.isUploading = false - this.$refs.upload.clearFiles() - this.$alert("
" + response.msg + "
", "导入结果", { dangerouslyUseHTMLString: true }) - this.getList() + handleDateRangeChange(value) { + console.log("%c 🐁: handleDateRangeChange -> value ", "font-size:16px;background-color:#dbe986;color:black;", value) + this.queryParams.startTime = value[0] + this.queryParams.endTime = value[1] }, - // 提交上传文件 - submitFileForm() { - this.$refs.upload.submit() + + disablePastDate(time) { + // 获取当前日期(本地时间戳) + const today = new Date(); + // 重置时间为当天 00:00:00 + today.setHours(0, 0, 0, 0); + + // 禁用所有早于今天 00:00:00 的日期 + console.log("%c 🐇: disablePastDate -> time.getTime() < today.getTime() ", "font-size:16px;background-color:#c5c908;color:black;", time.getTime() , today.getTime(), time.getTime() < today.getTime()) + return time.getTime() < today.getTime(); } } } diff --git a/ALOps_sys_fe/alops-ui/src/views/device/deviceManufacturer/index.vue b/ALOps_sys_fe/alops-ui/src/views/device/deviceManufacturer/index.vue index 5a84e20d..9dea1060 100644 --- a/ALOps_sys_fe/alops-ui/src/views/device/deviceManufacturer/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/device/deviceManufacturer/index.vue @@ -96,8 +96,8 @@
- - + + @@ -240,10 +240,6 @@ export default { }, created() { this.getList() - // this.getDeptTree() - this.getConfigKey("sys.user.initPassword").then(response => { - this.initPassword = response.msg - }) }, methods: { /** 查询用户列表 */ diff --git a/ALOps_sys_fe/alops-ui/src/views/device/deviceSupplier/index.vue b/ALOps_sys_fe/alops-ui/src/views/device/deviceSupplier/index.vue index 2a1cefef..a426c45d 100644 --- a/ALOps_sys_fe/alops-ui/src/views/device/deviceSupplier/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/device/deviceSupplier/index.vue @@ -221,10 +221,6 @@ export default { }, created() { this.getList() - // this.getDeptTree() - this.getConfigKey("sys.user.initPassword").then(response => { - this.initPassword = response.msg - }) }, methods: { /** 查询用户列表 */ diff --git a/ALOps_sys_fe/alops-ui/src/views/device/deviceType/index.vue b/ALOps_sys_fe/alops-ui/src/views/device/deviceType/index.vue index da1b4e7f..91cfdbf1 100644 --- a/ALOps_sys_fe/alops-ui/src/views/device/deviceType/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/device/deviceType/index.vue @@ -62,7 +62,6 @@ - @@ -188,10 +187,6 @@ export default { }, created() { this.getList() - // this.getDeptTree() - this.getConfigKey("sys.user.initPassword").then(response => { - this.initPassword = response.msg - }) }, methods: { /** 查询类型列表 */ @@ -207,8 +202,6 @@ export default { upImage(fileList){ console.log(fileList) this.form.image = fileList - - }, // 取消按钮 cancel() { @@ -234,10 +227,7 @@ export default { }, /** 重置按钮操作 */ resetQuery() { - this.dateRange = [] this.resetForm("queryForm") - this.queryParams.deptId = undefined - this.$refs.tree.setCurrentKey(null) this.handleQuery() }, // 多选框选中数据 diff --git a/ALOps_sys_fe/alops-ui/src/views/device/files/index.vue b/ALOps_sys_fe/alops-ui/src/views/device/files/index.vue index 866eda70..18e5e9aa 100644 --- a/ALOps_sys_fe/alops-ui/src/views/device/files/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/device/files/index.vue @@ -6,27 +6,19 @@ + + + - - - - - - - - - - + - - - - + + 搜索 @@ -53,46 +45,43 @@ width="60" type="index" > - + - - + + - - - + - + - + + + + - - - - - + - - + + + {{ parseTime(scope.row.createDate) }} + - \ No newline at end of file diff --git a/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue new file mode 100644 index 00000000..3f7ad5e9 --- /dev/null +++ b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue @@ -0,0 +1,324 @@ + + + \ No newline at end of file diff --git a/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/rules/index.vue b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/rules/index.vue new file mode 100644 index 00000000..5800c083 --- /dev/null +++ b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/rules/index.vue @@ -0,0 +1,445 @@ + + + \ No newline at end of file From b3c5172929bcf312e1f3c3f5ac49f4ab59e7140e Mon Sep 17 00:00:00 2001 From: Wangxin Date: Mon, 6 Oct 2025 14:23:07 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E3=80=90web=E3=80=91=20=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ALOps_sys_fe/alops-ui/public/index.html | 1 + .../alops-ui/src/api/QandA/knowledge.js | 2 +- .../views/device/deviceManufacturer/index.vue | 5 +- .../alops-ui/src/views/index copy.vue | 308 +++++++ ALOps_sys_fe/alops-ui/src/views/index.vue | 759 ++++++++++++------ 5 files changed, 807 insertions(+), 268 deletions(-) create mode 100644 ALOps_sys_fe/alops-ui/src/views/index copy.vue diff --git a/ALOps_sys_fe/alops-ui/public/index.html b/ALOps_sys_fe/alops-ui/public/index.html index 925455ca..ec69afcf 100644 --- a/ALOps_sys_fe/alops-ui/public/index.html +++ b/ALOps_sys_fe/alops-ui/public/index.html @@ -6,6 +6,7 @@ + <%= webpackConfig.name %> diff --git a/ALOps_sys_fe/alops-ui/src/views/index.vue b/ALOps_sys_fe/alops-ui/src/views/index.vue index 64031b5a..d35b56a4 100644 --- a/ALOps_sys_fe/alops-ui/src/views/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/index.vue @@ -1,94 +1,127 @@ @@ -100,25 +133,6 @@ import PieChart from './dashboard/PieChart' import BarChart from './dashboard/BarChart' import digital from './dashboard/digital' -const lineChartData = { - newVisitis: { - expectedData: [100, 120, 161, 134, 105, 160, 165], - actualData: [120, 82, 91, 154, 162, 140, 145] - }, - messages: { - expectedData: [200, 192, 120, 144, 160, 130, 140], - actualData: [180, 160, 151, 106, 145, 150, 130] - }, - purchases: { - expectedData: [80, 100, 121, 104, 105, 90, 100], - actualData: [120, 90, 100, 138, 142, 130, 130] - }, - shoppings: { - expectedData: [130, 140, 141, 142, 145, 150, 160], - actualData: [120, 82, 91, 154, 162, 140, 130] - } -} - export default { name: 'Index', components: { @@ -131,178 +145,395 @@ export default { }, data() { return { - lineChartData: lineChartData.newVisitis, - scrollConfig:{ - header: ['设备名称', '设备位置', 'CPU使用率','内存使用率','温度', '健康度', '设备运行时长','采集时间'], - data: [ - ['行1列1', '行1列2', '行1列3', '行1列4', '行1列5', '行1列6','行1列7', '行1列8'], - ['行2列1', '行2列2', '行2列3', '行2列4', '行2列5', '行2列6','行2列7', '行2列8'], - ['行3列1', '行3列2', '行3列3', '行3列4', '行3列5', '行3列6','行3列7', '行3列8'], - ['行4列1', '行4列2', '行4列3', '行4列4', '行4列5', '行4列6','行4列7', '行4列8'], - ['行5列1', '行5列2', '行5列3', '行5列4', '行5列5', '行5列6','行5列7', '行5列8'], - ['行6列1', '行6列2', '行6列3', '行6列4', '行6列5', '行6列6','行6列7', '行6列8'], - ['行7列1', '行7列2', '行7列3', '行7列4', '行7列5', '行7列6','行7列7', '行7列8'], - ['行8列1', '行8列2', '行8列3', '行8列4', '行8列5', '行8列6','行8列7', '行8列8'], - ['行9列1', '行9列2', '行9列3', '行9列4', '行9列5', '行9列6','行9列7', '行9列8'], - ['行10列1', '行10列2', '行10列3', '行10列4', '行10列5', '行10列6','行10列7', '行10列8'] - ], - headerBGC:'#f8f8f9', - headerHeight:60, - oddRowBGC:'#f5f7fa', - evenRowBGC:'#fff', - }, + totalAlerts: 111, + activeAlerts: 42, + resolvedAlerts: 69, + lastUpdate: new Date().toLocaleString(), + devices: [ + { id: 1, name: 'Forecasts', description: '预测分析系统', status: 'normal', icon: 'fas fa-chart-line' }, + { id: 2, name: 'Gold', description: '核心处理单元', status: 'warning', icon: 'fas fa-server' }, + { id: 3, name: 'Industries', description: '工业控制系统', status: 'normal', icon: 'fas fa-industry' } + ], alerts: [ - { - time: '2021-10-16 14:54:11', - deviceName: 'PLC远程监控系统', - deviceLocation: '污水处理监控系统', - level: 1, - message: '2#电机运行状态等于1', - status: '触发值: 1' - }, - { - time: '2021-10-16 14:54:04', - deviceName: 'PLC远程监控系统', - deviceLocation: '污水处理监控系统', - level: 0, - message: '2#电机运行状态报警恢复', - status: '触发值: 0' - }, - { - time: '2021-10-16 14:54:11', - deviceName: 'PLC远程监控系统', - deviceLocation: '污水处理监控系统', - level: 1, - message: '2#电机运行状态等于1', - status: '触发值: 1' - }, - { - time: '2021-10-16 14:54:04', - deviceName: 'PLC远程监控系统', - deviceLocation: '污水处理监控系统', - level: 0, - message: '2#电机运行状态报警恢复', - status: '触发值: 0' - }, - // 可以继续添加更多预警信息 + { + id: 1, + deviceName: 'PLC远程监控系统', + time: '2021-10-16 14:54:11', + location: '污水处理监控系统', + message: '2#电机运行状态等于1', + level: 1, + status: 'warning', + icon: 'fas fa-exclamation-circle' + }, + { + id: 2, + deviceName: 'PLC远程监控系统', + time: '2021-10-16 14:54:04', + location: '污水处理监控系统', + message: '2#电机运行状态报警恢复', + level: 0, + status: 'normal', + icon: 'fas fa-check-circle' + } + ], + tableHeaders: ['设备名称', '设备位置', 'CPU使用率', '内存使用率', '温度', '健康度', '设备运行时长', '采集时间'], + deviceStatus: [ + { + id: 1, + name: 'PLC控制系统', + location: '主控室A区', + cpuUsage: 45, + memoryUsage: 62, + temperature: 42, + health: 85, + uptime: '125天8小时', + collectionTime: '2021-10-16 15:20:00' + }, + { + id: 2, + name: '数据采集器', + location: '污水处理区', + cpuUsage: 78, + memoryUsage: 85, + temperature: 58, + health: 65, + uptime: '89天12小时', + collectionTime: '2021-10-16 15:22:00' + }, + { + id: 3, + name: '监控服务器', + location: '数据中心', + cpuUsage: 32, + memoryUsage: 45, + temperature: 38, + health: 92, + uptime: '210天3小时', + collectionTime: '2021-10-16 15:25:00' + }, + { + id: 4, + name: '网络交换机', + location: '通信机房', + cpuUsage: 15, + memoryUsage: 28, + temperature: 35, + health: 95, + uptime: '156天7小时', + collectionTime: '2021-10-16 15:18:00' + } ] } }, methods: { - handleSetLineChartData(type) { - this.lineChartData = lineChartData[type] + getCpuStatus(usage) { + if (usage < 50) return 'status-indicator status-good'; + if (usage < 80) return 'status-indicator status-warning'; + return 'status-indicator status-critical'; }, - getLevelColor(level) { - const levelColors = { - 0: 'green', - 1: 'orange', - 2: 'red' - }; - return levelColors[level] || 'black'; // 默认颜色 + getMemoryStatus(usage) { + if (usage < 60) return 'status-indicator status-good'; + if (usage < 85) return 'status-indicator status-warning'; + return 'status-indicator status-critical'; + }, + getHealthStatus(health) { + if (health >= 80) return 'health-good'; + if (health >= 60) return 'health-warning'; + return 'health-critical'; } } }