Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
online-edu-admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
online-edu
online-edu-admin
Commits
efdacb00
Commit
efdacb00
authored
May 19, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 企业列表管理
parent
805ead0e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
409 additions
and
0 deletions
+409
-0
enterprise.js
src/api/biz/enterprise.js
+19
-0
index.vue
src/views/biz/enterprise/index.vue
+390
-0
No files found.
src/api/biz/enterprise.js
0 → 100644
View file @
efdacb00
/******************
* 企业列表
*****************/
// 导入请求公用方法
import
{
request
}
from
'../../utils/axiosFun'
;
export
const
fetchList
=
(
query
)
=>
{
return
request
(
'post'
,
'/api/mgr/enterprise/list'
,
query
)
}
export
const
addObj
=
(
obj
)
=>
{
return
request
(
'post'
,
'/api/mgr/enterprise/save'
,
obj
)
}
export
const
putObj
=
(
obj
)
=>
{
return
request
(
'post'
,
'/api/mgr/enterprise/update'
,
obj
)
}
\ No newline at end of file
src/views/biz/enterprise/index.vue
0 → 100644
View file @
efdacb00
<
template
>
<div
class=
"template_content"
>
<!-- 搜索 -->
<div
class=
"search_box"
>
<a-form
layout=
"inline"
>
<a-form-item
label=
"企业名称"
>
<a-input
v-model=
"searchPage.enterpriseName"
placeholder=
"请输入企业名称"
allowClear
></a-input>
</a-form-item>
<a-form-item
label=
"管理员手机号"
>
<a-input
v-model=
"searchPage.adminMobile"
placeholder=
"请输入管理员手机号"
allowClear
></a-input>
</a-form-item>
<a-form-item>
<a-button
type=
"primary"
icon=
"search"
@
click=
"handlSearch"
>
查询
</a-button>
</a-form-item>
</a-form>
</div>
<!-- 表格内容 -->
<div
class=
"content_box"
>
<!-- 表格操作 -->
<div
class=
"table_top"
>
<a-button
icon=
"plus"
type=
"primary"
class=
"btn_right_margin"
@
click=
"showModal('')"
>
添加
</a-button>
</div>
<a-table
:columns=
"columns"
:dataSource=
"data"
:loading=
"loading"
:pagination=
"pagination"
bordered
size=
"small"
@
change=
"handleTableChange"
rowKey=
"id"
>
<!-- 企业名称 -->
<div
slot=
"name"
slot-scope=
"text,record"
>
<a-row
type=
"flex"
justify=
"start"
>
<!-- 头像 -->
<a-col>
<a-avatar
v-if=
"!record.logoUrl || record.logoUrl == ''"
shape=
"square"
:size=
"64"
icon=
"user"
/>
<a-avatar
v-if=
"record.logoUrl && record.logoUrl != ''"
shape=
"square"
:size=
"64"
:src=
"record.logoUrl"
/>
</a-col>
<!-- 企业名称 -->
<a-col>
<span
style=
"margin: 10px;"
>
{{
record
.
name
}}
</span>
</a-col>
</a-row>
</div>
<!-- 用户 -->
<div
slot=
"adminName"
slot-scope=
"text,record"
>
<a-row
type=
"flex"
justify=
"start"
align=
"middle"
>
<!-- 头像 -->
<a-col
:span=
"4"
>
<a-avatar
v-if=
"!record.adminAvatarUrl || record.adminAvatarUrl == ''"
shape=
"square"
:size=
"64"
icon=
"user"
/>
<a-avatar
v-if=
"record.adminAvatarUrl && record.adminAvatarUrl != ''"
shape=
"square"
:size=
"64"
:src=
"record.adminAvatarUrl"
/>
</a-col>
<!-- 管理员姓名、昵称,注册时间 -->
<a-col
:span=
"12"
>
<a-space
direction=
"vertical"
align=
"start"
>
<span>
姓名:
{{
record
.
adminName
&&
record
.
adminName
!=
''
?
record
.
adminName
:
'-'
}}
</span>
<span>
昵称:
{{
record
.
adminNickName
&&
record
.
adminNickName
!=
''
?
record
.
adminNickName
:
'-'
}}
</span>
<span>
注册时间:
{{
timestampToTime
(
record
.
createTime
)
}}
</span>
</a-space>
<!--
<a-row
type=
"flex"
justify=
"start"
align=
"middle"
>
<a-col
:span=
"24"
><span>
姓名:
{{
record
.
adminName
&&
record
.
adminName
!=
''
?
record
.
adminName
:
'-'
}}
</span></a-col>
<a-col
:span=
"24"
><span>
昵称:
{{
record
.
adminNickName
&&
record
.
adminNickName
!=
''
?
record
.
adminNickName
:
'-'
}}
</span></a-col>
<a-col
:span=
"24"
><span>
注册时间:
{{
timestampToTime
(
record
.
createTime
)
}}
</span></a-col>
</a-row>
-->
</a-col>
</a-row>
</div>
<!-- 用户状态 -->
<div
slot=
"adminStatus"
slot-scope=
"text,record"
>
<a-tag
v-if=
"record.adminStatus == 'ENABLE'"
color=
"green"
>
启用
</a-tag>
<a-tag
v-if=
"record.adminStatus == 'DISABLE'"
color=
"red"
>
禁用
</a-tag>
<a-tag
v-if=
"record.adminStatus == 'UNACTIVATE'"
color=
"orange"
>
未激活
</a-tag>
</div>
</a-table>
</div>
<!-- Modal窗口 -->
<template>
<a-modal
:visible=
"modalVisible"
:title=
"modalTitle"
@
ok=
"onConfirm"
@
cancel=
"onCancel"
>
<a-form-model
:model=
"formModel"
:label-col=
"
{span: 6}"
:wrapper-col="{span: 12}"
:rules="formRules"
ref="formModelRef"
>
<a-form-model-item
label=
"企业LOGO"
prop=
"logoUrl"
>
<a-avatar
v-if=
"!formModel.logoUrl || formModel.logoUrl == ''"
shape=
"square"
:size=
"64"
icon=
"user"
@
click=
"changeLogo"
/>
<a-avatar
v-if=
"formModel.logoUrl && formModel.logoUrl != ''"
shape=
"square"
:size=
"64"
:src=
"formModel.logoUrl"
@
click=
"changeLogo"
/>
<a-input
v-model=
"formModel.logoUrl"
type=
"hidden"
>
</a-input>
</a-form-model-item>
<a-form-model-item
label=
"企业名称"
prop=
"name"
>
<a-input
v-model=
"formModel.name"
>
</a-input>
</a-form-model-item>
<a-form-model-item
label=
"管理员手机号"
prop=
"adminMobile"
>
<a-input
v-model=
"formModel.adminMobile"
>
</a-input>
</a-form-model-item>
<a-form-model-item
label=
"管理员姓名"
prop=
"adminName"
>
<a-input
v-model=
"formModel.adminName"
>
</a-input>
</a-form-model-item>
<a-form-model-item
label=
"管理员昵称"
prop=
"adminNickName"
>
<a-input
v-model=
"formModel.adminNickName"
>
</a-input>
</a-form-model-item>
<a-form-model-item
label=
"省/市"
prop=
"province"
>
<a-input
v-model=
"formModel.province"
>
</a-input>
</a-form-model-item>
<a-form-model-item
label=
"市/区"
prop=
"city"
>
<a-input
v-model=
"formModel.city"
>
</a-input>
</a-form-model-item>
<a-form-model-item
label=
"地址"
prop=
"address"
>
<a-input
v-model=
"formModel.address"
>
</a-input>
</a-form-model-item>
</a-form-model>
</a-modal>
</
template
>
</div>
</template>
<
script
>
import
{
fetchList
,
addObj
,
putObj
}
from
'@/api/biz/enterprise'
import
{
disposereq
,
timestampToTime
}
from
'@/utils/util'
let
columns
=
[
{
title
:
'企业名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
scopedSlots
:
{
customRender
:
'name'
}
},
{
title
:
"管理员"
,
dataIndex
:
"adminName"
,
align
:
"center"
,
scopedSlots
:
{
customRender
:
'adminName'
}
},
{
title
:
"注册手机号"
,
dataIndex
:
"adminMobile"
,
align
:
"center"
,
},
{
title
:
"管理员状态"
,
dataIndex
:
"adminStatus"
,
align
:
"center"
,
scopedSlots
:
{
customRender
:
'adminStatus'
}
},
{
title
:
'成员人数'
,
dataIndex
:
'memberCount'
,
align
:
'center'
},
{
title
:
'最后登陆时间'
,
dataIndex
:
'lastLoginTime'
,
align
:
'center'
,
customRender
:
(
text
)
=>
{
return
text
?
timestampToTime
(
text
)
:
'-'
}
},
]
export
default
{
data
(){
return
{
columns
:
columns
,
data
:
[],
searchPage
:
{
pageIndex
:
1
,
pageSize
:
10
,
enterpriseName
:
''
,
adminMobile
:
''
},
pagination
:
{
showQuickJumper
:
true
,
showSizeChanger
:
true
},
loading
:
false
,
modalVisible
:
false
,
modalTitle
:
'添加'
,
modalType
:
'add'
,
formModel
:
{
id
:
''
,
name
:
''
,
logoUrl
:
''
,
adminMobile
:
''
,
adminNickName
:
''
,
adminName
:
''
,
province
:
''
,
city
:
''
,
address
:
''
},
formRules
:
{
name
:
[
{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'blur'
}
],
adminMobile
:
[
{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'blur'
},
{
pattern
:
/^1
[
3456789
]\d{9}
$/
,
message
:
'手机号格式不正确'
,
trigger
:
'blur'
}
]
}
}
},
// 创建完毕
created
()
{
this
.
getList
(
this
.
searchPage
);
},
// 即将更新渲染
beforeUpdate
()
{
},
methods
:
{
getList
(
query
){
this
.
loading
=
true
;
fetchList
(
query
).
then
(
res
=>
{
if
(
res
.
code
==
200
){
this
.
data
=
res
.
data
let
paper
=
{...
this
.
pagination
}
paper
.
current
=
query
.
pageIndex
paper
.
total
=
res
.
count
this
.
pagination
=
paper
}
else
{
this
.
$message
.
info
(
res
.
resp_msg
)
}
this
.
loading
=
false
;
}).
catch
(
err
=>
{
this
.
loading
=
false
;
disposereq
(
this
,
err
)
})
},
handleTableChange
(){
let
queryParam
=
{...
this
.
searchPage
}
queryParam
.
pageIndex
=
pagination
.
current
queryParam
.
pageSize
=
pagination
.
pageSize
this
.
getList
(
queryParam
)
},
handlSearch
(){
let
queryParam
=
{...
this
.
searchPage
}
this
.
getList
(
queryParam
)
},
timestampToTime
,
showModal
(
row
){
this
.
modalVisible
=
true
if
(
row
==
''
){
this
.
modalTitle
=
'添加'
this
.
modalType
=
'add'
}
else
{
this
.
modalTitle
=
'编辑'
this
.
modalType
=
'edit'
this
.
formModel
=
{...
row
}
}
},
saveData
(){
if
(
this
.
modalType
==
'add'
){
let
data
=
{...
this
.
formModel
}
addObj
(
data
).
then
(
res
=>
{
if
(
res
.
resp_code
==
200
){
this
.
$message
.
info
(
'保存成功'
)
this
.
getList
(
this
.
searchPage
)
}
else
{
this
.
$message
.
info
(
res
.
resp_msg
)
}
}).
catch
(
err
=>
{
disposereq
(
this
,
err
)
})
}
else
if
(
this
.
modalType
==
'edit'
){
}
},
onConfirm
(){
this
.
$refs
.
formModelRef
.
validate
(
valid
=>
{
if
(
valid
){
this
.
saveData
()
this
.
closeModal
()
}
else
{
return
false
}
})
},
onCancel
(){
this
.
closeModal
()
},
closeModal
(){
this
.
modalVisible
=
false
this
.
$refs
.
formModelRef
.
resetFields
()
},
changeLogo
(){
console
.
log
(
'changeLogo click'
)
}
}
}
</
script
>
<
style
>
.template_content
{
background-color
:
#f0f2f5
;
width
:
100%
;
height
:
100%
;
box-sizing
:
border-box
;
}
.search_box
{
width
:
100%
;
box-sizing
:
border-box
;
padding
:
14px
;
background-color
:
#fff
;
}
.content_box
{
width
:
100%
;
background-color
:
#fff
;
margin-top
:
10px
;
padding
:
14px
;
}
.table_top
{
padding-bottom
:
14px
;
}
.btn_margin
{
margin
:
0px
5px
;
}
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment