|
@@ -1,28 +1,31 @@
|
|
|
<template>
|
|
|
+ <!-- 搜索工作栏 -->
|
|
|
<ContentWrap>
|
|
|
- <!-- TODO @芋艿:setSearchParams -->
|
|
|
- <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
|
|
|
+ <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams">
|
|
|
+ <!-- 新增等操作按钮 -->
|
|
|
+ <template #actionMore>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="openModal('create')"
|
|
|
+ v-hasPermi="['system:mail-account:create']"
|
|
|
+ >
|
|
|
+ <Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </Search>
|
|
|
</ContentWrap>
|
|
|
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="openModal('create')"
|
|
|
- v-hasPermi="['system:mail-account:create']"
|
|
|
- >
|
|
|
- <Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
|
- </el-button>
|
|
|
-
|
|
|
+ <!-- 列表 -->
|
|
|
<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-form ref="modalRef" @success="getList" />
|
|
|
+ <MailAccountForm 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.getMailAccountPageApi,
|
|
|
- delListApi: MailAccountApi.deleteMailAccountApi
|
|
|
+// 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>
|