index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <ContentWrap>
  3. <!-- TODO @芋艿:setSearchParams -->
  4. <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
  5. </ContentWrap>
  6. <el-button
  7. type="primary"
  8. @click="openModal('create')"
  9. v-hasPermi="['system:mail-account:create']"
  10. >
  11. <Icon icon="ep:plus" class="mr-5px" /> 新增
  12. </el-button>
  13. <ContentWrap>
  14. <Table
  15. v-model:pageSize="tableObject.pageSize"
  16. v-model:currentPage="tableObject.currentPage"
  17. :columns="allSchemas.tableColumns"
  18. :data="tableObject.tableList"
  19. :loading="tableObject.loading"
  20. :pagination="{
  21. total: tableObject.total
  22. }"
  23. @register="register"
  24. >
  25. <template #action="{ row }">
  26. <el-button
  27. link
  28. type="primary"
  29. @click="openModal('update', row.id)"
  30. v-hasPermi="['system:mail-account:update']"
  31. >
  32. 编辑
  33. </el-button>
  34. <el-button
  35. link
  36. type="danger"
  37. v-hasPermi="['system:mail-account:delete']"
  38. @click="delList(row.id, false)"
  39. >
  40. 删除
  41. </el-button>
  42. </template>
  43. </Table>
  44. </ContentWrap>
  45. <!-- 表单弹窗:添加/修改 -->
  46. <mail-account-form ref="modalRef" @success="getList" />
  47. </template>
  48. <script setup lang="ts" name="MailAccount">
  49. import { allSchemas } from './account.data'
  50. import { useTable } from '@/hooks/web/useTable'
  51. import * as MailAccountApi from '@/api/system/mail/account'
  52. import MailAccountForm from './form.vue'
  53. // const { t } = useI18n() // 国际化
  54. // const message = useMessage() // 消息弹窗
  55. const { register, tableObject, methods } = useTable<MailAccountApi.MailAccountVO>({
  56. getListApi: MailAccountApi.getMailAccountPageApi,
  57. delListApi: MailAccountApi.deleteMailAccountApi
  58. })
  59. const { getList, setSearchParams } = methods
  60. const { delList } = methods
  61. /** 添加/修改操作 */
  62. const modalRef = ref()
  63. const openModal = (type: string, id?: number) => {
  64. modalRef.value.openModal(type, id)
  65. }
  66. getList()
  67. </script>