|
@@ -9,7 +9,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
<el-tab-pane v-for="item, index in appList" :label="item.name" :name="item.name" :key="index">
|
|
<el-tab-pane v-for="item, index in appList" :label="item.name" :name="item.name" :key="index">
|
|
|
- <div class="app-item" v-for="(childItem, index) in item.childrenMenus" :key="index" @click="handleSelect(childItem)"
|
|
|
|
|
|
|
+ <div class="app-item" v-for="(childItem, index) in item.children" :key="index" @click="handleSelect(childItem)"
|
|
|
@mouseover="showContent = index" @mouseleave="showContent = null">
|
|
@mouseover="showContent = index" @mouseleave="showContent = null">
|
|
|
<svg-icon :icon-class="childItem.icon" style="width: 40px;height: 40px" />
|
|
<svg-icon :icon-class="childItem.icon" style="width: 40px;height: 40px" />
|
|
|
{{ childItem.name }}
|
|
{{ childItem.name }}
|
|
@@ -25,8 +25,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import {appList} from "@/api/home";
|
|
|
|
|
-import { constantRoutes } from "@/router";
|
|
|
|
|
|
|
+import {appList,getListByMenuId} from "@/api/home";
|
|
|
import router from '@/router'
|
|
import router from '@/router'
|
|
|
import store from '@/store'
|
|
import store from '@/store'
|
|
|
export default {
|
|
export default {
|
|
@@ -35,144 +34,87 @@ export default {
|
|
|
activeName: 'OA',
|
|
activeName: 'OA',
|
|
|
showContent: null,
|
|
showContent: null,
|
|
|
appList: [
|
|
appList: [
|
|
|
- {
|
|
|
|
|
- name: 'OA',
|
|
|
|
|
- childrenMenus: [
|
|
|
|
|
- {
|
|
|
|
|
- type: 1,
|
|
|
|
|
- path: 'https://www.baidu.com/',
|
|
|
|
|
- name: '自定义应用',
|
|
|
|
|
- icon: 'zidingyi',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- type: 3,
|
|
|
|
|
- path: '/system/companyInfo',
|
|
|
|
|
- name: '系统管理',
|
|
|
|
|
- icon: 'chuchai',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- type: 1,
|
|
|
|
|
- path: '/oa/entry',
|
|
|
|
|
- name: '入职审批',
|
|
|
|
|
- icon: 'qingjia',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- type: 2,
|
|
|
|
|
- path: '/oa/turnJust',
|
|
|
|
|
- name: '转正申请',
|
|
|
|
|
- icon: 'chuchai',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- type: 3,
|
|
|
|
|
- path: '/oa/renewal',
|
|
|
|
|
- name: '续签申请',
|
|
|
|
|
- icon: 'chuchai',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- type: 4,
|
|
|
|
|
- path: '/oa/staffQuit',
|
|
|
|
|
- name: '离职申请',
|
|
|
|
|
- icon: 'chuchai',
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // {
|
|
|
|
|
+ // name: 'OA',
|
|
|
|
|
+ // children: [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // type: 1,
|
|
|
|
|
+ // path: 'https://www.baidu.com/',
|
|
|
|
|
+ // name: '自定义应用',
|
|
|
|
|
+ // icon: 'zidingyi',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // type: 3,
|
|
|
|
|
+ // path: '/system/companyInfo',
|
|
|
|
|
+ // name: '系统管理',
|
|
|
|
|
+ // icon: 'chuchai',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // type: 1,
|
|
|
|
|
+ // path: '/oa/entry',
|
|
|
|
|
+ // name: '入职审批',
|
|
|
|
|
+ // icon: 'qingjia',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // type: 2,
|
|
|
|
|
+ // path: '/oa/turnJust',
|
|
|
|
|
+ // name: '转正申请',
|
|
|
|
|
+ // icon: 'chuchai',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // type: 3,
|
|
|
|
|
+ // path: '/oa/renewal',
|
|
|
|
|
+ // name: '续签申请',
|
|
|
|
|
+ // icon: 'chuchai',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // type: 4,
|
|
|
|
|
+ // path: '/oa/staffQuit',
|
|
|
|
|
+ // name: '离职申请',
|
|
|
|
|
+ // icon: 'chuchai',
|
|
|
|
|
+ // },
|
|
|
|
|
|
|
|
- {
|
|
|
|
|
- type: 4,
|
|
|
|
|
- path: '/meeting/list',
|
|
|
|
|
- name: '会议室管理',
|
|
|
|
|
- icon: 'chuchai',
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: '人事',
|
|
|
|
|
- childrenMenus: [],
|
|
|
|
|
|
|
+ // {
|
|
|
|
|
+ // type: 4,
|
|
|
|
|
+ // path: '/meeting/list',
|
|
|
|
|
+ // name: '会议室管理',
|
|
|
|
|
+ // icon: 'chuchai',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ],
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // name: '人事',
|
|
|
|
|
+ // children: [],
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: '财务',
|
|
|
|
|
- childrenMenus: [],
|
|
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // name: '财务',
|
|
|
|
|
+ // children: [],
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: 'CRM',
|
|
|
|
|
- childrenMenus: [],
|
|
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // name: 'CRM',
|
|
|
|
|
+ // children: [],
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // },
|
|
|
]
|
|
]
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
- computed: {
|
|
|
|
|
- // 顶部显示菜单
|
|
|
|
|
- topMenus() {
|
|
|
|
|
- let topMenus = [];
|
|
|
|
|
- this.routers.map((menu) => {
|
|
|
|
|
- if (menu.hidden !== true) {
|
|
|
|
|
- // 兼容顶部栏一级菜单内部跳转
|
|
|
|
|
- if (menu.path === "/") {
|
|
|
|
|
- topMenus.push(menu.children[0]);
|
|
|
|
|
- } else {
|
|
|
|
|
- topMenus.push(menu);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- return topMenus;
|
|
|
|
|
- },
|
|
|
|
|
- // 所有的路由信息
|
|
|
|
|
- routers() {
|
|
|
|
|
- return this.$store.state.permission.topbarRouters;
|
|
|
|
|
- },
|
|
|
|
|
- // 设置子路由
|
|
|
|
|
- childrenMenus() {
|
|
|
|
|
- const childrenMenus = [];
|
|
|
|
|
- this.routers.map((router) => {
|
|
|
|
|
- for (let item in router.children) {
|
|
|
|
|
- if (router.children[item].parentPath === undefined) {
|
|
|
|
|
- if (router.path === "/") {
|
|
|
|
|
- router.children[item].path = "/" + router.children[item].path;
|
|
|
|
|
- } else {
|
|
|
|
|
- if (!this.ishttp(router.children[item].path)) {
|
|
|
|
|
- router.children[item].path = router.path + "/" + router.children[item].path;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- router.children[item].parentPath = router.path;
|
|
|
|
|
- }
|
|
|
|
|
- childrenMenus.push(router.children[item]);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- return constantRoutes.concat(childrenMenus);
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
created(){
|
|
created(){
|
|
|
- // this.getAppList();
|
|
|
|
|
|
|
+ this.getAppList();
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
getAppList() {
|
|
getAppList() {
|
|
|
appList().then(res => {
|
|
appList().then(res => {
|
|
|
let appDataList = [];
|
|
let appDataList = [];
|
|
|
res.data.map((item) => {
|
|
res.data.map((item) => {
|
|
|
- if (item.name != '其他') {
|
|
|
|
|
|
|
+ // if (item.name != '其他') {
|
|
|
appDataList.push(item);
|
|
appDataList.push(item);
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
});
|
|
});
|
|
|
this.appList = appDataList;
|
|
this.appList = appDataList;
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- // 当前激活的路由
|
|
|
|
|
- activeRoutes(key) {
|
|
|
|
|
- debugger
|
|
|
|
|
- const routes = []
|
|
|
|
|
- if (this.childrenMenus && this.childrenMenus.length > 0) {
|
|
|
|
|
- this.childrenMenus.map((item) => {
|
|
|
|
|
- if (key === item.parentPath || (key === "index" && "" === item.path)) {
|
|
|
|
|
- routes.push(item);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- if (routes.length > 0) {
|
|
|
|
|
- this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
|
|
|
|
|
- }
|
|
|
|
|
- this.$router.push({ path: key });
|
|
|
|
|
- },
|
|
|
|
|
childMethod() {
|
|
childMethod() {
|
|
|
this.$parent.openAppList();
|
|
this.$parent.openAppList();
|
|
|
},
|
|
},
|
|
@@ -183,6 +125,24 @@ export default {
|
|
|
// 菜单选择事件
|
|
// 菜单选择事件
|
|
|
handleSelect(item) {
|
|
handleSelect(item) {
|
|
|
let key = item.path;
|
|
let key = item.path;
|
|
|
|
|
+ getListByMenuId({menuld:item.id}).then(response => {
|
|
|
|
|
+ let menuList =response.data;
|
|
|
|
|
+ localStorage.setItem("menus", JSON.stringify(menuList))
|
|
|
|
|
+ if (this.ishttp(key)) {
|
|
|
|
|
+ // http(s):// 路径新窗口打开
|
|
|
|
|
+ window.open(key, "_blank");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ store.dispatch('GenerateRoutes', menuList).then(accessRoutes => {
|
|
|
|
|
+ console.log(accessRoutes);
|
|
|
|
|
+ // 根据 roles 权限生成可访问的路由表
|
|
|
|
|
+ router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
|
|
|
|
+ })
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.$router.push({ path: key });
|
|
|
|
|
+ }, 200);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
const menus = [
|
|
const menus = [
|
|
|
{
|
|
{
|
|
|
"id": 1254,
|
|
"id": 1254,
|
|
@@ -3124,21 +3084,6 @@ export default {
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
- localStorage.setItem("menus", JSON.stringify(menu))
|
|
|
|
|
- if (this.ishttp(key)) {
|
|
|
|
|
- // http(s):// 路径新窗口打开
|
|
|
|
|
- window.open(key, "_blank");
|
|
|
|
|
- } else {
|
|
|
|
|
- store.dispatch('GenerateRoutes', menu).then(accessRoutes => {
|
|
|
|
|
- console.log(accessRoutes);
|
|
|
|
|
- // 根据 roles 权限生成可访问的路由表
|
|
|
|
|
- router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
|
|
|
|
- })
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.$router.push({ path: key });
|
|
|
|
|
- }, 200);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
handleClick(tab, event) {
|
|
handleClick(tab, event) {
|
|
|
console.log(tab, event);
|
|
console.log(tab, event);
|