Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-system
/
system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 96f06c7f
authored
Nov 05, 2020
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复bug
1 parent
25e8e9a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
12 deletions
src/utils/common.js
src/views/user/index.vue
src/utils/common.js
View file @
96f06c7
...
...
@@ -51,7 +51,9 @@ export const Common = {
}
})
},
// 正整数
/**
* 正整数
* */
checkRegExpNumber
(
rule
,
value
,
callback
)
{
var
rxp
=
/^
\+?[
1-9
][
0-9
]
*$/
if
(
!
rule
.
required
)
{
...
...
@@ -61,5 +63,26 @@ export const Common = {
return
callback
(
new
Error
(
'只支持正整数'
))
}
}
},
/**
* 手机号
* */
checkRegExpPhoneTel
(
rule
,
value
,
callback
)
{
var
rxpPhone
=
/^1
[
345789
]\d{9}
$/
var
rxpTel
=
/^
(\(\d{3,4}\)
|
\d{3,4}
-|
\s)?\d{7,14}
$/
if
(
!
rule
.
required
)
{
if
(
!
value
)
{
callback
()
}
else
if
(
!
rxpPhone
.
test
(
value
))
{
return
callback
(
new
Error
(
'请输入正确的手机号码'
))
}
}
if
(
!
value
)
{
return
callback
(
new
Error
(
'请输入手机号码或固话'
))
}
else
if
(
!
rxpPhone
.
test
(
value
)
&&
!
rxpTel
.
test
(
value
))
{
return
callback
(
new
Error
(
'请输入正确的手机号码或固话'
))
}
else
{
callback
()
}
}
}
src/views/user/index.vue
View file @
96f06c7
...
...
@@ -8,7 +8,7 @@
size=
"mini"
placeholder=
"输入内容搜索"
v-model=
"orgName"
@
change
=
"treeInput"
@
input
=
"treeInput"
></el-input>
<el-tree
:data=
"treedata"
...
...
@@ -239,15 +239,18 @@ export default {
username
:
[{
required
:
true
,
message
:
'请输入用户名称'
,
trigger
:
'blur'
}],
roleId
:
[{
required
:
true
,
message
:
'请选择角色'
,
trigger
:
'change'
}],
email
:
[{
type
:
'email'
,
message
:
'请输入正确的邮箱地址'
,
trigger
:
[
'blur'
,
'change'
]
}],
phoneNumber
:
[{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
'blur'
}],
phoneNumber
:
[{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
'blur'
},
{
validator
:
this
.
$Common
.
checkRegExpPhoneTel
,
trigger
:
'blur'
}],
enableStatus
:
[{
required
:
true
}],
},
addRule
:
[{
required
:
true
,
message
:
'请输入密码'
,
trigger
:
'blur'
}],
addRule
:
[{
required
:
true
,
message
:
'请输入密码'
,
trigger
:
'blur'
},
{
min
:
6
,
max
:
50
,
message
:
'长度在 6 到 50 个字符'
,
trigger
:
'blur'
}],
// 部门弹窗
filterDialogTitle
:
'选择组织'
,
filterVisible
:
false
,
filterText
:
''
,
filterTextData
:
[],
isOpen
:
true
}
},
watch
:
{
...
...
@@ -274,6 +277,9 @@ export default {
// 重置搜索条件
refresh
()
{
this
.
searchForm
=
{}
this
.
orgName
=
''
this
.
getTreeOrg
()
this
.
$refs
.
userTable
.
refreshTable
()
},
// 确定,新增用户、编辑用户
handleConfirm
()
{
...
...
@@ -286,6 +292,7 @@ export default {
delete
params
.
superiorName
delete
params
.
createdDate
delete
params
.
roleName
delete
params
.
deptDepth
this
.
emptyData
(
params
)
let
api
=
addUser
if
(
params
.
id
)
api
=
editUser
...
...
@@ -328,6 +335,7 @@ export default {
btnClick
(
pType
,
scope
)
{
switch
(
pType
)
{
case
'create'
:
this
.
isOpen
=
true
this
.
userDialogTitle
=
'新增用户'
this
.
$set
(
this
.
userRules
,
'password'
,
this
.
addRule
)
this
.
userForm
=
{
...
...
@@ -344,6 +352,7 @@ export default {
this
.
handleClose
()
break
case
'edit'
:
this
.
isOpen
=
false
this
.
userDialogTitle
=
'编辑用户'
if
(
this
.
userRules
.
password
)
{
this
.
$set
(
this
.
userRules
,
'password'
,
null
)
...
...
@@ -365,7 +374,7 @@ export default {
this
.
userForm
.
gender
=
this
.
userForm
.
gender
+
''
this
.
userData
.
map
(
item
=>
{
if
(
item
.
prop
==
'superiorName'
)
{
item
.
hidden
=
!
(
this
.
userForm
.
deptDepth
==
0
)
item
.
hidden
=
this
.
userForm
.
deptDepth
==
0
}
})
this
.
handleClose
(
res
.
data
)
...
...
@@ -397,10 +406,12 @@ export default {
},
// 部门弹窗
selectDepart
()
{
this
.
filterText
=
''
this
.
filterDialogTitle
=
'选择组织'
this
.
getSimpleList
()
this
.
closeFilter
()
if
(
this
.
isOpen
)
{
this
.
filterText
=
''
this
.
filterDialogTitle
=
'选择组织'
this
.
getSimpleList
()
this
.
closeFilter
()
}
},
// 上级弹窗
selectSuperior
()
{
...
...
@@ -416,8 +427,13 @@ export default {
filterConfirm
()
{
console
.
log
(
this
.
$refs
.
tree
.
getCurrentNode
())
if
(
this
.
filterDialogTitle
==
'选择直接上级'
)
{
this
.
userForm
.
superiorId
=
this
.
$refs
.
tree
.
getCurrentNode
().
id
this
.
userForm
.
superiorName
=
this
.
$refs
.
tree
.
getCurrentNode
().
label
if
(
this
.
$refs
.
tree
.
getCurrentNode
().
disabled
)
{
this
.
$message
(
'该选项不可选择为直接上级'
)
}
else
{
this
.
userForm
.
superiorId
=
this
.
$refs
.
tree
.
getCurrentNode
().
id
this
.
userForm
.
superiorName
=
this
.
$refs
.
tree
.
getCurrentNode
().
label
this
.
closeFilter
()
}
}
else
{
this
.
userForm
.
departmentId
=
this
.
$refs
.
tree
.
getCurrentNode
().
id
this
.
userForm
.
departmentName
=
this
.
$refs
.
tree
.
getCurrentNode
().
label
...
...
@@ -430,8 +446,8 @@ export default {
}
}
})
this
.
closeFilter
()
}
this
.
closeFilter
()
},
filterNode
(
value
,
data
)
{
if
(
!
value
)
return
true
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment