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 e863a9fc
authored
Oct 26, 2020
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交组织管理接口
1 parent
b71d9b4d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
141 additions
and
291 deletions
src/config/config.js
src/services/orginizaManage.js
src/utils/constants.js
src/views/menuManage/index.vue
src/views/orginizaManage/index.vue
src/views/user/index.vue
src/config/config.js
View file @
e863a9f
...
...
@@ -46,7 +46,10 @@ const ORGINIZA_API = {
ORGINIZA_SEARCH
:
BASE_URL
+
'/usercenter/organization/rootList'
,
ORGINIZA_CHILDREN
:
BASE_URL
+
'/usercenter/organization/children'
,
ORGINIZA_SIMPLElIST
:
BASE_URL
+
'/usercenter/organization/simpleList'
,
ORGINIZA_TREEORY
:
BASE_URL
+
'/usercenter/organization/treeOrg'
ORGINIZA_TREEORY
:
BASE_URL
+
'/usercenter/organization/treeOrg'
,
ORGINIZA_ADD
:
BASE_URL
+
'/usercenter/organization/add'
,
ORGINIZA_EDIT
:
BASE_URL
+
'/usercenter/organization/edit'
,
ORGINIZA_DELETE
:
BASE_URL
+
'/usercenter/organization/delete'
}
const
DICT_API
=
{
DICT_SEARCH
:
BASE_URL
+
'/publiccenter/dict/type/search'
,
...
...
src/services/orginizaManage.js
View file @
e863a9f
import
HTTP
from
'@/utils/http'
import
{
ORGINIZA_API
}
from
'@/config/config'
import
request
from
'@/services/request'
export
default
class
OrginizaService
extends
HTTP
{
// 获取组织列表
getTableList
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
url
:
ORGINIZA_API
.
ORGINIZA_SEARCH
,
data
:
{},
success
(
data
)
{
resolve
(
data
)
},
error
(
error
)
{
// 网络请求失败
console
.
log
(
'网络请求失败'
)
}
})
})
}
// 根据根节点,获取子节点列表
getChildren
(
id
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
url
:
ORGINIZA_API
.
ORGINIZA_CHILDREN
,
data
:
{
rootId
:
id
},
success
(
data
)
{
resolve
(
data
)
},
error
(
error
)
{
// 网络请求失败
console
.
log
(
'网络请求失败'
)
}
})
})
}
// 获取组织列表树
getSimpleList
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
url
:
ORGINIZA_API
.
ORGINIZA_SIMPLElIST
,
data
:
{},
success
(
data
)
{
resolve
(
data
)
},
error
(
error
)
{
// 网络请求失败
console
.
log
(
'网络请求失败'
)
}
})
})
}
// 组织架构
getTreeOrg
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
url
:
ORGINIZA_API
.
ORGINIZA_TREEORY
,
data
:
{},
success
(
data
)
{
resolve
(
data
)
},
error
(
error
)
{
// 网络请求失败
console
.
log
(
'网络请求失败'
)
}
})
})
}
// 获取组织列表
function
getTableList
(
params
)
{
const
url
=
ORGINIZA_API
.
ORGINIZA_SEARCH
return
request
(
params
,
url
)
}
// 根据根节点,获取子节点列表
function
getChildren
(
params
)
{
const
url
=
ORGINIZA_API
.
ORGINIZA_CHILDREN
return
request
(
params
,
url
)
}
// 获取组织列表树
function
getSimpleList
(
params
)
{
const
url
=
ORGINIZA_API
.
ORGINIZA_SIMPLElIST
return
request
(
params
,
url
)
}
// 组织架构
function
getTreeOrg
(
params
)
{
const
url
=
ORGINIZA_API
.
ORGINIZA_TREEORY
return
request
(
params
,
url
)
}
// 添加组织
function
addOrganiza
(
params
)
{
const
url
=
ORGINIZA_API
.
ORGINIZA_ADD
return
request
(
params
,
url
,
'post'
)
}
// 编辑组织
function
editOrganiza
(
params
)
{
const
url
=
ORGINIZA_API
.
ORGINIZA_EDIT
return
request
(
params
,
url
,
'post'
)
}
// 添加组织
function
deleteOrganiza
(
params
)
{
const
url
=
ORGINIZA_API
.
ORGINIZA_DELETE
return
request
(
params
,
url
)
}
export
{
getTableList
,
getChildren
,
getSimpleList
,
getTreeOrg
,
addOrganiza
,
editOrganiza
,
deleteOrganiza
}
src/utils/constants.js
View file @
e863a9f
...
...
@@ -93,9 +93,9 @@ const Constants = {
// 组织管理状态
ORGINIZASTATUS
:
{
'
1
'
:
'正常,green'
,
'
2
'
:
'停用,gray'
,
'
3
'
:
'注销,red'
'
0
'
:
'正常,green'
,
'
1
'
:
'停用,gray'
,
'
2
'
:
'注销,red'
},
ORGINIZATYPE
:
{
'1'
:
'层级'
,
...
...
src/views/menuManage/index.vue
View file @
e863a9f
...
...
@@ -26,7 +26,7 @@
type=
"primary"
:size=
"btn_size"
icon=
"el-icon-plus"
@
click=
"
handleClose
"
@
click=
"
btnClick('create')
"
>
新增
</el-button>
</div>
<el-table
...
...
@@ -290,7 +290,8 @@ export default {
children
:
'children'
,
label
:
'label'
},
loading
:
false
loading
:
false
,
num
:
10
}
},
...
...
@@ -304,7 +305,7 @@ export default {
},
methods
:
{
search
()
{
this
.
getList
(
this
.
searchForm
)
},
// 重置搜索条件
refresh
()
{
...
...
@@ -338,6 +339,9 @@ export default {
btnClick
(
pType
,
scope
)
{
console
.
log
(
pType
,
scope
)
switch
(
pType
)
{
case
'create'
:
this
.
handleClose
()
break
case
'edit'
:
this
.
editEvent
(
scope
)
break
...
...
@@ -376,21 +380,15 @@ export default {
this
.
$Common
.
confirmDialog
(
tipData
)
},
load
(
tree
,
treeNode
,
resolve
)
{
setTimeout
(()
=>
{
resolve
([
{
id
:
31
,
date
:
'2016-05-01'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1519 弄'
},
{
id
:
32
,
date
:
'2016-05-01'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1519 弄'
}
])
},
1000
)
console
.
log
(
tree
,
treeNode
,
resolve
)
getMenuChildren
({
id
:
tree
.
id
}).
then
(
res
=>
{
let
nodes
=
res
.
data
nodes
.
map
(
item
=>
{
const
aa
=
this
.
num
++
item
.
id
=
aa
+
''
+
item
.
id
})
resolve
(
nodes
)
})
},
// 上级弹窗
selectSuperior
()
{
...
...
@@ -410,22 +408,10 @@ export default {
if
(
!
value
)
return
true
return
data
.
label
.
indexOf
(
value
)
!==
-
1
},
getList
()
{
getMenuList
().
then
((
res
)
=>
{
console
.
log
(
res
);
let
arr
=
res
.
data
.
list
// for (let i in arr) {
// console.log(i)
// if (arr[i].haschildren) {
// console.log('Jinlaile ')
// arr[i].children = []
// }
// }
this
.
menuTableData
=
arr
console
.
log
(
this
.
menuTableData
)
},
(
err
)
=>
{
});
getList
(
params
)
{
getMenuList
(
params
).
then
((
res
)
=>
{
this
.
menuTableData
=
res
.
data
.
list
})
}
}
}
...
...
src/views/orginizaManage/index.vue
View file @
e863a9f
...
...
@@ -11,12 +11,13 @@
type=
"primary"
:size=
"btn_size"
icon=
"el-icon-search"
:id=
"tableParams.btnId
"
@
click=
"search
"
>
搜索
</el-button>
<el-button
type=
"primary"
:size=
"btn_size"
icon=
"el-icon-refresh"
@
click=
"refresh"
>
重置
</el-button>
</slot>
</search-form>
...
...
@@ -25,28 +26,18 @@
type=
"primary"
:size=
"btn_size"
icon=
"el-icon-plus"
@
click=
"btnClick('
create
')"
>
新增
</el-button>
@
click=
"btnClick('
root
')"
>
新增
根组织
</el-button>
</div>
<el-table
v-loading=
"loading"
align=
"center"
ref=
"multipleTable"
:data=
"listData"
tooltip-effect=
"dark"
:data=
"orginTableData"
style=
"width: 100%"
@
row-click=
"rowClick"
:header-cell-style=
"
{background:'#f5f7fa'}"
row-key=
"id"
border
lazy
:load=
"load"
:tree-props=
"
{children: 'children', hasChildren: 'hasChildren'}"
>
<table-tree-column
ref=
'OrgiSort'
@
table-click=
"tableClick"
prop=
"departmentName"
header-align=
"center"
treeKey=
"id"
width=
"300"
label=
"组织名称"
></table-tree-column>
<el-table-column
v-for=
"(item,index) in listHeadData"
:key=
"index"
...
...
@@ -58,13 +49,12 @@
show-overflow-tooltip
>
<template
slot-scope=
"scope"
>
<template
v-if=
"item.prop === 'orgStatus'"
>
dfs
<!--
<span
<template
v-if=
"item.prop === 'enableStatus'"
>
<span
class=
"dot"
:class=
"
ORGINIZASTATUS[scope.row[item.prop]].split(',')[1]
"
:class=
"
scope.row.enableStatus ? ORGINIZASTATUS[scope.row.enableStatus].split(',')[1] : ''
"
></span>
<span
class=
"statusText"
>
{{
ORGINIZASTATUS
[
scope
.
row
[
item
.
prop
]].
split
(
','
)[
0
]
}}
</span>
--
>
<span
class=
"statusText"
>
{{
scope
.
row
.
enableStatus
?
ORGINIZASTATUS
[
scope
.
row
.
enableStatus
].
split
(
','
)[
0
]
:
'--'
}}
</span
>
</
template
>
<
template
v-else
>
{{
scope
.
row
[
item
.
prop
]?
scope
.
row
[
item
.
prop
]:
'--'
}}
...
...
@@ -85,7 +75,7 @@
:type=
"j.type"
size=
"mini"
plain
@
click=
"btnClick(j.pType, scope.
scope
)"
@
click=
"btnClick(j.pType, scope.
row
)"
>
{{
j
.
name
}}
</el-button>
</
template
>
</el-table-column>
...
...
@@ -105,38 +95,11 @@
></rule-form>
</slot>
</basic-dialog>
<basic-dialog
:title=
"filterDialogTitle"
:isVisible=
"filterVisible"
@
confirmDialog=
"filterConfirm"
@
closeDialog=
"closeFilter"
>
<slot>
<el-input
placeholder=
"输入关键字进行过滤"
v-model=
"filterText"
>
</el-input>
<el-tree
class=
"filter-tree"
:data=
"filterTextData"
:props=
"defaultProps"
:filter-node-method=
"filterNode"
ref=
"tree"
node-key=
"id"
check-on-click-node
>
</el-tree>
</slot>
</basic-dialog>
</div>
</div>
</template>
<
script
>
import
OrginizaService
from
'services/orginizaManage'
;
const
orginizaService
=
new
OrginizaService
();
import
{
getTableList
,
getChildren
,
addOrganiza
,
editOrganiza
,
deleteOrganiza
}
from
'services/orginizaManage'
export
default
{
data
()
{
return
{
...
...
@@ -162,10 +125,12 @@ export default {
}]
}
],
orginTableData
:
[],
listHeadData
:
[
// 列表 头部设置 数据
{
prop
:
'departmentName'
,
label
:
'组织名称'
},
{
prop
:
'orderNum'
,
label
:
'排序'
},
{
prop
:
'enableStatus'
,
label
:
'状态'
},
{
prop
:
'create
Tim
e'
,
label
:
'创建时间'
}
{
prop
:
'create
Dat
e'
,
label
:
'创建时间'
}
],
tableParams
:
{
tableOption
:
{
...
...
@@ -189,96 +154,23 @@ export default {
}
},
// 弹窗数据
orginizaDialogTitle
:
'新增
用户
'
,
orginizaDialogTitle
:
'新增
组织
'
,
orginizaVisible
:
false
,
orginizaForm
:
{
account
:
''
,
departmentId
:
''
,
superiorId
:
''
,
enableStatus
:
true
},
orginizaData
:
[
{
label
:
'组织名称'
,
prop
:
'account'
,
type
:
'input'
},
{
label
:
'显示排序'
,
prop
:
'departmentId'
,
type
:
'input'
},
{
label
:
'组织状态'
,
prop
:
'superiorId'
,
type
:
'radio'
,
children
:
this
.
$Constants
.
ORGINIZA_STATUS
}
{
label
:
'上级组织'
,
prop
:
'departmentName'
,
type
:
'input'
,
hidden
:
false
,
readonly
:
true
},
{
label
:
'组织名称'
,
prop
:
'name'
,
type
:
'input'
},
{
label
:
'显示排序'
,
prop
:
'orderNum'
,
type
:
'input'
},
{
label
:
'组织状态'
,
prop
:
'enableStatus'
,
type
:
'radio'
,
children
:
this
.
$Constants
.
ORGINIZA_STATUS
}
],
orginizaRules
:
{
account
:
[{
required
:
true
,
message
:
'请输入登录名称'
,
trigger
:
blur
}]
name
:
[{
required
:
true
,
message
:
'请输入组织名称'
,
trigger
:
'blur'
}],
orderNum
:
[{
required
:
true
,
message
:
'请输入显示排序'
,
trigger
:
'blur'
}],
enableStatus
:
[{
required
:
true
,
message
:
'请选择组织状态'
,
trigger
:
'change'
}]
},
// 部门弹窗
filterDialogTitle
:
'选择组织'
,
filterVisible
:
false
,
filterText
:
''
,
filterTextData
:
[
{
id
:
1
,
label
:
'广汇集团'
,
children
:
[
{
id
:
10
,
label
:
'东北大区'
},
{
id
:
11
,
label
:
'华南大区'
},
{
id
:
12
,
label
:
'西北大区'
,
children
:
[
{
id
:
100
,
label
:
'新疆'
,
children
:
[
{
id
:
1000
,
label
:
'新疆克拉玛依华威4S店'
},
{
id
:
1001
,
label
:
'新疆克拉玛依华威4S店'
}
]
},
{
id
:
101
,
label
:
'陕西'
}
]
}
]
},
{
id
:
2
,
label
:
'成都轱辘汽车服务公司'
,
children
:
[
{
id
:
20
,
label
:
'新疆克拉玛依华威4S店'
},
{
id
:
21
,
label
:
'深圳市'
,
children
:
[
{
id
:
200
,
label
:
'南山区'
,
children
:
[
{
id
:
2000
,
label
:
'南山科技园片区'
}
]
},
{
id
:
201
,
label
:
'福田竹子林金融产业园区'
}
]
}
]
}
],
defaultProps
:
{
children
:
'children'
,
label
:
'label'
},
listData
:
[
],
loading
:
false
num
:
1
}
},
...
...
@@ -291,12 +183,25 @@ export default {
this
.
getList
()
},
methods
:
{
// 确定,新增用户、编辑用户
search
()
{
this
.
getList
(
this
.
searchForm
)
},
// 重置搜索条件
refresh
()
{
this
.
searchForm
=
{}
},
// 确定,新增组织、编辑组织
handleConfirm
()
{
console
.
log
(
this
.
$refs
.
orginizaForm
)
console
.
log
(
this
.
orginizaForm
)
this
.
$refs
.
orginizaForm
.
$children
[
0
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
handleClose
()
let
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
orginizaForm
))
params
.
enableStatus
=
this
.
orginizaForm
.
enableStatus
?
0
:
1
let
api
=
addOrganiza
if
(
params
.
id
)
api
=
editOrganiza
api
(
params
).
then
(
res
=>
{
this
.
handleClose
()
})
}
else
{
console
.
log
(
'error'
)
}
...
...
@@ -313,10 +218,18 @@ export default {
btnClick
(
pType
,
scope
)
{
console
.
log
(
pType
,
scope
)
switch
(
pType
)
{
case
'root'
:
this
.
orginizaData
[
0
].
hidden
=
true
this
.
orginizaDialogTitle
=
'新增根组织'
this
.
handleClose
()
break
case
'create'
:
this
.
orginizaData
[
0
].
hidden
=
false
this
.
orginizaDialogTitle
=
'新增组织'
this
.
handleClose
()
break
case
'edit'
:
this
.
orginizaDialogTitle
=
'编辑组织'
this
.
editEvent
(
scope
)
break
case
'delete'
:
...
...
@@ -326,6 +239,9 @@ export default {
},
// 编辑触发事件
editEvent
(
row
)
{
console
.
log
(
row
)
this
.
orginizaForm
=
JSON
.
parse
(
JSON
.
stringify
(
row
))
this
.
orginizaForm
.
enableStatus
=
row
.
enableStatus
==
0
?
true
:
false
this
.
handleClose
()
},
// 删除触发事件
...
...
@@ -337,55 +253,32 @@ export default {
tipTitle
:
'提示'
,
type
:
'error'
,
callBack
:
()
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'删除成功!'
deleteOrganiza
({
id
:
id
}).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'删除成功!'
})
})
}
}
this
.
$Common
.
confirmDialog
(
tipData
)
},
// 部门弹窗
selectDepart
()
{
this
.
filterDialogTitle
=
'选择组织'
this
.
closeFilter
()
},
// 上级弹窗
selectSuperior
()
{
this
.
filterDialogTitle
=
'选择直接上级'
this
.
closeFilter
()
},
closeFilter
()
{
this
.
filterVisible
=
!
this
.
filterVisible
},
filterConfirm
()
{
console
.
log
(
this
.
$refs
.
tree
.
getCheckedKeys
(
false
,
true
))
// this.closeFilter()
},
filterNode
(
value
,
data
)
{
console
.
log
(
value
,
data
)
if
(
!
value
)
return
true
return
data
.
label
.
indexOf
(
value
)
!==
-
1
},
// 表格方法
rowClick
(
row
,
e
,
col
)
{
console
.
log
(
row
,
e
,
col
,
'row cliock data'
)
orginizaService
.
getChildren
(
row
.
id
).
then
(
res
=>
{
console
.
log
(
res
)
row
.
children
=
res
.
data
.
list
// 树形table懒加载
load
(
tree
,
treeNode
,
resolve
)
{
console
.
log
(
tree
,
treeNode
,
resolve
)
getChildren
({
id
:
tree
.
id
}).
then
(
res
=>
{
let
nodes
=
res
.
data
.
list
nodes
.
map
(
item
=>
{
const
aa
=
this
.
num
++
item
.
id
=
aa
+
''
+
item
.
id
})
resolve
(
nodes
)
})
},
// 业务
tableClick
(
that
,
index
,
row
,
data
)
{
console
.
log
(
that
,
index
,
row
,
data
,
'tableClick'
)
},
getList
()
{
orginizaService
.
getTableList
().
then
((
res
)
=>
{
console
.
log
(
res
);
this
.
listData
=
res
.
data
.
list
},
(
err
)
=>
{
});
getList
(
params
)
{
getTableList
(
params
).
then
((
res
)
=>
{
this
.
orginTableData
=
res
.
data
.
list
})
}
}
}
...
...
src/views/user/index.vue
View file @
e863a9f
...
...
@@ -121,8 +121,7 @@
// import UserService from 'services/user';
import
{
getUserList
,
getSuperUser
,
addUser
,
editUser
,
detailUser
,
deleteUser
,
roleList
}
from
'services/user'
;
import
OrginizaService
from
'services/orginizaManage'
;
const
orginizaService
=
new
OrginizaService
();
import
{
getSimpleList
,
getTreeOrg
}
from
'services/orginizaManage'
export
default
{
data
()
{
return
{
...
...
@@ -445,14 +444,14 @@ export default {
},
// 获取组织树
getSimpleList
()
{
orginizaService
.
getSimpleList
().
then
(
res
=>
{
getSimpleList
().
then
(
res
=>
{
console
.
log
(
res
)
this
.
filterTextData
=
res
.
data
.
list
})
},
// 获取组织架构
getTreeOrg
()
{
orginizaService
.
getTreeOrg
().
then
(
res
=>
{
getTreeOrg
().
then
(
res
=>
{
console
.
log
(
res
)
this
.
data
=
res
.
data
.
list
})
...
...
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