index.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <ContentWrap>
  3. <!-- 列表 -->
  4. <XTable @register="registerTable">
  5. <!-- 操作:导出 -->
  6. <template #toolbar_buttons>
  7. <XButton
  8. type="warning"
  9. preIcon="ep:download"
  10. :title="t('action.export')"
  11. @click="handleExport()"
  12. />
  13. </template>
  14. <template #actionbtns_default="{ row }">
  15. <!-- 操作:详情 -->
  16. <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
  17. </template>
  18. </XTable>
  19. </ContentWrap>
  20. <!-- 弹窗 -->
  21. <XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
  22. <!-- 表单:详情 -->
  23. <Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
  24. <template #footer>
  25. <!-- 按钮:关闭 -->
  26. <XButton :title="t('dialog.close')" @click="dialogVisible = false" />
  27. </template>
  28. </XModal>
  29. </template>
  30. <script setup lang="ts" name="Loginlog">
  31. // 全局相关的 import
  32. import { ref } from 'vue'
  33. import { useI18n } from '@/hooks/web/useI18n'
  34. import { useXTable } from '@/hooks/web/useXTable'
  35. // 业务相关的 import
  36. import { allSchemas } from './loginLog.data'
  37. import { getLoginLogPageApi, exportLoginLogApi, LoginLogVO } from '@/api/system/loginLog'
  38. const { t } = useI18n() // 国际化
  39. // 列表相关的变量
  40. const [registerTable, { exportList }] = useXTable({
  41. allSchemas: allSchemas,
  42. getListApi: getLoginLogPageApi,
  43. exportListApi: exportLoginLogApi
  44. })
  45. // 详情操作
  46. const detailData = ref() // 详情 Ref
  47. const dialogVisible = ref(false) // 是否显示弹出层
  48. const dialogTitle = ref(t('action.detail')) // 弹出层标题
  49. // 详情
  50. const handleDetail = async (row: LoginLogVO) => {
  51. // 设置数据
  52. detailData.value = row
  53. dialogVisible.value = true
  54. }
  55. // 导出操作
  56. const handleExport = async () => {
  57. await exportList('登录列表.xls')
  58. }
  59. </script>