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 15adcd5f
authored
Oct 22, 2020
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新组织管理
1 parent
925a71bb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
177 additions
and
161 deletions
src/App.vue
src/components/table-tree-column/index.vue
src/config/config.js
src/services/orginizaManage.js
src/utils/http.js
src/views/orginizaManage/index.vue
src/views/user/index.vue
src/App.vue
View file @
15adcd5
...
@@ -4,8 +4,13 @@
...
@@ -4,8 +4,13 @@
class=
"glsx-system-sub"
class=
"glsx-system-sub"
>
>
<div
id=
"nav"
>
<div
id=
"nav"
>
<!--
<router-link
to=
"/"
>
Home
</router-link>
|
<router-link
to=
"/"
>
Home
</router-link>
|
<router-link
to=
"/about"
>
About
</router-link>
-->
<router-link
to=
"/about"
>
About
</router-link>
|
<router-link
to=
"/user"
>
user
</router-link>
|
<router-link
to=
"/role"
>
role
</router-link>
|
<router-link
to=
"/orginizaManage"
>
orginizaManage
</router-link>
|
<router-link
to=
"/dictionaryManage"
>
dictionaryManage
</router-link>
<!--
<p>
a链接跳转到主项目/其他子项目的页面,页面会刷新,效果不好
<a
href=
"/about"
>
parent About
</a></p>
-->
<!--
<p>
a链接跳转到主项目/其他子项目的页面,页面会刷新,效果不好
<a
href=
"/about"
>
parent About
</a></p>
-->
<p
v-if=
"isQiankun"
>
<p
v-if=
"isQiankun"
>
主项目把router传给子项目,子项目用这个router来跳转
主项目把router传给子项目,子项目用这个router来跳转
...
@@ -55,6 +60,8 @@ export default {
...
@@ -55,6 +60,8 @@ export default {
-moz-osx-font-smoothing
:
grayscale
;
-moz-osx-font-smoothing
:
grayscale
;
/* text-align: center; */
/* text-align: center; */
color
:
#2c3e50
;
color
:
#2c3e50
;
height
:
800px
;
overflow-y
:
auto
;
}
}
/* .glsx-system-sub #nav {
/* .glsx-system-sub #nav {
...
...
src/components/table-tree-column/index.vue
View file @
15adcd5
...
@@ -56,16 +56,14 @@ export default {
...
@@ -56,16 +56,14 @@ export default {
return
[
!
row
.
_expanded
?
'el-icon-caret-right'
:
'el-icon-caret-bottom'
]
return
[
!
row
.
_expanded
?
'el-icon-caret-right'
:
'el-icon-caret-bottom'
]
},
},
iconStyles
(
row
)
{
iconStyles
(
row
)
{
return
{
'visibility'
:
this
.
hasChild
(
row
)
?
'visible'
:
'hidden'
}
return
{
'visibility'
:
row
.
hasChildren
?
'visible'
:
'hidden'
}
},
hasChild
(
row
)
{
return
(
isArray
(
row
[
this
.
childKey
])
&&
row
[
this
.
childKey
].
length
>=
1
)
||
false
},
},
// 切换处理
// 切换处理
toggleHandle
(
index
,
row
)
{
toggleHandle
(
index
,
row
)
{
// console.log(row,
'this row ')
console
.
log
(
index
,
row
,
'this row '
)
if
(
this
.
hasChild
(
row
)
)
{
if
(
row
.
hasChildren
)
{
var
data
=
this
.
$parent
.
store
.
states
.
data
.
slice
(
0
)
var
data
=
this
.
$parent
.
store
.
states
.
data
.
slice
(
0
)
console
.
log
(
data
,
this
.
$parent
)
data
[
index
].
_expanded
=
!
data
[
index
].
_expanded
data
[
index
].
_expanded
=
!
data
[
index
].
_expanded
if
(
data
[
index
].
_expanded
)
{
if
(
data
[
index
].
_expanded
)
{
data
=
data
.
splice
(
0
,
index
+
1
).
concat
(
this
.
addChildNode
(
row
[
this
.
childKey
])).
concat
(
data
)
data
=
data
.
splice
(
0
,
index
+
1
).
concat
(
this
.
addChildNode
(
row
[
this
.
childKey
])).
concat
(
data
)
...
@@ -81,6 +79,7 @@ export default {
...
@@ -81,6 +79,7 @@ export default {
}
}
},
},
addChildNode
(
row
)
{
addChildNode
(
row
)
{
console
.
log
(
row
)
// console.log(row,'点击当前项的产生的下级数据 row ')
// console.log(row,'点击当前项的产生的下级数据 row ')
// 遍历下一级项 如果下级数据中 存在展开项 继续操作
// 遍历下一级项 如果下级数据中 存在展开项 继续操作
var
arr
=
[]
var
arr
=
[]
...
@@ -89,18 +88,10 @@ export default {
...
@@ -89,18 +88,10 @@ export default {
},
},
forE
(
row
,
arr
)
{
forE
(
row
,
arr
)
{
var
_this
=
this
var
_this
=
this
console
.
log
(
row
,
arr
)
row
.
forEach
(
item
=>
{
row
.
forEach
(
item
=>
{
if
(
item
.
_expanded
)
{
if
(
item
.
_expanded
)
{
arr
.
push
(
item
)
arr
.
push
(
item
)
// item['children'].forEach(childitem => {
// if(childitem._expanded){
// arr.push(childitem)
// // arr.push(childitem['children'])
// //继续循环
// }else{
// arr.push(childitem)
// }
// });
_this
.
forE
(
item
[
_this
.
childKey
],
arr
)
_this
.
forE
(
item
[
_this
.
childKey
],
arr
)
}
else
{
}
else
{
arr
.
push
(
item
)
arr
.
push
(
item
)
...
...
src/config/config.js
View file @
15adcd5
...
@@ -5,7 +5,7 @@ const MOCK_CONFIG_URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545
...
@@ -5,7 +5,7 @@ const MOCK_CONFIG_URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545
const
env
=
process
.
env
.
NODE_ENV
const
env
=
process
.
env
.
NODE_ENV
if
(
!
BASE_URL
)
{
if
(
!
BASE_URL
)
{
BASE_URL
=
env
===
'development'
?
'
http://localhost:8080
'
BASE_URL
=
env
===
'development'
?
'
https://oss-config.test.glsx.com.cn/mock/5f8fda237ec90706c0f89d05/service
'
:
''
:
''
}
}
...
@@ -14,7 +14,9 @@ const API = {
...
@@ -14,7 +14,9 @@ const API = {
return
MOCK_CONFIG_URL
+
'/test_config'
return
MOCK_CONFIG_URL
+
'/test_config'
},
},
LOGIN_ACTION
:
BASE_URL
+
'/login_action'
,
LOGIN_ACTION
:
BASE_URL
+
'/login_action'
,
USER_SEARCH
:
BASE_URL
+
'/usercenter/user/search'
USER_SEARCH
:
BASE_URL
+
'/usercenter/user/search'
,
ORGINIZA_SEARCH
:
BASE_URL
+
'/usercenter/organization/rootList'
,
ORGINIZA_CHILDREN
:
BASE_URL
+
'/usercenter/organization/children'
}
}
export
{
API
}
export
{
API
}
src/services/orginizaManage.js
0 → 100644
View file @
15adcd5
import
HTTP
from
'@/utils/http'
import
{
API
}
from
'@/config/config'
export
default
class
OrginizaService
extends
HTTP
{
getTableList
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
url
:
API
.
ORGINIZA_SEARCH
,
data
:
{},
success
(
data
)
{
resolve
(
data
)
},
error
(
error
)
{
// 网络请求失败
console
.
log
(
'网络请求失败'
)
// window.location.reload()
}
})
})
}
getChildren
(
id
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
url
:
API
.
ORGINIZA_CHILDREN
,
data
:
{
rootId
:
id
},
success
(
data
)
{
resolve
(
data
)
},
error
(
error
)
{
// 网络请求失败
console
.
log
(
'网络请求失败'
)
// window.location.reload()
}
})
})
}
}
src/utils/http.js
View file @
15adcd5
import
axios
from
'axios'
;
import
axios
from
'axios'
import
qs
from
'qs'
;
import
qs
from
'qs'
// import store from '@/store/index'
;
// import store from '@/store/index'
// const baseURL = store.state.baseURL
;
// const baseURL = store.state.baseURL
// let loadingInstance = null // 加载全局的loading
// let loadingInstance = null // 加载全局的loading
const
instance
=
axios
.
create
({
//创建axios实例,在这里可以设置请求的默认配置
const
instance
=
axios
.
create
({
//
创建axios实例,在这里可以设置请求的默认配置
timeout
:
60000
,
// 设置超时时间60s
timeout
:
60000
,
// 设置超时时间60s
// baseURL
// baseURL
})
})
// 文档中的统一设置post请求头。
// 文档中的统一设置post请求头。
// instance.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
// instance.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
let
httpCode
=
{
let
httpCode
=
{
601
:
'(601)请求参数错误'
,
601
:
'(601)请求参数错误'
,
704
:
'(704)权限不足, 请重新登录'
,
704
:
'(704)权限不足, 请重新登录'
,
703
:
'(703)服务器拒绝本次访问'
,
703
:
'(703)服务器拒绝本次访问'
,
// 404: '(404)请求资源未找到',
// 404: '(404)请求资源未找到',
// 500: '(500)内部服务器错误',
// 500: '(500)内部服务器错误',
707
:
'(707)服务器不支持该请求中使用的方法'
,
707
:
'(707)服务器不支持该请求中使用的方法'
,
// 502: '(502)网关错误',
// 502: '(502)网关错误',
// 504: '(504)网关超时'
// 504: '(504)网关超时'
}
}
/** 添加请求拦截器 **/
/** 添加请求拦截器 **/
instance
.
interceptors
.
request
.
use
(
config
=>
{
instance
.
interceptors
.
request
.
use
(
config
=>
{
/**
/**
* 在这里:可以根据业务需求可以在发送请求之前做些什么。
* 在这里:可以根据业务需求可以在发送请求之前做些什么。
* config.headers['token'] = sessionStorage.getItem('token') || ''
* config.headers['token'] = sessionStorage.getItem('token') || ''
*/
*/
// loadingInstance = Loading.service({ // 发起请求时加载全局loading,请求失败或有响应时会关闭
// loadingInstance = Loading.service({ // 发起请求时加载全局loading,请求失败或有响应时会关闭
// spinner: 'fa fa-spinner fa-spin fa-3x fa-fw',
// spinner: 'fa fa-spinner fa-spin fa-3x fa-fw',
// text: '拼命加载中...'
// text: '拼命加载中...'
// })
// })
return
config
return
config
},
error
=>
{
},
error
=>
{
// 对请求错误做些什么
// 对请求错误做些什么
console
.
log
(
'请求错误,原因:'
,
error
)
console
.
log
(
'请求错误,原因:'
,
error
)
return
Promise
.
reject
(
error
)
return
Promise
.
reject
(
error
)
})
})
/** 添加响应拦截器 **/
/** 添加响应拦截器 **/
instance
.
interceptors
.
response
.
use
(
response
=>
{
instance
.
interceptors
.
response
.
use
(
response
=>
{
// loadingInstance.close()
// loadingInstance.close()
if
(
response
.
data
.
code
===
200
||
response
.
status
===
200
)
{
// 响应结果里的status: 200是我与后台的约定,大家可以根据实际情况去做对应的判断
if
(
response
.
data
.
code
===
200
||
response
.
status
===
200
)
{
// 响应结果里的status: 200是我与后台的约定,大家可以根据实际情况去做对应的判断
if
(
response
.
status
)
{
if
(
response
.
status
)
{
return
Promise
.
resolve
(
response
);
return
Promise
.
resolve
(
response
)
}
return
Promise
.
resolve
(
response
.
data
);
}
else
{
// Message({
// message: response.data.message,
// type: 'error'
// })
console
.
log
(
response
.
data
.
message
)
return
Promise
.
reject
(
response
.
data
.
message
)
}
}
return
Promise
.
resolve
(
response
.
data
)
}
else
{
// Message({
// message: response.data.message,
// type: 'error'
// })
console
.
log
(
response
.
data
.
message
)
return
Promise
.
reject
(
response
.
data
.
message
)
}
},
error
=>
{
},
error
=>
{
// loadingInstance.close()
// loadingInstance.close()
if
(
error
.
response
)
{
if
(
error
.
response
)
{
/**
/**
* 在这里:可以根据业务需求可以在请求失败后做什么。
* 在这里:可以根据业务需求可以在请求失败后做什么。
* 根据请求失败的http状态码去给用户相应的提示
* 根据请求失败的http状态码去给用户相应的提示
*/
*/
let
tips
=
error
.
response
.
status
in
httpCode
?
httpCode
[
error
.
response
.
status
]
:
error
.
response
.
data
.
message
let
tips
=
error
.
response
.
status
in
httpCode
?
httpCode
[
error
.
response
.
status
]
:
error
.
response
.
data
.
message
// Message({
// Message({
// message: tips,
// message: tips,
// type: 'error'
// type: 'error'
// })
// })
console
.
log
(
tips
)
console
.
log
(
tips
)
return
Promise
.
reject
(
error
)
return
Promise
.
reject
(
error
)
}
else
{
}
else
{
// Message({
// Message({
// message: '请求失败',
// message: '请求失败',
// type: 'error'
// type: 'error'
// })
// })
return
Promise
.
reject
(
new
Error
(
'请求失败'
))
return
Promise
.
reject
(
new
Error
(
'请求失败'
))
}
}
})
})
export
default
class
HTTP
{
export
default
class
HTTP
{
axiosPost
(
options
)
{
axiosPost
(
options
)
{
instance
({
instance
({
url
:
options
.
url
,
url
:
options
.
url
,
method
:
'post'
,
method
:
'post'
,
header
:
{
header
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
'Content-Type'
:
'application/x-www-form-urlencoded'
},
},
data
:
qs
.
stringify
(
options
.
data
)
data
:
qs
.
stringify
(
options
.
data
)
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
options
.
success
(
res
.
data
);
options
.
success
(
res
.
data
)
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
options
.
error
(
err
);
options
.
error
(
err
)
})
})
}
}
axiosGet
(
options
)
{
instance
({
url
:
options
.
url
,
method
:
'get'
}).
then
((
res
)
=>
{
options
.
success
(
res
.
data
);
}).
catch
((
err
)
=>
{
options
.
error
(
err
);
})
}
}
\ No newline at end of file
\ No newline at end of file
axiosGet
(
options
)
{
instance
({
url
:
options
.
url
,
method
:
'get'
}).
then
((
res
)
=>
{
options
.
success
(
res
.
data
)
}).
catch
((
err
)
=>
{
options
.
error
(
err
)
})
}
}
src/views/orginizaManage/index.vue
View file @
15adcd5
...
@@ -134,6 +134,9 @@
...
@@ -134,6 +134,9 @@
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
OrginizaService
from
'services/orginizaManage'
;
const
orginizaService
=
new
OrginizaService
();
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -143,12 +146,12 @@ export default {
...
@@ -143,12 +146,12 @@ export default {
{
{
type
:
'input'
,
type
:
'input'
,
inputType
:
'text'
,
inputType
:
'text'
,
prop
:
'
searchField
'
,
prop
:
'
organizationName
'
,
placeholder
:
'请输入组织名称'
placeholder
:
'请输入组织名称'
},
},
{
{
type
:
'select'
,
type
:
'select'
,
prop
:
'
user
Status'
,
prop
:
'
enable
Status'
,
placeholder
:
'请选择组织状态'
,
placeholder
:
'请选择组织状态'
,
options
:
[{
options
:
[{
value
:
'0'
,
value
:
'0'
,
...
@@ -165,26 +168,6 @@ export default {
...
@@ -165,26 +168,6 @@ export default {
{
prop
:
'createTime'
,
label
:
'创建时间'
}
{
prop
:
'createTime'
,
label
:
'创建时间'
}
],
],
tableParams
:
{
tableParams
:
{
mutiSelectName
:
'orginiza'
,
mutiSelectUniqueKey
:
'id'
,
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
listName
:
'list'
,
tableColumns
:
[
{
label
:
'组织名称'
,
prop
:
'departmentName'
},
{
label
:
'排序'
,
prop
:
'orderNum'
},
{
label
:
'状态'
,
prop
:
'enableStatus'
,
addHtml
:
'status'
},
{
label
:
'创建时间'
,
prop
:
'createDate'
}
],
tableOption
:
{
tableOption
:
{
btnList
:
[
btnList
:
[
{
{
...
@@ -205,7 +188,6 @@ export default {
...
@@ -205,7 +188,6 @@ export default {
]
]
}
}
},
},
getListApi
:
null
,
// 弹窗数据
// 弹窗数据
userDialogTitle
:
'新增用户'
,
userDialogTitle
:
'新增用户'
,
userVisible
:
false
,
userVisible
:
false
,
...
@@ -295,28 +277,6 @@ export default {
...
@@ -295,28 +277,6 @@ export default {
label
:
'label'
label
:
'label'
},
},
listData
:
[
listData
:
[
{
id
:
1
,
departmentName
:
'wangxp集团'
,
orderNum
:
1
,
enableStatus
:
1
,
children
:
[
]
},
{
id
:
2
,
departmentName
:
'232'
,
orderNum
:
1
,
enableStatus
:
1
,
children
:
[
{
id
:
3
,
departmentName
:
'111111'
,
orderNum
:
1
,
enableStatus
:
1
}
]
}
],
],
loading
:
false
loading
:
false
...
@@ -327,6 +287,9 @@ export default {
...
@@ -327,6 +287,9 @@ export default {
this
.
$refs
.
tree
.
filter
(
val
)
this
.
$refs
.
tree
.
filter
(
val
)
}
}
},
},
mounted
()
{
this
.
getList
()
},
methods
:
{
methods
:
{
// 确定,新增用户、编辑用户
// 确定,新增用户、编辑用户
handleConfirm
()
{
handleConfirm
()
{
...
@@ -404,10 +367,22 @@ export default {
...
@@ -404,10 +367,22 @@ export default {
// 表格方法
// 表格方法
rowClick
(
row
,
e
,
col
)
{
rowClick
(
row
,
e
,
col
)
{
console
.
log
(
row
,
e
,
col
,
'row cliock data'
)
console
.
log
(
row
,
e
,
col
,
'row cliock data'
)
orginizaService
.
getChildren
(
row
.
id
).
then
(
res
=>
{
console
.
log
(
res
)
row
.
children
=
res
.
data
.
list
})
},
},
// 业务
// 业务
tableClick
(
that
,
index
,
row
,
data
)
{
tableClick
(
that
,
index
,
row
,
data
)
{
console
.
log
(
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
)
=>
{
});
}
}
}
}
}
}
...
...
src/views/user/index.vue
View file @
15adcd5
...
@@ -115,6 +115,7 @@
...
@@ -115,6 +115,7 @@
<
script
>
<
script
>
import
UserService
from
'services/user'
;
import
UserService
from
'services/user'
;
const
userService
=
new
UserService
();
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -187,7 +188,7 @@ export default {
...
@@ -187,7 +188,7 @@ export default {
]
]
}
}
},
},
getListApi
:
null
,
getListApi
:
userService
.
getUserList
,
// 折叠菜单数据
// 折叠菜单数据
props
:
{
props
:
{
label
:
'departmentName'
,
label
:
'departmentName'
,
...
@@ -262,7 +263,13 @@ export default {
...
@@ -262,7 +263,13 @@ export default {
{
label
:
'岗位:'
,
prop
:
'position'
,
type
:
'select'
,
options
:
[]
}
{
label
:
'岗位:'
,
prop
:
'position'
,
type
:
'select'
,
options
:
[]
}
],
],
userRules
:
{
userRules
:
{
account
:
[{
required
:
true
,
message
:
'请输入登录名称'
,
trigger
:
blur
}]
account
:
[{
required
:
true
,
message
:
'请输入登录名称'
,
trigger
:
blur
}],
departmentId
:
[{
required
:
true
,
message
:
'请选择部门名称'
,
trigger
:
blur
}],
username
:
[{
required
:
true
,
message
:
'请输入用户名称'
,
trigger
:
blur
}],
password
:
[{
required
:
true
,
message
:
'请输入密码'
,
trigger
:
blur
}],
roleId
:
[{
required
:
true
,
message
:
'请选择角色'
,
trigger
:
blur
}],
phoneNumber
:
[{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
blur
}],
enableStatus
:
[{
required
:
true
}],
},
},
// 部门弹窗
// 部门弹窗
filterDialogTitle
:
'选择组织'
,
filterDialogTitle
:
'选择组织'
,
...
@@ -344,14 +351,11 @@ export default {
...
@@ -344,14 +351,11 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
const
userService
=
new
UserService
();
// userService.getUserList().then((res) => {
userService
.
getUserList
().
then
((
res
)
=>
{
// console.log(res);
console
.
log
(
res
);
// }, (err) => {
// const baseURL = res.axios.baseURL;
// this.updateBaseURL(baseURL);
},
(
err
)
=>
{
});
//
});
},
},
methods
:
{
methods
:
{
// 确定,新增用户、编辑用户
// 确定,新增用户、编辑用户
...
...
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