Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qr-consistency-vue3
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
刘怀志
qr-consistency-vue3
Commits
30cda148
Commit
30cda148
authored
Apr 30, 2025
by
lwy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(用户管理):修复修改,新建管理员功能
parent
48f9feda
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
10 deletions
+40
-10
role.js
src/api/system/role.js
+10
-0
index.vue
src/views/system/user/index.vue
+30
-10
No files found.
src/api/system/role.js
View file @
30cda148
...
@@ -117,3 +117,13 @@ export function deptTreeSelect(roleId) {
...
@@ -117,3 +117,13 @@ export function deptTreeSelect(roleId) {
method
:
'get'
,
method
:
'get'
,
})
})
}
}
// 获取所有角色
export
function
getRoleAll
()
{
return
request
({
url
:
'/system/role/optionselect'
,
method
:
'get'
,
})
}
src/views/system/user/index.vue
View file @
30cda148
...
@@ -383,13 +383,25 @@
...
@@ -383,13 +383,25 @@
show-password
show-password
/>
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"系统角色"
prop=
"roleNames"
>
<el-form-item
label=
"系统角色"
prop=
"roleId"
>
<el-select
v-if=
"title === '新建管理员'"
disabled
v-model=
"form.roleId"
placeholder=
"请选择"
>
<el-option
v-for=
"item in roleOptions"
:key=
"item.roleId"
:label=
"item.roleName"
:value=
"item.roleId"
/>
</el-select>
<el-input
<el-input
v-if=
"title === '修改用户'"
disabled
disabled
v-model=
"form.roleNames"
v-model=
"form.roleNames"
placeholder=
"请输入系统角色"
></el-input>
maxlength=
"30"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"状态"
>
<el-form-item
label=
"状态"
>
<el-radio-group
v-model=
"form.status"
>
<el-radio-group
v-model=
"form.status"
>
...
@@ -481,6 +493,7 @@ import {
...
@@ -481,6 +493,7 @@ import {
updateUserFactory
,
updateUserFactory
,
updateUserUnit
updateUserUnit
}
from
'@/api/system/user'
}
from
'@/api/system/user'
import
{
getRoleAll
}
from
'@/api/system/role'
import
{
getAllBusinessUnitName
}
from
"@/api/system/basicdata/businessunit.js"
;
import
{
getAllBusinessUnitName
}
from
"@/api/system/basicdata/businessunit.js"
;
import
{
Splitpanes
,
Pane
}
from
'splitpanes'
import
{
Splitpanes
,
Pane
}
from
'splitpanes'
import
'splitpanes/dist/splitpanes.css'
import
'splitpanes/dist/splitpanes.css'
...
@@ -519,7 +532,7 @@ const deptOptions = ref(undefined)
...
@@ -519,7 +532,7 @@ const deptOptions = ref(undefined)
const
enabledDeptOptions
=
ref
(
undefined
)
const
enabledDeptOptions
=
ref
(
undefined
)
const
initPassword
=
ref
(
undefined
)
const
initPassword
=
ref
(
undefined
)
const
postOptions
=
ref
([])
const
postOptions
=
ref
([])
const
roleOptions
=
ref
([])
const
roleOptions
=
ref
([])
// 所有可选角色
const
currentUserId
=
ref
(
''
);
// 当前行用户ID
const
currentUserId
=
ref
(
''
);
// 当前行用户ID
const
allDivsions
=
ref
([]);
const
allDivsions
=
ref
([]);
...
@@ -626,6 +639,12 @@ watch(deptName, (val) => {
...
@@ -626,6 +639,12 @@ watch(deptName, (val) => {
proxy
.
$refs
[
'deptTreeRef'
].
filter
(
val
)
proxy
.
$refs
[
'deptTreeRef'
].
filter
(
val
)
})
})
//获取系统角色下拉框
function
fetchRoles
()
{
getRoleAll
().
then
((
response
)
=>
{
roleOptions
.
value
=
response
.
data
})
}
...
@@ -903,6 +922,7 @@ function submitFileForm() {
...
@@ -903,6 +922,7 @@ function submitFileForm() {
/** 重置操作表单 */
/** 重置操作表单 */
function
reset
()
{
function
reset
()
{
form
.
value
=
{
form
.
value
=
{
roleId
:
1
,
//默认为超级管理员
divsions
:
[],
divsions
:
[],
userId
:
null
,
userId
:
null
,
deptId
:
null
,
deptId
:
null
,
...
@@ -913,7 +933,7 @@ function reset() {
...
@@ -913,7 +933,7 @@ function reset() {
phonenumber
:
null
,
phonenumber
:
null
,
email
:
null
,
email
:
null
,
sex
:
null
,
sex
:
null
,
roleNames
:
'超级管理员'
,
roleNames
:
null
,
status
:
'0'
,
status
:
'0'
,
userType
:
'00'
,
userType
:
'00'
,
remark
:
null
,
remark
:
null
,
...
@@ -936,9 +956,8 @@ function handleAdd() {
...
@@ -936,9 +956,8 @@ function handleAdd() {
reset
()
reset
()
getUser
().
then
((
response
)
=>
{
getUser
().
then
((
response
)
=>
{
postOptions
.
value
=
response
.
posts
postOptions
.
value
=
response
.
posts
roleOptions
.
value
=
response
.
roles
open
.
value
=
true
open
.
value
=
true
title
.
value
=
'
添加用户
'
title
.
value
=
'
新建管理员
'
form
.
value
.
password
=
initPassword
.
value
form
.
value
.
password
=
initPassword
.
value
})
})
}
}
...
@@ -950,7 +969,6 @@ function handleUpdate(row) {
...
@@ -950,7 +969,6 @@ function handleUpdate(row) {
getUser
(
userId
).
then
((
response
)
=>
{
getUser
(
userId
).
then
((
response
)
=>
{
form
.
value
=
response
.
data
form
.
value
=
response
.
data
postOptions
.
value
=
response
.
posts
postOptions
.
value
=
response
.
posts
roleOptions
.
value
=
response
.
roles
form
.
value
.
postIds
=
response
.
postIds
form
.
value
.
postIds
=
response
.
postIds
form
.
value
.
roleIds
=
response
.
roleIds
form
.
value
.
roleIds
=
response
.
roleIds
// 根据 roleIds 生成 roleNames
// 根据 roleIds 生成 roleNames
...
@@ -976,6 +994,8 @@ function submitForm() {
...
@@ -976,6 +994,8 @@ function submitForm() {
getList
()
getList
()
})
})
}
else
{
}
else
{
//接口需要roleIds[],将roleId转为roleIds
form
.
value
.
roleIds
=
[
form
.
value
.
roleId
];
addUser
(
form
.
value
).
then
((
response
)
=>
{
addUser
(
form
.
value
).
then
((
response
)
=>
{
proxy
.
$modal
.
msgSuccess
(
'新增成功'
)
proxy
.
$modal
.
msgSuccess
(
'新增成功'
)
open
.
value
=
false
open
.
value
=
false
...
@@ -1033,7 +1053,7 @@ function submitUnit() {
...
@@ -1033,7 +1053,7 @@ function submitUnit() {
onMounted
(()
=>
{
onMounted
(()
=>
{
fetchFactories
();
fetchFactories
();
fetchBusinessUnits
();
fetchBusinessUnits
();
//
fetchRoles();
fetchRoles
();
});
});
getDeptTree
()
getDeptTree
()
getList
()
getList
()
...
...
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