Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
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
hooloo
web
soss
Commits
460cbbf0
Commit
460cbbf0
authored
Jun 08, 2022
by
lixiaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改用户和角色的判断
parent
602a89e0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
src/views/system/role/index.vue
+1
-0
src/views/system/user/index.vue
+23
-8
No files found.
src/views/system/role/index.vue
View file @
460cbbf0
...
@@ -221,6 +221,7 @@ export default {
...
@@ -221,6 +221,7 @@ export default {
rules
:
{
rules
:
{
roleName
:
[
roleName
:
[
{
required
:
true
,
message
:
"角色名称不能为空"
,
trigger
:
"blur"
},
{
required
:
true
,
message
:
"角色名称不能为空"
,
trigger
:
"blur"
},
{
min
:
2
,
message
:
'最少输入2个字符'
,
trigger
:
'blur'
}
]
]
},
},
};
};
...
...
src/views/system/user/index.vue
View file @
460cbbf0
...
@@ -108,13 +108,13 @@
...
@@ -108,13 +108,13 @@
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"600px"
append-to-body
>
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"600px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"姓名"
prop=
"nickName"
>
<el-form-item
label=
"姓名"
prop=
"nickName"
>
<el-input
v-model=
"form.nickName"
placeholder=
"请输入人员姓名"
maxlength=
"30"
/>
<el-input
v-model=
"form.nickName"
placeholder=
"请输入人员姓名"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"手机号"
prop=
"phonenumber"
>
<el-form-item
label=
"手机号"
prop=
"phonenumber"
>
<el-input
v-model=
"form.phonenumber"
placeholder=
"请输入手机号"
maxlength=
"11"
/>
<el-input
v-model=
"form.phonenumber"
placeholder=
"请输入手机号"
maxlength=
"11"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"角色"
prop=
"roleId
s
"
>
<el-form-item
label=
"角色"
prop=
"roleId"
>
<el-select
v-model=
"form.roleId
s"
multiple
placeholder=
"请选择"
clearable
>
<el-select
v-model=
"form.roleId
"
placeholder=
"请选择"
clearable
>
<el-option
<el-option
v-for=
"item in roleOptions"
v-for=
"item in roleOptions"
:key=
"item.roleId"
:key=
"item.roleId"
...
@@ -188,8 +188,9 @@ export default {
...
@@ -188,8 +188,9 @@ export default {
rules
:
{
rules
:
{
nickName
:
[
nickName
:
[
{
required
:
true
,
message
:
"姓名不能为空"
,
trigger
:
"blur"
},
{
required
:
true
,
message
:
"姓名不能为空"
,
trigger
:
"blur"
},
{
min
:
2
,
message
:
'最少输入2个字符'
,
trigger
:
'blur'
}
],
],
roleId
s
:
[
roleId
:
[
{
required
:
true
,
message
:
"角色不能为空"
,
trigger
:
"blur"
},
{
required
:
true
,
message
:
"角色不能为空"
,
trigger
:
"blur"
},
],
],
phonenumber
:
[
phonenumber
:
[
...
@@ -269,6 +270,7 @@ export default {
...
@@ -269,6 +270,7 @@ export default {
email
:
null
,
email
:
null
,
status
:
"0"
,
status
:
"0"
,
remark
:
null
,
remark
:
null
,
roleId
:
null
,
roleIds
:
[],
roleIds
:
[],
};
};
this
.
resetForm
(
"form"
);
this
.
resetForm
(
"form"
);
...
@@ -302,9 +304,14 @@ export default {
...
@@ -302,9 +304,14 @@ export default {
const
userId
=
row
.
userId
||
this
.
ids
;
const
userId
=
row
.
userId
||
this
.
ids
;
getUser
(
userId
).
then
((
response
)
=>
{
getUser
(
userId
).
then
((
response
)
=>
{
if
(
response
.
code
==
"200"
){
if
(
response
.
code
==
"200"
){
this
.
form
=
response
.
data
;
this
.
form
.
userId
=
response
.
data
.
userId
;
this
.
roleOptions
=
response
.
roles
;
this
.
form
.
nickName
=
response
.
data
.
nickName
;
this
.
form
.
roleIds
=
response
.
roleIds
;
this
.
form
.
userName
=
response
.
data
.
userName
;
this
.
form
.
phonenumber
=
response
.
data
.
phonenumber
;
this
.
form
.
email
=
response
.
data
.
email
;
this
.
form
.
remark
=
response
.
data
.
remark
;
this
.
form
.
roleId
=
response
.
roleIds
[
0
];
this
.
roleOptions
=
response
.
roles
;
this
.
open
=
true
;
this
.
open
=
true
;
this
.
title
=
"修改人员"
;
this
.
title
=
"修改人员"
;
this
.
form
.
password
=
""
;
this
.
form
.
password
=
""
;
...
@@ -315,7 +322,15 @@ export default {
...
@@ -315,7 +322,15 @@ export default {
submitForm
:
function
()
{
submitForm
:
function
()
{
this
.
$refs
[
"form"
].
validate
((
valid
)
=>
{
this
.
$refs
[
"form"
].
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
if
(
this
.
form
.
email
){
let
reg
=
/^
([
a-zA-Z0-9_-
])
+@
([
a-zA-Z0-9_-
])
+
((
.
[
a-zA-Z0-9_-
]{2,3}){1,2})
$/
if
(
!
reg
.
test
(
this
.
form
.
email
)){
this
.
$message
.
error
(
'邮箱格式不正确!'
);
return
;
}
}
this
.
form
.
userName
=
this
.
form
.
phonenumber
;
this
.
form
.
userName
=
this
.
form
.
phonenumber
;
this
.
form
.
roleIds
.
push
(
this
.
form
.
roleId
);
if
(
this
.
form
.
userId
!=
null
)
{
if
(
this
.
form
.
userId
!=
null
)
{
updateUser
(
this
.
form
).
then
((
response
)
=>
{
updateUser
(
this
.
form
).
then
((
response
)
=>
{
if
(
response
.
code
==
"200"
){
if
(
response
.
code
==
"200"
){
...
@@ -340,7 +355,7 @@ export default {
...
@@ -340,7 +355,7 @@ export default {
handleDelete
(
row
)
{
handleDelete
(
row
)
{
const
userIds
=
row
.
userId
||
this
.
ids
;
const
userIds
=
row
.
userId
||
this
.
ids
;
this
.
$modal
this
.
$modal
.
confirm
(
'是否确认删除人员
编号
为"'
+
row
.
nickName
+
'"的数据项?'
)
.
confirm
(
'是否确认删除人员
姓名
为"'
+
row
.
nickName
+
'"的数据项?'
)
.
then
(
function
()
{
.
then
(
function
()
{
return
delUser
(
userIds
);
return
delUser
(
userIds
);
})
})
...
...
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