<template>
|
<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>
|
<template-manage v-if="setMenuFlag == 'templateManage'"></template-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>
|
|
<data-statistics v-if="setMenuFlag == 'dataStatistics'"></data-statistics> -->
|
</div>
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
import menuSettings from '@/views/maintenance/menuSettings.vue'; //菜单管理
|
import userManagement from '@/views/maintenance/userManagement.vue'; //用户管理
|
import orgManage from '@/views/userManage/orgManage.vue'; //单位管理
|
import resourceManage from '@/views/userManage/resourceManage.vue'; //资源管理
|
import roleManage from '@/views/userManage/roleManage.vue'; //角色管理
|
import authorityManage from '@/views/userManage/authorityManage.vue'; //权限管理
|
import userRoleAuthorization from '@/views/AuthorizationManagement/userRoleAuthorization.vue'; //用户角色授权
|
import menuRoleAuthorization from '@/views/AuthorizationManagement/menuRoleAuthorization.vue'; //菜单权限授权
|
import roleMenuAuthorization from '@/views/AuthorizationManagement/roleMenuAuthorization.vue'; //角色菜单授权
|
import roleResAuthorization from '@/views/AuthorizationManagement/roleResAuthorization.vue'; //角色资源授权
|
import logLog from '@/views/maintenance/logLog.vue'; //登录日志
|
import operationLog from '@/views/maintenance/operationLog.vue'; //操作日志
|
import eventlogManage from '@/views/maintenance/eventlogManage.vue'; //资源日志
|
import tokentool from '@/views/maintenance/tokentool.vue'; //令牌管理
|
import blackwhiteList from '@/views/maintenance/blackwhiteList.vue'; //黑白名单
|
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 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,
|
userManagement,
|
orgManage,
|
resourceManage,
|
roleManage,
|
authorityManage,
|
userRoleAuthorization,
|
menuRoleAuthorization,
|
roleMenuAuthorization,
|
roleResAuthorization,
|
logLog,
|
operationLog,
|
eventlogManage,
|
tokentool,
|
blackwhiteList,
|
databaseMonitoring,
|
systemMonitoring,
|
parameterConfiguration,
|
customElMenu,
|
downlog,
|
templateManage,
|
dataStatistics
|
},
|
data() {
|
return {
|
setMenuFlag: ' ',
|
activeIndex: ' ',
|
oriData: [], //原始树数据
|
dirData: [], //el树数据
|
newData: [], //拖动后数据
|
lang: 'zh',
|
|
menuList: [],
|
editTitle: '',
|
showPopover: false,
|
showEditInfoWrapper: false,
|
showEdit: false,
|
editMenu: false,
|
editCatalogue: false,
|
editUnit: false,
|
itemdetail: {},
|
formLabelWidth: '70px',
|
m1: null,
|
menuId: 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) {
|
this.$router.push('/login');
|
return;
|
}
|
if (this.$store.state.permsEntity.length == 0) {
|
const data = await getPerms();
|
this.$store.state.permsEntity = data.result;
|
}
|
var store = this.menuList[0];
|
this.m1 = store.cnName;
|
this.setViewController(store);
|
},
|
getTimeCookies() {
|
var time1 = new Date(JSON.parse(localStorage.getItem('LFToken')).time);
|
var time2 = new Date();
|
if (time2 > time1) {
|
return false;
|
} else {
|
return true;
|
}
|
},
|
//获取树
|
async getTreeData() {
|
const data = await queryMenuTree();
|
|
let menuLists = data.result.filter((value) => {
|
return value.url == '/systemController';
|
});
|
this.menuId = 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) => {
|
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('暂无菜单栏数据');
|
}
|
} else {
|
console.log('接口报错');
|
}
|
|
// 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;
|
}
|
},
|
treeData(source) {
|
let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆
|
// console.log(cloneData);
|
if (cloneData.length != 0) {
|
return cloneData.filter((father) => {
|
// 循环所有项
|
let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
|
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 == this.menuId; // 返回一级菜单
|
});
|
} else {
|
alert('暂无菜单栏数据');
|
}
|
},
|
|
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) {
|
if (index.indexOf('http') != -1) {
|
this.$store.commit('getIframe', data.url);
|
index = 'dataIfream';
|
}
|
}
|
this.setMenuFlag = index;
|
|
},
|
},
|
};
|
</script>
|
|
|