Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
9e208411
提交
9e208411
authored
4月 27, 2021
作者:
zuihou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(demo): add permission table demo
上级
5a3861b9
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
141 行增加
和
0 行删除
+141
-0
table.ts
src/locales/lang/en/routes/demo/table.ts
+1
-0
table.ts
src/locales/lang/zh_CN/routes/demo/table.ts
+1
-0
comp.ts
src/router/menus/modules/demo/comp.ts
+4
-0
comp.ts
src/router/routes/modules/demo/comp.ts
+8
-0
AuthColumn.vue
src/views/demo/table/AuthColumn.vue
+127
-0
没有找到文件。
src/locales/lang/en/routes/demo/table.ts
浏览文件 @
9e208411
...
@@ -16,4 +16,5 @@ export default {
...
@@ -16,4 +16,5 @@ export default {
footerTable
:
'Footer'
,
footerTable
:
'Footer'
,
editCellTable
:
'Editable cell'
,
editCellTable
:
'Editable cell'
,
editRowTable
:
'Editable row'
,
editRowTable
:
'Editable row'
,
authColumn
:
'Auth column'
,
};
};
src/locales/lang/zh_CN/routes/demo/table.ts
浏览文件 @
9e208411
...
@@ -16,4 +16,5 @@ export default {
...
@@ -16,4 +16,5 @@ export default {
footerTable
:
'表尾行合计'
,
footerTable
:
'表尾行合计'
,
editCellTable
:
'可编辑单元格'
,
editCellTable
:
'可编辑单元格'
,
editRowTable
:
'可编辑行'
,
editRowTable
:
'可编辑行'
,
authColumn
:
'权限列'
,
};
};
src/router/menus/modules/demo/comp.ts
浏览文件 @
9e208411
...
@@ -118,6 +118,10 @@ const menu: MenuModule = {
...
@@ -118,6 +118,10 @@ const menu: MenuModule = {
path
:
'editRowTable'
,
path
:
'editRowTable'
,
name
:
t
(
'routes.demo.table.editRowTable'
),
name
:
t
(
'routes.demo.table.editRowTable'
),
},
},
{
path
:
'authColumn'
,
name
:
t
(
'routes.demo.table.authColumn'
),
},
],
],
},
},
{
{
...
...
src/router/routes/modules/demo/comp.ts
浏览文件 @
9e208411
...
@@ -230,6 +230,14 @@ const comp: AppRouteModule = {
...
@@ -230,6 +230,14 @@ const comp: AppRouteModule = {
title
:
t
(
'routes.demo.table.editRowTable'
),
title
:
t
(
'routes.demo.table.editRowTable'
),
},
},
},
},
{
path
:
'authColumn'
,
name
:
'AuthColumnDemo'
,
component
:
()
=>
import
(
'/@/views/demo/table/AuthColumn.vue'
),
meta
:
{
title
:
t
(
'routes.demo.table.authColumn'
),
},
},
],
],
},
},
{
{
...
...
src/views/demo/table/AuthColumn.vue
0 → 100644
浏览文件 @
9e208411
<
template
>
<div
class=
"p-4"
>
<BasicTable
@
register=
"registerTable"
>
<template
#
action=
"
{ record }">
<TableAction
:actions=
"[
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'other', // 根据权限控制是否显示: 无权限,不显示
},
{
label: '删除',
icon: 'ic:outline-delete-outline',
onClick: handleDelete.bind(null, record),
auth: 'super', // 根据权限控制是否显示: 有权限,会显示
},
]"
:dropDownActions="[
{
label: '启用',
popConfirm: {
title: '是否启用?',
confirm: handleOpen.bind(null, record),
},
ifShow: (_action) => {
return record.status !== 'enable'; // 根据业务控制是否显示: 非enable状态的不显示启用按钮
},
},
{
label: '禁用',
popConfirm: {
title: '是否禁用?',
confirm: handleOpen.bind(null, record),
},
ifShow: () => {
return record.status === 'enable'; // 根据业务控制是否显示: enable状态的显示禁用按钮
},
},
{
label: '同时控制',
popConfirm: {
title: '是否动态显示?',
confirm: handleOpen.bind(null, record),
},
auth: 'super', // 同时根据权限和业务控制是否显示
ifShow: () => {
return true;
},
},
]"
/>
</
template
>
</BasicTable>
</div>
</template>
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
'vue'
;
import
{
BasicTable
,
useTable
,
BasicColumn
,
TableAction
}
from
'/@/components/Table'
;
import
{
demoListApi
}
from
'/@/api/demo/table'
;
const
columns
:
BasicColumn
[]
=
[
{
title
:
'编号'
,
dataIndex
:
'no'
,
width
:
100
,
},
{
title
:
'姓名'
,
dataIndex
:
'name'
,
auth
:
'test'
,
// 根据权限控制是否显示: 无权限,不显示
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
},
{
title
:
'地址'
,
dataIndex
:
'address'
,
auth
:
'super'
,
// 同时根据权限和业务控制是否显示
ifShow
:
(
_column
)
=>
{
return
true
;
},
},
{
title
:
'开始时间'
,
dataIndex
:
'beginTime'
,
},
{
title
:
'结束时间'
,
dataIndex
:
'endTime'
,
width
:
200
,
},
];
export
default
defineComponent
({
components
:
{
BasicTable
,
TableAction
},
setup
()
{
const
[
registerTable
]
=
useTable
({
title
:
'TableAction组件及固定列示例'
,
api
:
demoListApi
,
columns
:
columns
,
bordered
:
true
,
actionColumn
:
{
width
:
250
,
title
:
'Action'
,
dataIndex
:
'action'
,
slots
:
{
customRender
:
'action'
},
},
});
function
handleEdit
(
record
:
Recordable
)
{
console
.
log
(
'点击了编辑'
,
record
);
}
function
handleDelete
(
record
:
Recordable
)
{
console
.
log
(
'点击了删除'
,
record
);
}
function
handleOpen
(
record
:
Recordable
)
{
console
.
log
(
'点击了启用'
,
record
);
}
return
{
registerTable
,
handleEdit
,
handleDelete
,
handleOpen
,
};
},
});
</
script
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论