Commit 811a6450 by 胡悦

部门下拉树完善

1 parent 38595d6d
<template> <template>
<gl-dialog title="收货地址" :visible.sync="dialogFormVisible" :before-close="cancelForm" > <gl-dialog :title="title" :visible.sync="dialogFormVisible" :before-close="cancelForm" >
<gl-form :model="userManageForm" :rules="rules" ref="userManageForm" label-width="100px"> <gl-form :model="userManageForm" :rules="rules" ref="userManageForm" label-width="100px">
<el-col :span="12"> <el-col :span="12">
<gl-form-item label="用户名" prop="username"> <gl-form-item label="用户名" prop="username">
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</gl-col> </gl-col>
<gl-col :span="12"> <gl-col :span="12">
<gl-form-item label="注册IP" prop="joinip"> <gl-form-item label="注册IP" prop="joinip">
<gl-masked v-model="userManageForm.joinip" :mask="tel" placeholder='请输入注册IP' clearable></gl-masked> <gl-masked v-model="userManageForm.joinip" ip placeholder='请输入注册IP' clearable></gl-masked>
<!-- <gl-input v-model="userManageForm.joinip" clearable></gl-input> --> <!-- <gl-input v-model="userManageForm.joinip" clearable></gl-input> -->
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
...@@ -55,12 +55,12 @@ ...@@ -55,12 +55,12 @@
</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 style="height:160px"> <gl-option style="height:160px">
<tree ref='tree' :isDepart="isDepart" :defaultExpandAll="defaultExpandAll" @node-click='clickDepart' style="height:160px"></tree> <tree ref='tree' :isDepart="isDepart" :defaultExpandAll="defaultExpandAll" @node-click='clickDepart' style="height:160px"></tree>
</gl-option> </gl-option>
</gl-select> </gl-select> -->
<!-- <gl-input-tree :data='userManageForm.departList' :props="props" :treeStyle='{ maxHeight: "160px" }' v-model="userManageForm.departName" /> --> <gl-input-tree :data='userManageForm.departList' :props="props" :treeStyle='{ maxHeight: "160px" }' @node-click='clickDepart' v-model="userManageForm.departName" />
<!-- <gl-select v-model="userManageForm.departId" placeholder="请选择"> <!-- <gl-select v-model="userManageForm.departId" placeholder="请选择">
<gl-option <gl-option
v-for="item in userManageForm.options" v-for="item in userManageForm.options"
...@@ -108,6 +108,7 @@ export default { ...@@ -108,6 +108,7 @@ export default {
'userManageForm.id'(val) { 'userManageForm.id'(val) {
val && (this.placeholder = '不填为不修改') val && (this.placeholder = '不填为不修改')
!val && (this.placeholder = '') !val && (this.placeholder = '')
this.title = val ? '编辑用户' : '新建用户'
} }
}, },
data() { data() {
...@@ -118,6 +119,7 @@ export default { ...@@ -118,6 +119,7 @@ export default {
children: 'children', children: 'children',
label: 'text' label: 'text'
}, },
title: '新建用户',
placeholder: '', placeholder: '',
defaultExpandAll: true, defaultExpandAll: true,
val: '', val: '',
......
...@@ -108,7 +108,6 @@ export default { ...@@ -108,7 +108,6 @@ export default {
label: '编辑', label: '编辑',
type: 'text', type: 'text',
callback: (index, rows) => { callback: (index, rows) => {
console.log(rows[index])
this.editUser(rows[index]) this.editUser(rows[index])
} }
}, { }, {
...@@ -204,16 +203,13 @@ export default { ...@@ -204,16 +203,13 @@ export default {
getRoleOptions() { getRoleOptions() {
getRoleList.req().then(res => { getRoleList.req().then(res => {
userForm.roleList = res.list userForm.roleList = res.list
// return res.list
}) })
}, },
// 获取部门树 // 获取部门树
getdepartData() { getdepartData() {
findDepartTree.req().then(res => { findDepartTree.req().then(res => {
console.log(res)
this.departList = res this.departList = res
userForm.departList = fn(res, '#') userForm.departList = fn(res, '#')
console.log(userForm.departList)
}) })
}, },
// 新增更新用户接口请求 // 新增更新用户接口请求
...@@ -222,12 +218,10 @@ export default { ...@@ -222,12 +218,10 @@ export default {
updateUser.req(params).then(res => { updateUser.req(params).then(res => {
console.log(res) console.log(res)
this.message('操作成功', 'success') this.message('操作成功', 'success')
// this.createOrEditSuccess()
this.dialogFormVisible = !this.dialogFormVisible this.dialogFormVisible = !this.dialogFormVisible
this.findUserList() this.findUserList()
}).catch(message => { }).catch(message => {
console.log(message) console.log(message)
// this.msg = message
this.message(message, 'error') this.message(message, 'error')
}) })
} }
...@@ -256,19 +250,11 @@ export default { ...@@ -256,19 +250,11 @@ export default {
}, },
// 接受子组件传递的值 // 接受子组件传递的值
handleUserFormData(isEdit, params) { handleUserFormData(isEdit, params) {
console.log(params)
// this.userManageForm = {}
if (params) { if (params) {
this.updateUser_Post(params) this.updateUser_Post(params)
} else { } else {
this.dialogFormVisible = !this.dialogFormVisible this.dialogFormVisible = !this.dialogFormVisible
// this.message('取消操作', 'info')
} }
// !params && this.message('取消操作', 'info')
// params && this.updateUser_Post(params)
// if (!params) {
// this.dialogFormVisible = !this.dialogFormVisible
// }
}, },
// 新增按钮 // 新增按钮
createUser() { createUser() {
...@@ -278,7 +264,6 @@ export default { ...@@ -278,7 +264,6 @@ export default {
}, },
// 编辑按钮 // 编辑按钮
editUser(row) { editUser(row) {
console.log(row)
row.password = '' row.password = ''
row.roleList = this.$deep_clone(userForm.roleList) row.roleList = this.$deep_clone(userForm.roleList)
row.departList = this.$deep_clone(userForm.departList) row.departList = this.$deep_clone(userForm.departList)
...@@ -290,7 +275,6 @@ export default { ...@@ -290,7 +275,6 @@ export default {
} }
}) })
Promise.all([findAll, getRoleList]).then((result) => { Promise.all([findAll, getRoleList]).then((result) => {
console.log(row.roles)
if (row.roles && typeof (row.roles) === 'string') { if (row.roles && typeof (row.roles) === 'string') {
row.roles = (row.roles + '').split(',').map(role => +role) row.roles = (row.roles + '').split(',').map(role => +role)
} else if (row.roles && typeof (row.roles) === 'object') { } else if (row.roles && typeof (row.roles) === 'object') {
...@@ -299,7 +283,6 @@ export default { ...@@ -299,7 +283,6 @@ export default {
row.roles = [] row.roles = []
} }
this.userManageForm = this.$deep_clone(row) this.userManageForm = this.$deep_clone(row)
console.log(this.userManageForm)
}) })
this.dialogFormVisible = !this.dialogFormVisible this.dialogFormVisible = !this.dialogFormVisible
this.isEdit = this.isEdit this.isEdit = this.isEdit
...@@ -373,25 +356,13 @@ export default { ...@@ -373,25 +356,13 @@ export default {
this.consoleParam = [] this.consoleParam = []
this.flagRoleOrUser = false this.flagRoleOrUser = false
this.apiParam = this.$deep_clone(rows[index]) this.apiParam = this.$deep_clone(rows[index])
// console.log(rows[index])
this.apiParam.roles = this.findRolesName(this.apiParam.roles) this.apiParam.roles = this.findRolesName(this.apiParam.roles)
// console.log(this.apiParam)
this.userDetailVisible = !this.userDetailVisible this.userDetailVisible = !this.userDetailVisible
}, },
handleUserDetailClose() { handleUserDetailClose() {
this.userDetailVisible = !this.userDetailVisible this.userDetailVisible = !this.userDetailVisible
this.apiParam = Object this.apiParam = Object
} }
// 修改启用禁用
// updateState() {
// if (this.state === '0') {
// consoleState = '禁用'
// return consoleState
// } else {
// consoleState = '启用'
// return consoleState
// }
// }
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!