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 59865e25
authored
Sep 08, 2018
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
edit和create复用组件
1 parent
d24284af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
19 deletions
src/components/RoleCreate/src/main.vue
src/views/customer/role/index.vue
src/views/customer/user/index.vue
src/components/RoleCreate/src/main.vue
View file @
59865e2
...
@@ -6,7 +6,11 @@
...
@@ -6,7 +6,11 @@
<gl-input
v-model=
"createRuleForm.roleName"
clearable
></gl-input>
<gl-input
v-model=
"createRuleForm.roleName"
clearable
></gl-input>
</gl-form-item>
</gl-form-item>
<gl-form-item
label=
"角色描述:"
prop=
"roleDescript"
>
<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>
<gl-form-item
label=
"所属部门:"
prop=
"department"
>
<gl-form-item
label=
"所属部门:"
prop=
"department"
>
<gl-select
v-model=
"createRuleForm.department"
placeholder=
"请选择"
>
<gl-select
v-model=
"createRuleForm.department"
placeholder=
"请选择"
>
...
@@ -26,11 +30,18 @@
...
@@ -26,11 +30,18 @@
export
default
{
export
default
{
name
:
'RoleCreate'
,
name
:
'RoleCreate'
,
props
:
{
props
:
{
createVisible
:
Boolean
createVisible
:
Boolean
,
editParams
:
Object
},
},
watch
:
{
watch
:
{
createVisible
(
val
)
{
createVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
},
editParams
(
val
)
{
if
(
val
)
{
this
.
createRuleForm
=
val
}
console
.
log
(
this
.
createRuleForm
)
}
}
},
},
data
()
{
data
()
{
...
...
src/views/customer/role/index.vue
View file @
59865e2
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
<div>
<div>
<div
class=
"default m-b20"
>
<div
class=
"default m-b20"
>
<gl-input
class=
"search-w250"
placeholder=
"请输入角色名称"
v-model=
"roleName"
clearable
></gl-input>
<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>
</div>
<hr>
<hr>
<div
class=
"default p-t15"
>
<div
class=
"default p-t15"
>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateRole"
>
创建
</gl-button>
<gl-button
class=
"control-tabledata-button"
size=
"small"
@
click=
"handleCreateRole
(editParams)
"
>
创建
</gl-button>
<role-create
:createVisible=
"createVisible"
@
createClose=
"handleCreateClose"
></role-create>
<role-create
:createVisible=
"createVisible"
:editParams=
"editParams"
@
createClose=
"handleCreateClose"
></role-create>
<div
class=
"m-b8"
>
<div
class=
"m-b8"
>
<gl-table
:table=
"roleData"
:pagination=
"pagination"
></gl-table>
<gl-table
:table=
"roleData"
:pagination=
"pagination"
></gl-table>
</div>
</div>
...
@@ -28,6 +28,7 @@ export default {
...
@@ -28,6 +28,7 @@ export default {
return
{
return
{
roleName
:
''
,
roleName
:
''
,
createVisible
:
false
,
createVisible
:
false
,
editParams
:
{},
roleData
:
{
roleData
:
{
border
:
true
,
border
:
true
,
height
:
400
,
height
:
400
,
...
@@ -55,7 +56,7 @@ export default {
...
@@ -55,7 +56,7 @@ export default {
label
:
'编辑'
,
label
:
'编辑'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
,
rows
)
=>
{
this
.
$alert
(
rows
[
index
])
this
.
handleCreateRole
(
rows
[
index
])
}
}
},
{
},
{
label
:
'详细'
,
label
:
'详细'
,
...
@@ -114,25 +115,28 @@ export default {
...
@@ -114,25 +115,28 @@ export default {
this
.
message
(
'取消删除'
)
this
.
message
(
'取消删除'
)
})
})
},
},
dateFormat
()
{
//
dateFormat() {
const
currentTime
=
new
Date
()
//
const currentTime = new Date()
const
date
=
currentTime
.
toLocaleDateString
().
split
(
'/'
).
forEach
((
item
)
=>
{
console
.
log
(
item
)
})
//
const date = currentTime.toLocaleDateString().split('/').forEach((item) => { console.log(item) })
console
.
log
(
date
)
//
console.log(date)
},
//
},
roleDataEdit
(
data
)
{
// 新增用户到页面
this
.
dateFormat
()
addRole
(
data
)
{
const
newData
=
{
roleId
:
'1038'
,
roleName
:
data
.
roleName
,
department
:
data
.
department
,
roleStatus
:
'开启'
,
roleCreateTime
:
''
}
const
newData
=
{
roleId
:
'1038'
,
roleName
:
data
.
roleName
,
department
:
data
.
department
,
roleStatus
:
'开启'
,
roleCreateTime
:
new
Date
().
toLocaleString
().
split
(
'/'
).
join
(
'-'
)
}
this
.
roleData
.
data
.
push
(
newData
)
this
.
roleData
.
data
.
push
(
newData
)
},
},
handle
Find
RoleName
()
{
handle
Search
RoleName
()
{
this
.
roleName
=
''
this
.
roleName
=
''
},
},
handleCreateRole
()
{
handleCreateRole
(
params
)
{
console
.
log
(
params
)
this
.
editParams
=
params
this
.
createVisible
=
!
this
.
createVisible
this
.
createVisible
=
!
this
.
createVisible
},
},
// 关闭新增用户组件
handleCreateClose
(
data
)
{
handleCreateClose
(
data
)
{
this
.
createVisible
=
false
this
.
handleCreateRole
()
data
&&
this
.
roleDataEdit
(
data
)
data
&&
!
this
.
editParams
&&
this
.
addRole
(
data
)
}
}
}
}
}
}
...
...
src/views/customer/user/index.vue
View file @
59865e2
...
@@ -114,9 +114,9 @@ export default {
...
@@ -114,9 +114,9 @@ export default {
methods
:
{
methods
:
{
// 接受子组件传递的值
// 接受子组件传递的值
handleUserForm
(
params
)
{
handleUserForm
(
params
)
{
console
.
log
(
params
)
this
.
dialogFormVisible
=
false
this
.
dialogFormVisible
=
false
// this.userDataCreate(data)
// this.userDataCreate(data)
console
.
log
(
params
)
},
},
// 新增按钮
// 新增按钮
createUser
()
{
createUser
()
{
...
...
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