| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { findAllSdk, showSystemStates } from "@/api/device"; |
| | | export default { |
| | | props: { |
| | | node: { |
| | |
| | | }, |
| | | }, |
| | | created() { |
| | | this.getAlg(); |
| | | this.getDevicePerformance(); |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | }, |
| | | methods: { |
| | | //获取算法信息 |
| | | async getAlg() { |
| | | const res = await findAllSdk({ |
| | | ip: this.node.devIp, |
| | | port: this.node.serverPort, |
| | | }); |
| | | |
| | | res.data.data.forEach((item) => { |
| | | //计算算法总数 |
| | | if (item.installed) { |
| | | this.algAll++; |
| | | } |
| | | //计算待升级算法 |
| | | if (item.installed && item.isUpgrade) { |
| | | this.algUpgrade++; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //获取设备性能 |
| | | async getDevicePerformance() { |
| | | const res = await showSystemStates({ |
| | | ip: this.node.devIp, |
| | | port: this.node.serverPort, |
| | | }); |
| | | this.devicePerformance.push({ |
| | | data: +res.data.mem.usedPercent.toString().split(".")[0], |
| | | name: "内存", |
| | | type: "mem", |
| | | }); |
| | | this.devicePerformance.push({ |
| | | data: +res.data.gpu.toString().split(".")[0], |
| | | name: "算力", |
| | | type: "gpu", |
| | | }); |
| | | this.devicePerformance.push({ |
| | | data: +res.data.cpu.toString().split(".")[0], |
| | | name: "cpu", |
| | | type: "cpu", |
| | | }); |
| | | |
| | | let distData = 0; |
| | | |
| | | res.data.disk.forEach((item) => { |
| | | let distItem = +item.info.usedPercent.toString().split(".")[0]; |
| | | distData = distData + distItem; |
| | | }); |
| | | |
| | | this.devicePerformance.push({ |
| | | data: distData, |
| | | name: `硬盘`, |
| | | type: "dist", |
| | | }); |
| | | |
| | | console.log(this.devicePerformance); |
| | | }, |
| | | |
| | | //关闭 |
| | | close() { |
| | | this.$emit("close"); |