管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-02-11 d5efa1b1cdbab10b034357ae3e7b65c21754a123
src/views/maintenance/mochaitmo.vue
@@ -1,48 +1,52 @@
<template>
  <div class="mochaitmo_Box">
    <div class="left_tree">
      <el-card class="el-card-define">
        <div class="card_tree">
          <el-menu
            active-text-color="#ffd04b"
            class="el-menu-vertical-demo"
            :default-active="activeIndex"
            background-color="transparent"
            text-color="#fff"
            @select="handleselect"
          >
            <customElMenu :menuData="menuList"></customElMenu>
          </el-menu>
        </div>
      </el-card>
  <div class="contentBox">
    <div
      class="box"
      ref="box"
    >
      <div class="left box_div">
        <el-menu
          :default-active="activeIndex"
          background-color="transparent"
          @select="handleselect"
        >
          <customElMenu :menuData="menuList"></customElMenu>
        </el-menu>
      </div>
      <div
        class="resize"
        title="收缩侧边栏"
      >
        ⋮
      </div>
      <div class="mid box_div">
        <menu-settings v-if="setMenuFlag == 'menuSettings'"></menu-settings>
        <user-management v-if="setMenuFlag == 'userInfoManage'"></user-management>
        <org-manage v-if="setMenuFlag == 'orgManage'"></org-manage>
        <resource-manage v-if="setMenuFlag == 'resourceManage'"></resource-manage>
        <role-manage v-if="setMenuFlag == 'roleManage'"></role-manage>
        <authority-manage v-if="setMenuFlag == 'authorityManage'"></authority-manage>
        <user-role-authorization v-if="setMenuFlag == 'userRoleAuthorization'"></user-role-authorization>
        <menu-role-authorization v-if="setMenuFlag == 'menuRoleAuthorization'"></menu-role-authorization>
        <role-menu-authorization v-if="setMenuFlag == 'roleMenuAuthorization'">
        </role-menu-authorization>
        <role-res-authorization v-if="setMenuFlag == 'roleResAuthorization'"></role-res-authorization>
        <log-log v-if="setMenuFlag == 'logLog'"> </log-log>
        <operation-log v-if="setMenuFlag == 'operationLog'"></operation-log>
        <eventlog-manage v-if="setMenuFlag == 'eventlogManage'"></eventlog-manage>
        <tokentool v-if="setMenuFlag == 'tokentool'"></tokentool>
        <blackwhite-list v-if="setMenuFlag == 'blackwhiteList'"></blackwhite-list>
        <database-monitoring v-if="setMenuFlag == 'dataIfream'"></database-monitoring>
        <system-monitoring v-if="setMenuFlag == 'systemMonitoring'"></system-monitoring>
        <parameter-configuration v-if="setMenuFlag == 'parameterConfiguration'"></parameter-configuration>
        <downlog v-if="setMenuFlag == 'downlog'"></downlog>
        <template-manage v-if="setMenuFlag == 'templateManage'"></template-manage>
      </div>
    </div>
    <div class="right_page">
      <el-card class="el-card-define">
       <div>
          <menu-settings v-if="setMenuFlag == 'menuSettings'"></menu-settings>
          <user-management v-if="setMenuFlag == 'userInfoManage'"></user-management>
          <org-manage v-if="setMenuFlag == 'orgManage'"></org-manage>
          <resource-manage v-if="setMenuFlag == 'resourceManage'"></resource-manage>
          <role-manage v-if="setMenuFlag == 'roleManage'"></role-manage>
          <authority-manage v-if="setMenuFlag == 'authorityManage'"></authority-manage>
          <user-role-authorization v-if="setMenuFlag == 'userRoleAuthorization'"></user-role-authorization>
          <menu-role-authorization v-if="setMenuFlag == 'menuRoleAuthorization'"></menu-role-authorization>
          <role-menu-authorization v-if="setMenuFlag == 'roleMenuAuthorization'">
          </role-menu-authorization>
          <role-res-authorization v-if="setMenuFlag == 'roleResAuthorization'"></role-res-authorization>
          <log-log v-if="setMenuFlag == 'logLog'"> </log-log>
          <operation-log v-if="setMenuFlag == 'operationLog'"></operation-log>
          <eventlog-manage v-if="setMenuFlag == 'eventlogManage'"></eventlog-manage>
          <tokentool v-if="setMenuFlag == 'tokentool'"></tokentool>
          <blackwhite-list v-if="setMenuFlag == 'blackwhiteList'"></blackwhite-list>
          <database-monitoring v-if="setMenuFlag == 'dataIfream'"></database-monitoring>
          <system-monitoring v-if="setMenuFlag == 'systemMonitoring'"></system-monitoring>
          <parameter-configuration v-if="setMenuFlag == 'parameterConfiguration'"></parameter-configuration>
          <downlog v-if="setMenuFlag == 'downlog'"></downlog>
        </div>
      </el-card>
    </div>
  </div>
</template>
<script>
@@ -64,12 +68,14 @@
import databaseMonitoring from '@/views/maintenance/databaseMonitoring.vue'; //数据库监控
import systemMonitoring from '@/views/maintenance/systemMonitoring.vue'; //系统监控
import parameterConfiguration from '@/views/maintenance/parameterConfiguration.vue'; //系统配置
import downlog  from '@/views/maintenance/downlog.vue'; //下载日志
import { selectMenuRecursive, queryMenuTree, getPerms } from '../../api/api';
import downlog from '@/views/maintenance/downlog.vue'; //下载日志
import templateManage from '@/views/userManage/templateManage.vue'//模板管理
import { selectMenuRecursive, queryMenuTree, getPerms, sign_insertOpLog } from '../../api/api';
import customElMenu from '../../components/customElMenu.vue';
export default {
  components: {
  menuSettings,
    menuSettings,
    userManagement,
    orgManage,
    resourceManage,
@@ -88,11 +94,13 @@
    systemMonitoring,
    parameterConfiguration,
    customElMenu,
    downlog
    downlog,
    templateManage,
  },
  data() {
    return {
     setMenuFlag: '   ',
      setMenuFlag: '   ',
      activeIndex: ' ',
      oriData: [], //原始树数据
      dirData: [], //el树数据
@@ -109,14 +117,60 @@
      editUnit: false,
      itemdetail: {},
      formLabelWidth: '70px',
      m1: null,
    };
  },
  created() { },
  mounted() {
  this.getTreeData();
    this.getTreeData();
    //左右拖動
    this.dragControllerDiv();
  },
  methods: {
     async getCookies() {
    //左右拖動
    dragControllerDiv: function () {
      var resize = document.getElementsByClassName('resize');
      var left = document.getElementsByClassName('left');
      var mid = document.getElementsByClassName('mid');
      var box = document.getElementsByClassName('box');
      for (let i = 0; i < resize.length; i++) {
        // 鼠标按下事件
        resize[i].onmousedown = function (e) {
          //颜色改变提醒
          resize[i].style.background = '#818181';
          var startX = e.clientX;
          resize[i].left = resize[i].offsetLeft;
          // 鼠标拖动事件
          document.onmousemove = function (e) {
            var endX = e.clientX;
            var moveLen = resize[i].left + (endX - startX); // (endx-startx)=移动的距离。resize[i].left+移动的距离=左边区域最后的宽度
            var maxT = box[i].clientWidth - resize[i].offsetWidth; // 容器宽度 - 左边区域的宽度 = 右边区域的宽度
            if (moveLen < 205) moveLen = 205; // 左边区域的最小宽度为32px
            if (moveLen > maxT - 300) moveLen = maxT - 300; //右边区域最小宽度为150px
            resize[i].style.left = moveLen; // 设置左侧区域的宽度
            for (let j = 0; j < left.length; j++) {
              left[j].style.width = moveLen + 'px';
              mid[j].style.width = (box[i].clientWidth - moveLen - 10) + 'px';
            }
          };
          // 鼠标松开事件
          document.onmouseup = function (evt) {
            //颜色恢复
            resize[i].style.background = '#d6d6d6';
            document.onmousemove = null;
            document.onmouseup = null;
            resize[i].releaseCapture && resize[i].releaseCapture(); //当你不在需要继续获得鼠标消息就要应该调用ReleaseCapture()释放掉
          };
          resize[i].setCapture && resize[i].setCapture(); //该函数在属于当前线程的指定窗口里设置鼠标捕获
          return false;
        };
      }
    },
    async getCookies() {
      var boolean = this.getTimeCookies();
      if (boolean != true) {
        this.$router.push('/login');
@@ -127,6 +181,7 @@
        this.$store.state.permsEntity = data.result;
      }
      var store = this.menuList[0];
      this.m1 = store.cnName;
      this.setViewController(store);
    },
    getTimeCookies() {
@@ -145,9 +200,9 @@
      let menuLists = data.result.filter((value) => {
        return value.url == '/mochaitmo';
      });
      const res = await selectMenuRecursive({ id: menuLists[0].id});
      const res = await selectMenuRecursive({ id: menuLists[0].id });
      if (res.code == 200) {
        if (res.result.length != 0) {
          let menuList = res.result.filter((value) => {
@@ -155,6 +210,13 @@
          });
          this.menuList = this.treeData(menuList);
          this.getCookies();
          const hanleselectmochaitmo = sessionStorage.getItem('hanleselectmochaitmo')
          if (hanleselectmochaitmo) {
            this.$nextTick(function () {
              this.handleselecttwo(JSON.parse(hanleselectmochaitmo).url, JSON.parse(hanleselectmochaitmo))
              this.setViewController(JSON.parse(hanleselectmochaitmo))
            })
          }
          //
        } else {
          alert('暂无菜单栏数据');
@@ -165,14 +227,28 @@
      // this.treeList = this.treeData(data.result);
    },
    async signInsertOpLog(m1, m2) {
      var obj = {
        m1: m1,
        m2: m2,
      }
      const data = await sign_insertOpLog(obj);
    },
    setViewController(res) {
      if (res == null) {
        return;
      }
      if (res.children != null) {
        this.setViewController(res.children[0]);
      } else {
        this.$store.state.currentPerms = res.perms;
        this.signInsertOpLog(this.m1, res.cnName)
        this.setMenuFlag = res.url;
        this.activeIndex = res.url;
      }
@@ -196,7 +272,31 @@
    handleselect(index, indexPath, e) {
      this.getTimeCookies();
      this.signInsertOpLog(this.m1, e.$attrs.perms.cnName)
      const a = JSON.stringify(e.$attrs.perms)
      sessionStorage.setItem('hanleselectmochaitmo', a)
      var data = e.$attrs.perms;
      this.$store.state.currentPerms = data.perms;
      var index = data.url;
      if (index != null) {
        if (index.indexOf('http') != -1) {
          this.$store.commit('getIframe', data.url);
          index = 'dataIfream';
        }
      }
      this.setMenuFlag = index;
    },
    handleselecttwo(index, e) {
      this.getTimeCookies();
      const a = JSON.stringify(e)
      sessionStorage.setItem('hanleselectmochaitmo', a)
      var data = e;
      this.$store.state.currentPerms = data.perms;
      var index = data.url;
      if (index != null) {
@@ -212,66 +312,4 @@
};
</script>
<style lang="less" scoped>
.mochaitmo_Box {
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  margin: 0;
  padding: 10px;
  overflow-y: hidden;
  .left_tree {
    width: 270px;
    height: 100%;
    position: relative;
    float: left;
    border-radius: 5px;
  }
  .el-card-define {
    height: 100%;
    background: #303030;
    border: 1px solid gray;
    padding: 1px !important;
  }
  .el-tree {
    background-color: transparent;
  }
  .card_tree {
    height: 100%;
    overflow-y: auto;
  }
  .el-card__body,
  .el-main {
    padding: 0px !important;
    height: 100%;
  }
  .right_page {
    width: calc(100% - 280px);
    height: 100%;
    background: #303030;
    position: relative;
    float: right;
  }
  /deep/.el-menu {
    border: transparent !important;
  }
  /deep/.el-submenu__title:hover {
    background: rgba(255, 255, 255, 0.3) !important;
  }
  /deep/ .el-submenu .el-menu-item:hover {
    background: rgba(255, 255, 255, 0.3) !important;
  }
  /deep/.el-textarea__inner {
    background: transparent;
    border-color: #fff !important;
    color: white;
  }
  /deep/.el-textarea .el-input__count {
    background: transparent;
    color: #fff !important;
  }
  /deep/ .el-card__body {
    padding: 0px !important;
    height: 100%;
  }
}
</style>