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 ccf27b8d
authored
Oct 23, 2020
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of 192.168.3.233:micro-system/system
2 parents
33ab6221
4142b8e6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
86 deletions
src/components/basic-table/index.vue
src/config/config.js
src/services/request.js
src/services/user.js
src/views/user/index.vue
src/components/basic-table/index.vue
View file @
ccf27b8
...
...
@@ -3,7 +3,7 @@
<div
class=
"d2-table"
>
<el-table
:ref=
"tableParams.mutiSelectName + 'MutiTable' || 'mutiTable'"
:data=
"
apiParame
? data : tableData"
:data=
"
getListApi
? data : tableData"
:row-key=
"tableParams.mutiSelectUniqueKey || ''"
v-loading=
"loading"
:border=
"tableParams.border || false"
...
...
@@ -63,7 +63,7 @@
<
template
v-else-if=
"item.formatter"
>
<span
v-text=
"item.formatter(scope.row)"
></span>
</
template
>
<
template
v-else-if=
"
apiParame
"
>
<
template
v-else-if=
"
getListApi
"
>
<span
v-text=
"data[scope.$index][item.prop]"
></span>
</
template
>
<
template
v-else
>
...
...
@@ -102,7 +102,7 @@
:current-page=
"page.pageNum"
:page-sizes=
"[10,20,30,40]"
:page-size=
"page.pageSize"
:total=
"
apiParame
? total : tableTotal"
:total=
"
getListApi
? total : tableTotal"
layout=
"sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
...
...
@@ -110,7 +110,6 @@
</template>
<
script
>
import
request
from
'@/services/request'
export
default
{
name
:
'basic-table'
,
data
()
{
...
...
@@ -158,13 +157,9 @@ export default {
default
:
10
},
// 获取列表接口
// getListApi: {
// type: Function,
// default: null
// },
apiParame
:
{
type
:
Object
,
default
:
()
=>
{
}
getListApi
:
{
type
:
Function
,
default
:
null
},
// 分页,默认有
hasPage
:
{
...
...
@@ -223,7 +218,6 @@ export default {
watch
:
{
},
mounted
()
{
console
.
log
(
'ccc'
,
this
.
apiParame
)
const
btn
=
document
.
getElementById
(
this
.
tableParams
.
btnId
)
// this.tableData = [
// {
...
...
@@ -237,7 +231,7 @@ export default {
// }
// ]
btn
&&
btn
.
addEventListener
(
'click'
,
this
.
refreshEmit
)
this
.
apiParame
&&
this
.
refreshTable
()
this
.
getListApi
&&
this
.
refreshTable
()
},
methods
:
{
...
...
@@ -278,12 +272,9 @@ export default {
params
.
sortColum
=
this
.
sortColum
params
.
sort
=
this
.
sort
===
'descending'
?
1
:
0
}
const
apiUrl
=
this
.
apiParame
.
apiUrl
const
method
=
this
.
apiParame
.
method
||
'get'
request
(
apiUrl
,
method
,
params
).
then
(
res
=>
{
this
.
getListApi
(
params
).
then
(
res
=>
{
var
data
=
res
.
data
this
.
data
=
data
[
this
.
tableParams
.
listName
]
console
.
log
(
this
.
data
)
this
.
total
=
data
.
total
this
.
loading
=
false
}).
catch
(()
=>
{
...
...
@@ -294,12 +285,12 @@ export default {
// 页码
handleSizeChange
(
value
)
{
this
.
page
.
pageSize
=
value
this
.
apiParame
?
this
.
refreshTable
(
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
this
.
getListApi
?
this
.
refreshTable
(
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
},
handleCurrentChange
(
value
)
{
this
.
page
.
pageNum
=
value
this
.
apiParame
?
this
.
refreshTable
(
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
this
.
getListApi
?
this
.
refreshTable
(
false
)
:
this
.
$emit
(
'refreshTable'
,
this
.
page
)
}
}
}
...
...
src/config/config.js
View file @
ccf27b8
...
...
@@ -18,10 +18,7 @@ const API = {
}
const
USER_API
=
{
USER_SEARCH
:
{
apiUrl
:
BASE_URL
+
'/usercenter/user/search'
// method: 'post'
},
USER_SEARCH
:
BASE_URL
+
'/usercenter/user/search'
,
USER_SUPER
:
BASE_URL
+
'/usercenter/user/suitableSuperUsers'
,
USER_ADD
:
BASE_URL
+
'/usercenter/user/add'
}
...
...
src/services/request.js
View file @
ccf27b8
...
...
@@ -2,11 +2,11 @@ import HTTP from '@/utils/http'
const
axiosHttp
=
new
HTTP
()
function
request
(
url
=
''
,
method
=
'GET'
,
data
=
{}
)
{
function
request
(
data
=
{},
method
=
'GET'
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
reqMethod
=
method
.
toLocaleLowerCase
()
===
'get'
?
'axiosGet'
:
'axiosPost'
axiosHttp
[
reqMethod
]({
url
:
url
,
url
:
data
.
url
,
data
:
data
,
success
(
data
)
{
resolve
(
data
)
...
...
src/services/user.js
View file @
ccf27b8
import
HTTP
from
'@/utils/http'
import
{
USER_API
}
from
'@/config/config'
import
{
USER_API
}
from
'@/config/config'
import
request
from
'@/services/request'
export
default
class
UserService
extends
HTTP
{
// 获取用户列表
// getUserList () {
// return new Promise((resolve, reject) => {
// this.axiosGet({
// url: USER_API.USER_SEARCH,
// data: {},
// success(data) {
// resolve(data)
// },
// error(error) {
// // 网络请求失败
// console.log('网络请求失败')
// // window.location.reload()
// }
// })
// })
// }
// 获取上级树
getSuperUser
(
params
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
url
:
USER_API
.
USER_SUPER
,
data
:
{
params
},
success
(
data
)
{
resolve
(
data
)
},
error
(
error
)
{
// 网络请求失败
console
.
log
(
'网络请求失败'
)
}
})
})
}
// 新增用户
addUser
(
params
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
url
:
USER_API
.
USER_SUPER
,
data
:
{
params
},
success
(
data
)
{
resolve
(
data
)
},
error
(
error
)
{
// 网络请求失败
console
.
log
(
'网络请求失败'
)
}
})
})
}
// 获取用户列表
function
getUserList
(
params
)
{
params
.
url
=
USER_API
.
USER_SEARCH
return
request
(
params
)
}
// 获取上级树
function
getSuperUser
(
params
)
{
params
.
url
=
USER_API
.
USER_SUPER
return
request
(
params
)
}
// 新增用户
function
addUser
(
params
)
{
params
.
url
=
USER_API
.
USER_ADD
return
request
(
params
)
}
export
{
getUserList
,
getSuperUser
,
addUser
}
\ No newline at end of file
src/views/user/index.vue
View file @
ccf27b8
...
...
@@ -46,7 +46,7 @@
<basic-table
:tableParams=
"tableParams"
:searchForm=
"searchForm"
:
apiParame=
"apiParame
"
:
getListApi=
"getListApi
"
:hasNum=
"false"
>
<span
...
...
@@ -118,12 +118,9 @@
</
template
>
<
script
>
import
{
USER_API
}
from
'@/config/config'
import
UserService
from
'services/user'
;
// import UserService from 'services/user';
import
{
getUserList
,
getSuperUser
,
addUser
}
from
'services/user'
;
import
OrginizaService
from
'services/orginizaManage'
;
const
userService
=
new
UserService
();
const
orginizaService
=
new
OrginizaService
();
export
default
{
data
()
{
...
...
@@ -198,8 +195,7 @@ export default {
]
}
},
apiParame
:
USER_API
.
USER_SEARCH
,
// getListApi: getUserList,
getListApi
:
getUserList
,
// 折叠菜单数据
data
:
[],
// 弹窗数据
...
...
@@ -422,7 +418,7 @@ export default {
},
// 获取上级树
getSuperUser
(
params
)
{
userService
.
getSuperUser
(
params
).
then
(
res
=>
{
getSuperUser
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
filterTextData
=
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