<template>
|
<el-scrollbar wrapClass="scrollbar-wrapper">
|
<el-menu
|
mode="vertical"
|
:show-timeout="200"
|
:default-active="$route.path"
|
:collapse="isCollapse"
|
background-color="#304156"
|
text-color="#bfcbd9"
|
active-text-color="#409EFF">
|
<sidebar-item :routes="computedRouters"></sidebar-item>
|
</el-menu>
|
</el-scrollbar>
|
</template>
|
|
<script>
|
import { mapGetters } from 'vuex'
|
import SidebarItem from './SidebarItem'
|
|
export default {
|
components: { SidebarItem },
|
computed: {
|
...mapGetters([
|
'sidebar'
|
]),
|
// routes() {
|
// return this.$router.options.routes
|
// },
|
isCollapse() {
|
return !this.sidebar.opened
|
},
|
computedRouters() {
|
const workshopArr = this.$store.getters.workshopList
|
// const deviceMaintenanceArr = this.$store.getters.workshopList
|
// const dCategories = this.$store.getters.deviceCategories
|
// const sideMenuArr = [{
|
// // path: '/log/index',
|
// meta: { title: '机床', icon: 'current_data' }
|
// },
|
const sideMenuArr = [{
|
path: '/shift-config/index',
|
meta: { title: '班次设置', icon: 'alarm' }
|
},
|
{
|
path: '/component-info/index',
|
meta: { title: '工件信息', icon: 'alarm' }
|
},
|
{
|
path: '/machine-types/index',
|
meta: { title: '机床类型', icon: 'alarm' }
|
}
|
// {
|
// path: '/report/index',
|
// meta: { title: '报表生成', icon: 'alarm' }
|
// }
|
// {
|
// path: '/device/manage',
|
// meta: { title: '数控设备台账', icon: 'alarm' }
|
// },
|
// {
|
// path: '/current-data/index',
|
// meta: { title: '今日数据', icon: 'current_data' }
|
// },
|
// {
|
// path: '/history-data/index',
|
// meta: { title: '历史数据', icon: 'history_data' }
|
// },
|
// {
|
// path: '/alarm/index',
|
// meta: { title: '刀具预警', icon: 'alarm' }
|
// },
|
// {
|
// path: '/device/maintenance',
|
// meta: { title: '设备保养', icon: 'alarm' }
|
// },
|
// {
|
// path: '/history/index4',
|
// meta: { title: '设备保修', icon: 'alarm' }
|
// },
|
// {
|
// path: '/tool-info/index',
|
// meta: { title: '刀具信息', icon: 'alarm' }
|
// },
|
// {
|
// path: '/user/user',
|
// meta: { title: '个人中心', icon: 'user' }
|
// }
|
]
|
// 车间
|
let totalMachineCount = 0
|
for (let i = 0; i < workshopArr.length; i++) {
|
totalMachineCount += workshopArr[i].machineCount
|
}
|
const workshopObj = {
|
path: '/workshop',
|
meta: { title: '车间列表', icon: 'workshop' },
|
children: []
|
}
|
workshopObj.children.push({
|
path: 0,
|
meta: { title: '2厂(' + totalMachineCount + ')', icon: 'workshop' }
|
})
|
for (let i = 0; i < workshopArr.length; i++) {
|
var name = workshopArr[i].name
|
workshopObj.children.push({
|
path: workshopArr[i].id,
|
meta: { title: name + '(' + workshopArr[i].machineCount + ')', icon: workshopArr[i].workshopId === 'suppertoggle' ? 'suppertoggle' : 'workshop' }
|
})
|
for (let j = 0; j < workshopArr[i].sectionList.length; j++) {
|
name = workshopArr[i].name + '-' + workshopArr[i].sectionList[j].name
|
workshopObj.children.push({
|
path: workshopArr[i].id + '=' + workshopArr[i].sectionList[j].id,
|
meta: { title: name + '(' + workshopArr[i].sectionList[j].machineCount + ')', icon: workshopArr[i].workshopId === 'suppertoggle' ? 'suppertoggle' : 'workshop' }
|
})
|
}
|
}
|
// 车间大屏
|
const workshopObjlist = {
|
path: '/workshoplist',
|
meta: { title: '车间大屏', icon: 'workshop' },
|
children: []
|
}
|
for (let i = 0; i < workshopArr.length; i++) {
|
workshopObjlist.children.push({
|
path: workshopArr[i].id,
|
meta: { title: workshopArr[i].name, icon: workshopArr[i].workshopId === 'suppertoggle' ? 'suppertoggle' : 'workshop' }
|
})
|
}
|
const deviceMaintenanceArr = [
|
{ path: 'dailymaintain', metas: '日常保养', icon: 'alarm', routes: 'dailymaintain' },
|
{ path: 'firstmaintain', metas: '一级保养', icon: 'alarm', routes: 'firstmaintain' },
|
{ path: 'maintainTwo', metas: '二级保养', icon: 'alarm', routes: 'maintainTwo' },
|
{ path: 'maintainThree', metas: '三级保养', icon: 'alarm', routes: 'maintainThree' }
|
]
|
const deviceMaintenanceObj = {
|
path: '/deviceManage',
|
meta: { title: '设备保养', icon: 'alarm' },
|
children: []
|
}
|
for (let i = 0; i < deviceMaintenanceArr.length; i++) {
|
deviceMaintenanceObj.children.push({
|
path: deviceMaintenanceArr[i].path,
|
meta: { title: deviceMaintenanceArr[i].metas, icon: deviceMaintenanceArr[i].icon }
|
})
|
}
|
const reportArr = [
|
{ path: 'stateDistribution', metas: '机床状态分布图', icon: 'alarm', routes: 'state-distribution' },
|
{ path: 'dailyStateDistribution', metas: '当日状态分布图', icon: 'alarm', routes: 'daily-state-distribution' },
|
{ path: 'banCiNengLiYongLv', metas: '班次能力利用率', icon: 'alarm', routes: 'banCiNengLiYongLv' },
|
{ path: 'sheBeiFengLeiLiYongLv', metas: '分类利用率', icon: 'alarm', routes: 'sheBeiFengLeiLiYongLv' },
|
{ path: 'sheBeiYueFenBanCiLiYongLvPaiXu', metas: '班次利用率排名', icon: 'alarm', routes: 'sheBeiYueFenBanCiLiYongLvPaiXu' },
|
{ path: 'shebeiliyonglvniandu', metas: '分析图表', icon: 'alarm', routes: 'shebeiliyonglvniandu' },
|
{ path: 'sheBeiLiYongLvOld', metas: '统计报表(旧版)', icon: 'alarm', routes: 'sheBeiLiYongLvOld' },
|
{ path: 'shebeiliyonglvfenxi', metas: '当月利用率对比', icon: 'alarm', routes: 'shebeiliyonglvfenxi' },
|
{ path: 'shebeiguzhang', metas: '每月故障停机统计', icon: 'alarm', routes: 'shebeiguzhang' },
|
{ path: 'week_use', metas: '周利用率报表', icon: 'alarm', routes: 'week_use' },
|
{ path: 'tpmd', metas: '逐日利用率折线图', icon: 'alarm', routes: 'tpmd' },
|
{ path: 'tpmm', metas: '逐月利用率折线图', icon: 'alarm', routes: 'tpmm' },
|
{ path: 'base', metas: '设备利用率明细', icon: 'alarm', routes: 'base' },
|
{ path: 'importDownTime', metas: '故障时间导入', icon: 'alarm', routes: 'importDownTime' },
|
{ path: 'clearDownTime', metas: '故障时间清零', icon: 'alarm', routes: 'clearDownTime' },
|
{ path: 'workDays', metas: '制度时间输入', icon: 'alarm', routes: 'workDays' },
|
{ path: 'import19', metas: '19厂数据导入', icon: 'alarm', routes: 'import19' }
|
]
|
const reportObj = {
|
path: '/report',
|
meta: { title: '报表生成', icon: 'alarm' },
|
children: []
|
}
|
for (let i = 0; i < reportArr.length; i++) {
|
reportObj.children.push({
|
path: reportArr[i].path,
|
meta: { title: reportArr[i].metas, icon: reportArr[i].icon }
|
})
|
}
|
const workshopMapObj = {
|
path: '/themap/index',
|
meta: { title: '车间地图', icon: 'alarm' }
|
}
|
const screenMapObj = {
|
path: '/screen/index',
|
meta: { title: '大屏展示', icon: 'alarm' }
|
}
|
const statusMonitor2Obj = {
|
path: '/status-monitor2/index',
|
meta: { title: '状态监控2', icon: 'alarm' }
|
}
|
const statusMonitorObj = {
|
path: '/status-monitor/index',
|
meta: { title: '状态监控', icon: 'alarm' }
|
}
|
const welcomeObj = {
|
path: '/dashboard/index',
|
meta: { title: '航星MDC', icon: 'home' }
|
}
|
|
// 机床
|
// const machineObj = {
|
// path: '/machine',
|
// meta: { title: '机床', icon: 'machine' },
|
// children: []
|
// }
|
// for (let i = 0; i < dCategories.length; i++) {
|
// const cateItem = dCategories[i]
|
// machineObj.children.push({
|
// path: cateItem.type,
|
// meta: { title: cateItem.remark, icon: cateItem.type }
|
// })
|
// }
|
// sideMenuArr.unshift(machineObj)
|
sideMenuArr.unshift(reportObj)
|
sideMenuArr.unshift(deviceMaintenanceObj)
|
sideMenuArr.unshift(workshopObj)
|
// sideMenuArr.unshift(workshopObjlist)
|
sideMenuArr.unshift(workshopMapObj)
|
sideMenuArr.unshift(screenMapObj)
|
sideMenuArr.unshift(statusMonitor2Obj)
|
sideMenuArr.unshift(statusMonitorObj)
|
sideMenuArr.unshift(welcomeObj)
|
// const user = this.$store.getters.userInfo
|
// if (user.roles === 'admin') {
|
// let insetIndex = sideMenuArr.length - 2
|
// insetIndex = insetIndex < 0 ? 0 : insetIndex
|
// sideMenuArr.splice(insetIndex, 0, {
|
// path: '/perm/ums',
|
// meta: { title: '用户管理', icon: 'perm' }
|
// })
|
// }
|
return sideMenuArr
|
}
|
}
|
}
|
</script>
|