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 8b36465e
authored
Sep 20, 2018
by
liwk
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
https://github.com/glsx-web/authority
2 parents
2bea3649
b2ccf800
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
243 additions
and
174 deletions
src/common/commonConst.js
src/common/roleConst.js
src/common/userConst.js
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/common/commonConst.js
View file @
8b36465
import
{
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleConst'
import
{
roleCreateStructure
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
}
from
'./roleConst'
import
{
userDetailColumn
}
from
'./userConst'
import
{
user
Form
,
user
DetailColumn
}
from
'./userConst'
export
{
export
{
roleCreateStructure
,
roleCreateStructure
,
roleDataColumn
,
roleDataColumn
,
userRoleDetailColumn
,
userRoleDetailColumn
,
userRoleDetailConsole
,
userRoleDetailConsole
,
userDetailColumn
userDetailColumn
,
userForm
}
}
src/common/roleConst.js
View file @
8b36465
...
@@ -4,7 +4,9 @@ const roleCreateStructure = {
...
@@ -4,7 +4,9 @@ const roleCreateStructure = {
id
:
Number
,
id
:
Number
,
roleName
:
''
,
roleName
:
''
,
description
:
''
,
description
:
''
,
departId
:
''
,
departName
:
''
,
departName
:
''
,
departPath
:
''
,
rights
:
Array
,
rights
:
Array
,
state
:
1
,
state
:
1
,
createTime
:
''
createTime
:
''
...
...
src/common/userConst.js
View file @
8b36465
const
userForm
=
{
username
:
''
,
realname
:
''
,
password
:
''
,
mobile
:
''
,
joinip
:
''
,
email
:
''
,
state
:
''
,
isadmin
:
''
,
departName
:
''
,
roles
:
[
'1'
,
'2'
],
departId
:
''
,
roleList
:
[],
options
:
[
{
value
:
'1006'
,
label
:
'总经办'
},
{
value
:
'1001'
,
label
:
'研发中心-网络软件部'
}
]
}
const
userDetailColumn
=
[{
const
userDetailColumn
=
[{
label
:
'用户名'
,
label
:
'用户名'
,
prop
:
'username'
prop
:
'username'
...
@@ -27,4 +51,4 @@ const userDetailColumn = [{
...
@@ -27,4 +51,4 @@ const userDetailColumn = [{
}
}
}]
}]
export
{
userDetailColumn
}
export
{
user
Form
,
user
DetailColumn
}
src/components/RoleCreate/src/main.vue
View file @
8b36465
...
@@ -13,20 +13,15 @@
...
@@ -13,20 +13,15 @@
<span
style=
"position:absolute; right:5px; top:-20px;"
>
/200
</span>
<span
style=
"position:absolute; right:5px; top:-20px;"
>
/200
</span>
</gl-form-item>
</gl-form-item>
<gl-form-item
label=
"所属部门:"
prop=
"departName"
>
<gl-form-item
label=
"所属部门:"
prop=
"departName"
>
<gl-select
v-model=
"createRuleForm.departName"
placeholder=
"请选择"
>
<gl-select
placeholder=
"请选择"
v-model=
"createRuleForm.departName"
>
<gl-option
label=
"运营平台"
value=
"运营平台"
></gl-option>
<gl-option
style=
"height:160px"
>
<tree
ref=
'tree'
:isDepart=
"isDepart"
v-model=
"createRuleForm.departName"
:defaultExpandAll=
"defaultExpandAll"
@
node-click=
'clickDepart'
style=
"height:160px"
></tree>
</gl-option>
<!--
<gl-option
label=
"运营平台"
value=
"运营平台"
></gl-option>
-->
</gl-select>
</gl-select>
</gl-form-item>
</gl-form-item>
<gl-form-item
label=
"菜单选项:"
prop=
"rights"
>
<gl-form-item
label=
"菜单选项:"
prop=
"rights"
>
<tree
<tree
ref=
'tree'
v-model=
"createRuleForm.rights"
:show-checkbox=
"show_checkbox"
:defaultExpandAll=
"defaultExpandAll"
:defaultCheckedKeys=
"roleMenuTree"
@
input=
"getMenuOption"
style=
"height:160px"
></tree>
ref=
'tree'
v-model=
"createRuleForm.rights"
:show-checkbox=
"show_checkbox"
:defaultExpandAll=
"defaultExpandAll"
:defaultCheckedKeys=
"roleMenuTree"
@
input=
"getMenuOption"
style=
"height:160px"
></tree>
</gl-form-item>
</gl-form-item>
</gl-form>
</gl-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
@@ -49,18 +44,19 @@ export default {
...
@@ -49,18 +44,19 @@ export default {
createVisible
(
val
)
{
createVisible
(
val
)
{
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
!
val
&&
this
.
$refs
[
'createRuleForm'
].
resetFields
()
// 考虑一下放这里还是放下面
// 考虑一下放这里还是放下面
this
.
c
hangeMenuTree
=
this
.
roleMenuTree
this
.
c
reateRuleForm
.
rights
=
this
.
roleMenuTree
},
},
flagCOrE
(
val
)
{
flagCOrE
(
val
)
{
this
.
title
=
val
?
'新建角色'
:
'角色列表'
this
.
title
=
val
?
'新建角色'
:
'角色列表'
// this.c
hangeMenuTree
= this.roleMenuTree
// this.c
reateRuleForm.rights
= this.roleMenuTree
}
}
},
},
data
()
{
data
()
{
return
{
return
{
isDepart
:
true
,
show_checkbox
:
true
,
show_checkbox
:
true
,
defaultExpandAll
:
true
,
defaultExpandAll
:
true
,
changeMenuTre
e
:
[],
departNam
e
:
[],
title
:
''
,
title
:
''
,
createRules
:
{
createRules
:
{
roleName
:
[
roleName
:
[
...
@@ -82,11 +78,27 @@ export default {
...
@@ -82,11 +78,27 @@ export default {
methods
:
{
methods
:
{
// tree-strat
// tree-strat
getMenuOption
(
params
)
{
getMenuOption
(
params
)
{
this
.
changeMenuTree
=
params
.
treeData
.
checkedKeys
.
concat
(
params
.
treeData
.
halfCheckedKeys
)
this
.
createRuleForm
.
rights
=
params
.
treeData
.
checkedKeys
.
concat
(
params
.
treeData
.
halfCheckedKeys
)
},
clickDepart
(
data
,
treeData
,
vue
,
props
)
{
if
(
data
.
parent
!==
'#'
||
!
data
.
children
)
{
this
.
createRuleForm
.
departId
=
data
.
id
this
.
createRuleForm
.
departPath
=
data
.
type
this
.
getDepartName
(
treeData
)
this
.
createRuleForm
.
departName
=
this
.
departName
.
join
(
' - '
)
this
.
departName
=
[]
}
},
getDepartName
(
params
)
{
this
.
departName
.
unshift
(
params
.
data
.
text
)
if
(
params
.
data
.
parent
!==
'#'
)
{
this
.
getDepartName
(
params
.
parent
)
}
else
{
return
true
}
},
},
// tree-end
// tree-end
getParams
()
{
getParams
()
{
this
.
createRuleForm
.
rights
=
this
.
changeMenuTree
return
this
.
$deep_clone
(
this
.
createRuleForm
)
return
this
.
$deep_clone
(
this
.
createRuleForm
)
},
},
handleCreateSubmit
(
formName
)
{
handleCreateSubmit
(
formName
)
{
...
...
src/components/UserCreate/src/main.vue
View file @
8b36465
...
@@ -24,8 +24,8 @@
...
@@ -24,8 +24,8 @@
</gl-form-item>
</gl-form-item>
</gl-col>
</gl-col>
<gl-col
:span=
"12"
>
<gl-col
:span=
"12"
>
<gl-form-item
label=
"注册IP"
prop=
"
registeredIP
"
>
<gl-form-item
label=
"注册IP"
prop=
"
joinip
"
>
<gl-input
v-model=
"userManageForm.
registeredIP
"
clearable
></gl-input>
<gl-input
v-model=
"userManageForm.
joinip
"
clearable
></gl-input>
</gl-form-item>
</gl-form-item>
</gl-col>
</gl-col>
<gl-col
:span=
"12"
>
<gl-col
:span=
"12"
>
...
@@ -37,44 +37,44 @@
...
@@ -37,44 +37,44 @@
<gl-col
:span=
"12"
>
<gl-col
:span=
"12"
>
<gl-form-item
label=
"状态"
prop=
"state"
>
<gl-form-item
label=
"状态"
prop=
"state"
>
<gl-select
v-model=
"userManageForm.state"
placeholder=
"启用"
>
<gl-select
v-model=
"userManageForm.state"
placeholder=
"启用"
>
<gl-option
label=
"启用"
value=
"启用"
></gl-option>
<gl-option
label=
"启用"
value=
'0'
></gl-option>
<gl-option
label=
"禁用"
value=
"禁用"
></gl-option>
<gl-option
label=
"禁用"
value=
'1'
></gl-option>
</gl-select>
</gl-select>
</gl-form-item>
</gl-form-item>
</gl-col>
</gl-col>
<gl-col
:span=
"12"
>
<gl-col
:span=
"12"
>
<gl-form-item
label=
"管理员"
>
<gl-form-item
label=
"管理员"
>
<gl-select
v-model=
"userManageForm.isadmin"
placeholder=
"否"
>
<gl-select
v-model=
"userManageForm.isadmin"
placeholder=
"否"
>
<gl-option
label=
"否"
value=
"否"
></gl-option>
<gl-option
label=
"否"
value=
'0'
></gl-option>
<gl-option
label=
"是"
value=
"是"
></gl-option>
<gl-option
label=
"是"
value=
'1'
></gl-option>
</gl-select>
</gl-select>
</gl-form-item>
</gl-form-item>
</gl-col>
</gl-col>
<gl-col
:span=
"24"
>
<gl-col
:span=
"24"
>
<gl-form-item
label=
"所属部门"
prop=
"departName"
>
<gl-form-item
label=
"所属部门"
prop=
"departName"
>
<gl-select
v-model=
"userManageForm.departName"
placeholder=
"请选择"
>
<
!--
<
gl-select
v-model=
"userManageForm.departName"
placeholder=
"请选择"
>
<gl-option
<gl-option
v-for=
"item in userManageForm.options"
v-for=
"item in userManageForm.options"
:key=
"item.value"
:key=
"item.value"
:label=
"item.label"
:label=
"item.label"
:value=
"item.value"
>
:value=
"item.value"
>
</gl-option>
</gl-option>
</gl-select>
</gl-select>
-->
<gl-select
v-model=
"userManageForm.departId"
placeholder=
"请选择"
>
<gl-option
v-for=
"item in userManageForm.options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</gl-option>
</gl-select>
</gl-form-item>
</gl-form-item>
</gl-col>
</gl-col>
<gl-col
:span=
"24"
>
<gl-col
:span=
"24"
>
<gl-form-item
label=
"角色选项"
prop=
"roles"
>
<gl-form-item
label=
"角色选项"
prop=
"roles"
>
<gl-checkbox-group
v-model=
"userManageForm.roles"
>
<gl-col
:span=
"10"
>
<gl-checkbox
label=
"诺威达-艺展-系统日志上报"
></gl-checkbox>
<gl-checkbox
v-for=
"item in userManageForm.roleList"
:key=
"item.id"
v-model=
"item.isSelect"
@
change=
"handleCheckedChange"
>
{{
item
.
roleName
}}
</gl-checkbox>
<gl-checkbox
label=
"盗抢险"
></gl-checkbox>
</gl-col>
<gl-checkbox
label=
"研发工具-增量"
></gl-checkbox>
<gl-checkbox
label=
"精品分期0329角色"
></gl-checkbox>
<gl-checkbox
label=
"好车主"
></gl-checkbox>
<gl-checkbox
label=
"云商分润"
></gl-checkbox>
<gl-checkbox
label=
"营销系统"
></gl-checkbox>
<gl-checkbox
label=
"GPS后台角色控制"
></gl-checkbox>
<gl-checkbox
label=
"外场测试"
></gl-checkbox>
</gl-checkbox-group>
</gl-form-item>
</gl-form-item>
</gl-col>
</gl-col>
</gl-form>
</gl-form>
...
@@ -86,108 +86,94 @@
...
@@ -86,108 +86,94 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
userForm
}
from
'@/common/userConst'
export
default
{
export
default
{
name
:
'UserCreate'
,
name
:
'UserCreate'
,
props
:
{
props
:
{
dialogFormVisible
:
Boolean
,
dialogFormVisible
:
Boolean
,
editUser
:
Object
userManageForm
:
Object
},
components
:
{
userForm
},
},
watch
:
{
watch
:
{
dialogFormVisible
(
val
)
{
dialogFormVisible
(
val
)
{
val
&&
console
.
log
(
this
.
userManageForm
)
!
val
&&
this
.
$refs
[
'userManageForm'
].
resetFields
()
!
val
&&
this
.
$refs
[
'userManageForm'
].
resetFields
()
},
editUser
(
val
)
{
if
(
val
)
{
this
.
userManageForm
=
val
}
console
.
log
(
this
.
userManageForm
)
}
}
},
},
mounted
()
{
this
.
userManageForm
.
roleList
.
forEach
(
element
=>
{
element
.
isSelect
=
false
})
},
data
()
{
data
()
{
return
{
return
{
tel
:
'[ 1, /[34578]/, /\d/{9}]'
,
state
:
'1'
,
userManageForm
:
{
tel
:
'[ 1, /[34578]/, /d/{9}]'
,
username
:
''
,
realname
:
''
,
password
:
''
,
mobile
:
''
,
registeredIP
:
''
,
email
:
''
,
state
:
''
,
isadmin
:
''
,
departName
:
''
,
roles
:
[],
options
:
[{
value
:
'选项1'
,
label
:
'总经办'
},
{
value
:
'选项2'
,
label
:
'研发中心-网络软件部'
}]
},
rules
:
{
rules
:
{
username
:
[
username
:
[
{
required
:
true
,
message
:
'请输入用户名'
,
trigger
:
'blur'
}
,
{
required
:
true
,
message
:
'请输入用户名'
,
trigger
:
'blur'
}
{
min
:
3
,
max
:
5
,
message
:
'长度在 2 到 5 个字符'
,
trigger
:
'blur'
}
//
{ min: 3, max: 5, message: '长度在 2 到 5 个字符', trigger: 'blur' }
],
],
realname
:
[
realname
:
[
{
required
:
true
,
message
:
'请输入用户真实名字'
,
trigger
:
'blur'
}
,
{
required
:
true
,
message
:
'请输入用户真实名字'
,
trigger
:
'blur'
}
{
min
:
2
,
max
:
4
,
message
:
'长度在 2 到 4 个字符'
,
trigger
:
'blur'
}
//
{ min: 2, max: 4, message: '长度在 2 到 4 个字符', trigger: 'blur' }
],
],
password
:
[
password
:
[
{
required
:
true
,
message
:
'请输入用户密码'
,
trigger
:
'blur'
},
{
required
:
true
,
message
:
'请输入用户密码'
,
trigger
:
'blur'
}
{
min
:
6
,
max
:
8
,
message
:
'长度在 6 到 8 个字符'
,
trigger
:
'blur'
}
],
phoneNumber
:
[
{
required
:
true
,
message
:
'请输入手机号码'
,
trigger
:
'blur'
},
{
length
:
11
,
message
:
'长度为11个字符'
,
trigger
:
'blur'
}
]
]
// registeredIP: [
// { required: true, message: '请输入注册IP', trigger: 'blur' },
// { min: 6, max: 8, message: '长度在 6 到 8 个字符', trigger: 'blur' }
// ],
// email: [
// { required: true, message: '请输入邮箱', trigger: 'blur' },
// { min: 6, max: 8, message: '长度在 6 到 8 个字符', trigger: 'blur' }
// ]
}
}
}
}
},
},
methods
:
{
methods
:
{
message
(
message
,
type
)
{
message
(
message
,
type
)
{
type
&&
this
.
$message
({
type
&&
showClose
:
true
,
this
.
$message
({
type
:
type
,
showClose
:
true
,
message
:
message
type
:
type
,
})
message
:
message
!
type
&&
this
.
$message
({
})
showClose
:
true
,
!
type
&&
message
:
message
this
.
$message
({
})
showClose
:
true
,
message
:
message
})
},
},
submitForm
(
formName
)
{
submitForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
(
(
valid
)
=>
{
this
.
$refs
[
formName
].
validate
(
valid
=>
{
const
userData
=
this
.
$deep_clone
(
this
.
userManageForm
)
const
userData
=
this
.
$deep_clone
(
this
.
userManageForm
)
console
.
log
(
userData
.
roleList
)
// userData.roleList = userData.roleList.map(item => item.id).join(',')
userData
.
roles
=
userData
.
roles
.
join
(
','
)
// userData.departId = userData.options.map(item => item.value).join(',')
console
.
log
(
userData
)
const
isflagId
=
userData
.
id
const
isflagId
=
userData
.
id
if
(
valid
)
{
if
(
valid
)
{
this
.
$emit
(
'userFormData'
,
isflagId
,
userData
)
this
.
$emit
(
'userFormData'
,
isflagId
,
userData
)
}
else
{
}
else
{
return
false
return
false
}
}
console
.
log
(
userData
)
})
})
},
},
cancelForm
()
{
cancelForm
()
{
this
.
$emit
(
'userFormData'
)
this
.
$emit
(
'userFormData'
)
},
handleCheckedChange
(
value
)
{
// console.log(value)
// this.userManageForm.roleList.map(item => {
// item.isSelect = value
// })
}
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.el-checkbox
+
.el-checkbox
{
.el-checkbox
+
.el-checkbox
{
margin-left
:
0
!important
;
margin-left
:
0
!important
;
}
}
</
style
>
</
style
>
<
style
>
<
style
>
</
style
>
</
style
>
src/views/customer/role/index.vue
View file @
8b36465
...
@@ -32,7 +32,9 @@ export default {
...
@@ -32,7 +32,9 @@ export default {
components
:
{
components
:
{
RoleCreate
,
RoleCreate
,
RoleDetail
,
RoleDetail
,
UserDetail
UserDetail
,
saveRoleList
,
updateRole
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -176,23 +178,23 @@ export default {
...
@@ -176,23 +178,23 @@ export default {
// console.log(aa)
// console.log(aa)
// console.log(editData)
// console.log(editData)
// const cc = { roleName: 'ggg' }
// const cc = { roleName: 'ggg' }
saveRoleList
.
req
(
params
).
then
((
data
)
=>
{
//
saveRoleList.req(params).then((data) => {
// console.log(data)
// console.log(data)
// this.createOrEditSuccess()
// this.createOrEditSuccess()
}).
catch
(
err
=>
{
//
}).catch(err => {
console
.
log
(
err
)
//
console.log(err)
})
//
})
},
},
// 编辑角色
// 编辑角色
updateRoleInfo
(
params
)
{
updateRoleInfo
(
params
)
{
console
.
log
(
params
)
console
.
log
(
params
)
this
.
createOrEditSuccess
()
this
.
createOrEditSuccess
()
updateRole
.
req
(
params
).
then
((
data
)
=>
{
//
updateRole.req(params).then((data) => {
// console.log(data)
// console.log(data)
// this.createOrEditSuccess()
// this.createOrEditSuccess()
}).
catch
(
err
=>
{
//
}).catch(err => {
console
.
log
(
err
)
//
console.log(err)
})
//
})
},
},
// 接口请求-end---------------------------------------
// 接口请求-end---------------------------------------
createDialogVisible
()
{
createDialogVisible
()
{
...
...
src/views/customer/user/index.vue
View file @
8b36465
...
@@ -8,9 +8,9 @@
...
@@ -8,9 +8,9 @@
<hr>
<hr>
<div
class=
"default p-t15"
>
<div
class=
"default p-t15"
>
<div
class=
"control-tabledata-button"
>
<div
class=
"control-tabledata-button"
>
<gl-button
size=
"small"
@
click=
"createUser(
editUser=
{}
)">新增用户
</gl-button>
<gl-button
size=
"small"
@
click=
"createUser()"
>
新增用户
</gl-button>
<gl-button
size=
"small"
@
click=
"toggleRowSelection"
>
删除选中
</gl-button>
<gl-button
size=
"small"
@
click=
"toggleRowSelection"
>
删除选中
</gl-button>
<user-create
:dialogFormVisible=
"dialogFormVisible"
:
editUser=
"editUser
"
@
userFormData=
"handleUserFormData"
></user-create>
<user-create
:dialogFormVisible=
"dialogFormVisible"
:
userManageForm=
"userManageForm
"
@
userFormData=
"handleUserFormData"
></user-create>
</div>
</div>
<div
class=
"m-b8"
>
<div
class=
"m-b8"
>
<gl-table
:table=
"userData"
ref=
"multipleTable"
></gl-table>
<gl-table
:table=
"userData"
ref=
"multipleTable"
></gl-table>
...
@@ -25,20 +25,22 @@
...
@@ -25,20 +25,22 @@
<
script
>
<
script
>
import
{
UserCreate
,
UserDetail
}
from
'@/components/index'
import
{
UserCreate
,
UserDetail
}
from
'@/components/index'
// 接口
// 接口
import
{
findAll
}
from
'@/api/api'
import
{
findAll
,
updateUser
,
getRoleList
,
batcheDelUser
,
operatUser
}
from
'@/api/api'
import
{
user
DetailColumn
}
from
'@/common/common
Const'
import
{
user
Form
,
userDetailColumn
}
from
'@/common/user
Const'
export
default
{
export
default
{
name
:
'user'
,
name
:
'user'
,
components
:
{
components
:
{
UserCreate
,
UserCreate
,
UserDetail
UserDetail
,
updateUser
,
userForm
},
},
data
()
{
data
()
{
return
{
return
{
userName
:
''
,
userName
:
''
,
toggle
:
[],
toggle
:
[],
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
editUser
:
{}
,
userManageForm
:
this
.
$deep_clone
(
userForm
)
,
userDetailVisible
:
false
,
userDetailVisible
:
false
,
userDetailTitle
:
'用户详情'
,
userDetailTitle
:
'用户详情'
,
// 分页所需参数-start
// 分页所需参数-start
...
@@ -104,16 +106,16 @@ export default {
...
@@ -104,16 +106,16 @@ export default {
this
.
handleGetUserDetail
(
index
,
rows
)
this
.
handleGetUserDetail
(
index
,
rows
)
}
}
},
{
},
{
label
:
'
删除
'
,
label
:
'
禁用
'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
,
rows
)
=>
{
this
.
confirmDeleteOrNot
(
index
,
rows
)
this
.
$alert
(
rows
[
index
]
)
}
}
},
{
},
{
label
:
'
用户
'
,
label
:
'
删除
'
,
type
:
'text'
,
type
:
'text'
,
callback
:
(
index
,
rows
)
=>
{
callback
:
(
index
,
rows
)
=>
{
this
.
$alert
(
rows
[
index
]
)
this
.
confirmDeleteOrNot
(
index
,
rows
)
}
}
}]
}]
},
},
...
@@ -124,6 +126,7 @@ export default {
...
@@ -124,6 +126,7 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
findUserList
()
this
.
findUserList
()
this
.
getRoleOptions
()
},
},
watch
:
{
watch
:
{
userName
(
val
)
{
userName
(
val
)
{
...
@@ -145,6 +148,7 @@ export default {
...
@@ -145,6 +148,7 @@ export default {
findAll
.
req
(
params
).
then
(
res
=>
{
findAll
.
req
(
params
).
then
(
res
=>
{
this
.
total
=
res
.
total
this
.
total
=
res
.
total
this
.
userData
.
data
=
res
.
list
this
.
userData
.
data
=
res
.
list
console
.
log
(
this
.
userData
.
data
)
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
})
})
...
@@ -161,63 +165,100 @@ export default {
...
@@ -161,63 +165,100 @@ export default {
message
:
message
message
:
message
})
})
},
},
// 获取所有角色选项
getRoleOptions
()
{
getRoleList
.
req
().
then
(
res
=>
{
userForm
.
roleList
=
res
.
list
console
.
log
(
res
)
})
},
// 新增更新用户接口请求
updateUser_Post
(
params
)
{
if
(
params
)
{
updateUser
.
req
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
})
}
else
{
console
.
log
(
'no data!'
)
}
},
// 删除用户接口
batcheDel
(
params
)
{
console
.
log
(
params
)
if
(
params
)
{
batcheDelUser
.
req
({
ids
:
params
}).
then
(
res
=>
{
this
.
findUserList
()
})
}
else
{
console
.
log
(
'无数据!'
)
}
},
// 删除、禁用、启用接口
operatUser
(
params
)
{
console
.
log
(
params
)
if
(
params
)
{
operatUser
.
req
(
params
).
then
(
res
=>
{
this
.
findUserList
()
})
}
else
{
console
.
log
(
'无数据!'
)
}
},
// 接受子组件传递的值
// 接受子组件传递的值
handleUserFormData
(
isflag
,
params
)
{
handleUserFormData
(
isflag
,
params
)
{
this
.
dialogFormVisible
=
!
this
.
dialogFormVisible
this
.
dialogFormVisible
=
!
this
.
dialogFormVisible
this
.
userManageForm
=
{}
!
params
&&
this
.
message
(
'取消操作'
)
!
params
&&
this
.
message
(
'取消操作'
)
params
&&
!
isflag
&&
this
.
u
serDataCreate
(
params
)
params
&&
!
isflag
&&
this
.
u
pdateUser_Post
(
params
)
params
&&
isflag
&&
this
.
message
(
'已经成功修改数据!'
,
'success'
)
params
&&
isflag
&&
this
.
message
(
'已经成功修改数据!'
,
'success'
)
},
},
// 新增按钮
// 新增按钮
createUser
(
editUser
)
{
createUser
(
userManageForm
)
{
console
.
log
(
editUser
)
console
.
log
(
userManageForm
)
this
.
editUser
=
editUser
if
(
userManageForm
)
{
this
.
dialogFormVisible
=
!
this
.
dialogFormVisible
userManageForm
.
roleList
=
this
.
$deep_clone
(
userForm
.
roleList
)
},
console
.
log
(
userManageForm
.
roleList
)
// 新增事件
userManageForm
.
options
=
userForm
.
options
userDataCreate
(
params
)
{
userManageForm
.
state
=
userManageForm
.
state
+
''
// this.dateFormat()
userManageForm
.
isadmin
=
userManageForm
.
isadmin
+
''
params
.
id
=
'100'
+
this
.
userData
.
data
.
length
Promise
.
all
([
findAll
,
updateUser
]).
then
((
result
)
=>
{
params
.
createTime
=
this
.
dateFormat
()
const
arr
=
userManageForm
.
roles
.
split
(
','
)
const
newData
=
params
arr
.
forEach
(
index
=>
{
// { id: '100' + this.userData.data.length, username: params.username, realname: params.realname, isadmin: params.isadmin, mobile: params.mobile, state: params.state, createTime: this.dateFormat() }
userManageForm
.
roleList
.
forEach
(
item
=>
{
this
.
userData
.
data
.
push
(
newData
)
if
(
+
item
.
id
===
+
index
)
{
this
.
message
(
'创建用户成功!'
,
'success'
)
console
.
log
(
item
.
id
)
},
item
.
isSelect
=
true
dateFormat
()
{
console
.
log
(
item
)
const
zeroize
=
function
(
value
)
{
return
false
if
(
value
<
10
)
{
}
value
=
'0'
+
value
})
return
value
})
}
else
{
this
.
userManageForm
=
this
.
$deep_clone
(
userManageForm
)
return
value
})
}
// this.userManageForm = this.$deep_clone(userManageForm)
}
else
{
this
.
userManageForm
=
this
.
$deep_clone
(
userForm
)
}
}
const
currentTime
=
new
Date
()
console
.
log
(
userManageForm
)
const
year
=
currentTime
.
getFullYear
()
// this.userManageForm = userManageForm ? this.$deep_clone(userManageForm) : this.$deep_clone(userForm)
const
month
=
zeroize
(
currentTime
.
getMonth
()
+
1
)
// console.log(userManageForm)
const
day
=
zeroize
(
currentTime
.
getDate
())
this
.
dialogFormVisible
=
!
this
.
dialogFormVisible
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
)
return
createTime
},
},
// 获取选中的行
handleSelectionChange
(
val
,
row
)
{
handleSelectionChange
(
val
,
row
)
{
// this.multipleSelection = val
// this.multipleSelection = val
this
.
toggle
=
val
this
.
toggle
=
val
console
.
log
(
this
.
toggle
)
},
},
// 删除选中的行
toggleRowSelection
()
{
toggleRowSelection
()
{
cons
ole
.
log
(
this
.
$refs
.
multipleTable
,
this
.
toggle
)
cons
t
ids
=
[]
if
(
this
.
toggle
)
{
if
(
this
.
toggle
)
{
this
.
toggle
.
forEach
(
row
=>
{
this
.
toggle
.
forEach
(
row
=>
{
this
.
userData
.
data
.
splice
(
this
.
toggle
,
1
)
ids
.
push
(
row
.
id
+
''
)
// this.$refs.multipleTable.$refs.table.toggleRowSelection(row)
})
})
this
.
batcheDel
(
ids
.
join
(
','
))
}
else
{
}
else
{
// this.$refs.multipleTable.clearSelection(
)
this
.
message
(
''
,
'操作失败'
)
}
}
},
},
finduserName
()
{
finduserName
()
{
...
@@ -233,21 +274,22 @@ export default {
...
@@ -233,21 +274,22 @@ export default {
this
.
pageNum
=
val
this
.
pageNum
=
val
this
.
findUserList
()
this
.
findUserList
()
},
},
delteSelected
(
val
)
{
console
.
log
(
val
)
},
confirmDeleteOrNot
(
index
,
rows
)
{
confirmDeleteOrNot
(
index
,
rows
)
{
this
.
$confirm
(
'确定要删除这条数据?'
,
''
,
{
console
.
log
(
rows
[
index
].
id
)
confirmButtonTest
:
'确定'
,
this
.
operatUser
({
id
:
rows
[
index
].
id
,
state
:
2
})
cancelButtonText
:
'取消'
,
type
:
'warning'
// this.delectUser(rows[index].id)
}).
then
(()
=>
{
// this.$confirm('确定要删除这条数据?', '', {
// this.userData.data.splice(index, 1)
// confirmButtonTest: '确定',
rows
.
splice
(
index
,
1
)
// cancelButtonText: '取消',
this
.
message
(
'success'
,
'删除成功'
)
// type: 'warning'
}).
catch
(()
=>
{
// }).then(() => {
this
.
message
(
''
,
'取消删除'
)
// // this.userData.data.splice(index, 1)
})
// rows.splice(index, 1)
// this.message('success', '删除成功')
// }).catch(() => {
// this.message('', '取消删除')
// })
},
},
changeShowNumber
(
command
)
{
changeShowNumber
(
command
)
{
this
.
showNumber
=
command
this
.
showNumber
=
command
...
@@ -271,9 +313,9 @@ export default {
...
@@ -271,9 +313,9 @@ export default {
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.search-w250
{
.search-w250
{
width
:
250px
;
width
:
250px
;
}
}
.m-b8
{
.m-b8
{
margin-bottom
:
8px
;
margin-bottom
:
8px
;
}
}
</
style
>
</
style
>
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