Surpriseplus
2022-10-13 612dcb4fd8806b0153560ff67124c37a082a7bf5
系统配置,环境资源监控接口对接
已修改9个文件
1263 ■■■■ 文件已修改
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/api.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/lang/en.js 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/lang/zh.js 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/navMenu.vue 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.js 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/maintenance/parameterConfiguration.vue 228 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/maintenance/systemMonitoring.vue 835 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/userManage/resourceManage.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -14,6 +14,7 @@
    "cesium": "^1.84.0",
    "core-js": "^3.6.5",
    "echarts": "^5.3.3",
    "echarts-liquidfill": "^3.1.0",
    "element-ui": "^2.14.1",
    "esri-loader": "^2.14.0",
    "install": "^0.13.0",
src/api/api.js
@@ -256,3 +256,12 @@
  //请求地址
  return request.post('/roleUser/inserts',  params );
}
//系统配置列表
export function select_Args_ByPageAndCount(params) {
  return request.get('/args/selectByPageAndCount', { params: params });
}
//系统配置修改
export function update_args(params) {
  return request.post('/args/update', params);
}
src/assets/lang/en.js
@@ -104,7 +104,7 @@
  operatManage: {
    operatManage: 'Operat Manage',
    ResourceLog: 'Resource Log',
    UserRoleAuthorization:"User Role Authorization",
    UserRoleAuthorization: 'User Role Authorization',
    UserRoleAuthorizationObj:{
      RoleTable: 'Role Table',
      userTable: 'user Table',
@@ -139,6 +139,16 @@
    },
    userManagement: 'User Management',
    systemLayout: 'System Layout',
    sysLayOutObj: {
      name: 'Name',
      cvalue: 'Current value',
      dvalue: 'Default value',
      minValue: 'Minimum value',
      maxValue: 'Maximum value',
      descr: 'Describe',
      editSysLayOut: 'Modify system configuration',
    },
    menuSettings: 'Menu Settings',
    parameterConfiguration: 'parameterConfiguration',
    rests: 'Rests',
@@ -390,20 +400,20 @@
      depName: 'department name',
      userexport: 'Excel user export',
      userinput: 'Excel user input',
      userStatus: "User Status",
      addr: "address",
      bak: "notes",
      contact: "contact",
      edu: "education",
      email: "email",
      idcard: "idcard",
      job: "job",
      natives: "natives",
      pwd: "password",
      sex: "gender",
      status: "status",
      uname: "username",
      depid: "department",
      userStatus: 'User Status',
      addr: 'address',
      bak: 'notes',
      contact: 'contact',
      edu: 'education',
      email: 'email',
      idcard: 'idcard',
      job: 'job',
      natives: 'natives',
      pwd: 'password',
      sex: 'gender',
      status: 'status',
      uname: 'username',
      depid: 'department',
      chineseName: 'Chinese Name [User Name]',
      affiliatedUnit: 'Affiliated unit [on-the-job]',
      mobileNumber: 'Mobile number [receive SMS]',
src/assets/lang/zh.js
@@ -19,7 +19,6 @@
    close: '关闭',
    see: '查看',
    index: '序号',
  },
  dataManage: {
    dataManage: '数据管理',
@@ -106,7 +105,7 @@
  operatManage: {
    operatManage: '运维管理',
    ResourceLog: '资源日志',
    UserRoleAuthorization:"用户角色授权",
    UserRoleAuthorization: '用户角色授权',
    UserRoleAuthorizationObj:{
      RoleTable: '角色表',
      userTable: '用户表',
@@ -141,6 +140,15 @@
    },
    userManagement: '用户管理',
    systemLayout: '系统配置',
    sysLayOutObj: {
      name: '名称',
      cvalue: '当前值',
      dvalue: '默认值',
      minValue: '最小值',
      maxValue: '最大值',
      descr: '描述',
      editSysLayOut: '修改系统配置',
    },
    menuSettings: '菜单设置',
    parameterConfiguration: '参数配置',
    rests: '其他',
@@ -392,20 +400,20 @@
      depName: '单位名称',
      userexport: 'Excel用户导出',
      userinput: 'Excel用户导入',
      userStatus: "用户状态",
      uname: "用户名",
      pwd: "密码",
      sex: "性别",
      natives: "籍贯",
      idcard: "证件号",
      job: "工作",
      edu: "教育",
      addr: "地址",
      email: "电子邮件",
      contact: "联系方式",
      status: "状态",
      bak: "备注",
      depid: "所属部门",
      userStatus: '用户状态',
      uname: '用户名',
      pwd: '密码',
      sex: '性别',
      natives: '籍贯',
      idcard: '证件号',
      job: '工作',
      edu: '教育',
      addr: '地址',
      email: '电子邮件',
      contact: '联系方式',
      status: '状态',
      bak: '备注',
      depid: '所属部门',
      chineseName: '中文名[用户名]',
      affiliatedUnit: '所属单位[在职]',
      mobileNumber: '手机号[接收短信]',
src/components/navMenu.vue
@@ -34,13 +34,13 @@
</template>
<script>
import { logout } from "@/api/api";
import { removeToken, getToken } from "@/utils/auth";
import customElMenu from "../components/customElMenu.vue";
import { queryMenuTree, updateMenuTree, queryMaxId } from "../api/api";
import { logout } from '@/api/api';
import { removeToken, getToken } from '@/utils/auth';
import customElMenu from '../components/customElMenu.vue';
import { queryMenuTree, updateMenuTree, queryMaxId } from '../api/api';
export default {
  name: "navMenu",
  name: 'navMenu',
  //import引入的组件需要注入到对象中才能使用
  components: {
    customElMenu,
@@ -50,10 +50,10 @@
      oriData: [], //原始树数据
      dirData: [], //el树数据
      newData: [], //拖动后数据
      lang: "zh",
      activeIndex: "/",
      lang: 'zh',
      activeIndex: '/',
      menuList: [],
      editTitle: "",
      editTitle: '',
      showPopover: false,
      showEditInfoWrapper: false,
      showEdit: false,
@@ -61,7 +61,7 @@
      editCatalogue: false,
      editUnit: false,
      itemdetail: {},
      formLabelWidth: "70px",
      formLabelWidth: '70px',
    };
  },
  mounted() {
@@ -96,10 +96,10 @@
            });
            this.menuList = this.treeData(menuLists);
          } else {
            alert("暂无菜单栏数据");
            alert('暂无菜单栏数据');
          }
        } else {
          console.log("接口报错");
          console.log('接口报错');
        }
      });
    },
@@ -110,62 +110,70 @@
        return cloneData.filter((father) => {
          // 循环所有项
          let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
          branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值
          branchArr.length > 0 ? (father.children = branchArr) : ''; // 给父级添加一个children属性,并赋值
          // 属于同一对象问题,例如:令 a=b、c=1 ,然后再令 b.c=c , 那么 a.c=b.c=c=1 ;同理,后续令 c.d=2 ,那么 a.c.d 也是=2;
          // 由此循环多次后,就能形成相应的树形数据结构
          return father.pid == 1; // 返回一级菜单
        });
      } else {
        alert("暂无菜单栏数据");
        alert('暂无菜单栏数据');
      }
    },
    logOut() {
      this.$confirm("确认是否退出登录?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      this.$confirm('确认是否退出登录?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(async () => {
          const data = await logout({ token: getToken() });
          console.log(data);
          if (data.code != 200) {
            return this.$message.error("退出登录失败");
            return this.$message.error('退出登录失败');
          }
          removeToken();
          this.$router.push("/login");
          this.$router.push('/login');
          this.$message({
            message: "退出登录成功",
            type: "success",
            message: '退出登录成功',
            type: 'success',
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
            type: 'info',
            message: '已取消',
          });
        });
    },
    switchLang() {
      //当前en
      if (this.lang == "en") {
      if (this.lang == 'en') {
        //语言换成zh
        this.lang = "zh";
        this.lang = 'zh';
        //菜单换为zh
        this.$store.commit("changeLang", "zh");
        this.$store.commit('changeLang', 'zh');
        //i18换成zh
        this.$i18n.locale = this.lang;
      }
      //当前zh
      else {
        this.lang = "en";
        this.lang = 'en';
        this.$i18n.locale = this.lang;
        this.$store.commit("changeLang", "en"); //传递点击的节点
        this.$store.commit('changeLang', 'en'); //传递点击的节点
      }
    },
    handleselect(index, indexPath) {
      if (index.indexOf("http") != -1) {
        this.$router.push("/databaseMonitoring");
        this.$store.commit("getIframe", index);
      if (Window.ws != null) {
        Window.ws.close();
        Window.ws.onclose = () => {
          console.log('服务器关闭');
        };
        Window.ws = null;
      }
      if (index.indexOf('http') != -1) {
        this.$router.push('/databaseMonitoring');
        this.$store.commit('getIframe', index);
      } else if (isNaN(Number(index))) {
        this.$router.push(index);
      }
@@ -174,14 +182,14 @@
  watch: {
    $route() {
      let str = this.$route.path;
      if (str[0] == "/") {
      if (str[0] == '/') {
        this.activeIndex = str.slice(1);
      }
    },
  },
  created() {
    let str = this.$route.path;
    if (str[0] == "/") {
    if (str[0] == '/') {
      this.activeIndex = str.slice(1);
    }
  },
src/store/index.js
@@ -1,8 +1,8 @@
import Vue from 'vue';
import Vuex from 'vuex';
import { getToken, setToken, removeToken } from "@/utils/auth";
import { Loading, Message } from "element-ui";
import { login, getPublicKey } from "@/api/api";
import { getToken, setToken, removeToken } from '@/utils/auth';
import { Loading, Message } from 'element-ui';
import { login, getPublicKey } from '@/api/api';
var encrypt = new JSEncrypt();
Vue.use(Vuex);
@@ -23,7 +23,9 @@
    apiCount: 0,
    //loading实例
    loadingInstance: null,
    key: null
    key: null,
    //系统监控WebSocket
    ws: null,
  },
  mutations: {
    // 获取完整面包屑路径
@@ -43,7 +45,6 @@
    changeName(state, msg) {
      state.menuNode = msg;
      // console.log(msg);
    },
    verChangeNode(state, msg) {
      state.verCateNode = msg;
@@ -62,8 +63,8 @@
    START_LOADING(state, msg) {
      state.loadingInstance = Loading.service({
        lock: true,
        text: msg ? msg : "加载中...",
        background: "rgba(0, 0, 0, 0.7)",
        text: msg ? msg : '加载中...',
        background: 'rgba(0, 0, 0, 0.7)',
      });
    },
    /* 关闭loading */
@@ -73,13 +74,13 @@
    },
    /* 更新请求线程池 */
    UPDATE_API_COUNT(state, handle) {
      if (handle == "add") {
      if (handle == 'add') {
        state.apiCount++;
        this.commit("START_LOADING");
        this.commit('START_LOADING');
      } else {
        state.apiCount--;
        if (state.apiCount <= 0) {
          this.commit("CLOSE_LOADING");
          this.commit('CLOSE_LOADING');
        }
      }
    },
@@ -97,7 +98,7 @@
      return new Promise((resolve, reject) => {
        var data = {
          uid: encrypt.encrypt(userInfo.uid),
          pwd: encrypt.encrypt(userInfo.pwd)
          pwd: encrypt.encrypt(userInfo.pwd),
        };
        login(data)
          .then((response) => {
@@ -105,11 +106,11 @@
            if (data.code !== 200) {
              return Message({
                message: data.msg,
                type: "error",
                type: 'error',
                duration: 5 * 1000,
              });
            }
            commit("SET_TOKEN", data.result.token);
            commit('SET_TOKEN', data.result.token);
            setToken(data.result.token);
            resolve(data);
          })
@@ -119,12 +120,11 @@
      });
    },
    getpublickey({ commit, state }, userInfo) {
      return new Promise((resolve, reject) => {
        getPublicKey(userInfo)
          .then((response) => {
            const data = response;
            commit("SET_KEY", data.result);
            commit('SET_KEY', data.result);
            encrypt.setPublicKey(data.result); // 设置公钥
            resolve();
@@ -133,7 +133,7 @@
            reject(error);
          });
      });
    }
    },
  },
  modules: {},
});
src/views/maintenance/parameterConfiguration.vue
@@ -1,36 +1,138 @@
<template>
  <div class="parameterConfiguration_box">
    <My-bread :list="['运维管理', '参数配置']"></My-bread>
    <My-bread
      :list="[
        `${$t('operatManage.operatManage')}`,
        `${$t('operatManage.systemLayout')}`,
      ]"
    ></My-bread>
    <el-divider />
    <div class="parameterConfiguration">
      <el-form ref="formRef" :model="form" label-width="140px">
        <el-form-item label="站点名称" prop="usePageView">
          <el-input v-model="form.usePageView" placeholder="请输入" />
      <el-table :data="tableData" style="width: 100%" fit>
        <el-table-column
          align="center"
          type="index"
          :label="$t('operatManage.ELM.index')"
          width="70px"
        />
        <el-table-column
          prop="name"
          align="center"
          :label="$t('operatManage.sysLayOutObj.name')"
        />
        <el-table-column
          prop="cvalue"
          align="center"
          :label="$t('operatManage.sysLayOutObj.cvalue')"
        />
        <el-table-column
          prop="dvalue"
          align="center"
          :label="$t('operatManage.sysLayOutObj.dvalue')"
        />
        <el-table-column
          prop="minValue"
          align="center"
          :label="$t('operatManage.sysLayOutObj.minValue')"
        />
        <el-table-column
          prop="maxValue"
          align="center"
          :label="$t('operatManage.sysLayOutObj.maxValue')"
        />
        <el-table-column
          prop="descr"
          align="center"
          :label="$t('operatManage.sysLayOutObj.descr')"
        />
        <el-table-column
          fixed="right"
          :label="$t('common.operate')"
          width="100px"
        >
          <template slot-scope="scope">
            <el-button
              @click="showDetail(scope.$index, scope.row)"
              type="primary"
              plain
              size="small"
              >{{ $t('common.edit') }}</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="pagination_box">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="listData.pageIndex"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="listData.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="count"
      >
      </el-pagination>
    </div>
    <el-dialog
      :title="$t('operatManage.sysLayOutObj.editSysLayOut')"
      style="overflow: hidden"
      :visible.sync="EditFormdialog"
      :before-close="EditFromDataClose"
    >
      <el-form :model="upform">
        <el-form-item
          :label="$t('operatManage.sysLayOutObj.name')"
          :label-width="formLabelWidth"
        >
          <label class="boxlabel">{{ upform.name }}</label>
        </el-form-item>
        <el-form-item label="浏览器图标" prop="usePageView">
          <el-input v-model="form.usePageView" placeholder="请输入" />
        <el-form-item
          :label="$t('operatManage.sysLayOutObj.cvalue')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="upform.cvalue" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="版本信息" prop="usePageView">
          <el-input v-model="form.usePageView" placeholder="请输入" />
        <el-form-item
          :label="$t('operatManage.sysLayOutObj.dvalue')"
          :label-width="formLabelWidth"
        >
          <label class="boxlabel">{{ upform.dvalue }}</label>
        </el-form-item>
        <el-form-item label="备案信息" prop="servePageView">
          <el-input v-model="form.servePageView" placeholder="请输入" />
        <el-form-item
          :label="$t('operatManage.sysLayOutObj.minValue')"
          :label-width="formLabelWidth"
        >
          <label class="boxlabel">{{ upform.minValue }}</label>
        </el-form-item>
        <el-form-item label="版本信息" prop="servePageView">
          <el-input v-model="form.servePageView" placeholder="请输入" />
        <el-form-item
          :label="$t('operatManage.sysLayOutObj.maxValue')"
          :label-width="formLabelWidth"
        >
          <label class="boxlabel">{{ upform.maxValue }}</label>
        </el-form-item>
        <el-form-item class="flex_box">
          <el-button type="primary">确认</el-button>
          <el-button>重置</el-button>
        <el-form-item
          :label="$t('operatManage.sysLayOutObj.descr')"
          :label-width="formLabelWidth"
        >
          <label class="boxlabel">{{ upform.descr }}</label>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="EditFromDataClose">{{
          $t('common.close')
        }}</el-button>
        <el-button @click="EditFromData" type="primary">{{
          $t('common.confirm')
        }}</el-button>
    </div>
    </el-dialog>
  </div>
</template>
<script>
import MyBread from "../../components/MyBread.vue";
import MyBread from '../../components/MyBread.vue';
import { select_Args_ByPageAndCount, update_args } from '../../api/api.js';
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {
@@ -39,19 +141,81 @@
  data() {
    return {
      currentPage4: 4,
      form: {
        date1: "",
        subject: "",
        usePageView: "",
        overtime: "",
        servePageView: "",
        aging: "",
      formLabelWidth: '100px',
      upform: {},
      EditFormdialog: false,
      tableData: [],
      count: 0,
      listData: {
        name: '',
        pageIndex: 1,
        pageSize: 10,
      },
    };
  },
  methods: {},
  created() {},
  methods: {
    handleSizeChange(val) {
      this.listData.pageSize = val;
      this.getRoleTabelData();
    },
    handleCurrentChange(val) {
      this.listData.pageIndex = val;
      this.getRoleTabelData();
    },
    showDetail(index, row) {
      this.EditFormdialog = true;
      this.upform = row;
    },
    EditFromDataClose() {
      this.EditFormdialog = false;
      this.upform = {};
    },
    async EditFromData() {
      if (
        parseInt(this.upform.cvalue) < parseInt(this.upform.minValue) ||
        parseInt(this.upform.cvalue) > parseInt(this.upform.maxValue)
      ) {
        this.$message({
          message: '当前值不能小于最小值或大于最大值!',
          type: 'warning',
        });
        return;
      }
      var val_data = await update_args(this.upform);
      if (val_data.code == 200) {
        this.uploadFile = val_data.result;
        this.$message({
          message: '修改成功!',
          type: 'success',
        });
        this.getRoleTabelData();
        this.EditFormdialog = false;
        this.upform = {};
      } else {
        this.$message({
          message: '修改失败!',
          type: 'warning',
        });
      }
    },
    async getRoleTabelData() {
      if (this.listData.tab == '') {
        delete this.listData.tab;
      }
      const data = await select_Args_ByPageAndCount(this.listData);
      if (data.code != 200) {
        this.$message.error('列表调用失败');
      }
      console.log(data);
      this.tableData = data.result;
      this.count = data.count;
    },
  },
  created() {
    this.getRoleTabelData();
  },
};
</script>
<style lang="less" scoped>
@@ -63,11 +227,10 @@
  padding: 10px;
  box-sizing: border-box;
  .parameterConfiguration {
    padding-left: 20%;
    padding-right: 20%;
    padding-top: 20px;
    padding-bottom: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    background: #fff;
    height: 86%;
    border-radius: 5px;
    border: 1px solid rgb(202, 201, 204);
    box-sizing: border-box;
@@ -79,5 +242,8 @@
      justify-content: center;
    }
  }
  .pagination_box {
    margin-top: 20px;
  }
}
</style>
src/views/maintenance/systemMonitoring.vue
@@ -10,132 +10,160 @@
    <div class="inform_box">
      <div class="content_box">
        <div class="top_box">
          <div class="Syslabel">{{$t('operatManage.systemMonitoringObj.totalMemory')}}</div>
          <div class="details">63.93GB</div>
          <div style="width: 100%; height: 100%">
            <div
              style="
                width: 30%;
                height: 100%;
                float: left;
                margin-left: 20%;
              "
            >
          <div class="Syslabel">
            <span>{{$t('operatManage.systemMonitoringObj.haveBeenUsed')}} 31.16GB</span>
            <span style="margin-left: 25px">{{$t('operatManage.systemMonitoringObj.usageRate')}} 49%</span>
                <p style="line-height: 25px">
                  {{ $t('operatManage.systemMonitoringObj.haveBeenUsed') }}
                  {{ memInfo.use }}
                </p>
                <br />
                <p style="line-height: 25px">
                  {{ $t('operatManage.systemMonitoringObj.totalMemory') }}
                  {{ memInfo.totalMem }}
                </p>
          </div>
        </div>
        <div class="bottom_box">{{$t('operatManage.systemMonitoringObj.systemMemory')}}</div>
            <div
              id="shuiwen"
              style="
                width: 40%;
                height: 100%;
                float: left;
              "
            ></div>
          </div>
          <!-- <div class="Syslabel">
            {{ $t('operatManage.systemMonitoringObj.totalMemory') }}
          </div>
          <div class="details">{{ memInfo.totalMem }}</div> -->
          <!-- -->
          <!-- <div class="Syslabel">
            <span
              >{{ $t('operatManage.systemMonitoringObj.haveBeenUsed') }}
              {{ memInfo.use }}</span
            >
            <span style="margin-left: 25px"
              >{{ $t('operatManage.systemMonitoringObj.usageRate') }}
              {{ memInfo.usage }}</span
            >
          </div> -->
        </div>
        <div class="bottom_box">
          {{ $t('operatManage.systemMonitoringObj.systemMemory') }}
        </div>
      </div>
      <div class="content_box">
        <div class="top_box">
          <div class="Syslabel">{{$t('operatManage.systemMonitoringObj.CPUusage')}}</div>
          <div class="details">3.49%</div>
          <div class="Syslabel">
            {{ $t('operatManage.systemMonitoringObj.CPUusage') }}
          </div>
          <div class="details">{{ cpuInfo.cpuSysUsage }}</div>
          <div id="Sys_cpu_chart"></div>
        </div>
        <div class="bottom_box">{{$t('operatManage.systemMonitoringObj.CPUsystemUsage')}}</div>
        <div class="bottom_box">
          {{ $t('operatManage.systemMonitoringObj.CPUsystemUsage') }}
        </div>
      </div>
      <div class="content_box">
        <div class="top_box">
          <div class="Syslabel">{{$t('operatManage.systemMonitoringObj.numberOfExceptions')}}</div>
          <div class="details">0</div>
          <div class="Syslabel">
            {{ $t('operatManage.systemMonitoringObj.numberOfExceptions') }}
        </div>
        <div class="bottom_box">{{$t('operatManage.systemMonitoringObj.numberOfAbnormalSystems')}}</div>
          <div class="details">{{ resInfoCount }}</div>
      </div>
      <div class="content_box">
        <div class="bottom_box">
          {{ $t('operatManage.systemMonitoringObj.numberOfAbnormalSystems') }}
        </div>
      </div>
      <!-- <div class="content_box">
        <div class="top_box">
          <div class="Syslabel">{{$t('operatManage.systemMonitoringObj.serviceAarm')}}</div>
          <div class="details">8</div>
        </div>
        <div class="bottom_box">{{$t('operatManage.systemMonitoringObj.serviceResourceAlarm')}}</div>
      </div>
      </div> -->
    </div>
    <div class="chart_box">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane :label="$t('operatManage.systemMonitoringObj.serviceResourceStatus')" name="first">
          <div class="gauge_box">
            <div id="gauge_chart1"></div>
            <div id="gauge_chart2"></div>
          </div>
        </el-tab-pane>
        <el-tab-pane :label="$t('operatManage.systemMonitoringObj.userOperationBehavior')" name="second">
          <div class="gauge_box">
            <div class="input_box">
              <el-form
                :inline="true"
                :model="formInline"
                size="mini"
      <p class="title_box">
        {{ $t('operatManage.systemMonitoringObj.abnormalResources') }}
      </p>
      <el-table :data="resInfo" style="width: 100%">
        <el-table-column
          prop="id"
          :label="$t('operatManage.systemMonitoringObj.resourceID')"
              >
                <el-form-item label="">
                  <el-input
                    v-model="formInline.user"
                    :placeholder="$t('operatManage.systemMonitoringObj.EnterTheUserChineseName')"
                  ></el-input>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="onSubmit">{{$t('operatManage.systemMonitoringObj.inquire')}}</el-button>
                </el-form-item>
              </el-form>
            </div>
            <div ref="dayBar" id="gauge_chart3"></div>
          </div>
        </el-tab-pane>
        <el-tab-pane :label="$t('operatManage.systemMonitoringObj.resourceInvocationStatus')" name="third">
          <div class="gauge_box">
             <div class="input_box">
              <el-form
                :inline="true"
                :model="formInline"
                size="mini"
        </el-table-column>
        <el-table-column
          prop="name"
          :label="$t('operatManage.systemMonitoringObj.resourceName')"
              >
                <el-form-item label="">
                  <el-input
                    v-model="formInline.user"
                    :placeholder="$t('operatManage.systemMonitoringObj.EnterTheResourceID')"
                  ></el-input>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="onSubmit">{{$t('operatManage.systemMonitoringObj.inquire')}}</el-button>
                </el-form-item>
              </el-form>
            </div>
            <div ref="dayline" id="line_chart"></div>
          </div>
        </el-tab-pane>
        <el-tab-pane :label="$t('operatManage.systemMonitoringObj.resourceCallStatistics')" name="fourth">
          <div class="gauge_box">
             <div class="input_box">
              <el-form
                :inline="true"
                :model="formInline"
                size="mini"
        </el-table-column>
        <el-table-column
          prop="bak"
          :label="$t('operatManage.systemMonitoringObj.resourceState')"
              >
                <el-form-item label="">
                  <el-input
                    v-model="formInline.user"
                    :placeholder="$t('operatManage.systemMonitoringObj.EnterTheUserName')"
                  ></el-input>
                </el-form-item>
        </el-table-column>
        <el-table-column
          prop="createTime"
          :label="$t('operatManage.systemMonitoringObj.abnormaltime')"
          show-overflow-tooltip
        >
        </el-table-column>
      </el-table>
      <!-- <div style="margin-top: 10px" class="pagination_box">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="10"
          layout="total, sizes, prev, pager, next, jumper"
          :total="4"
        >
        </el-pagination>
      </div> -->
    </div>
                <el-form-item>
                  <el-button type="primary" @click="onSubmit">{{$t('operatManage.systemMonitoringObj.inquire')}}</el-button>
                </el-form-item>
              </el-form>
            </div>
            <div ref="dayBar1" id="gauge_chart5"></div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
    <div class="table_box">
      <div class="left">
        <p class="title_box">{{$t('operatManage.systemMonitoringObj.onlinePersonnel')}}</p>
      <p class="title_box">
        {{ $t('operatManage.systemMonitoringObj.onlinePersonnel') }}
      </p>
        <el-table :data="tableData" style="width: 100%">
          <el-table-column prop="name" :label="$t('operatManage.systemMonitoringObj.userID')"> </el-table-column>
          <el-table-column prop="servicecatalog" :label="$t('operatManage.systemMonitoringObj.username')">
        <el-table-column
          align="center"
          type="index"
          :label="$t('operatManage.ELM.index')"
          width="100px"
        />
        <el-table-column
          prop="uid"
          :label="$t('operatManage.systemMonitoringObj.userID')"
        >
          </el-table-column>
          <el-table-column prop="visitTimes" :label="$t('operatManage.systemMonitoringObj.onlineTime')" fixed="right">
        <el-table-column
          prop="uname"
          :label="$t('operatManage.systemMonitoringObj.username')"
        >
        </el-table-column>
        <el-table-column
          prop="loginTime"
          :label="$t('operatManage.systemMonitoringObj.onlineTime')"
          fixed="right"
        >
          </el-table-column>
        </el-table>
        <div style="margin-top: 40px" class="pagination_box">
      <!-- <div style="margin-top: 10px" class="pagination_box">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
@@ -146,38 +174,14 @@
            :total="4"
          >
          </el-pagination>
        </div>
      </div>
      <div class="right">
        <p class="title_box">{{$t('operatManage.systemMonitoringObj.abnormalResources')}}</p>
        <el-table :data="tableData" style="width: 100%">
          <el-table-column prop="name" :label="$t('operatManage.systemMonitoringObj.resourceID')"> </el-table-column>
          <el-table-column prop="servicecatalog" :label="$t('operatManage.systemMonitoringObj.resourceName')">
          </el-table-column>
          <el-table-column prop="visitTimes" :label="$t('operatManage.systemMonitoringObj.resourceState')">
          </el-table-column>
          <el-table-column prop="date" :label="$t('operatManage.systemMonitoringObj.abnormaltime')" show-overflow-tooltip>
          </el-table-column>
        </el-table>
        <div style="margin-top: 40px" class="pagination_box">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage4"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="4"
          >
          </el-pagination>
        </div>
      </div>
      </div> -->
    </div>
  </div>
</template>
<script>
import MyBread from "../../components/MyBread.vue";
import MyBread from '../../components/MyBread.vue';
import 'echarts-liquidfill';
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {
@@ -186,409 +190,240 @@
  data() {
    //这里存放数据
    return {
      formInline: {
        user: "",
        region: "",
      },
      activeName: "first",
      currentPage4: 1,
      tableData: [
        {
          date: "2022-08-03",
          name: "test",
          servicecatalog: "业务图层",
          visitTimes: "12",
          state: "不可用",
        },
        {
          date: "2022-08-03",
          name: "cs9",
          servicecatalog: "业务图层",
          visitTimes: "7",
          state: "不可用",
        },
        {
          date: "2022-08-03",
          name: "test1",
          servicecatalog: "业务图层",
          visitTimes: "5",
          state: "不可用",
        },
        {
          date: "2022-08-03",
          name: "cs3",
          servicecatalog: "业务图层",
          visitTimes: "8",
          state: "不可用",
        },
      ],
      ws: null,
      tableData: [],
      memInfo: { totalMem: 0, use: 0, usage: 0 },
      cpuInfo: { cpuSysUsage: 0 },
      resInfo: [],
      resInfoCount: 0,
      echartData: [],
    };
  },
  //方法集合
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    handleClick(tab, event) {
      console.log(tab, event);
      this.$nextTick(() => {
        this.$echarts.getInstanceByDom(this.$refs.dayBar).resize();
        this.$echarts.getInstanceByDom(this.$refs.dayBar1).resize();
        this.$echarts.getInstanceByDom(this.$refs.dayline).resize();
      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    gaugeChart1() {
      let option = {
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "5%",
          left: "20%",
          orient: "vertical",
        },
        series: [
          {
            name: "",
            type: "pie",
            radius: ["70%", "90%"],
            avoidLabelOverlap: false,
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: "30",
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 1048, name: "正常资源" },
              { value: 735, name: "异常资源" },
            ],
            itemStyle: {
              normal: {
                color: function (colors) {
                  var colorList = ["#d3e9af", "#ed9678"];
                  return colorList[colors.dataIndex];
                },
              },
            },
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("gauge_chart1"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    },
    gaugeChart2() {
      let option = {
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "5%",
          left: "20%",
          orient: "vertical",
        },
        series: [
          {
            name: "",
            type: "pie",
            radius: ["70%", "90%"],
            avoidLabelOverlap: false,
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: "30",
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 1048, name: "活跃资源" },
              { value: 0, name: "不活跃资源" },
            ],
            itemStyle: {
              normal: {
                color: function (colors) {
                  var colorList = ["#d3e9af", "#ed9678"];
                  return colorList[colors.dataIndex];
                },
              },
            },
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("gauge_chart2"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    },
    barChart() {
      let option = {
        xAxis: {
          type: "category",
          axisLabel: {
            interval: 0,
            rotate: 60,
          },
          data: [
            "Mon",
            "Tue",
            "Wed",
            "Thu",
            "Fri",
            "Sat",
            "Sun",
            "Mon",
            "Tue",
            "Wed",
            "Thu",
            "Fri",
            "Sat",
            "Sun",
            "Mon",
            "Tue",
            "Wed",
            "Thu",
            "Fri",
            "Sat",
            "Sun",
          ],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [
              120, 200, 150, 80, 70, 110, 130120, 200, 150, 80, 70, 110, 130,
              120, 200, 150, 80, 70, 110, 130,
            ],
            type: "bar",
            showBackground: true,
            backgroundStyle: {
              color: "rgba(180, 180, 180, 0.2)",
            },
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("gauge_chart5"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    },
    barChart1() {
      let option = {
        xAxis: {
          type: "category",
          axisLabel: {
            interval: 0,
            rotate: 60,
          },
          data: [
            "Mon",
            "Tue",
            "Wed",
            "Thu",
            "Fri",
            "Sat",
            "Sun",
            "Mon",
            "Tue",
            "Wed",
            "Thu",
            "Fri",
            "Sat",
            "Sun",
            "Mon",
            "Tue",
            "Wed",
            "Thu",
            "Fri",
            "Sat",
            "Sun",
          ],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [
              120, 200, 150, 80, 70, 110, 130120, 200, 150, 80, 70, 110, 130,
              120, 200, 150, 80, 70, 110, 130,
            ],
            type: "bar",
            showBackground: true,
            backgroundStyle: {
              color: "rgba(180, 180, 180, 0.2)",
            },
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("gauge_chart3"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    },
    lineChart() {
      let base = +new Date(1968, 9, 3);
      let oneDay = 24 * 3600 * 1000;
      let date = [];
      let data = [Math.random() * 300];
      for (let i = 1; i < 20000; i++) {
        var now = new Date((base += oneDay));
        date.push(
          [now.getFullYear(), now.getMonth() + 1, now.getDate()].join("/")
        );
        data.push(Math.round((Math.random() - 0.5) * 20 + data[i - 1]));
    SetTableData1(res) {
      this.tableData = res.userInfo;
      this.memInfo = res.memInfo;
      this.cpuInfo = res.cpuInfo;
      if (this.echartData.length == 7) {
        this.echartData.splice(0, 1);
      }
      let option = {
        tooltip: {
          trigger: "axis",
          position: function (pt) {
            return [pt[0], "10%"];
      this.echartData.push(parseFloat(res.cpuInfo.cpuSysUsage));
      this.lineChart1();
      console.log(this.memInfo.usage);
      this.lineChart2(this.memInfo.usage);
          },
        },
        title: {
          left: "center",
          text: "Large Area Chart",
        },
        toolbox: {
          feature: {
            dataZoom: {
              yAxisIndex: "none",
            },
            restore: {},
            saveAsImage: {},
          },
        },
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: date,
        },
        yAxis: {
          type: "value",
          boundaryGap: [0, "100%"],
        },
        dataZoom: [
          {
            type: "inside",
            start: 0,
            end: 10,
          },
          {
            start: 0,
            end: 10,
          },
        ],
        series: [
          {
            name: "Fake Data",
            type: "line",
            symbol: "none",
            sampling: "lttb",
            itemStyle: {
              color: "rgb(255, 70, 131)",
            },
            areaStyle: {
              color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "rgb(255, 158, 68)",
                },
                {
                  offset: 1,
                  color: "rgb(255, 70, 131)",
                },
              ]),
            },
            data: data,
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("line_chart"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    SetTableData2(res) {
      this.resInfo = res.resInfo;
      this.resInfoCount = res.resInfo.length;
    },
    lineChart1() {
      let option = {
        grid: {
          top: 0,
          left: "0%",
          right: "4%",
          bottom: "0%",
          left: '0%',
          right: '4%',
          bottom: '0%',
          containLabel: true,
        },
        tooltip: {
          trigger: "axis",
          trigger: 'axis',
        },
        xAxis: {
          type: "category",
          type: 'category',
          boundaryGap: false,
          data: ["", "", "", "", "", "", ""],
          data: ['', '', '', '', '', '', ''],
        },
        yAxis: {
          type: "value",
          type: 'value',
          axisLabel: {
            show: false, // 不显示坐标轴上的文字
          },
        },
        series: [
          {
            data: [820, 932, 901, 934, 1290, 1330, 1320],
            type: "line",
            data: this.echartData,
            type: 'line',
            areaStyle: {},
          },
        ],
      };
      let myChart = this.$echarts.init(
        document.getElementById("Sys_cpu_chart")
        document.getElementById('Sys_cpu_chart')
      );
      myChart.setOption(option);
      window.addEventListener("resize", function () {
      window.addEventListener('resize', function () {
        myChart.resize();
      });
    },
    handleSelectionChange() {},
    lineChart2(res) {
      var a = res.split('%').join('');
      console.log(a);
      let value = parseFloat(a);
      let data = [value, value, value];
      let option = {
        title: {
          text: value + '{a|%}',
          textStyle: {
            fontSize: 15,
            fontFamily: 'Microsoft Yahei',
            fontWeight: 'normal',
            color: '#00FFFF',
            rich: {
              a: {
                fontSize: 15,
  },
  created() {},
  mounted() {
    this.$nextTick(() => {
      this.lineChart();
      this.lineChart1();
      this.barChart();
      this.barChart1();
      this.gaugeChart1();
      this.gaugeChart2();
            },
          },
          x: 'center',
          y: '35%',
        },
        graphic: [
          {
            type: 'group',
            left: 'center',
            children: [
              {
                type: 'text',
                z: 20,
                left: '10',
                top: '50',
                style: {
                  fill: '#00FFFF',
                  text: '使用率',
                  font: '14px Microsoft YaHei',
                },
              },
            ],
          },
        ],
        series: [
          {
            type: 'liquidFill',
            radius: '80%',
            center: ['50%', '50%'],
            //  shape: 'roundRect',
            data: data,
            backgroundStyle: {
              color: {
                type: 'linear',
                x: 1,
                y: 0,
                x2: 0.5,
                y2: 1,
                colorStops: [
                  {
                    offset: 1,
                    color: 'rgba(68, 145, 253, 0)',
                  },
                  {
                    offset: 0.5,
                    color: 'rgba(68, 145, 253, .25)',
                  },
                  {
                    offset: 0,
                    color: 'rgba(68, 145, 253, 1)',
                  },
                ],
                globalCoord: false,
              },
            },
            outline: {
              borderDistance: 0,
              itemStyle: {
                borderWidth: 20,
                borderColor: {
                  type: 'linear',
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [
                    {
                      offset: 0,
                      color: 'rgba(69, 73, 240, 0)',
                    },
                    {
                      offset: 0.5,
                      color: 'rgba(69, 73, 240, .25)',
                    },
                    {
                      offset: 1,
                      color: 'rgba(69, 73, 240, 1)',
                    },
                  ],
                  globalCoord: false,
                },
                shadowBlur: 10,
                shadowColor: '#000',
              },
            },
            itemStyle: {
              color: {
                type: 'linear',
                x: 0,
                y: 0,
                x2: 0,
                y2: 1,
                colorStops: [
                  {
                    offset: 1,
                    color: 'rgba(58, 71, 212, 0)',
                  },
                  {
                    offset: 0.5,
                    color: 'rgba(31, 222, 225, .2)',
                  },
                  {
                    offset: 0,
                    color: 'rgba(31, 222, 225, 1)',
                  },
                ],
                globalCoord: false,
              },
            },
            label: {
              normal: {
                formatter: '',
              },
            },
          },
        ],
      };
      let myChart1 = this.$echarts.init(document.getElementById('shuiwen'));
      myChart1.setOption(option);
      window.addEventListener('resize', function () {
        myChart.resize();
    });
    },
  },
  created() {
    if (Window.ws != null) {
      Window.ws.close();
      Window.ws.onclose = () => {
        console.log('服务器关闭');
      };
      Window.ws = null;
    }
    Window.ws = new WebSocket('ws://192.168.20.55:12316/ws');
    Window.ws.option = () => {};
    var that = this;
    Window.ws.onmessage = (msg) => {
      // console.log('来自服务器端的数据:' + msg.data); //监听接受来自服务端的信息
      var data = JSON.parse(msg.data);
      if (data.resInfo == undefined) {
        that.SetTableData1(data);
      } else {
        that.SetTableData2(data);
      }
    };
  },
  mounted() {
    this.lineChart2(0);
  },
};
</script>
@@ -612,7 +447,7 @@
      box-sizing: border-box;
      padding: 10px;
      padding-top: 30px;
      width: 24%;
      width: 33%;
      height: 100%;
      background: #fff;
      border-radius: 5px;
@@ -653,32 +488,16 @@
      }
    }
  }
  .table_box {
    height: 36%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left {
      box-sizing: border-box;
      padding: 10px;
      width: 49%;
      height: 100%;
    width: 100%;
    height: 37%;
      background: #fff;
      border-radius: 5px;
      border: 1px solid rgb(202, 201, 204);
      overflow: auto;
    }
    .right {
      overflow: auto;
      box-sizing: border-box;
      padding: 10px;
      width: 49%;
      height: 100%;
      background: #fff;
      border-radius: 5px;
      border: 1px solid rgb(202, 201, 204);
    }
  }
  .title_box {
    font-weight: 800;
src/views/userManage/resourceManage.vue
@@ -746,11 +746,11 @@
      }
      this.listData.name = this.ruleForm.name;
      const data = await select_Res_ByPageAndCount(this.listData);
      console.log(data)
      if (data.code != 200) {
        this.$message.error('列表调用失败');
      }
      console.log(data.result);
      this.tableData = data.result;
      this.count = data.count;
    },