Commit 186cc5c5 authored by jingnan's avatar jingnan 👀

首页修改

parent 97676d89
......@@ -162,7 +162,7 @@ router.beforeEach(async(to, from, next) => {
})
function findModuleRoute(path, query) {
if (path === '/') return null
if (path === '/' || path === '/home') return null
let result = null
const module = path.split('/')[1]
......
......@@ -133,6 +133,13 @@ export const constantRoutes = [
// component: () => import('@/views/general/page/index.vue'),
// hidden: true
// },
{
path: '/oldCenter',
name: 'oldCenter',
meta: { disnav: true },
component: () => import('@/views/navigation/index'),
hidden: true
},
{
path: '/',
name: 'navigation',
......
......@@ -5,14 +5,14 @@
* @FilePath: applications/dee-task-center/src/views/home/compontents/apply-app.vue
*/
<template>
<div class="apply-app">
<div v-dee-loading="appConLoading" class="apply-app">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>应用APP</span>
</div>
<div class="text item div-card">
<div v-for="(item, i) in cardList" :key="i" :class="!item.hasPermission?'no-allowed':''">
<div :class="!item.hasPermission?'no-click':''" class="card" @click="handClick(item)">
<div :class="!item.hasPermission?'no-click':''" class="card" @click="goContent(item)">
<div class="icon">
<img :src="item.icon" alt="Icon">
</div>
......@@ -27,52 +27,36 @@
</template>
<script>
import { mapGetters } from 'vuex'
import { get } from '@/utils/http'
export default {
components: {},
data() {
return {
appConLoading: false,
cardList: [
{
icon: '/icons/home/cangku_kucun.png',
title: '库房管理',
route: {
path: '/page/86a5fa19-e245-4732-aff6-c48b18e2b5c7?title=采购入库&menuRootAppId=1626781924331'
}
title: '库房管理'
},
{
icon: '/icons/home/计划管理与执行.png',
title: '计划与执行管理',
route: {
path: '/dee-mes/inspection-dispatch?title=检验派工&menuRootAppId=1626785745213'
}
title: '计划与执行管理'
},
{
icon: '/icons/home/质量单据.png',
title: '现场例外管理',
route: {
path: '/page/ca1f328e-b591-4e29-8b48-57a5ae20870d?title=行动项管理&menuRootAppId=1626786988508'
}
title: '现场例外管理'
},
{
icon: '/icons/home/物料配套管理.png',
title: '物料配套管理',
route: {
path: '/page/f535277f-b636-437b-a88b-bf42b2087f5e?title=缺件明细维护&menuRootAppId=1626789048727'
}
title: '物料配套管理'
},
{
icon: '/icons/home/不合格品.png',
title: '线边库管理',
route: {
path: '/page/0b6a7a64-8480-4f95-a24a-c9a480a90c10?title=工具台账管理&menuRootAppId=1626788064518'
}
title: '线边库管理'
},
{
icon: '/icons/home/报表中心.png',
title: '报表中心',
route: {
path: '/page/fb9de1be-089d-44e6-9482-6afe2ebf61ad?title=台账流水&menuRootAppId=1626788424160'
}
title: '报表中心'
},
// {
// icon: '/icons/home/实物构型管理.png',
......@@ -80,19 +64,16 @@ export default {
// },
{
icon: '/icons/home/基础数据管理.png',
title: '基础数据管理',
route: {
path: '/page/6f1343ab-3376-4bf1-8cd6-b1f8031e9a6f?title=库房库位定义&menuRootAppId=1626781744425'
}
},
{
icon: '/icons/home/系统管理.png',
title: '系统管理',
route: {
path: '/systemHome?title=systemHome'
}
title: '基础数据管理'
},
// {
// icon: '/icons/home/系统管理.png',
// title: '系统管理'
// // route: {
// // path: '/systemHome?title=systemHome'
// // }
// },
// {
// icon: '/icons/home/看板.png',
// title: '看板',
// route: {
......@@ -101,47 +82,177 @@ export default {
// },
{
icon: '/icons/home/单架次MBOM.png',
title: '单架次MBOM',
route: {
path: '/page/262fe280-0436-4920-a549-4c4aade22f10?title=指令标识维护&menuRootAppId=1626782294437'
}
title: '单架次MBOM配置'
}
]
}
},
computed: {
...mapGetters(['permMenus'])
...mapGetters(['permMenus', 'activeWorkSpace'])
},
watch: {
cardList: {
immediate: true,
deep: true,
handler(val) {
val && val.length && this.getPermAppMenu()
}
}
},
created() {
// 初始化数据
this.getAppGroup()
},
methods: {
handClick(val) {
if (!val.route) {
this.$utils.showMessageWarning('暂无页面')
return
}
this.$router.push(val.route)
/**
* @function 获取应用分组
* @description 通过工作空间id查询当前APP中心分组
*/
getAppGroup() {
this.appConLoading = true
get('/DxWorkspace/findWorkspaceListById', { id: this.activeWorkSpace.id }).then(res => {
let dxAppWorkGroups = []
const allApps = res.items.sourceDxAppWorkLink ? res.items.sourceDxAppWorkLink.map(r => {
return r.target
}) : []
if (Array.isArray(res.items.dxAppWorkGroups) && res.items.dxAppWorkGroups.length > 0) {
dxAppWorkGroups = res.items.dxAppWorkGroups || []
}
dxAppWorkGroups.forEach((group, idx) => {
if (group.sourceDxAppWorkGroupLink && group.sourceDxAppWorkGroupLink.length) {
group.sourceDxAppWorkGroupLink.map(r => {
allApps.push(r.target)
})
}
})
const obj = {}
this.getPermAppMenu(allApps.reduce(function(item, next) {
obj[next.id] ? '' : obj[next.id] = true && item.push(next)
return item
}, []))
}).catch(err => {
console.log('err: ', err)
}).finally(() => {
this.appConLoading = false
})
},
// 与有权限的菜单取交集
getPermAppMenu() {
getPermAppMenu(dxApplications) {
const permMenus = this.permMenus.filter(m => m.dxApplicationId)
this.cardList.forEach(app => {
const menuIdx = permMenus.findIndex(g => g.name === app.title)
dxApplications.forEach(app => {
const menuIdx = permMenus.findIndex(g => g.dxApplicationId === app.id)
if (menuIdx > -1) {
// app.hasPermission = !!permMenus.find(h => h.parentId && h.name === app.title)
app.hasPermission = !!permMenus.find(h => h.name === app.title)
app.dxApplicationMenus = permMenus.filter(h => h.parentId && h.dxApplicationId === app.id)
this.cardList.forEach((card, index) => {
if (card.title === app.name) {
const tempCard = {
...card,
...app,
hasPermission: true
}
this.$set(this.cardList, index, tempCard)
}
})
}
})
},
goContent(app) {
if (!app.dxApplicationMenus) {
return this.$utils.showMessageWarning('请在应用中心配置菜单页面')
}
const menu = this.$utils.generateTree(app.dxApplicationMenus, {
pid: 'parentId'
})
if (this.activeWorkSpace) {
const params = {
'openProps': [
{
'name': 'dxApplicationPage'
}
],
'searchItems': {
'items': [
{
'fieldName': 'dxWorkspaceId',
'operator': 'EQ',
'value': this.activeWorkSpace.id
},
{
'fieldName': 'dxApplicationId',
'operator': 'EQ',
'value': app.id
}
],
'operator': 'AND'
}
}
this.$api.searchApi('DxSpaceStartPage', params).then(res => {
if (res.items.content && res.items.content.length) {
const activePage = res.items.content[0].dxApplicationPage
let toPage
if (activePage.type === '1') {
toPage = {
path: `/page/${activePage.pageKey}`,
query: {}
}
} else if (activePage.type === '2') {
toPage = {
path: activePage.route,
query: {}
}
}
if (activePage.name) {
toPage.query.title = activePage.name
}
toPage.query.menuRootAppId = app.id
localStorage.setItem('moduleName', app.name)
this.$router.push(toPage)
} else {
this.topage(menu, app)
}
})
} else {
this.topage(menu, app)
}
},
topage(menu, app) {
const activePage = this.getActiveTab(menu)
if (!activePage) return
let toPage
if (activePage.type === '1') {
toPage = {
path: `/page/${activePage.pageKey}`,
query: {}
}
} else if (activePage.type === '2') {
toPage = {
path: activePage.route,
query: {}
}
}
if (activePage.name) {
toPage.query.title = activePage.name
}
toPage.query.menuRootAppId = app.id
localStorage.setItem('moduleName', app.title)
this.$router.push(toPage)
},
getActiveTab(menus) {
for (let i = 0; i < menus.length; i++) {
const menu = menus[i]
if (
menu.dxApplicationPage &&
menu.dxApplicationPage.subTypeName === 'DxApplicationPage' &&
menu.permFlag
) {
return menu.dxApplicationPage
} else if (menu.children && menu.children.length > 0 && menu.permFlag) {
for (let j = 0; j < menu.children.length; j++) {
const item = menu.children[j]
if (
item.dxApplicationPage &&
item.dxApplicationPage.subTypeName === 'DxApplicationPage'
) {
return item.dxApplicationPage
} else if (item.children && item.children.length > 0) {
return this.getActiveTab(item)
}
}
}
}
}
}
}
......
......@@ -5,7 +5,7 @@
* @FilePath: applications/dee-task-center/src/views/home/index.vue
*/
<template>
<div class="home-container">
<div v-if="userInfo!=='sysadmin'&&userInfo!=='secadmin'" class="home-container">
<dee-fold-pane :min-percent="30" :default-percent="33" split="vertical" class="detail-pane">
<template slot="paneL">
<!-- 左侧 -->
......@@ -100,7 +100,8 @@ export default {
{ color: '#F48686', name: '某缺件率', present: 20 }
],
activeTitle: '我的待办'
activeTitle: '我的待办',
userInfo: localStorage.getItem('user')
}
},
computed: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment