明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jt_front
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
Administrator
jt_front
Commits
e91f1040
Commit
e91f1040
authored
Dec 11, 2025
by
yangyajing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户管理、角色管理
parent
c1d66a41
Pipeline
#104489
passed with stage
in 13 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
166 deletions
+104
-166
commonTable.vue
src/components/common/commonTable.vue
+23
-17
style.css
src/style.css
+4
-4
manage.less
src/styles/manage.less
+22
-0
roleManage.vue
src/views/systemManage/roleManage.vue
+44
-84
userManage.vue
src/views/systemManage/userManage.vue
+11
-61
No files found.
src/components/common/commonTable.vue
View file @
e91f1040
...
@@ -15,8 +15,6 @@
...
@@ -15,8 +15,6 @@
<el-table
<el-table
style=
"width: 100%"
style=
"width: 100%"
:data=
"tableData"
:data=
"tableData"
:height=
"computedTableHeight"
:max-height=
"maxHeight"
:stripe=
"stripe"
:stripe=
"stripe"
border
border
:size=
"size"
:size=
"size"
...
@@ -72,6 +70,7 @@
...
@@ -72,6 +70,7 @@
v-if=
"index"
v-if=
"index"
type=
"index"
type=
"index"
width=
"60"
width=
"60"
align=
"center"
:label=
"indexLabel"
:label=
"indexLabel"
:index=
"indexMethod"
:index=
"indexMethod"
/>
/>
...
@@ -299,7 +298,7 @@ const props = defineProps({
...
@@ -299,7 +298,7 @@ const props = defineProps({
// 索引列的标题
// 索引列的标题
indexLabel
:
{
indexLabel
:
{
type
:
String
,
type
:
String
,
default
:
"
#
"
,
default
:
""
,
},
},
// 自定义索引的计算方法
// 自定义索引的计算方法
indexMethod
:
Function
,
indexMethod
:
Function
,
...
@@ -393,22 +392,22 @@ const tableData = computed(() => {
...
@@ -393,22 +392,22 @@ const tableData = computed(() => {
});
});
// 自动计算表格高度
// 自动计算表格高度
const
computedTableHeight
=
computed
(()
=>
{
//
const computedTableHeight = computed(() => {
if
(
!
props
.
autoHeight
)
{
//
if (!props.autoHeight) {
return
props
.
tableHeight
;
//
return props.tableHeight;
}
//
}
const
headerHeight
=
50
;
//
const headerHeight = 50;
// const paginationHeight = props.pagination ? 50 : 0;
//
// const paginationHeight = props.pagination ? 50 : 0;
const
noDataHeight
=
tableData
.
value
.
length
?
0
:
50
;
//
const noDataHeight = tableData.value.length ? 0 : 50;
const
baseHeight
=
headerHeight
+
noDataHeight
;
//
const baseHeight = headerHeight + noDataHeight;
// 如果数据超过最大行数,固定显示最大行数的高度;如果数据不超过最大行数,按实际行数计算高度
//
// 如果数据超过最大行数,固定显示最大行数的高度;如果数据不超过最大行数,按实际行数计算高度
const
actualRows
=
Math
.
min
(
tableData
.
value
.
length
,
props
.
maxRows
);
//
const actualRows = Math.min(tableData.value.length, props.maxRows);
const
contentHeight
=
actualRows
*
props
.
rowHeight
;
//
const contentHeight = actualRows * props.rowHeight;
return
`
${
baseHeight
+
contentHeight
}
px`
;
//
return `${baseHeight + contentHeight}px`;
});
//
});
// 监听器
// 监听器
watch
(
watch
(
...
@@ -545,7 +544,14 @@ const handleNextClick = (val) => {
...
@@ -545,7 +544,14 @@ const handleNextClick = (val) => {
}
}
.table-container {
.table-container {
margin-bottom: 16px;
flex: 1;
height: 0;
display: flex;
flex-direction: column;
.el-table{
flex: 1;
height: 0;
}
}
}
.table-footer {
.table-footer {
...
...
src/style.css
View file @
e91f1040
...
@@ -24,8 +24,8 @@ html, body {
...
@@ -24,8 +24,8 @@ html, body {
/* 自定义滚动条样式 */
/* 自定义滚动条样式 */
::-webkit-scrollbar
{
::-webkit-scrollbar
{
width
:
6
px
;
width
:
4
px
;
height
:
6
px
;
height
:
4
px
;
}
}
::-webkit-scrollbar-track
{
::-webkit-scrollbar-track
{
...
@@ -34,8 +34,8 @@ html, body {
...
@@ -34,8 +34,8 @@ html, body {
}
}
::-webkit-scrollbar-thumb
{
::-webkit-scrollbar-thumb
{
background
:
#c1c1c1
;
background
:
rgba
(
37
,
139
,
248
,
0.5
)
;
border-radius
:
3
px
;
border-radius
:
2
px
;
}
}
::-webkit-scrollbar-thumb:hover
{
::-webkit-scrollbar-thumb:hover
{
...
...
src/styles/manage.less
View file @
e91f1040
...
@@ -11,8 +11,30 @@
...
@@ -11,8 +11,30 @@
justify-content: space-between;
justify-content: space-between;
align-items: center;
align-items: center;
margin-bottom: 10px;
margin-bottom: 10px;
.header-left{
flex: 1;
width: 0;
.el-input{
width: 220px;
}
}
}
}
.manage-content{
.manage-content{
flex: 1;
flex: 1;
height: 0;
height: 0;
.common-table{
height: 100%;
display: flex;
flex-direction: column;
.table-container{
flex: 1;
height: 0;
display: flex;
flex-direction: column;
.el-table{
flex: 1;
height: 0;
}
}
}
}
}
\ No newline at end of file
src/views/systemManage/roleManage.vue
View file @
e91f1040
<
template
>
<
template
>
<div
class=
"user-manage"
v-loading=
"loading"
>
<div
class=
"user-manage"
v-loading=
"loading"
>
<!-- search form moved into table header to align with 新增 button -->
<div
class=
"manage-header"
>
<div
class=
"table-container"
>
<div
class=
"header-left"
>
<el-form
:inline=
"true"
:model=
"searchForm"
>
<el-form-item
label=
"名称查询"
>
<el-input
v-model=
"searchForm.name"
clearable
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"handleSearch"
>
查询
</el-button>
</el-form-item>
</el-form>
</div>
<div
class=
"header-right"
>
<el-form>
<el-form-item>
<el-button
type=
"primary"
@
click=
"handleAdd"
>
新增角色
</el-button>
</el-form-item>
</el-form>
</div>
</div>
<div
class=
"manage-content table-container"
>
<common-table
<common-table
:autoHeight=
"true"
:autoHeight=
"true"
:maxRows=
"10"
:maxRows=
"10"
...
@@ -12,27 +30,16 @@
...
@@ -12,27 +30,16 @@
:current-page=
"currentPage"
:current-page=
"currentPage"
:page-size=
"pageSize"
:page-size=
"pageSize"
title=
""
title=
""
:index=
"true"
:border=
"true"
:border=
"true"
@
size-change=
"handleSizeChange"
@
size-change=
"handleSizeChange"
@
current-page-change=
"handleCurrentPageChange"
@
current-page-change=
"handleCurrentPageChange"
>
>
<template
#
header-left
>
<div
style=
"display:flex;align-items:center;gap:12px;"
>
<commonForm
v-model=
"searchForm"
:config=
"searchConfig"
:items=
"searchItems"
@
submit=
"handleSearch"
@
reset=
"handleReset"
/>
<el-button
type=
"primary"
@
click=
"handleAdd"
>
新增
</el-button>
</div>
</
template
>
<template
#
operations=
"
{ row, index }">
<template
#
operations=
"
{ row, index }">
<el-button
type=
"text
"
size=
"small"
@
click=
"handleEdit(row, index)"
>
<el-button
link
type=
"primary
"
size=
"small"
@
click=
"handleEdit(row, index)"
>
编辑
编辑
</el-button>
</el-button>
<el-button
type=
"text
"
size=
"small"
@
click=
"handleDelete(row, index)"
>
<el-button
link
type=
"danger
"
size=
"small"
@
click=
"handleDelete(row, index)"
>
删除
删除
</el-button>
</el-button>
<!--
<el-button
type=
"text"
size=
"small"
>
数据权限
</el-button>
-->
<!--
<el-button
type=
"text"
size=
"small"
>
数据权限
</el-button>
-->
...
@@ -91,52 +98,20 @@
...
@@ -91,52 +98,20 @@
<
script
setup
>
<
script
setup
>
import
{
ref
,
reactive
,
onMounted
,
getCurrentInstance
,
computed
,
nextTick
}
from
"vue"
;
import
{
ref
,
reactive
,
onMounted
,
getCurrentInstance
,
computed
,
nextTick
}
from
"vue"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
Plus
,
Edit
,
Delete
}
from
"@element-plus/icons-vue"
;
import
commonForm
from
"@/components/common/commonForm.vue"
;
import
commonForm
from
"@/components/common/commonForm.vue"
;
import
CommonTable
from
"@/components/common/commonTable.vue"
;
import
CommonTable
from
"@/components/common/commonTable.vue"
;
import
{
da
}
from
"element-plus/es/locales.mjs"
;
const
{
proxy
}
=
getCurrentInstance
();
const
{
proxy
}
=
getCurrentInstance
();
const
loading
=
ref
(
false
);
const
loading
=
ref
(
false
);
const
treeData
=
ref
([]);
const
treeData
=
ref
([]);
const
treeRef
=
ref
(
null
);
const
treeRef
=
ref
(
null
);
// 数据转换函数
// const convertToTreeData = (apiData) => {
// return apiData.map((item) => ({
// value: item.id.toString(),
// label: item.name,
// children: item.children ? convertToTreeData(item.children) : [],
// }));
// };
// 查询表单数据
// 查询表单数据
const
searchForm
=
ref
({
const
searchForm
=
ref
({
name
:
""
,
name
:
""
,
mobile
:
""
,
mobile
:
""
,
});
});
// 查询表单配置
const
searchConfig
=
{
inline
:
true
,
labelWidth
:
"80px"
,
showButtons
:
true
,
submitText
:
"查询"
,
resetText
:
"重置"
,
};
// 查询表单项配置
const
searchItems
=
[
{
type
:
"input"
,
prop
:
"name"
,
label
:
""
,
placeholder
:
"请输入角色名称"
,
clearable
:
true
,
span
:
8
,
},
];
// 表格数据
// 表格数据
const
tableData
=
ref
([]);
const
tableData
=
ref
([]);
const
total
=
ref
(
0
);
const
total
=
ref
(
0
);
...
@@ -150,25 +125,25 @@ const tableColumns = [
...
@@ -150,25 +125,25 @@ const tableColumns = [
label
:
"角色名称"
,
label
:
"角色名称"
,
minWidth
:
100
,
minWidth
:
100
,
},
},
{
//
{
prop
:
"key"
,
//
prop: "key",
label
:
"角色标识"
,
//
label: "角色标识",
minWidth
:
100
,
//
minWidth: 100,
},
//
},
{
//
{
prop
:
"createdAt"
,
//
prop: "createdAt",
label
:
"创建时间"
,
//
label: "创建时间",
minWidth
:
160
,
//
minWidth: 160,
},
//
},
{
//
{
prop
:
"updatedAt"
,
//
prop: "updatedAt",
label
:
"更新时间"
,
//
label: "更新时间",
minWidth
:
160
,
//
minWidth: 160,
},
//
},
{
{
prop
:
"operations"
,
prop
:
"operations"
,
label
:
"操作"
,
label
:
"操作"
,
width
:
31
0
,
width
:
10
0
,
slot
:
"operations"
,
slot
:
"operations"
,
fixed
:
"right"
,
fixed
:
"right"
,
align
:
"center"
,
align
:
"center"
,
...
@@ -211,10 +186,10 @@ const formItems = computed(() => [
...
@@ -211,10 +186,10 @@ const formItems = computed(() => [
type
:
"input"
,
type
:
"input"
,
prop
:
"key"
,
prop
:
"key"
,
label
:
"角色标识"
,
label
:
"角色标识"
,
placeholder
:
"请输入角色
英文
标识"
,
placeholder
:
"请输入角色标识"
,
span
:
24
,
span
:
24
,
required
:
true
,
required
:
true
,
rules
:
[{
required
:
true
,
message
:
"请输入角色
英文
标识"
,
trigger
:
"blur"
}],
rules
:
[{
required
:
true
,
message
:
"请输入角色标识"
,
trigger
:
"blur"
}],
},
},
{
{
type
:
"slot"
,
type
:
"slot"
,
...
@@ -233,16 +208,6 @@ const handleSearch = (formData) => {
...
@@ -233,16 +208,6 @@ const handleSearch = (formData) => {
currentPage
.
value
=
1
;
currentPage
.
value
=
1
;
loadTableData
();
loadTableData
();
};
};
const
handleReset
=
()
=>
{
searchForm
.
value
=
{
name
:
""
,
mobile
:
""
,
};
currentPage
.
value
=
1
;
loadTableData
();
};
const
handleSizeChange
=
(
size
)
=>
{
const
handleSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
;
pageSize
.
value
=
size
;
currentPage
.
value
=
1
;
currentPage
.
value
=
1
;
...
@@ -254,13 +219,7 @@ const handleCurrentPageChange = (page) => {
...
@@ -254,13 +219,7 @@ const handleCurrentPageChange = (page) => {
loadTableData
();
loadTableData
();
};
};
// 树节点点击
// 新增角色
const
handleNodeClick
=
(
data
,
node
,
element
)
=>
{
// console.log(data, "data");
// console.log(node, "node");
// console.log(element, "element");
};
// 新增用户
const
handleAdd
=
()
=>
{
const
handleAdd
=
()
=>
{
isEdit
.
value
=
false
;
isEdit
.
value
=
false
;
dialogTitle
.
value
=
"新增角色"
;
dialogTitle
.
value
=
"新增角色"
;
...
@@ -310,7 +269,7 @@ const handleEdit = (row, index) => {
...
@@ -310,7 +269,7 @@ const handleEdit = (row, index) => {
// 删除
// 删除
const
handleDelete
=
async
(
row
,
index
)
=>
{
const
handleDelete
=
async
(
row
,
index
)
=>
{
try
{
try
{
await
ElMessageBox
.
confirm
(
`确定要删除
用户
"
${
row
.
name
}
"吗?`
,
"提示"
,
{
await
ElMessageBox
.
confirm
(
`确定要删除
角色
"
${
row
.
name
}
"吗?`
,
"提示"
,
{
confirmButtonText
:
"确定"
,
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
type
:
"warning"
,
...
@@ -447,6 +406,7 @@ onMounted(() => {
...
@@ -447,6 +406,7 @@ onMounted(() => {
</
script
>
</
script
>
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
@import "@/styles/manage.less";
.user-manage {
.user-manage {
padding: 20px;
padding: 20px;
background: rgba(157, 188, 218, 0.1);
background: rgba(157, 188, 218, 0.1);
...
...
src/views/systemManage/userManage.vue
View file @
e91f1040
...
@@ -22,13 +22,13 @@
...
@@ -22,13 +22,13 @@
<div
class=
"manage-content table-container"
>
<div
class=
"manage-content table-container"
>
<common-table
<common-table
:autoHeight=
"true"
:autoHeight=
"true"
:maxRows=
"10"
:data=
"tableData"
:data=
"tableData"
:columns=
"tableColumns"
:columns=
"tableColumns"
:total=
"total"
:total=
"total"
:current-page=
"currentPage"
:current-page=
"currentPage"
:page-size=
"pageSize"
:page-size=
"pageSize"
title=
""
title=
""
:index=
"true"
:border=
"true"
:border=
"true"
@
size-change=
"handleSizeChange"
@
size-change=
"handleSizeChange"
@
current-page-change=
"handleCurrentPageChange"
@
current-page-change=
"handleCurrentPageChange"
...
@@ -43,10 +43,10 @@
...
@@ -43,10 +43,10 @@
</
template
>
</
template
>
<
template
#
operations=
"{ row, index }"
>
<
template
#
operations=
"{ row, index }"
>
<el-button
type=
"text
"
size=
"small"
@
click=
"handleEdit(row, index)"
>
<el-button
link
type=
"primary
"
size=
"small"
@
click=
"handleEdit(row, index)"
>
编辑
编辑
</el-button>
</el-button>
<el-button
type=
"text
"
size=
"small"
@
click=
"handleDelete(row, index)"
>
<el-button
link
type=
"danger
"
size=
"small"
@
click=
"handleDelete(row, index)"
>
删除
删除
</el-button>
</el-button>
</
template
>
</
template
>
...
@@ -74,52 +74,17 @@
...
@@ -74,52 +74,17 @@
<
script
setup
>
<
script
setup
>
import
{
ref
,
reactive
,
onMounted
,
getCurrentInstance
,
computed
}
from
"vue"
;
import
{
ref
,
reactive
,
onMounted
,
getCurrentInstance
,
computed
}
from
"vue"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
Plus
,
Edit
,
Delete
}
from
"@element-plus/icons-vue"
;
import
commonForm
from
"@/components/common/commonForm.vue"
;
import
commonForm
from
"@/components/common/commonForm.vue"
;
import
CommonTable
from
"@/components/common/commonTable.vue"
;
import
CommonTable
from
"@/components/common/commonTable.vue"
;
import
{
da
}
from
"element-plus/es/locales.mjs"
;
const
{
proxy
}
=
getCurrentInstance
();
const
{
proxy
}
=
getCurrentInstance
();
const
loading
=
ref
(
false
);
const
loading
=
ref
(
false
);
// 数据转换函数
// const convertToTreeData = (apiData) => {
// return apiData.map((item) => ({
// value: item.id.toString(),
// label: item.name,
// children: item.children ? convertToTreeData(item.children) : [],
// }));
// };
// 查询表单数据
// 查询表单数据
const
searchForm
=
ref
({
const
searchForm
=
ref
({
name
:
""
,
name
:
""
,
mobile
:
""
,
mobile
:
""
,
});
});
// 查询表单配置
const
searchConfig
=
{
inline
:
true
,
labelWidth
:
"80px"
,
showButtons
:
true
,
submitText
:
"查询"
,
resetText
:
"重置"
,
};
// 查询表单项配置
const
searchItems
=
[
{
type
:
"input"
,
prop
:
"name"
,
label
:
""
,
placeholder
:
"请输入关键字查询"
,
clearable
:
true
,
span
:
12
,
}
];
// 表格数据
// 表格数据
const
tableData
=
ref
([]);
const
tableData
=
ref
([]);
const
total
=
ref
(
0
);
const
total
=
ref
(
0
);
...
@@ -157,11 +122,11 @@ const tableColumns = [
...
@@ -157,11 +122,11 @@ const tableColumns = [
minWidth
:
100
,
minWidth
:
100
,
showOverflowTooltip
:
true
,
showOverflowTooltip
:
true
,
},
},
{
//
{
prop
:
"createdAt"
,
//
prop: "createdAt",
label
:
"创建时间"
,
//
label: "创建时间",
minWidth
:
160
,
//
minWidth: 160,
},
//
},
{
{
prop
:
"enable"
,
prop
:
"enable"
,
label
:
"状态"
,
label
:
"状态"
,
...
@@ -172,7 +137,7 @@ const tableColumns = [
...
@@ -172,7 +137,7 @@ const tableColumns = [
{
{
prop
:
"operations"
,
prop
:
"operations"
,
label
:
"操作"
,
label
:
"操作"
,
width
:
1
6
0
,
width
:
1
2
0
,
slot
:
"operations"
,
slot
:
"operations"
,
fixed
:
"right"
,
fixed
:
"right"
,
align
:
"center"
,
align
:
"center"
,
...
@@ -266,7 +231,7 @@ const formItems = computed(() => [
...
@@ -266,7 +231,7 @@ const formItems = computed(() => [
checkStrictly
:
true
,
checkStrictly
:
true
,
renderAfterExpand
:
true
,
renderAfterExpand
:
true
,
showCheckbox
:
false
,
showCheckbox
:
false
,
multiple
:
fals
e
,
multiple
:
tru
e
,
collapseTags
:
true
,
collapseTags
:
true
,
maxCollapseTags
:
2
,
maxCollapseTags
:
2
,
span
:
24
,
span
:
24
,
...
@@ -331,15 +296,6 @@ const handleSearch = (formData) => {
...
@@ -331,15 +296,6 @@ const handleSearch = (formData) => {
loadTableData
();
loadTableData
();
};
};
const
handleReset
=
()
=>
{
searchForm
.
value
=
{
name
:
""
,
mobile
:
""
,
};
currentPage
.
value
=
1
;
loadTableData
();
};
const
handleSizeChange
=
(
size
)
=>
{
const
handleSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
;
pageSize
.
value
=
size
;
currentPage
.
value
=
1
;
currentPage
.
value
=
1
;
...
@@ -355,13 +311,7 @@ const handleCurrentPageChange = (page) => {
...
@@ -355,13 +311,7 @@ const handleCurrentPageChange = (page) => {
const
handleAdd
=
()
=>
{
const
handleAdd
=
()
=>
{
isEdit
.
value
=
false
;
isEdit
.
value
=
false
;
dialogTitle
.
value
=
"新增用户"
;
dialogTitle
.
value
=
"新增用户"
;
userForm
.
value
=
{
userForm
.
value
=
{};
name
:
""
,
departs
:
[],
positions
:
[],
roles
:
[],
enable
:
"0"
,
};
loadDepartmentData
();
loadDepartmentData
();
loadPositionsData
();
loadPositionsData
();
loadRolesData
();
loadRolesData
();
...
...
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