Files
ipms-sjy/yudao-ui-admin-vue3/src/views/system/loginlog/index.vue

67 lines
2.1 KiB
Vue
Raw Normal View History

2022-11-13 14:49:59 +08:00
<template>
<ContentWrap>
<!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
<template #toolbar_buttons>
<XButton
type="primary"
preIcon="ep:download"
:title="t('action.export')"
@click="handleExport()"
/>
</template>
<template #actionbtns_default="{ row }">
<!-- 操作详情 -->
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
</template>
</vxe-grid>
</ContentWrap>
<!-- 弹窗 -->
<XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
<template #default>
<!-- 表单详情 -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef" />
</template>
<template #footer>
<!-- 按钮关闭 -->
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</XModal>
</template>
2022-07-18 19:06:37 +08:00
<script setup lang="ts">
2022-11-13 14:49:59 +08:00
// 全局相关的 import
2022-07-18 19:06:37 +08:00
import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
2022-11-13 14:49:59 +08:00
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
import { VxeGridInstance } from 'vxe-table'
import { allSchemas } from './loginLog.data'
import { getLoginLogPageApi, exportLoginLogApi, LoginLogVO } from '@/api/system/loginLog'
import download from '@/utils/download'
2022-07-18 19:06:37 +08:00
const { t } = useI18n() // 国际化
2022-11-13 14:49:59 +08:00
// 列表相关的变量
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
const { gridOptions } = useVxeGrid<LoginLogVO>({
allSchemas: allSchemas,
getListApi: getLoginLogPageApi
2022-07-18 19:06:37 +08:00
})
// 详情操作
2022-11-13 14:49:59 +08:00
const detailRef = ref() // 详情 Ref
2022-07-18 19:06:37 +08:00
const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref(t('action.detail')) // 弹出层标题
const handleDetail = async (row: LoginLogVO) => {
// 设置数据
detailRef.value = row
dialogVisible.value = true
}
2022-11-13 14:49:59 +08:00
// 导出操作
const handleExport = async () => {
const queryParams = Object.assign(
{},
JSON.parse(JSON.stringify(xGrid.value?.getRefMaps().refForm.value.data))
)
const res = await exportLoginLogApi(queryParams)
download.excel(res, '登录列表.xls')
}
2022-07-18 19:06:37 +08:00
</script>