Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
authority
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4de45599
authored
Sep 08, 2018
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
编辑用户
2 parents
68766182
59865e25
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
30 deletions
src/components/RoleCreate/src/main.vue
src/components/UserCreate/src/main.vue
src/views/customer/role/index.vue
src/views/customer/user/index.vue
src/components/RoleCreate/src/main.vue
View file @
4de4559
...
...
@@ -6,7 +6,11 @@
<gl-input
v-model=
"createRuleForm.roleName"
clearable
></gl-input>
</gl-form-item>
<gl-form-item
label=
"角色描述:"
prop=
"roleDescript"
>
<gl-input
v-model=
"createRuleForm.roleDescript"
type=
"textarea"
clearable
></gl-input>
<gl-input
v-model=
"createRuleForm.roleDescript"
type=
"textarea"
:rows=
"3"
clearable
></gl-input>
</gl-form-item>
<gl-form-item>
<span
style=
"position:absolute; right:35px; top:-20px;"
>
{{
createRuleForm
.
roleDescript
.
length
}}
</span>
<span
style=
"position:absolute; right:5px; top:-20px;"
>
/200
</span>
</gl-form-item>
<gl-form-item
label=
"所属部门:"
prop=
"department"
>
<gl-select
v-model=
"createRuleForm.department"
placeholder=
"请选择"
>
...
...
@@ -26,11 +30,18 @@
export
default
{
name
:
'RoleCreate'
,
props
:
{
createVisible
:
Boolean
createVisible
:
Boolean
,
editParams
:
Object
},
watch
:
{
createVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
},
editParams
(
val
)
{
if
(
val
)
{
this
.
createRuleForm
=
val
}
console
.
log
(
this
.
createRuleForm
)
}
},
data
()
{
...
...
src/components/UserCreate/src/main.vue
View file @
4de4559
...
...
@@ -85,11 +85,18 @@
export
default
{
name
:
'UserForm'
,
props
:
{
dialogFormVisible
:
Boolean
dialogFormVisible
:
Boolean
,
editUser
:
Object
},
watch
:
{
dialogFormVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'userManageForm'
].
resetFields
()
},
editUser
(
val
)
{
if
(
val
)
{
this
.
userManageForm
=
val
}
console
.
log
(
this
.
userManageForm
)
}
},
data
()
{
...
...
src/views/customer/role/index.vue
View file @
4de4559
...
...
@@ -3,12 +3,12 @@
<div>
<div
class=
"default m-b20"
>
<gl-input
class=
"search-w250"
placeholder=
"请输入角色名称"
v-model=
"roleName"
clearable
></gl-input>
<gl-button
type=
"primary"
@
click=
"handle
Find
RoleName"
>
搜索
</gl-button>
<gl-button
type=
"primary"
@
click=
"handle
Search
RoleName"
>
搜索
</gl-button>
</div>
<hr>
<div
class=
"default p-t15"
>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateRole"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
@
createClose=
"handleCreateClose"
></role-create>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateRole
(editParams)
"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
:editParams=
"editParams"
@
createClose=
"handleCreateClose"
></role-create>
<div
class=
"m-b8"
>
<gl-table
:table=
"roleData"
:pagination=
"pagination"
></gl-table>
</div>
...
...
@@ -28,6 +28,7 @@ export default {
return
{
roleName
:
''
,
createVisible
:
false
,
editParams
:
{},
roleData
:
{
border
:
true
,
height
:
400
,
...
...
@@ -55,7 +56,7 @@ export default {
label
:
'编辑'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
this
.
$alert
(
rows
[
index
])
this
.
handleCreateRole
(
rows
[
index
])
}
},
{
label
:
'详细'
,
...
...
@@ -114,25 +115,28 @@ export default {
this
.
message
(
'取消删除'
)
})
},
dateFormat
()
{
const
currentTime
=
new
Date
()
const
date
=
currentTime
.
toLocaleDateString
().
split
(
'/'
).
forEach
((
item
)
=>
{
console
.
log
(
item
)
})
console
.
log
(
date
)
},
roleDataEdit
(
data
)
{
this
.
dateFormat
()
const
newData
=
{
roleId
:
'1038'
,
roleName
:
data
.
roleName
,
department
:
data
.
department
,
roleStatus
:
'开启'
,
roleCreateTime
:
''
}
//
dateFormat() {
//
const currentTime = new Date()
//
const date = currentTime.toLocaleDateString().split('/').forEach((item) => { console.log(item) })
//
console.log(date)
//
},
// 新增用户到页面
addRole
(
data
)
{
const
newData
=
{
roleId
:
'1038'
,
roleName
:
data
.
roleName
,
department
:
data
.
department
,
roleStatus
:
'开启'
,
roleCreateTime
:
new
Date
().
toLocaleString
().
split
(
'/'
).
join
(
'-'
)
}
this
.
roleData
.
data
.
push
(
newData
)
},
handle
Find
RoleName
()
{
handle
Search
RoleName
()
{
this
.
roleName
=
''
},
handleCreateRole
()
{
handleCreateRole
(
params
)
{
console
.
log
(
params
)
this
.
editParams
=
params
this
.
createVisible
=
!
this
.
createVisible
},
// 关闭新增用户组件
handleCreateClose
(
data
)
{
this
.
createVisible
=
false
data
&&
this
.
roleDataEdit
(
data
)
this
.
handleCreateRole
()
data
&&
!
this
.
editParams
&&
this
.
addRole
(
data
)
}
}
}
...
...
src/views/customer/user/index.vue
View file @
4de4559
...
...
@@ -8,9 +8,9 @@
<hr>
<div
class=
"default p-t15"
>
<div
class=
"control-tabledata-button"
>
<gl-button
size=
"small"
@
click=
"createUser"
>
新增用户
</gl-button>
<gl-button
size=
"small"
@
click=
"createUser
(editUser=
{})
">新增用户
</gl-button>
<gl-button
size=
"small"
@
click=
"delteSelected"
>
删除选中
</gl-button>
<user-form
:dialogFormVisible=
"dialogFormVisible"
@
userFormData=
"handleUserFormData"
></user-form>
<user-form
:dialogFormVisible=
"dialogFormVisible"
:editUser=
"editUser"
@
userFormData=
"handleUserFormData"
></user-form>
</div>
<div
class=
"m-b8"
>
<gl-table
:table=
"userData"
ref=
"multipleTable"
:pagination=
"pagination"
></gl-table>
...
...
@@ -31,6 +31,7 @@ export default {
return
{
userName
:
''
,
dialogFormVisible
:
false
,
editUser
:
{},
userData
:
{
border
:
true
,
align
:
'center'
,
...
...
@@ -72,7 +73,7 @@ export default {
label
:
'编辑'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
this
.
dialogFormVisible
=
true
this
.
createUser
(
rows
[
index
])
}
},
{
label
:
'详细'
,
...
...
@@ -119,7 +120,9 @@ export default {
params
&&
this
.
userDataCreate
(
params
)
},
// 新增按钮
createUser
()
{
createUser
(
editUser
)
{
console
.
log
(
editUser
)
this
.
editUser
=
editUser
this
.
dialogFormVisible
=
!
this
.
dialogFormVisible
},
// 新增事件
...
...
@@ -129,18 +132,24 @@ export default {
this
.
userData
.
data
.
push
(
newData
)
},
dateFormat
()
{
const
zeroize
=
function
(
value
)
{
if
(
value
<
10
)
{
value
=
'0'
+
value
return
value
}
else
{
return
value
}
}
const
currentTime
=
new
Date
()
const
year
=
currentTime
.
getFullYear
()
const
month
=
currentTime
.
getMonth
()
+
1
const
day
=
currentTime
.
getDate
(
)
const
h
=
currentTime
.
getHours
(
)
const
m
=
currentTime
.
getHours
(
)
const
s
=
currentTime
.
getSeconds
(
)
const
month
=
zeroize
(
currentTime
.
getMonth
()
+
1
)
const
day
=
zeroize
(
currentTime
.
getDate
()
)
const
h
=
zeroize
(
currentTime
.
getHours
()
)
const
m
=
zeroize
(
currentTime
.
getHours
()
)
const
s
=
zeroize
(
currentTime
.
getSeconds
()
)
const
createTime
=
year
+
'-'
+
month
+
'-'
+
day
+
' '
+
h
+
':'
+
m
+
':'
+
s
console
.
log
(
createTime
)
// const createDate = currentTime.toLocaleDateString().split('/').forEach((item) => { console.log(item) })
return
createTime
// const date = currentTime.toLocaleDateString().split('/').forEach((item) => { console.log(item) })
},
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
...
...
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