Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
shop-vite-main
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
front-base-project
shop-vite-main
Commits
9c022d05
提交
9c022d05
authored
12月 18, 2024
作者:
郁骅焌
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
分页修改
上级
9abad03b
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
230 行增加
和
23 行删除
+230
-23
auto-imports.d.ts
library/build/unplugin/auto-imports.d.ts
+1
-0
userManagement.ts
src/api/userManagement.ts
+30
-0
index.ts
src/router/index.ts
+14
-0
authRole.vue
src/views/system/userManagement/authRole.vue
+154
-0
index.vue
src/views/system/userManagement/index.vue
+31
-23
没有找到文件。
library/build/unplugin/auto-imports.d.ts
浏览文件 @
9c022d05
...
@@ -17,6 +17,7 @@ declare global {
...
@@ -17,6 +17,7 @@ declare global {
const
EffectScope
:
typeof
import
(
'vue'
)[
'EffectScope'
]
const
EffectScope
:
typeof
import
(
'vue'
)[
'EffectScope'
]
const
ElLoading
:
typeof
import
(
'element-plus/es'
)[
'ElLoading'
]
const
ElLoading
:
typeof
import
(
'element-plus/es'
)[
'ElLoading'
]
const
ElMessage
:
typeof
import
(
'element-plus/es'
)[
'ElMessage'
]
const
ElMessage
:
typeof
import
(
'element-plus/es'
)[
'ElMessage'
]
const
ElMessageBox
:
typeof
import
(
'element-plus/es'
)[
'ElMessageBox'
]
const
acceptHMRUpdate
:
typeof
import
(
'pinia'
)[
'acceptHMRUpdate'
]
const
acceptHMRUpdate
:
typeof
import
(
'pinia'
)[
'acceptHMRUpdate'
]
const
asyncComputed
:
typeof
import
(
'@vueuse/core'
)[
'asyncComputed'
]
const
asyncComputed
:
typeof
import
(
'@vueuse/core'
)[
'asyncComputed'
]
const
autoResetRef
:
typeof
import
(
'@vueuse/core'
)[
'autoResetRef'
]
const
autoResetRef
:
typeof
import
(
'@vueuse/core'
)[
'autoResetRef'
]
...
...
src/api/userManagement.ts
浏览文件 @
9c022d05
...
@@ -52,3 +52,33 @@ export function changeUserStatus(userId: any, status: any) {
...
@@ -52,3 +52,33 @@ export function changeUserStatus(userId: any, status: any) {
data
,
data
,
})
})
}
}
// 用户密码重置
export
function
resetUserPwd
(
userId
:
any
,
password
:
any
)
{
const
data
=
{
userId
,
password
,
}
return
request
({
url
:
'/system/user/resetPwd'
,
method
:
'put'
,
data
,
})
}
// 查询授权角色
export
function
getAuthRole
(
userId
:
any
)
{
return
request
({
url
:
`/system/user/authRole/
${
userId
}
`
,
method
:
'get'
,
})
}
// 保存授权角色
export
function
updateAuthRole
(
data
:
any
)
{
return
request
({
url
:
'/system/user/authRole'
,
method
:
'put'
,
params
:
data
,
})
}
src/router/index.ts
浏览文件 @
9c022d05
...
@@ -247,11 +247,25 @@ export const customRoutes: VabRouteRecord[] = [
...
@@ -247,11 +247,25 @@ export const customRoutes: VabRouteRecord[] = [
},
},
children
:
[
children
:
[
{
{
path
:
'userManagement/authRole/:userId'
,
component
:
'/@/views/system/userManagement/authRole.vue'
,
name
:
'AuthRole'
,
meta
:
{
hidden
:
true
,
icon
:
'admin-line'
,
title
:
'分配角色'
,
noKeepAlive
:
true
,
dynamicNewTab
:
true
,
activeMenu
:
'/system/userManagement'
,
},
},
{
path
:
'roleManagement/authUser/:roleId'
,
path
:
'roleManagement/authUser/:roleId'
,
component
:
'/@/views/system/roleManagement/authUser.vue'
,
component
:
'/@/views/system/roleManagement/authUser.vue'
,
name
:
'AuthUser'
,
name
:
'AuthUser'
,
meta
:
{
meta
:
{
hidden
:
true
,
hidden
:
true
,
icon
:
'user-3-line'
,
title
:
'分配用户'
,
title
:
'分配用户'
,
noKeepAlive
:
true
,
noKeepAlive
:
true
,
dynamicNewTab
:
true
,
dynamicNewTab
:
true
,
...
...
src/views/system/userManagement/authRole.vue
0 → 100644
浏览文件 @
9c022d05
<
template
>
<div
class=
"auto-height-container"
>
<h4
class=
"form-header h4"
>
基本信息
</h4>
<el-form
label-width=
"80px"
:model=
"form"
>
<el-row>
<el-col
:offset=
"2"
:span=
"8"
>
<el-form-item
label=
"用户昵称"
prop=
"nickName"
>
<el-input
v-model=
"form.nickName"
disabled
/>
</el-form-item>
</el-col>
<el-col
:offset=
"2"
:span=
"8"
>
<el-form-item
label=
"登录账号"
prop=
"userName"
>
<el-input
v-model=
"form.userName"
disabled
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<h4
class=
"form-header h4"
>
角色信息
</h4>
<el-table
ref=
"roleRef"
v-loading=
"loading"
:data=
"roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)"
:row-key=
"getRowKey"
@
row-click=
"clickRow"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
align=
"center"
label=
"序号"
type=
"index"
width=
"55"
>
<template
#
default=
"scope"
>
<span>
{{
(
pageNum
-
1
)
*
pageSize
+
scope
.
$index
+
1
}}
</span>
</
template
>
</el-table-column>
<el-table-column
:reserve-selection=
"true"
type=
"selection"
width=
"55"
/>
<el-table-column
align=
"center"
label=
"角色编号"
prop=
"roleId"
/>
<el-table-column
align=
"center"
label=
"角色名称"
prop=
"roleName"
/>
<el-table-column
align=
"center"
label=
"权限字符"
prop=
"roleKey"
/>
<el-table-column
align=
"center"
label=
"创建时间"
prop=
"createTime"
width=
"180"
/>
</el-table>
<vab-pagination
:current-page=
"pageNum"
:page-size=
"pageSize"
:total=
"total"
@
current-change=
"handleCurrentChange"
@
size-change=
"handleSizeChange"
/>
<el-form
label-width=
"100px"
>
<div
style=
"margin-top: 30px; margin-left: -120px; text-align: center"
>
<el-button
type=
"primary"
@
click=
"submitForm()"
>
提交
</el-button>
<el-button
@
click=
"close()"
>
返回
</el-button>
</div>
</el-form>
</div>
</template>
<
script
lang=
"ts"
setup
>
import
{
getAuthRole
,
updateAuthRole
}
from
'/@/api/userManagement'
import
{
useTabsStore
}
from
'/@/store/modules/tabs'
defineOptions
({
name
:
'AuthRole'
,
})
const
route
=
useRoute
()
const
router
=
useRouter
()
const
tabStore
=
useTabsStore
()
const
{
delVisitedRoute
}
=
tabStore
const
{
proxy
}
=
getCurrentInstance
()
as
any
const
loading
=
ref
(
true
)
const
total
=
ref
(
0
)
const
pageNum
=
ref
(
1
)
const
pageSize
=
ref
(
10
)
const
roleIds
=
ref
([])
const
roles
=
ref
([])
const
form
=
ref
({
nickName
:
undefined
,
userName
:
undefined
,
userId
:
undefined
,
})
const
handleSizeChange
=
(
value
:
number
)
=>
{
pageNum
.
value
=
1
pageSize
.
value
=
value
// fetchData()
}
const
handleCurrentChange
=
(
value
:
number
)
=>
{
pageNum
.
value
=
value
// fetchData()
}
/** 单击选中行数据 */
function
clickRow
(
row
:
any
)
{
proxy
.
$refs
[
'roleRef'
].
toggleRowSelection
(
row
)
}
/** 多选框选中数据 */
function
handleSelectionChange
(
selection
:
any
)
{
roleIds
.
value
=
selection
.
map
((
item
:
any
)
=>
item
.
roleId
)
}
/** 保存选中的数据编号 */
function
getRowKey
(
row
:
any
)
{
return
row
.
roleId
}
/** 关闭按钮 */
async
function
close
()
{
await
delVisitedRoute
(
route
.
path
)
router
.
push
({
name
:
'UserManagement'
})
}
/** 提交按钮 */
function
submitForm
()
{
const
userId
=
form
.
value
.
userId
const
rIds
=
roleIds
.
value
.
join
(
','
)
updateAuthRole
({
userId
,
roleIds
:
rIds
}).
then
(()
=>
{
$baseMessage
(
'授权成功'
,
'success'
,
'hey'
)
close
()
})
}
;(()
=>
{
const
userId
=
route
.
params
&&
route
.
params
.
userId
if
(
userId
)
{
loading
.
value
=
true
getAuthRole
(
userId
).
then
((
response
:
any
)
=>
{
form
.
value
=
response
.
user
roles
.
value
=
response
.
roles
total
.
value
=
roles
.
value
.
length
nextTick
(()
=>
{
roles
.
value
.
forEach
((
row
:
any
)
=>
{
if
(
row
.
flag
)
{
proxy
.
$refs
[
'roleRef'
].
toggleRowSelection
(
row
)
}
})
})
loading
.
value
=
false
})
}
})()
</
script
>
<
style
lang=
"scss"
scoped
>
.form-header
{
padding-bottom
:
5px
;
margin
:
8px
10px
25px
10px
;
font-size
:
15px
;
color
:
#6379bb
;
border-bottom
:
1px
solid
#ddd
;
}
</
style
>
src/views/system/userManagement/index.vue
浏览文件 @
9c022d05
...
@@ -179,13 +179,15 @@
...
@@ -179,13 +179,15 @@
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
type
{
TableInstance
}
from
'element-plus'
import
type
{
TableInstance
}
from
'element-plus'
import
{
ElMessageBox
}
from
'element-plus'
import
{
deptTreeSelect
}
from
'/@/api/departmentManagement'
import
{
deptTreeSelect
}
from
'/@/api/departmentManagement'
import
{
changeUserStatus
,
doDelete
,
getList
}
from
'/@/api/userManagement'
import
{
changeUserStatus
,
doDelete
,
getList
,
resetUserPwd
}
from
'/@/api/userManagement'
defineOptions
({
defineOptions
({
name
:
'UserManagement'
,
name
:
'UserManagement'
,
})
})
const
router
=
useRouter
()
const
{
proxy
}
=
getCurrentInstance
()
as
any
const
{
proxy
}
=
getCurrentInstance
()
as
any
const
{
sys_normal_disable
}
=
proxy
.
useDict
(
'sys_normal_disable'
)
const
{
sys_normal_disable
}
=
proxy
.
useDict
(
'sys_normal_disable'
)
...
@@ -356,31 +358,37 @@ function handleCommand(command: string, row: any) {
...
@@ -356,31 +358,37 @@ function handleCommand(command: string, row: any) {
/** 跳转角色分配 */
/** 跳转角色分配 */
function
handleAuthRole
(
row
:
any
)
{
function
handleAuthRole
(
row
:
any
)
{
console
.
log
(
row
)
const
userId
=
row
.
userId
// const userId = row.userId;
router
.
push
({
// router.push("/system/user-auth/role/" + userId);
name
:
'AuthRole'
,
params
:
{
userId
,
},
})
}
}
/** 重置密码按钮操作 */
/** 重置密码按钮操作 */
function
handleResetPwd
(
row
:
any
)
{
const
handleResetPwd
=
(
row
:
any
)
=>
{
console
.
log
(
row
)
ElMessageBox
.
prompt
(
'提示'
,
`请输入"
${
row
.
userName
}
"的新密码`
,
{
// proxy.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
confirmButtonText
:
'确定'
,
// confirmButtonText: "确定",
cancelButtonText
:
'取消'
,
// cancelButtonText: "取消",
type
:
'warning'
,
// closeOnClickModal: false,
closeOnClickModal
:
false
,
// inputPattern: /^.{5,20}$/,
inputPattern
:
/^.
{5,20}
$/
,
// inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
inputErrorMessage
:
'用户密码长度必须介于 5 和 20 之间'
,
// inputValidator: (value) => {
inputValidator
:
(
value
)
=>
{
// if (/
<|>|
"|'|
\
||
\\
/.test(value)) {
if
(
/<|>|"|'|
\|
|
\\
/
.
test
(
value
))
{
// return "
不能包含非法字符:
<
>
\
" '
\\\
|"
return
String
.
raw
`不能包含非法字符:< > " ' \ |`
// }
}
// },
return
true
// }).then(({ value }) => {
},
// const encryptPassword = hex_md5(value)
})
// resetUserPwd(row.userId, encryptPassword).then(response => {
.
then
(({
value
})
=>
{
// proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
resetUserPwd
(
row
.
userId
,
value
).
then
(()
=>
{
// });
$baseMessage
(
`修改成功,新密码是:
${
value
}
`
,
'success'
,
'hey'
)
// }).catch(() => { });
})
})
.
catch
(()
=>
{})
}
}
/** 新增按钮操作 */
/** 新增按钮操作 */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论