Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
SHR
/
tFIMS
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6dceac3d
authored
Sep 03, 2019
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
权限按钮修改
2 parents
f73b3e42
283f9383
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
184 additions
and
159 deletions
src/components/d2-auth/d2-auth-btn.js
src/libs/util.permision.js
src/router/routes.js
src/store/modules/d2admin/modules/auth.js
src/views/deviceManagement/index.vue
src/views/maintainManagement/index.vue
src/views/materiaOrderManagement/index.vue
src/views/materialList/index.vue
src/views/subSysManagement/index.vue
src/views/trafficManagement/index.vue
src/views/userManage/user/index.vue
src/components/d2-auth/d2-auth-btn.js
View file @
6dceac3
...
@@ -3,15 +3,19 @@ export default {
...
@@ -3,15 +3,19 @@ export default {
props
:
{
props
:
{
label
:
{
label
:
{
type
:
String
,
type
:
String
,
default
:
'
Button
'
default
:
''
},
},
size
:
{
size
:
{
type
:
String
,
type
:
String
,
default
:
'mini'
default
:
'mini'
},
},
type
:
{
// type: {
// type: String,
// default: 'text'
// },
category
:{
type
:
String
,
type
:
String
,
default
:
'
text
'
default
:
'
operation
'
},
},
loading
:
{
loading
:
{
type
:
Boolean
,
type
:
Boolean
,
...
@@ -35,30 +39,40 @@ export default {
...
@@ -35,30 +39,40 @@ export default {
},
},
data
:
Object
,
data
:
Object
,
},
},
functional
:
true
,
// 开启函数化组件
functional
:
true
,
// 开启函数化组件
render
:
(
h
,
ctx
)
=>
{
render
:
(
h
,
ctx
)
=>
{
const
_this
=
ctx
.
parent
//获取 vue this 实例
const
_this
=
ctx
.
parent
//获取 vue this 实例
// console.log(ctx);
/**
/**
* 获取传入参数
* 获取传入参数
*
type 非必填 button 类型 默认 text ----- route 中不标明 视为默认值 text
*
category 非必填 button 类别 暂时两种 1 表格操作:operation ,2 Button 按钮: action 默认 operation ----- route 中不标明 视为默认值 operation
* data 点击按钮时 需要得到的参数 比如 table 中的 当前行数据 row
* data 点击按钮时 需要得到的参数 比如 table 中的 当前行数据 row
* mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名
* mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名
* label 当传入label 字段时 标识明确指定渲染该label 的按钮
*/
*/
const
{
type
,
data
,
mapping
}
=
ctx
.
props
const
{
category
,
data
,
mapping
,
label
}
=
ctx
.
props
let
curBtns
=
[]
/**
/**
* 判断一个按钮(btn)是否存在与当前行(data) 的映射关系(mapping)中
* 判断一个按钮(btn)是否存在与当前行(data) 的映射关系(mapping)中
* @param {*} btn
* @param {*} btn
*/
*/
const
filter
=
btn
=>
mapping
?
mapping
[
data
[
mapping
[
'field'
]]].
includes
(
btn
.
label
):
true
const
filter
=
btn
=>
mapping
?
mapping
[
data
[
mapping
[
'field'
]]].
includes
(
btn
.
label
):
true
const
$store
=
_this
.
$store
.
getters
[
'd2admin/auth/curBtns'
]
if
(
label
){
//指定label
const
__item
=
$store
.
find
(
btn
=>
(
btn
.
label
===
label
)
&&
filter
(
btn
))
__item
&&
curBtns
.
push
(
__item
)
}
else
{
/**
/**
* 拿到当前模块(页面) 所拥有按钮列表 过滤type属性 与 映射关系 返回需要显示的按钮列表
* 拿到当前模块(页面) 所拥有按钮列表 过滤type属性 与 映射关系 返回需要显示的按钮列表
*/
*/
const
curBtns
=
_this
.
$store
.
getters
[
'd2admin/auth/curBtns'
]
.
filter
(
btn
=>
{
curBtns
=
$store
.
filter
(
btn
=>
{
if
(
type
===
'text'
||
!
type
){
if
(
category
===
'operation'
){
return
(
btn
.
type
===
'text'
||
!
btn
.
type
)
&&
filter
(
btn
)
return
(
btn
.
category
===
'operation'
||
!
btn
.
category
)
&&
filter
(
btn
)
}
}
return
btn
.
type
===
type
&&
filter
(
btn
)
return
(
btn
.
category
===
category
)
&&
filter
(
btn
)
})
})
}
if
(
curBtns
.
length
===
0
)
return
''
const
__aBtns
=
[]
const
__aBtns
=
[]
/**
/**
* 循环最终显示的按钮列表
* 循环最终显示的按钮列表
...
@@ -67,12 +81,15 @@ export default {
...
@@ -67,12 +81,15 @@ export default {
curBtns
.
forEach
(
btn
=>
curBtns
.
forEach
(
btn
=>
__aBtns
.
push
(
h
(
'el-button'
,
{
__aBtns
.
push
(
h
(
'el-button'
,
{
props
:
{
props
:
{
type
type
:
btn
.
type
||
'text'
,
},
style
:{
color
:
btn
.
color
},
},
on
:
{
on
:
{
click
:
()
=>
_this
[
btn
.
handle
](
data
)
click
:
()
=>
btn
.
handle
&&
_this
[
btn
.
handle
](
data
)
}
}
},
[
btn
.
label
])))
},
[
btn
.
label
])))
return
h
(
'div'
,
{},
__aBtns
)
return
h
(
'div'
,
{},
[...
__aBtns
,
ctx
.
children
]
)
}
}
}
}
\ No newline at end of file
\ No newline at end of file
src/libs/util.permision.js
View file @
6dceac3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-08-27 19:16:26
* @Date: 2019-08-27 19:16:26
* @Last Modified by: limin
* @Last Modified by: limin
* @Last Modified time: 2019-09-0
2 16:20:21
* @Last Modified time: 2019-09-0
3 09:07:46
*/
*/
const
permision
=
{}
const
permision
=
{}
/**
/**
...
...
src/router/routes.js
View file @
6dceac3
...
@@ -65,99 +65,96 @@ export const sys = [
...
@@ -65,99 +65,96 @@ export const sys = [
* 所有需动态过滤的资源点
* 所有需动态过滤的资源点
*/
*/
export
const
resources
=
{
export
const
resources
=
{
'102'
:
{
path
:
'/page'
,
icon
:
'folder-o'
,
name
:
'页面'
,
meta
:
{
auth
:
true
,
title
:
'页面'
,
id
:
'102'
,
pid
:
'0'
,
cache
:
true
}
},
'10201'
:
{
path
:
'/page1'
,
name
:
'page1'
,
meta
:
{
auth
:
true
,
title
:
'页面 1'
,
id
:
'10201'
,
pid
:
'102'
,
cache
:
true
},
component
:
_import
(
'demo/page1'
)
},
'10202'
:
{
path
:
'/page2'
,
name
:
'page2'
,
meta
:
{
auth
:
true
,
title
:
'页面 2'
,
id
:
'10202'
,
pid
:
'102'
,
cache
:
true
},
component
:
_import
(
'demo/page2'
),
auth
:
[{
// 列表操作
id
:
'1020201'
,
pid
:
'10202'
,
label
:
'查看'
},
{
//
id
:
'1020202'
,
pid
:
'10202'
,
label
:
'编辑'
}],
},
'10203'
:
{
path
:
'/page3'
,
name
:
'页面 3'
,
meta
:
{
auth
:
true
,
title
:
'页面 3'
,
id
:
'10203'
,
pid
:
'102'
},
auth
:
[{
// 列表操作
id
:
'1020301'
,
pid
:
'10203'
,
label
:
'查看'
},
{
//
id
:
'1020302'
,
pid
:
'10203'
,
label
:
'编辑'
}],
component
:
_import
(
'demo/page3'
)
},
// '102': {
// '102': {
// path: '
trafficManagement
',
// path: '
/page
',
// icon: '
train
',
// icon: '
folder-o
',
// name: '
车辆管理
',
// name: '
页面
',
// meta: {
// meta: {
// auth: true,
// auth: true,
// title: '
车辆管理
',
// title: '
页面
',
// id: '102',
// id: '102',
// pid: '0'
// pid: '0',
// cache: true
// }
// },
// },
// component: _import('trafficManagement'),
// '10201': {
// auth: {
// path: '/page1',
// 'operation': [{
// name: 'page1',
// meta: {
// auth: true,
// title: '页面 1',
// id: '10201',
// id: '10201',
// pid: '102',
// pid: '102',
// label: '编辑'
// cache: true
// }, {
// },
// component: _import('demo/page1')
// },
// '10202': {
// path: '/page2',
// name: 'page2',
// meta: {
// auth: true,
// title: '页面 2',
// id: '10202',
// id: '10202',
// pid: '102',
// pid: '102',
// label: '删除'
// cache: true
// },
// component: _import('demo/page2'),
// auth: [{ // 列表操作
// id: '1020201',
// pid: '10202',
// label: '查看'
// }, { //
// id: '1020202',
// pid: '10202',
// label: '编辑'
// }],
// }],
// 'action': [{
// },
// '10203': {
// path: '/page3',
// name: '页面 3',
// meta: {
// auth: true,
// title: '页面 3',
// id: '10203',
// id: '10203',
// pid: '102',
// pid: '102'
// label: '添加车辆'
// },
// }]
// auth: [{ // 列表操作
// }
// id: '1020301',
// pid: '10203',
// label: '查看'
// }, { //
// id: '1020302',
// pid: '10203',
// label: '编辑'
// }],
// component: _import('demo/page3')
// },
// },
'102'
:
{
path
:
'trafficManagement'
,
icon
:
'train'
,
name
:
'车辆管理'
,
meta
:
{
auth
:
true
,
title
:
'车辆管理'
,
id
:
'102'
,
pid
:
'0'
},
component
:
_import
(
'trafficManagement'
),
auth
:
[{
id
:
'10201'
,
pid
:
'102'
,
label
:
'编辑'
},
{
id
:
'10202'
,
pid
:
'102'
,
label
:
'删除'
},
{
id
:
'10203'
,
pid
:
'102'
,
label
:
'添加车辆'
}]
},
'103'
:
{
'103'
:
{
path
:
'/subSysManagement'
,
path
:
'/subSysManagement'
,
icon
:
'th-list'
,
icon
:
'th-list'
,
...
@@ -184,7 +181,7 @@ export const resources = {
...
@@ -184,7 +181,7 @@ export const resources = {
}]
}]
},
},
'104'
:
{
'104'
:
{
path
:
'/
traffic
Management'
,
path
:
'/
device
Management'
,
icon
:
'train'
,
icon
:
'train'
,
name
:
'物料管理'
,
name
:
'物料管理'
,
meta
:
{
meta
:
{
...
@@ -323,7 +320,8 @@ export const resources = {
...
@@ -323,7 +320,8 @@ export const resources = {
},
{
//
},
{
//
id
:
'1070105'
,
id
:
'1070105'
,
pid
:
'10701'
,
pid
:
'10701'
,
label
:
'禁用'
label
:
'禁用'
,
color
:
'#FF0000'
},
{
//
},
{
//
id
:
'1070106'
,
id
:
'1070106'
,
pid
:
'10701'
,
pid
:
'10701'
,
...
@@ -332,8 +330,9 @@ export const resources = {
...
@@ -332,8 +330,9 @@ export const resources = {
id
:
'1070107'
,
id
:
'1070107'
,
pid
:
'10701'
,
pid
:
'10701'
,
label
:
'创建用户'
,
label
:
'创建用户'
,
category
:
'action'
,
type
:
'button'
,
type
:
'button'
,
handle
:
'handle
Edit
'
handle
:
'handle
Register
'
}],
}],
component
:
_import
(
'userManage/user'
)
component
:
_import
(
'userManage/user'
)
},
},
...
...
src/store/modules/d2admin/modules/auth.js
View file @
6dceac3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-08-27 17:25:12
* @Date: 2019-08-27 17:25:12
* @Last Modified by: limin
* @Last Modified by: limin
* @Last Modified time: 2019-09-0
2 16:57:35
* @Last Modified time: 2019-09-0
3 09:03:37
*/
*/
import
util
from
'@/libs/util.js'
import
util
from
'@/libs/util.js'
import
router
from
'@/router'
import
router
from
'@/router'
...
...
src/views/deviceManagement/index.vue
View file @
6dceac3
...
@@ -32,14 +32,12 @@
...
@@ -32,14 +32,12 @@
label=
"导入"
label=
"导入"
class=
"import-button"
class=
"import-button"
type=
""
type=
""
accept=
".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@
import-file=
"importFile"
>
>
<
!--
<
input
<input
type=
"file"
type=
"file"
class=
"import-input"
class=
"import-input"
accept=
".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
accept=
".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@
change=
"importFile($event)"
/>
-->
@
change=
"importFile($event)"
/>
</auth-button>
</auth-button>
<auth-button
label=
"导出"
type=
""
></auth-button>
<auth-button
label=
"导出"
type=
""
></auth-button>
</el-col>
</el-col>
...
@@ -278,11 +276,16 @@ export default {
...
@@ -278,11 +276,16 @@ export default {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
console
.
log
(
index
)
// // console.log(index)
console
.
log
(
row
)
// console.log(row)
this
.
$message
({
// this.$message({
type
:
'success'
,
// type: 'success',
message
:
'删除成功'
// message: '删除成功'
// })
removeApi
(
row
).
then
(
res
=>
{
notice
.
okTips
()
}).
catch
(
err
=>
{
notice
.
errorTips
()
})
})
}).
catch
(
err
=>
{})
}).
catch
(
err
=>
{})
}
}
...
@@ -296,7 +299,7 @@ export default {
...
@@ -296,7 +299,7 @@ export default {
position
:
relative
;
position
:
relative
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
/*
.import-input {
.import-input
{
opacity
:
0
;
opacity
:
0
;
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
...
@@ -305,5 +308,5 @@ export default {
...
@@ -305,5 +308,5 @@ export default {
height
:
100%
;
height
:
100%
;
cursor
:
pointer
;
cursor
:
pointer
;
font-size
:
0
font-size
:
0
}
*/
}
</
style
>
</
style
>
src/views/maintainManagement/index.vue
View file @
6dceac3
...
@@ -312,11 +312,16 @@ export default {
...
@@ -312,11 +312,16 @@ export default {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
console
.
log
(
index
)
// console.log(index)
console
.
log
(
row
)
// console.log(row)
this
.
$message
({
// this.$message({
type
:
'success'
,
// type: 'success',
message
:
'删除成功'
// message: '删除成功'
// })
removeApi
(
row
).
then
(
res
=>
{
notice
.
okTips
()
}).
catch
(
err
=>
{
notice
.
errorTips
()
})
})
}).
catch
(
err
=>
{})
}).
catch
(
err
=>
{})
}
}
...
...
src/views/materiaOrderManagement/index.vue
View file @
6dceac3
...
@@ -248,11 +248,16 @@ export default {
...
@@ -248,11 +248,16 @@ export default {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
console
.
log
(
index
)
// console.log(index)
console
.
log
(
row
)
// console.log(row)
this
.
$message
({
// this.$message({
type
:
'success'
,
// type: 'success',
message
:
'删除成功'
// message: '删除成功'
// })
removeApi
(
row
).
then
(
res
=>
{
notice
.
okTips
()
}).
catch
(
err
=>
{
notice
.
errorTips
()
})
})
}).
catch
(
err
=>
{})
}).
catch
(
err
=>
{})
}
}
...
...
src/views/materialList/index.vue
View file @
6dceac3
...
@@ -156,21 +156,6 @@ export default {
...
@@ -156,21 +156,6 @@ export default {
this
.
currentPage
=
value
this
.
currentPage
=
value
// 调接口
// 调接口
this
.
loadingGetList
()
this
.
loadingGetList
()
},
handleDelete
(
index
,
row
)
{
this
.
$confirm
(
'确认删除?'
,
'删除'
,
{
comfirmButtonText
:
'确认'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
console
.
log
(
index
)
console
.
log
(
row
)
this
.
$message
({
type
:
'success'
,
message
:
'删除成功'
})
}).
catch
(
err
=>
{})
}
}
}
}
}
}
...
...
src/views/subSysManagement/index.vue
View file @
6dceac3
...
@@ -265,11 +265,16 @@ export default {
...
@@ -265,11 +265,16 @@ export default {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
console
.
log
(
index
)
// console.log(index)
console
.
log
(
row
)
// console.log(row)
this
.
$message
({
// this.$message({
type
:
'success'
,
// type: 'success',
message
:
'删除成功'
// message: '删除成功'
// })
removeApi
(
row
).
then
(
res
=>
{
notice
.
okTips
()
}).
catch
(
err
=>
{
notice
.
errorTips
()
})
})
}).
catch
(
err
=>
{})
}).
catch
(
err
=>
{})
}
}
...
...
src/views/trafficManagement/index.vue
View file @
6dceac3
...
@@ -261,11 +261,16 @@ export default {
...
@@ -261,11 +261,16 @@ export default {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
console
.
log
(
index
)
// console.log(index)
console
.
log
(
row
)
// console.log(row)
this
.
$message
({
// this.$message({
type
:
'success'
,
// type: 'success',
message
:
'删除成功'
// message: '删除成功'
// })
removeApi
(
row
).
then
(
res
=>
{
notice
.
okTips
()
}).
catch
(
err
=>
{
notice
.
errorTips
()
})
})
}).
catch
(
err
=>
{})
}).
catch
(
err
=>
{})
}
}
...
...
src/views/userManage/user/index.vue
View file @
6dceac3
...
@@ -67,8 +67,7 @@
...
@@ -67,8 +67,7 @@
<el-row
style=
"height: 40px; line-height: 40px"
>
<el-row
style=
"height: 40px; line-height: 40px"
>
<el-col
:span=
"12"
>
用户列表
</el-col>
<el-col
:span=
"12"
>
用户列表
</el-col>
<el-col
:span=
"12"
style=
"text-align: right"
>
<el-col
:span=
"12"
style=
"text-align: right"
>
<!--
<el-button
@
click=
"register()"
>
创建用户
</el-button>
-->
<auth-button
category=
"action"
label=
"创建用户"
></auth-button>
<auth-button
type=
"button"
></auth-button>
</el-col>
</el-col>
</el-row>
</el-row>
<el-table
:data=
"tableData"
v-loading=
"tableLoading"
border
style=
"margin: 20px 0;"
>
<el-table
:data=
"tableData"
v-loading=
"tableLoading"
border
style=
"margin: 20px 0;"
>
...
@@ -89,11 +88,6 @@
...
@@ -89,11 +88,6 @@
<el-table-column
align=
"center"
label=
"操作"
>
<el-table-column
align=
"center"
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<auth-button
:mapping=
"mapping"
:data=
"scope.row"
></auth-button>
<auth-button
:mapping=
"mapping"
:data=
"scope.row"
></auth-button>
<!--
<auth-button
type=
"text"
label=
"审核"
:mapping=
"mapping"
@
click=
"handleEdit(scope.row, scope.$index)"
></auth-button>
<auth-button
type=
"text"
label=
"编辑"
:mapping=
"mapping"
@
click=
"handleEdit(scope.row, scope.$index)"
></auth-button>
<auth-button
type=
"text"
label=
"延期"
:mapping=
"mapping"
@
click=
"handleEdit(scope.row, scope.$index)"
></auth-button>
<auth-button
type=
"text"
label=
"禁用"
:mapping=
"mapping"
@
click=
"handleEdit(scope.row, scope.$index)"
></auth-button>
<auth-button
type=
"text"
label=
"激活"
:mapping=
"mapping"
@
click=
"handleEdit(scope.row, scope.$index)"
></auth-button>
-->
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -273,7 +267,9 @@ export default {
...
@@ -273,7 +267,9 @@ export default {
this
.
tableLoading
=
false
;
this
.
tableLoading
=
false
;
});
});
},
},
handleRegister
(){
console
.
log
(
this
.
searchForm
);
},
// 页码
// 页码
handleSizeChange
(
value
)
{
handleSizeChange
(
value
)
{
this
.
page
.
pageSize
=
value
;
this
.
page
.
pageSize
=
value
;
...
@@ -296,12 +292,17 @@ export default {
...
@@ -296,12 +292,17 @@ export default {
type
:
"warning"
type
:
"warning"
})
})
.
then
(()
=>
{
.
then
(()
=>
{
console
.
log
(
index
);
// console.log(index)
console
.
log
(
row
);
// console.log(row)
this
.
$message
({
// this.$message({
type
:
"success"
,
// type: 'success',
message
:
"删除成功"
// message: '删除成功'
});
// })
removeApi
(
row
).
then
(
res
=>
{
notice
.
okTips
()
}).
catch
(
err
=>
{
notice
.
errorTips
()
})
})
})
.
catch
(
err
=>
{});
.
catch
(
err
=>
{});
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment