69 lines
2.0 KiB
Vue
Raw Normal View History

2022-07-18 19:06:37 +08:00
<template>
<ContentWrap>
<!-- 列表 -->
2022-11-15 20:43:02 +08:00
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
<!-- 操作导出 -->
<template #toolbar_buttons>
<XButton
type="warning"
preIcon="ep:download"
:title="t('action.export')"
@click="handleExport()"
/>
2022-07-18 19:06:37 +08:00
</template>
2022-11-15 20:43:02 +08:00
<template #actionbtns_default="{ row }">
2022-11-15 17:42:04 +08:00
<XTextButton preIcon="ep:view" :title="t('action.detail')" @click="handleDetail(row)" />
2022-07-18 19:06:37 +08:00
</template>
2022-11-15 20:43:02 +08:00
</vxe-grid>
2022-07-18 19:06:37 +08:00
</ContentWrap>
2022-11-15 20:43:02 +08:00
<XModal id="smsLog" v-model="dialogVisible" :title="dialogTitle">
2022-07-18 19:06:37 +08:00
<!-- 对话框(详情) -->
<Descriptions
v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema"
:data="detailRef"
2022-11-15 17:05:05 +08:00
/>
2022-07-18 19:06:37 +08:00
<!-- 操作按钮 -->
<template #footer>
2022-11-15 17:42:04 +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-15 17:42:04 +08:00
<script setup lang="ts">
2022-11-15 20:43:02 +08:00
// 全局相关的 import
2022-11-15 17:42:04 +08:00
import { ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
2022-11-15 20:43:02 +08:00
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
import { VxeGridInstance } from 'vxe-table'
2022-11-15 17:42:04 +08:00
import { allSchemas } from './sms.log.data'
import * as SmsLoglApi from '@/api/system/sms/smsLog'
const { t } = useI18n() // 国际化
2022-11-15 20:43:02 +08:00
// 列表相关的变量
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
const { gridOptions, exportList } = useVxeGrid<SmsLoglApi.SmsLogVO>({
allSchemas: allSchemas,
getListApi: SmsLoglApi.getSmsLogPageApi,
exportListApi: SmsLoglApi.exportSmsLogApi
2022-11-15 17:42:04 +08:00
})
2022-11-15 20:43:02 +08:00
// 弹窗相关的变量
2022-11-15 17:42:04 +08:00
const dialogVisible = ref(false) // 是否显示弹出层
2022-11-15 20:43:02 +08:00
const dialogTitle = ref('edit') // 弹出层标题
const actionType = ref('') // 操作按钮的类型
2022-11-15 17:42:04 +08:00
// ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref
2022-11-15 20:43:02 +08:00
const handleDetail = (row: SmsLoglApi.SmsLogVO) => {
2022-11-15 17:42:04 +08:00
// 设置数据
detailRef.value = row
dialogVisible.value = true
}
2022-11-15 20:43:02 +08:00
// 导出操作
const handleExport = async () => {
await exportList(xGrid, '短信日志.xls')
}
2022-11-15 17:42:04 +08:00
</script>