管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-02-28 fb207b8eec40b5111018db0ae38c3e9fef56f0aa
src/views/maintenance/mochaitmo.vue
@@ -41,6 +41,8 @@
        <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>
        <data-statistics v-if="setMenuFlag == 'dataStatistics'"></data-statistics>
      </div>
    </div>
@@ -68,8 +70,11 @@
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 templateManage from '@/views/userManage/templateManage.vue'//模板管理
import { selectMenuRecursive, queryMenuTree, getPerms, sign_insertOpLog } from '../../api/api';
import customElMenu from '../../components/customElMenu.vue';
import dataStatistics from '@/views/datamanage/dataStatistics.vue'; //数据统计
export default {
  components: {
    menuSettings,
@@ -91,7 +96,9 @@
    systemMonitoring,
    parameterConfiguration,
    customElMenu,
    downlog
    downlog,
    templateManage,
    dataStatistics
  },
  data() {
    return {
@@ -112,13 +119,59 @@
      editUnit: false,
      itemdetail: {},
      formLabelWidth: '70px',
      m1: null,
    };
  },
  created() { },
  mounted() {
    this.getTreeData();
    //左右拖動
    this.dragControllerDiv();
  },
  methods: {
    //左右拖動
    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) {
@@ -130,6 +183,7 @@
        this.$store.state.permsEntity = data.result;
      }
      var store = this.menuList[0];
      this.m1 = store.cnName;
      this.setViewController(store);
    },
    getTimeCookies() {
@@ -155,9 +209,19 @@
        if (res.result.length != 0) {
          let menuList = res.result.filter((value) => {
            return value.type == 1;
          });
          })
            .filter(value => {
              return value.isShow == 1;
            });
          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('暂无菜单栏数据');
@@ -168,14 +232,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;
      }
@@ -199,6 +277,11 @@
    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;
@@ -208,6 +291,25 @@
          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) {
        if (index.indexOf('http') != -1) {
          this.$store.commit('getIframe', data.url);
          index = 'dataIfream';
        }
      }
      this.setMenuFlag = index;
    },