index.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <ContentWrap>
  3. <!-- 列表 -->
  4. <XTable @register="registerTable">
  5. <template #toolbar_buttons>
  6. <!-- 操作:新增 -->
  7. <XButton
  8. type="warning"
  9. preIcon="ep:download"
  10. :title="t('action.export')"
  11. v-hasPermi="['system:operate-log:export']"
  12. @click="exportList('操作日志.xls')"
  13. />
  14. </template>
  15. <template #duration="{ row }">
  16. <span>{{ row.duration + 'ms' }}</span>
  17. </template>
  18. <template #resultCode="{ row }">
  19. <span>{{ row.resultCode === 0 ? '成功' : '失败' }}</span>
  20. </template>
  21. <template #actionbtns_default="{ row }">
  22. <!-- 操作:详情 -->
  23. <XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
  24. </template>
  25. </XTable>
  26. </ContentWrap>
  27. <!-- 弹窗 -->
  28. <XModal id="postModel" v-model="dialogVisible" :title="t('action.detail')">
  29. <!-- 对话框(详情) -->
  30. <Descriptions :schema="allSchemas.detailSchema" :data="detailData">
  31. <template #resultCode="{ row }">
  32. <span>{{ row.resultCode === 0 ? '成功' : '失败' }}</span>
  33. </template>
  34. <template #duration="{ row }">
  35. <span>{{ row.duration + 'ms' }}</span>
  36. </template>
  37. </Descriptions>
  38. <template #footer>
  39. <!-- 按钮:关闭 -->
  40. <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
  41. </template>
  42. </XModal>
  43. </template>
  44. <script setup lang="ts" name="OperateLog">
  45. // 全局相关的 import
  46. import { ref } from 'vue'
  47. import { useI18n } from '@/hooks/web/useI18n'
  48. import { useXTable } from '@/hooks/web/useXTable'
  49. // 业务相关的 import
  50. import * as OperateLogApi from '@/api/system/operatelog'
  51. import { allSchemas } from './operatelog.data'
  52. const { t } = useI18n() // 国际化
  53. // 列表相关的变量
  54. const [registerTable, { exportList }] = useXTable({
  55. allSchemas: allSchemas,
  56. getListApi: OperateLogApi.getOperateLogPageApi,
  57. exportListApi: OperateLogApi.exportOperateLogApi
  58. })
  59. // 弹窗相关的变量
  60. const dialogVisible = ref(false) // 是否显示弹出层
  61. const actionLoading = ref(false) // 按钮 Loading
  62. const detailData = ref() // 详情 Ref
  63. // 详情
  64. const handleDetail = (row: OperateLogApi.OperateLogVO) => {
  65. // 设置数据
  66. detailData.value = row
  67. dialogVisible.value = true
  68. }
  69. </script>