Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3f2a77f2
authored
Mar 17, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vue3 重构:邮件账号的重构部分提交
parent
96e0ce98
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
32 deletions
+40
-32
src/api/system/mail/account/index.ts
+6
-6
src/views/system/mail/account/account.data.ts
+0
-1
src/views/system/mail/account/form.vue
+3
-3
src/views/system/mail/account/index.vue
+29
-20
src/views/system/mail/log/index.vue
+1
-1
src/views/system/mail/template/index.vue
+1
-1
No files found.
src/api/system/mail/account/index.ts
View file @
3f2a77f2
...
...
@@ -11,31 +11,31 @@ export interface MailAccountVO {
}
// 查询邮箱账号列表
export
const
getMailAccountPage
Api
=
async
(
params
:
PageParam
)
=>
{
export
const
getMailAccountPage
=
async
(
params
:
PageParam
)
=>
{
return
await
request
.
get
({
url
:
'/system/mail-account/page'
,
params
})
}
// 查询邮箱账号详情
export
const
getMailAccount
Api
=
async
(
id
:
number
)
=>
{
export
const
getMailAccount
=
async
(
id
:
number
)
=>
{
return
await
request
.
get
({
url
:
'/system/mail-account/get?id='
+
id
})
}
// 新增邮箱账号
export
const
createMailAccount
Api
=
async
(
data
:
MailAccountVO
)
=>
{
export
const
createMailAccount
=
async
(
data
:
MailAccountVO
)
=>
{
return
await
request
.
post
({
url
:
'/system/mail-account/create'
,
data
})
}
// 修改邮箱账号
export
const
updateMailAccount
Api
=
async
(
data
:
MailAccountVO
)
=>
{
export
const
updateMailAccount
=
async
(
data
:
MailAccountVO
)
=>
{
return
await
request
.
put
({
url
:
'/system/mail-account/update'
,
data
})
}
// 删除邮箱账号
export
const
deleteMailAccount
Api
=
async
(
id
:
number
)
=>
{
export
const
deleteMailAccount
=
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
'/system/mail-account/delete?id='
+
id
})
}
// 获得邮箱账号精简列表
export
const
getSimpleMailAccount
s
=
async
()
=>
{
export
const
getSimpleMailAccount
List
=
async
()
=>
{
return
request
.
get
({
url
:
'/system/mail-account/list-all-simple'
})
}
src/views/system/mail/account/account.data.ts
View file @
3f2a77f2
...
...
@@ -77,7 +77,6 @@ const crudSchemas = reactive<CrudSchema[]>([
{
label
:
'操作'
,
field
:
'action'
,
width
:
'260px'
,
form
:
{
show
:
false
}
...
...
src/views/system/mail/account/form.vue
View file @
3f2a77f2
...
...
@@ -31,7 +31,7 @@ const openModal = async (type: string, id?: number) => {
if
(
id
)
{
formLoading
.
value
=
true
try
{
const
data
=
await
MailAccountApi
.
getMailAccount
Api
(
id
)
const
data
=
await
MailAccountApi
.
getMailAccount
(
id
)
formRef
.
value
.
setValues
(
data
)
}
finally
{
formLoading
.
value
=
false
...
...
@@ -52,10 +52,10 @@ const submitForm = async () => {
try
{
const
data
=
formRef
.
value
.
formModel
as
MailAccountApi
.
MailAccountVO
if
(
formType
.
value
===
'create'
)
{
await
MailAccountApi
.
createMailAccount
Api
(
data
)
await
MailAccountApi
.
createMailAccount
(
data
)
message
.
success
(
t
(
'common.createSuccess'
))
}
else
{
await
MailAccountApi
.
updateMailAccount
Api
(
data
)
await
MailAccountApi
.
updateMailAccount
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
}
modelVisible
.
value
=
false
...
...
src/views/system/mail/account/index.vue
View file @
3f2a77f2
<
template
>
<!-- 搜索工作栏 -->
<ContentWrap>
<!-- TODO @芋艿:setSearchParams -->
<Search
:schema=
"allSchemas.searchSchema"
@
search=
"setSearchParams"
@
reset=
"setSearchParams"
/>
</ContentWrap>
<Search
:schema=
"allSchemas.searchSchema"
@
search=
"setSearchParams"
@
reset=
"setSearchParams"
>
<!-- 新增等操作按钮 -->
<template
#
actionMore
>
<el-button
type=
"primary"
@
click=
"openModal('create')"
...
...
@@ -11,18 +11,21 @@
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
</el-button>
</
template
>
</Search>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<Table
v-model:pageSize=
"tableObject.pageSize"
v-model:currentPage=
"tableObject.currentPage"
:columns=
"allSchemas.tableColumns"
:data=
"tableObject.tableList"
:loading=
"tableObject.loading"
:pagination=
"{
total: tableObject.total
}"
@register="register"
v-model:pageSize=
"tableObject.pageSize"
v-model:currentPage=
"tableObject.currentPage"
>
<
template
#
action=
"{ row }"
>
<el-button
...
...
@@ -37,7 +40,7 @@
link
type=
"danger"
v-hasPermi=
"['system:mail-account:delete']"
@
click=
"
delList(row.id, false
)"
@
click=
"
handleDelete(row.id
)"
>
删除
</el-button>
...
...
@@ -46,7 +49,7 @@
</ContentWrap>
<!-- 表单弹窗:添加/修改 -->
<
mail-account-f
orm
ref=
"modalRef"
@
success=
"getList"
/>
<
MailAccountF
orm
ref=
"modalRef"
@
success=
"getList"
/>
</template>
<
script
setup
lang=
"ts"
name=
"MailAccount"
>
import
{
allSchemas
}
from
'./account.data'
...
...
@@ -54,17 +57,15 @@ import { useTable } from '@/hooks/web/useTable'
import
*
as
MailAccountApi
from
'@/api/system/mail/account'
import
MailAccountForm
from
'./form.vue'
//
const { t } = useI18n() // 国际化
//
const message = useMessage() // 消息弹窗
const
{
register
,
tableObject
,
methods
}
=
useTable
<
MailAccountApi
.
MailAccountVO
>
({
getListApi
:
MailAccountApi
.
getMailAccountPage
Api
,
delListApi
:
MailAccountApi
.
deleteMailAccount
Api
//
https://kailong110120130.gitee.io/vue-element-plus-admin-doc/components/table.html#usetable
//
tableObject:表格的属性对象,可获得分页大小、条数等属性
// tableMethods:表格的操作对象,可进行获得分页、删除记录等操作
const
{
tableObject
,
tableMethods
}
=
useTable
({
getListApi
:
MailAccountApi
.
getMailAccountPage
,
// 分页接口
delListApi
:
MailAccountApi
.
deleteMailAccount
// 删除接口
})
const
{
getList
,
setSearchParams
}
=
methods
const
{
delList
}
=
methods
// 获得表格的各种操作
const
{
getList
,
setSearchParams
}
=
tableMethods
/** 添加/修改操作 */
const
modalRef
=
ref
()
...
...
@@ -72,5 +73,13 @@ const openModal = (type: string, id?: number) => {
modalRef
.
value
.
openModal
(
type
,
id
)
}
getList
()
/** 删除按钮操作 */
const
handleDelete
=
(
id
:
number
)
=>
{
tableMethods
.
delList
(
id
,
false
)
}
/** 初始化 **/
onMounted
(()
=>
{
getList
()
})
</
script
>
src/views/system/mail/log/index.vue
View file @
3f2a77f2
...
...
@@ -91,7 +91,7 @@ const handleDetail = async (rowId: number) => {
// ========== 初始化 ==========
onMounted
(()
=>
{
MailAccountApi
.
getSimpleMailAccount
s
().
then
((
data
)
=>
{
MailAccountApi
.
getSimpleMailAccount
List
().
then
((
data
)
=>
{
accountOptions
.
value
=
data
})
})
...
...
src/views/system/mail/template/index.vue
View file @
3f2a77f2
...
...
@@ -266,7 +266,7 @@ const sendTest = async () => {
// ========== 初始化 ==========
onMounted
(()
=>
{
MailAccountApi
.
getSimpleMailAccount
s
().
then
((
data
)
=>
{
MailAccountApi
.
getSimpleMailAccount
List
().
then
((
data
)
=>
{
accountOptions
.
value
=
data
})
})
...
...
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