Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
gassafety
Commits
0bb327f5
Commit
0bb327f5
authored
Aug 05, 2021
by
纪泽龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大路由调整
parent
a3303844
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
112 additions
and
62 deletions
+112
-62
index.vue
gassafety-web/src/components/TopNav/index.vue
+22
-2
ResizeHandler.js
gassafety-web/src/layout/mixin/ResizeHandler.js
+22
-16
permission.js
gassafety-web/src/permission.js
+40
-31
app.js
gassafety-web/src/store/modules/app.js
+1
-0
permission.js
gassafety-web/src/store/modules/permission.js
+5
-2
RightBototmData.vue
...c/views/enterprise/mapView/components/RightBototmData.vue
+9
-6
index.vue
gassafety-web/src/views/enterprise/mapView/index.vue
+13
-5
No files found.
gassafety-web/src/components/TopNav/index.vue
View file @
0bb327f5
...
...
@@ -37,6 +37,7 @@
<
script
>
import
{
constantRoutes
}
from
"@/router"
;
import
"../../common/font/font.css"
;
export
default
{
data
()
{
...
...
@@ -47,6 +48,7 @@ export default {
isFrist
:
false
,
// 当前激活菜单的 index
currentIndex
:
undefined
,
myRouter
:
[],
};
},
computed
:
{
...
...
@@ -133,7 +135,9 @@ export default {
},
// 菜单选择事件
handleSelect
(
key
,
keyPath
)
{
console
.
log
(
key
)
console
.
log
(
"key"
,
key
);
console
.
log
(
"keypath"
,
keyPath
);
let
path
;
this
.
currentIndex
=
key
;
if
(
this
.
ishttp
(
key
))
{
// http(s):// 路径新窗口打开
...
...
@@ -143,7 +147,18 @@ export default {
this
.
$router
.
push
({
path
:
key
.
replace
(
"/redirect"
,
""
)
});
}
else
{
// 显示左侧联动菜单
this
.
activeRoutes
(
key
);
path
=
this
.
activeRoutes
(
key
);
if
(
this
.
$route
.
path
!=
path
[
0
].
path
)
{
this
.
$router
.
push
(
path
[
0
].
path
);
}
// if (key == "/enterprise") {
// // this.$store.commit("TOGGLE_DEVICE","mobile");
// this.$store.dispatch("app/toggleDevice", "mobile");
// } else {
// this.$store.dispatch("app/toggleDevice", "desktop");
// }
// TOGGLE_DEVICE
}
},
// 当前激活的路由
...
...
@@ -156,9 +171,14 @@ export default {
}
});
}
// console.log(this.myRouter)
// console.log(this.myRouter)
if
(
routes
.
length
>
0
)
{
this
.
$store
.
commit
(
"SET_SIDEBAR_ROUTERS"
,
routes
);
}
return
routes
;
},
ishttp
(
url
)
{
...
...
gassafety-web/src/layout/mixin/ResizeHandler.js
View file @
0bb327f5
import
store
from
'@/store'
import
store
from
"@/store"
;
const
{
body
}
=
document
const
WIDTH
=
992
// refer to Bootstrap's responsive design
const
{
body
}
=
document
;
const
WIDTH
=
992
;
// refer to Bootstrap's responsive design
export
default
{
watch
:
{
$route
(
route
)
{
if
(
this
.
device
===
'mobile'
&&
this
.
sidebar
.
opened
)
{
store
.
dispatch
(
'app/closeSideBar'
,
{
withoutAnimation
:
false
})
if
(
this
.
device
===
"mobile"
&&
this
.
sidebar
.
opened
)
{
store
.
dispatch
(
"app/closeSideBar"
,
{
withoutAnimation
:
false
});
}
}
},
beforeMount
()
{
window
.
addEventListener
(
'resize'
,
this
.
$_resizeHandler
)
window
.
addEventListener
(
"resize"
,
this
.
$_resizeHandler
);
},
beforeDestroy
()
{
window
.
removeEventListener
(
'resize'
,
this
.
$_resizeHandler
)
window
.
removeEventListener
(
"resize"
,
this
.
$_resizeHandler
);
},
mounted
()
{
const
isMobile
=
this
.
$_isMobile
()
const
isMobile
=
this
.
$_isMobile
()
;
if
(
isMobile
)
{
store
.
dispatch
(
'app/toggleDevice'
,
'mobile'
)
store
.
dispatch
(
'app/closeSideBar'
,
{
withoutAnimation
:
true
})
store
.
dispatch
(
"app/toggleDevice"
,
"mobile"
);
store
.
dispatch
(
"app/closeSideBar"
,
{
withoutAnimation
:
true
});
}
},
methods
:
{
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_isMobile
()
{
const
rect
=
body
.
getBoundingClientRect
()
return
rect
.
width
-
1
<
WIDTH
const
rect
=
body
.
getBoundingClientRect
()
;
return
rect
.
width
-
1
<
WIDTH
;
},
$_resizeHandler
()
{
if
(
!
document
.
hidden
)
{
const
isMobile
=
this
.
$_isMobile
()
store
.
dispatch
(
'app/toggleDevice'
,
isMobile
?
'mobile'
:
'desktop'
)
const
isMobile
=
this
.
$_isMobile
();
// console.log(this.$route.path)
// 当是gis地图的时候左边隐藏
if
(
this
.
$route
.
path
==
"/enterprise/mapView"
)
{
store
.
dispatch
(
"app/toggleDevice"
,
"mobile"
);
}
else
{
store
.
dispatch
(
"app/toggleDevice"
,
isMobile
?
"mobile"
:
"desktop"
);
}
if
(
isMobile
)
{
store
.
dispatch
(
'app/closeSideBar'
,
{
withoutAnimation
:
true
})
store
.
dispatch
(
"app/closeSideBar"
,
{
withoutAnimation
:
true
});
}
}
}
}
}
}
;
gassafety-web/src/permission.js
View file @
0bb327f5
import
router
from
'./router'
import
store
from
'./store'
import
{
Message
}
from
'element-ui'
import
NProgress
from
'nprogress'
import
'nprogress/nprogress.css'
import
{
getToken
}
from
'@/utils/auth'
import
router
from
"./router"
;
import
store
from
"./store"
;
import
{
Message
}
from
"element-ui"
;
import
NProgress
from
"nprogress"
;
import
"nprogress/nprogress.css"
;
import
{
getToken
}
from
"@/utils/auth"
;
NProgress
.
configure
({
showSpinner
:
false
})
NProgress
.
configure
({
showSpinner
:
false
})
;
const
whiteList
=
[
'/login'
,
'/auth-redirect'
,
'/bind'
,
'/register'
]
const
whiteList
=
[
"/login"
,
"/auth-redirect"
,
"/bind"
,
"/register"
];
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
NProgress
.
start
()
NProgress
.
start
()
;
if
(
getToken
())
{
/* has token*/
if
(
to
.
path
===
'/login'
)
{
next
({
path
:
'/'
})
NProgress
.
done
()
if
(
to
.
path
===
"/login"
)
{
next
({
path
:
"/"
});
NProgress
.
done
()
;
}
else
{
if
(
store
.
getters
.
roles
.
length
===
0
)
{
// 判断当前用户是否已拉取完user_info信息
store
.
dispatch
(
'GetInfo'
).
then
(()
=>
{
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
store
.
dispatch
(
"GetInfo"
)
.
then
(()
=>
{
store
.
dispatch
(
"GenerateRoutes"
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
})
}).
catch
(
err
=>
{
store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
Message
.
error
(
err
)
next
({
path
:
'/'
})
})
router
.
addRoutes
(
accessRoutes
);
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
});
// hack方法 确保addRoutes已完成
});
})
.
catch
(
err
=>
{
store
.
dispatch
(
"LogOut"
).
then
(()
=>
{
Message
.
error
(
err
);
next
({
path
:
"/"
});
});
});
}
else
{
next
()
next
()
;
}
}
}
else
{
// 没有token
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
// 在免登录白名单,直接进入
next
()
next
()
;
}
else
{
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
// 否则全部重定向到登录页
NProgress
.
done
()
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
;
// 否则全部重定向到登录页
NProgress
.
done
()
;
}
}
})
})
;
router
.
afterEach
(()
=>
{
NProgress
.
done
()
})
router
.
afterEach
((
to
,
from
)
=>
{
// console.log('全局后置钩子',to, from)
if
(
to
.
path
==
"/enterprise/mapView"
)
{
store
.
dispatch
(
"app/toggleDevice"
,
"mobile"
);
}
else
{
store
.
dispatch
(
"app/toggleDevice"
,
"desktop"
);
}
NProgress
.
done
();
});
gassafety-web/src/store/modules/app.js
View file @
0bb327f5
...
...
@@ -26,6 +26,7 @@ const mutations = {
},
TOGGLE_DEVICE
:
(
state
,
device
)
=>
{
state
.
device
=
device
console
.
log
(
123
)
},
SET_SIZE
:
(
state
,
size
)
=>
{
state
.
size
=
size
...
...
gassafety-web/src/store/modules/permission.js
View file @
0bb327f5
...
...
@@ -9,7 +9,8 @@ const permission = {
addRoutes
:
[],
defaultRoutes
:
[],
topbarRouters
:
[],
sidebarRouters
:
[]
sidebarRouters
:
[],
mySidebarRouters
:[],
},
mutations
:
{
SET_ROUTES
:
(
state
,
routes
)
=>
{
...
...
@@ -28,8 +29,10 @@ const permission = {
state
.
topbarRouters
=
routes
.
concat
(
index
);
},
SET_SIDEBAR_ROUTERS
:
(
state
,
routes
)
=>
{
state
.
sidebarRouters
=
routes
state
.
sidebarRouters
=
routes
;
state
.
mySidebarRouters
=
routes
;
},
},
actions
:
{
// 生成路由
...
...
gassafety-web/src/views/enterprise/mapView/components/RightBototmData.vue
View file @
0bb327f5
...
...
@@ -3,7 +3,7 @@
<div
class=
"left"
>
<div
class=
"top"
>
<span>
设备报警最新记录
</span>
<span
class=
"repeat"
>
刷新
</span>
<span
@
click=
"repeatClick"
class=
"repeat"
>
刷新
</span>
<span
@
click=
"moreClick"
class=
"more"
>
更多
</span>
</div>
...
...
@@ -23,15 +23,15 @@
style=
"width: 100%"
height=
"170"
>
<el-table-column
prop=
"deviceCode"
label=
"编号"
width=
"1
2
0"
>
<el-table-column
prop=
"deviceCode"
label=
"编号"
width=
"1
0
0"
>
</el-table-column>
<el-table-column
prop=
"deviceName"
label=
"名称"
width=
""
>
</el-table-column>
<el-table-column
prop=
"alarmType"
label=
"报警类型"
width=
""
>
<el-table-column
prop=
"alarmType"
label=
"报警类型"
width=
"
80
"
>
</el-table-column>
<el-table-column
prop=
"createTime"
label=
"报警开始时间"
width=
""
>
<el-table-column
prop=
"createTime"
label=
"报警开始时间"
width=
"
170
"
>
</el-table-column>
<el-table-column
prop=
"alarmValue"
label=
"报警内容"
width=
""
>
<el-table-column
prop=
"alarmValue"
label=
"报警内容"
width=
"
100
"
>
</el-table-column>
</el-table>
</div>
...
...
@@ -153,6 +153,9 @@ export default {
this
.
$router
.
push
(
"/dataMonitoring/deviceAlarm"
);
// route.push(`dataMonitoring/deviceAlarm`)
},
repeatClick
(){
this
.
getList
();
},
getList
()
{
this
.
loading
=
true
;
listDeviceAlarm
({
pageNum
:
1
,
pageSize
:
10
}).
then
((
res
)
=>
{
...
...
@@ -196,7 +199,7 @@ export default {
&
>
div
{
}
.left
{
width
:
778
px
;
width
:
680
px
;
margin-right
:
12px
;
box-shadow
:
2px
2px
5px
rgba
(
0
,
0
,
0
,
0
.16
);
// background-color: #fff;
...
...
gassafety-web/src/views/enterprise/mapView/index.vue
View file @
0bb327f5
...
...
@@ -94,7 +94,12 @@
</div>
</div>
<RightBototmData
v-show=
"bottomDataShow"
:class=
"{classShow:!bottomDataShow}"
ref=
"RightBototmData"
:list=
"rightBototmData"
/>
<RightBototmData
v-show=
"bottomDataShow"
:class=
"{ classShow: !bottomDataShow }"
ref=
"RightBototmData"
:list=
"rightBototmData"
/>
</div>
</template>
<
script
>
...
...
@@ -168,9 +173,13 @@ export default {
keyWord
:
""
,
// 右下角的数据data
rightBototmData
:
[],
bottomDataShow
:
true
,
bottomDataShow
:
true
,
};
},
created
()
{
// 让左边的框隐藏
this
.
$store
.
dispatch
(
"app/toggleDevice"
,
"mobile"
);
},
mounted
()
{
this
.
initMap
();
},
...
...
@@ -185,7 +194,6 @@ export default {
this
.
getPipeList
();
// 右下角数据
this
.
rightBottomData
();
},
// 右下角数据
async
rightBottomData
()
{
...
...
@@ -447,7 +455,7 @@ export default {
// 新建下拉列表关闭 window点击事件
barClose
()
{
// 一点windowbottomData显示
this
.
bottomDataShow
=
true
;
this
.
bottomDataShow
=
true
;
// return;
console
.
log
(
"window"
);
this
.
deviceType
=
false
;
...
...
@@ -730,7 +738,7 @@ input[type="radio"] {
color
:
white
;
background-color
:
#053b6a
;
}
.classShow
{
.classShow
{
opacity
:
0
;
}
</
style
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment