index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" />
  3. <!-- 搜索工作栏 -->
  4. <ContentWrap>
  5. <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams">
  6. <!-- 新增等操作按钮 -->
  7. <template #actionMore>
  8. <el-button
  9. type="primary"
  10. plain
  11. @click="openForm('create')"
  12. v-hasPermi="['system:mail-account:create']"
  13. >
  14. <Icon icon="ep:plus" class="mr-5px" /> 新增
  15. </el-button>
  16. </template>
  17. </Search>
  18. </ContentWrap>
  19. <!-- 列表 -->
  20. <ContentWrap>
  21. <Table
  22. :columns="allSchemas.tableColumns"
  23. :data="tableObject.tableList"
  24. :loading="tableObject.loading"
  25. :pagination="{
  26. total: tableObject.total
  27. }"
  28. v-model:pageSize="tableObject.pageSize"
  29. v-model:currentPage="tableObject.currentPage"
  30. >
  31. <template #action="{ row }">
  32. <el-button
  33. link
  34. type="primary"
  35. @click="openForm('update', row.id)"
  36. v-hasPermi="['system:mail-account:update']"
  37. >
  38. 编辑
  39. </el-button>
  40. <el-button
  41. link
  42. type="primary"
  43. @click="openDetail(row.id)"
  44. v-hasPermi="['system:mail-account:query']"
  45. >
  46. 详情
  47. </el-button>
  48. <el-button
  49. link
  50. type="danger"
  51. v-hasPermi="['system:mail-account:delete']"
  52. @click="handleDelete(row.id)"
  53. >
  54. 删除
  55. </el-button>
  56. </template>
  57. </Table>
  58. </ContentWrap>
  59. <!-- 表单弹窗:添加/修改 -->
  60. <MailAccountForm ref="formRef" @success="getList" />
  61. <!-- 详情弹窗 -->
  62. <MailAccountDetail ref="detailRef" />
  63. </template>
  64. <script setup lang="ts" name="SystemMailAccount">
  65. import { allSchemas } from './account.data'
  66. import * as MailAccountApi from '@/api/system/mail/account'
  67. import MailAccountForm from './MailAccountForm.vue'
  68. import MailAccountDetail from './MailAccountDetail.vue'
  69. // tableObject:表格的属性对象,可获得分页大小、条数等属性
  70. // tableMethods:表格的操作对象,可进行获得分页、删除记录等操作
  71. // 详细可见:https://doc.iocoder.cn/vue3/crud-schema/
  72. const { tableObject, tableMethods } = useTable({
  73. getListApi: MailAccountApi.getMailAccountPage, // 分页接口
  74. delListApi: MailAccountApi.deleteMailAccount // 删除接口
  75. })
  76. // 获得表格的各种操作
  77. const { getList, setSearchParams } = tableMethods
  78. /** 添加/修改操作 */
  79. const formRef = ref()
  80. const openForm = (type: string, id?: number) => {
  81. formRef.value.open(type, id)
  82. }
  83. /** 详情操作 */
  84. const detailRef = ref()
  85. const openDetail = (id: number) => {
  86. detailRef.value.open(id)
  87. }
  88. /** 删除按钮操作 */
  89. const handleDelete = (id: number) => {
  90. tableMethods.delList(id, false)
  91. }
  92. /** 初始化 **/
  93. onMounted(() => {
  94. getList()
  95. })
  96. </script>