66 lines
2.1 KiB
Vue
Raw Normal View History

2022-07-18 19:06:37 +08:00
<template>
<ContentWrap>
<!-- 列表 -->
2023-01-03 11:21:27 +08:00
<XTable @register="registerTable">
2022-11-21 15:27:06 +08:00
<template #duration_default="{ row }">
2022-07-18 19:06:37 +08:00
<span>{{ row.duration + 'ms' }}</span>
</template>
2022-11-21 15:27:06 +08:00
<template #resultCode_default="{ row }">
2022-07-18 19:06:37 +08:00
<span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span>
</template>
2022-11-21 15:27:06 +08:00
<template #actionbtns_default="{ row }">
<!-- 操作详情 -->
<XTextButton
preIcon="ep:view"
:title="t('action.detail')"
2022-07-18 19:06:37 +08:00
v-hasPermi="['infra:api-access-log:query']"
@click="handleDetail(row)"
2022-11-21 15:27:06 +08:00
/>
2022-07-18 19:06:37 +08:00
</template>
2023-01-03 11:21:27 +08:00
</XTable>
2022-07-18 19:06:37 +08:00
</ContentWrap>
2022-11-15 12:25:19 +08:00
<XModal v-model="dialogVisible" :title="dialogTitle">
2022-07-18 19:06:37 +08:00
<!-- 对话框(详情) -->
2022-12-06 23:46:13 +08:00
<Descriptions :schema="allSchemas.detailSchema" :data="detailData">
2022-07-18 19:06:37 +08:00
<template #duration="{ row }">
<span>{{ row.duration + 'ms' }}</span>
</template>
<template #resultCode="{ row }">
<span>{{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }}</span>
</template>
</Descriptions>
<!-- 操作按钮 -->
<template #footer>
2022-11-29 20:41:02 +08:00
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
2022-07-18 19:06:37 +08:00
</template>
2022-11-15 12:25:19 +08:00
</XModal>
2022-07-18 19:06:37 +08:00
</template>
2022-11-23 22:26:25 +08:00
<script setup lang="ts" name="ApiAccessLog">
2022-11-21 15:27:06 +08:00
import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
2023-01-03 11:21:27 +08:00
import { useXTable } from '@/hooks/web/useXTable'
2022-11-21 15:27:06 +08:00
import { allSchemas } from './apiAccessLog.data'
import * as ApiAccessLogApi from '@/api/infra/apiAccessLog'
2023-01-03 11:21:27 +08:00
2022-11-21 15:27:06 +08:00
const { t } = useI18n() // 国际化
// 列表相关的变量
2023-01-03 11:21:27 +08:00
const [registerTable] = useXTable({
2022-11-21 15:27:06 +08:00
allSchemas: allSchemas,
topActionSlots: false,
getListApi: ApiAccessLogApi.getApiAccessLogPageApi
})
// ========== 详情相关 ==========
2022-12-06 23:46:13 +08:00
const detailData = ref() // 详情 Ref
2022-11-21 15:27:06 +08:00
const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref('') // 弹出层标题
// 详情操作
const handleDetail = (row: ApiAccessLogApi.ApiAccessLogVO) => {
// 设置数据
2022-12-06 23:46:13 +08:00
detailData.value = row
2022-11-21 15:27:06 +08:00
dialogTitle.value = t('action.detail')
dialogVisible.value = true
}
</script>