Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
template_vue
Project
Project
Details
Activity
Releases
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
杨硕
template_vue
Commits
b6265c9a
Commit
b6265c9a
authored
Jul 20, 2023
by
杨硕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化中间页面权限问题
parent
76128e0e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
129 additions
and
57 deletions
+129
-57
loginInfo.js
src/api/monitor/loginInfo.js
+13
-12
permission.js
src/permission.js
+9
-3
permission.js
src/store/modules/permission.js
+0
-6
user.js
src/store/modules/user.js
+0
-2
home.vue
src/views/home.vue
+16
-3
index.vue
src/views/monitor/errorLog/index.vue
+17
-8
index.vue
src/views/monitor/loginInfo/index.vue
+16
-7
index.vue
src/views/monitor/operLog/index.vue
+16
-7
index.vue
src/views/production/data/index.vue
+15
-0
data.vue
src/views/system/dict/data.vue
+10
-1
index.vue
src/views/system/dict/index.vue
+17
-8
No files found.
src/api/monitor/loginInfo.js
View file @
b6265c9a
import
request
from
'@/utils/request'
import
request
from
'@/utils/request'
import
Qs
from
'qs'
import
Qs
from
'qs'
// 查询
操作
日志列表
// 查询
登录
日志列表
export
function
list
(
query
)
{
export
function
list
(
query
)
{
return
request
({
return
request
({
url
:
'/monitor/
operLog/queryOperLog
ListByPagination'
,
url
:
'/monitor/
loginInfo/querySysLogin
ListByPagination'
,
method
:
'get'
,
method
:
'get'
,
params
:
query
params
:
query
})
})
}
}
// 删除
操作
日志
// 删除
登录
日志
export
function
del
OperLog
(
data
)
{
export
function
del
Logininfo
(
data
)
{
// data = Qs.stringify(data)
// data = Qs.stringify(data)
return
request
({
return
request
({
url
:
'/monitor/
operLog
/delete'
,
url
:
'/monitor/
loginInfo
/delete'
,
method
:
'post'
,
method
:
'post'
,
data
,
data
,
headers
:
{
headers
:
{
...
@@ -23,21 +23,22 @@ export function delOperLog(data) {
...
@@ -23,21 +23,22 @@ export function delOperLog(data) {
})
})
}
}
// 清空
操作
日志
// 清空
登录
日志
export
function
clean
OperLog
(
query
)
{
export
function
clean
Logininfo
(
query
)
{
return
request
({
return
request
({
url
:
'/monitor/
operLog
/clean'
,
url
:
'/monitor/
loginInfo
/clean'
,
method
:
'delete'
,
method
:
'delete'
,
params
:
query
params
:
query
,
})
})
}
}
// 导出
操作
日志
// 导出
登录
日志
export
function
export
OperLog
(
query
)
{
export
function
export
Logininfo
(
query
)
{
return
request
({
return
request
({
url
:
'/monitor/
operLog
/export'
,
url
:
'/monitor/
loginInfo
/export'
,
method
:
'get'
,
method
:
'get'
,
params
:
query
,
params
:
query
,
responseType
:
'blob'
responseType
:
'blob'
})
})
}
}
src/permission.js
View file @
b6265c9a
...
@@ -28,8 +28,6 @@ router.beforeEach((to, from, next) => {
...
@@ -28,8 +28,6 @@ router.beforeEach((to, from, next) => {
if
(
store
.
getters
.
roles
.
length
===
0
)
{
if
(
store
.
getters
.
roles
.
length
===
0
)
{
// 判断当前用户是否已拉取完user_info信息
// 判断当前用户是否已拉取完user_info信息
store
.
dispatch
(
'GetInfo'
).
then
(
res
=>
{
store
.
dispatch
(
'GetInfo'
).
then
(
res
=>
{
// TODO: clear this log
console
.
log
(
`res=wei`
,
res
)
// 判断用户是否有权限 有角色
// 判断用户是否有权限 有角色
if
(
res
.
data
.
permissions
&&
res
.
data
.
permissions
.
length
>
0
)
{
if
(
res
.
data
.
permissions
&&
res
.
data
.
permissions
.
length
>
0
)
{
// 拉取user_info
// 拉取user_info
...
@@ -42,7 +40,15 @@ router.beforeEach((to, from, next) => {
...
@@ -42,7 +40,15 @@ router.beforeEach((to, from, next) => {
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
// 根据roles权限生成可访问的路由表
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
routers
.
accessedRoutes
)
// 动态添加可访问路由表
router
.
addRoutes
(
routers
.
accessedRoutes
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
// TODO: clear this log
console
.
log
(
`routers.accessedRoutes`
,
routers
.
accessedRoutes
)
// 如果是从中间页面跳转系统首页,默认打开第一个菜单
if
(
to
.
path
===
'/welcome'
)
{
next
({
path
:
routers
.
accessedRoutes
[
0
].
children
[
0
].
path
,
replace
:
true
})
}
else
{
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
}
// next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
}
}
// else {
// else {
// alert('用户无权限')
// alert('用户无权限')
...
...
src/store/modules/permission.js
View file @
b6265c9a
...
@@ -18,11 +18,7 @@ const permission = {
...
@@ -18,11 +18,7 @@ const permission = {
// 生成路由
// 生成路由
GenerateRoutes
({
commit
},
menuName
)
{
GenerateRoutes
({
commit
},
menuName
)
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
// TODO: clear this log
console
.
log
(
`menuName`
,
menuName
)
const
menuList
=
menuName
.
menuName
.
split
(
','
)
const
menuList
=
menuName
.
menuName
.
split
(
','
)
// TODO: clear this log
console
.
log
(
`menuList`
,
menuList
)
// 向后端请求路由数据
// 向后端请求路由数据
getInfo
().
then
(
res
=>
{
getInfo
().
then
(
res
=>
{
const
newRoute
=
[]
const
newRoute
=
[]
...
@@ -42,8 +38,6 @@ const permission = {
...
@@ -42,8 +38,6 @@ const permission = {
commit
(
'SET_ROUTES'
,
accessedRoutes
)
commit
(
'SET_ROUTES'
,
accessedRoutes
)
}
}
const
routers
=
{
accessedRoutes
:
accessedRoutes
,
getRouters
:
newRoute
}
const
routers
=
{
accessedRoutes
:
accessedRoutes
,
getRouters
:
newRoute
}
// TODO: clear this log
console
.
log
(
`routers`
,
routers
)
resolve
(
routers
)
resolve
(
routers
)
})
})
})
})
...
...
src/store/modules/user.js
View file @
b6265c9a
...
@@ -84,8 +84,6 @@ const user = {
...
@@ -84,8 +84,6 @@ const user = {
GetInfoMessage
({
commit
,
state
},
menuName
)
{
GetInfoMessage
({
commit
,
state
},
menuName
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// TODO: clear this log
console
.
log
(
`menuName-getInfo`
,
menuName
)
commit
(
'SET_MENUNAME'
,
menuName
)
// 存入菜单名
commit
(
'SET_MENUNAME'
,
menuName
)
// 存入菜单名
const
b
=
menuName
.
join
(
','
)
const
b
=
menuName
.
join
(
','
)
Cookies
.
set
(
'menuname'
,
b
)
Cookies
.
set
(
'menuname'
,
b
)
...
...
src/views/home.vue
View file @
b6265c9a
...
@@ -46,10 +46,16 @@ export default {
...
@@ -46,10 +46,16 @@ export default {
name
:
'Home'
,
name
:
'Home'
,
data
()
{
data
()
{
return
{
return
{
// 系统管理分组
systemManage
:
[
'系统管理'
],
systemManage
:
[
'系统管理'
],
// 日志管理分组
logManage
:
[
'日志管理'
],
logManage
:
[
'日志管理'
],
// 生产管理分组
productionManage
:
[
'生产管理'
],
productionManage
:
[
'生产管理'
],
equipmentManage
:
[
'设备管理'
,
'工序管理'
]
// 设备管理分组
equipmentManage
:
[
'设备管理'
,
'工序管理'
],
// 路由跳转路径
routerPath
:
''
}
}
},
},
created
()
{
created
()
{
...
@@ -60,23 +66,30 @@ export default {
...
@@ -60,23 +66,30 @@ export default {
this
.
$store
.
dispatch
(
'removeRole'
)
this
.
$store
.
dispatch
(
'removeRole'
)
},
},
gotoIndex
(
menuName
)
{
gotoIndex
(
menuName
)
{
// TODO: clear this log
console
.
log
(
`menuName`
,
menuName
)
getInfo
().
then
(
res
=>
{
getInfo
().
then
(
res
=>
{
if
(
res
.
data
.
permissions
)
{
if
(
res
.
data
.
permissions
)
{
// 判断用户是否有点击菜单的权限
// 判断用户是否有点击菜单的权限
var
index
=
0
var
index
=
0
const
routerItem
=
[]
res
.
data
.
menus
.
forEach
(
item
=>
{
res
.
data
.
menus
.
forEach
(
item
=>
{
menuName
.
forEach
(
menuItem
=>
{
menuName
.
forEach
(
menuItem
=>
{
if
(
item
.
meta
.
title
===
menuItem
)
{
if
(
item
.
meta
.
title
===
menuItem
)
{
index
=
index
+
1
index
=
index
+
1
routerItem
.
push
(
item
)
}
}
})
})
})
})
if
(
index
>
0
)
{
if
(
index
>
0
)
{
this
.
routerPath
=
routerItem
[
0
].
children
[
0
].
path
// TODO: clear this log
console
.
log
(
`router`
,
this
.
routerPath
)
// this.$message.success('用户有权限')
// this.$message.success('用户有权限')
// 存入点击的菜单名,便于后边路由跳转
// 存入点击的菜单名,便于后边路由跳转
this
.
$store
.
dispatch
(
'GetInfoMessage'
,
menuName
).
then
(()
=>
{
this
.
$store
.
dispatch
(
'GetInfoMessage'
,
menuName
).
then
(()
=>
{
// this.$nextTick(() => {
// this.$router.push(this.routerPath)
// }, 5000)
console
.
log
(
'路由跳转'
)
this
.
$router
.
push
(
'/welcome'
)
this
.
$router
.
push
(
'/welcome'
)
})
})
}
else
{
}
else
{
...
...
src/views/monitor/errorLog/index.vue
View file @
b6265c9a
...
@@ -324,7 +324,16 @@ export default {
...
@@ -324,7 +324,16 @@ export default {
// 类型数据字典
// 类型数据字典
typeOptions
:
[],
typeOptions
:
[],
// 类型数据字典
// 类型数据字典
statusOptions
:
[],
statusOptions
:
[
{
dictLabel
:
'启用'
,
dictValue
:
'1'
},
{
dictLabel
:
'停用'
,
dictValue
:
'0'
}
],
// 日期范围
// 日期范围
dateRange
:
''
,
dateRange
:
''
,
// 表单参数
// 表单参数
...
@@ -359,9 +368,9 @@ export default {
...
@@ -359,9 +368,9 @@ export default {
}
}
// this.queryParams.operTime = this.$parseDate(new Date(), 'YYYY-MM')
// this.queryParams.operTime = this.$parseDate(new Date(), 'YYYY-MM')
this
.
getList
()
this
.
getList
()
this
.
getDicts
(
'sys_oper_type'
.
toUpperCase
()).
then
(
response
=>
{
//
this.getDicts('sys_oper_type'.toUpperCase()).then(response => {
this
.
typeOptions
=
response
.
data
//
this.typeOptions = response.data
})
//
})
// this.getDicts('sys_common_status'.toUpperCase()).then(response => {
// this.getDicts('sys_common_status'.toUpperCase()).then(response => {
// this.statusOptions = response.data
// this.statusOptions = response.data
// })
// })
...
@@ -452,10 +461,10 @@ export default {
...
@@ -452,10 +461,10 @@ export default {
}
}
})
})
},
},
// 操作日志状态字典翻译
//
//
操作日志状态字典翻译
statusFormat
(
row
,
column
)
{
//
statusFormat(row, column) {
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
status
)
//
return this.selectDictLabel(this.statusOptions, row.status)
},
//
},
// 操作日志类型字典翻译
// 操作日志类型字典翻译
typeFormat
(
row
,
column
)
{
typeFormat
(
row
,
column
)
{
return
this
.
selectDictLabel
(
this
.
typeOptions
,
row
.
businessType
)
return
this
.
selectDictLabel
(
this
.
typeOptions
,
row
.
businessType
)
...
...
src/views/monitor/loginInfo/index.vue
View file @
b6265c9a
...
@@ -270,7 +270,16 @@ export default {
...
@@ -270,7 +270,16 @@ export default {
// 表格数据
// 表格数据
list
:
[],
list
:
[],
// 状态数据字典
// 状态数据字典
statusOptions
:
[],
statusOptions
:
[
{
dictLabel
:
'启用'
,
dictValue
:
'1'
},
{
dictLabel
:
'停用'
,
dictValue
:
'0'
}
],
// 日期范围
// 日期范围
dateRange
:
[],
dateRange
:
[],
// 查询参数
// 查询参数
...
@@ -302,9 +311,9 @@ export default {
...
@@ -302,9 +311,9 @@ export default {
}
}
// this.queryParams.loginTime = this.$parseDate(new Date(), 'YYYY-MM-DD HH:mm:ss')
// this.queryParams.loginTime = this.$parseDate(new Date(), 'YYYY-MM-DD HH:mm:ss')
this
.
getList
()
this
.
getList
()
this
.
getDicts
(
dictCons
[
'COMMON_STATUS'
]).
then
(
response
=>
{
//
this.getDicts(dictCons['COMMON_STATUS']).then(response => {
this
.
statusOptions
=
response
.
data
//
this.statusOptions = response.data
})
//
})
},
},
methods
:
{
methods
:
{
// 清空和导出弹出框的日期选择器禁用当前月份之后的月份
// 清空和导出弹出框的日期选择器禁用当前月份之后的月份
...
@@ -336,9 +345,9 @@ export default {
...
@@ -336,9 +345,9 @@ export default {
},
},
// 登录状态字典翻译
// 登录状态字典翻译
statusFormat
(
row
,
column
)
{
//
statusFormat(row, column) {
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
status
)
//
return this.selectDictLabel(this.statusOptions, row.status)
},
//
},
/** 查询按钮操作 */
/** 查询按钮操作 */
handleQuery
()
{
handleQuery
()
{
this
.
queryParams
.
page
=
1
this
.
queryParams
.
page
=
1
...
...
src/views/monitor/operLog/index.vue
View file @
b6265c9a
...
@@ -323,7 +323,16 @@ export default {
...
@@ -323,7 +323,16 @@ export default {
// 类型数据字典
// 类型数据字典
typeOptions
:
[],
typeOptions
:
[],
// 类型数据字典
// 类型数据字典
statusOptions
:
[],
statusOptions
:
[
{
dictLabel
:
'启用'
,
dictValue
:
'1'
},
{
dictLabel
:
'停用'
,
dictValue
:
'0'
}
],
// 日期范围
// 日期范围
dateRange
:
''
,
dateRange
:
''
,
// 表单参数
// 表单参数
...
@@ -359,9 +368,9 @@ export default {
...
@@ -359,9 +368,9 @@ export default {
}
}
// this.queryParams.operTime = this.$parseDate(new Date(), 'YYYY-MM')
// this.queryParams.operTime = this.$parseDate(new Date(), 'YYYY-MM')
this
.
getList
()
this
.
getList
()
this
.
getDicts
(
'sys_oper_type'
.
toUpperCase
()).
then
(
response
=>
{
//
this.getDicts('sys_oper_type'.toUpperCase()).then(response => {
this
.
typeOptions
=
response
.
data
//
this.typeOptions = response.data
})
//
})
// this.getDicts('sys_common_status'.toUpperCase()).then(response => {
// this.getDicts('sys_common_status'.toUpperCase()).then(response => {
// this.statusOptions = response.data
// this.statusOptions = response.data
// })
// })
...
@@ -452,9 +461,9 @@ export default {
...
@@ -452,9 +461,9 @@ export default {
})
})
},
},
// 操作日志状态字典翻译
// 操作日志状态字典翻译
statusFormat
(
row
,
column
)
{
//
statusFormat(row, column) {
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
status
)
//
return this.selectDictLabel(this.statusOptions, row.status)
},
//
},
// 操作日志类型字典翻译
// 操作日志类型字典翻译
typeFormat
(
row
,
column
)
{
typeFormat
(
row
,
column
)
{
return
this
.
selectDictLabel
(
this
.
typeOptions
,
row
.
businessType
)
return
this
.
selectDictLabel
(
this
.
typeOptions
,
row
.
businessType
)
...
...
src/views/production/data/index.vue
0 → 100644
View file @
b6265c9a
<
template
>
<div>
生产数据
</div>
</
template
>
<
script
>
export
default
{
name
:
'Index'
}
</
script
>
<
style
scoped
>
</
style
>
src/views/system/dict/data.vue
View file @
b6265c9a
...
@@ -284,7 +284,16 @@ export default {
...
@@ -284,7 +284,16 @@ export default {
// 是否显示弹出层
// 是否显示弹出层
open
:
false
,
open
:
false
,
// 状态数据字典
// 状态数据字典
statusOptions
:
[],
statusOptions
:
[
{
dictLabel
:
'启用'
,
dictValue
:
'1'
},
{
dictLabel
:
'停用'
,
dictValue
:
'0'
}
],
// 类型数据字典
// 类型数据字典
typeOptions
:
[],
typeOptions
:
[],
// 查询参数
// 查询参数
...
...
src/views/system/dict/index.vue
View file @
b6265c9a
...
@@ -127,7 +127,7 @@
...
@@ -127,7 +127,7 @@
<div
v-else
>
-
</div>
<div
v-else
>
-
</div>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"状态"
align=
"center"
prop=
"flag"
:formatter=
"statusFormat"
>
<el-table-column
label=
"状态"
align=
"center"
prop=
"flag"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-switch
<el-switch
v-model=
"scope.row.flag"
v-model=
"scope.row.flag"
...
@@ -350,7 +350,16 @@ export default {
...
@@ -350,7 +350,16 @@ export default {
// 是否显示弹出层
// 是否显示弹出层
open
:
false
,
open
:
false
,
// 状态数据字典
// 状态数据字典
statusOptions
:
[],
statusOptions
:
[
{
dictLabel
:
'启用'
,
dictValue
:
'1'
},
{
dictLabel
:
'停用'
,
dictValue
:
'0'
}
],
// 日期范围
// 日期范围
dateRange
:
[],
dateRange
:
[],
// 查询参数
// 查询参数
...
@@ -400,9 +409,9 @@ export default {
...
@@ -400,9 +409,9 @@ export default {
this
.
queryParams
=
{
...
param
}
this
.
queryParams
=
{
...
param
}
}
}
this
.
getList
()
this
.
getList
()
this
.
getDicts
(
dictCons
[
'NORMAL_DISABLE'
]).
then
(
response
=>
{
//
this.getDicts(dictCons['NORMAL_DISABLE']).then(response => {
this
.
statusOptions
=
response
.
data
//
this.statusOptions = response.data
})
//
})
// optionselect().then(response => {
// optionselect().then(response => {
// this.options = response.data
// this.options = response.data
// })
// })
...
@@ -455,9 +464,9 @@ export default {
...
@@ -455,9 +464,9 @@ export default {
})
})
},
},
// 字典状态字典翻译
// 字典状态字典翻译
statusFormat
(
row
,
column
)
{
//
statusFormat(row, column) {
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
flag
)
//
return this.selectDictLabel(this.statusOptions, row.flag)
},
//
},
// 取消按钮
// 取消按钮
cancel
()
{
cancel
()
{
this
.
open
=
false
this
.
open
=
false
...
...
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