|
@@ -0,0 +1,218 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <el-col :span="24" class="top">
|
|
|
+ <top topType="2" :leftArrow="false"></top>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
|
|
|
+ <van-tabs v-model="active" class="tab" @change="toChange">
|
|
|
+ <van-tab title="活跃用户">
|
|
|
+ <list :type="active" :monitorList="monitorList" @detailBtn="detailBtn"></list>
|
|
|
+ </van-tab>
|
|
|
+ <van-tab title="活跃节点">
|
|
|
+ <list :type="active" :monitorList="monitorList" @detailBtn="detailBtn"></list>
|
|
|
+ </van-tab>
|
|
|
+ <van-tab title="活跃应用">
|
|
|
+ <list :type="active" :monitorList="monitorList" @detailBtn="detailBtn"></list>
|
|
|
+ </van-tab>
|
|
|
+ </van-tabs>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="foot">
|
|
|
+ <page :total="total" :limit="limit" @search="search"></page>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <van-dialog v-model="dialog" class="dialog" title="监测信息详情" show-cancel-button :showConfirmButton="false">
|
|
|
+ <div v-if="type == '0'">
|
|
|
+ <p>
|
|
|
+ 用户:<span>{{ info.user || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 进程调度:<span>{{ info.pr || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 进程nice值:<span>{{ info.ni || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 驻留内存:<span>{{ info.res || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 共享内存:<span>{{ info.shr || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 进程状态:<span>{{ info.s || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ CPU时间:<span>{{ info.cpu || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 物理内存:<span>{{ info.mem || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 进程指令:<span>{{ info.command || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="type == '1'">
|
|
|
+ <p>
|
|
|
+ 用户:<span>{{ info.uname || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 运行作业:<span>{{ info.jobs || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 作业占用内存:<span>{{ info.physmem || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 可用核数:<span>{{ info.np || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 运行核数:<span>{{ info.ncpus || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 活跃结点:<span>{{ info.node || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="type == '2'">
|
|
|
+ <p>
|
|
|
+ 用户:<span>{{ info.user || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 进程调度:<span>{{ info.pr || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 进程nice值:<span>{{ info.ni || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 驻留内存:<span>{{ info.res || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 共享内存:<span>{{ info.shr || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 进程状态:<span>{{ info.s || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ CPU时间:<span>{{ info.cpu || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 物理内存:<span>{{ info.mem || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ 进程指令:<span>{{ info.command || '暂无' }}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </van-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import page from '@/layout/common/page.vue';
|
|
|
+import list from './parts/list.vue';
|
|
|
+import top from '@/layout/common/top.vue';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: topmessage } = createNamespacedHelpers('topmessage');
|
|
|
+import moment from 'moment';
|
|
|
+export default {
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ page,
|
|
|
+ top,
|
|
|
+ list,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ clientHeight: '',
|
|
|
+ active: 0,
|
|
|
+ monitorList: [],
|
|
|
+ total: 0,
|
|
|
+ limit: '4',
|
|
|
+ toDay: '',
|
|
|
+ type: 0,
|
|
|
+ // 监测详细信息
|
|
|
+ dialog: false,
|
|
|
+ info: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ let toDay = moment().format('YYYY-MM-DD');
|
|
|
+ this.$set(this, `toDay`, toDay);
|
|
|
+ this.toChange(0);
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 80;
|
|
|
+ this.$set(this, `clientHeight`, clientHeight);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...topmessage(['query', 'querytwo']),
|
|
|
+ async search({ skip = 0, limit = 4, ...info } = {}) {
|
|
|
+ if (this.type == '0') {
|
|
|
+ let res = await this.query({ skip, limit: this.limit, ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, 'monitorList', res.data);
|
|
|
+ this.$set(this, 'total', res.total);
|
|
|
+ }
|
|
|
+ } else if (this.type == '1') {
|
|
|
+ let res = await this.querytwo({ skip, limit: this.limit, time: this.toDay });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, 'monitorList', res.data);
|
|
|
+ this.$set(this, 'total', res.total);
|
|
|
+ }
|
|
|
+ } else if (this.type == '2') {
|
|
|
+ let res = await this.query({ skip, limit: this.limit, ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, 'monitorList', res.data.reverse());
|
|
|
+ this.$set(this, 'total', res.total);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toChange(type) {
|
|
|
+ this.$set(this, `type`, type);
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ // 详细信息
|
|
|
+ detailBtn(data) {
|
|
|
+ this.$set(this, 'info', data);
|
|
|
+ this.dialog = true;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.main {
|
|
|
+ .top {
|
|
|
+ height: 40px;
|
|
|
+ overflow: hidden;
|
|
|
+ border-bottom: 1px solid #f1f1f1;
|
|
|
+ }
|
|
|
+ .info {
|
|
|
+ overflow-x: hidden;
|
|
|
+ overflow-y: auto;
|
|
|
+ .tab {
|
|
|
+ padding: 0 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .foot {
|
|
|
+ height: 40px;
|
|
|
+ overflow: hidden;
|
|
|
+ border-top: 1px solid #f1f1f1;
|
|
|
+ }
|
|
|
+}
|
|
|
+.dialog {
|
|
|
+ div {
|
|
|
+ padding: 0 10px;
|
|
|
+ p {
|
|
|
+ padding: 5px 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|