From 02bbf25456f3a0165313340be277cfa4a2b3b24f Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 25 十二月 2024 18:09:51 +0800 Subject: [PATCH] 调度记录查看 --- src/api/model/sche/record/index.ts | 15 +++ src/views/model/sche/scheme/index.vue | 19 ++++ src/views/model/sche/scheme/record/index.vue | 153 ++++++++++++++++++++++++++++++++++++++ src/views/model/sche/scheme/record/RecordForm.vue | 0 4 files changed, 185 insertions(+), 2 deletions(-) diff --git a/src/api/model/sche/record/index.ts b/src/api/model/sche/record/index.ts new file mode 100644 index 0000000..f712041 --- /dev/null +++ b/src/api/model/sche/record/index.ts @@ -0,0 +1,15 @@ +import request from '@/config/axios' + +export interface StScheduleRecordPageReqVO extends PageParam { + schemeId?: string +} + +// 查询ScheduleRecord列表 +export const getScheduleRecordPage = (params: StScheduleRecordPageReqVO) => { + return request.get({ url: '/model/sche/record/page', params }) +} + +// 查询ScheduleRecord详情 +export const getScheduleRecord = (id: string) => { + return request.get({ url: '/model/sche/record/get?id=' + id}) +} diff --git a/src/views/model/sche/scheme/index.vue b/src/views/model/sche/scheme/index.vue index 6212a90..53f055a 100644 --- a/src/views/model/sche/scheme/index.vue +++ b/src/views/model/sche/scheme/index.vue @@ -81,6 +81,14 @@ </el-button> <el-button link + type="primary" + @click="openRecordList(scope.row.id)" + v-hasPermi="['sche:record:query']" + > + 日志 + </el-button> + <el-button + link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['sche:scheme:delete']" @@ -102,13 +110,14 @@ <!-- 表单弹窗:添加/修改 --> <ScheduleSchemeForm ref="formRef" @success="getList" /> + <!-- 表单弹窗:添加/修改 --> + <RecordList ref="recordRef" /> </template> <script lang="ts" setup> import {DICT_TYPE, getIntDictOptions} from '@/utils/dict' - import {dateFormatter} from '@/utils/formatTime' - import download from '@/utils/download' import * as ScheduleSchemeApi from '@/api/model/sche/scheme' import ScheduleSchemeForm from './ScheduleSchemeForm.vue' + import RecordList from './record/index.vue' defineOptions({name: 'ScheduleScheme'}) @@ -171,6 +180,12 @@ } } + /** 调用日志查看 */ + const recordRef = ref() + const openRecordList = (id?: string) => { + recordRef.value.open(id) + } + /** 初始化 **/ onMounted(async () => { await getList() diff --git a/src/views/model/sche/scheme/record/RecordForm.vue b/src/views/model/sche/scheme/record/RecordForm.vue new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/views/model/sche/scheme/record/RecordForm.vue diff --git a/src/views/model/sche/scheme/record/index.vue b/src/views/model/sche/scheme/record/index.vue new file mode 100644 index 0000000..4d74cda --- /dev/null +++ b/src/views/model/sche/scheme/record/index.vue @@ -0,0 +1,153 @@ +<template> + <el-drawer + v-model="drawer" + size="50%" + title="调度日志" + :direction="direction" + :before-close="handleClose" + > + <!-- 搜索 --> + <ContentWrap> + <el-form + class="-mb-15px" + :model="queryParams" + ref="queryFormRef" + :inline="true" + label-width="68px" + > + <el-form-item> + <el-date-picker + v-model="queryParams.startTime" + format="YYYY-MM-DD HH:mm:00" + value-format="YYYY-MM-DD HH:mm:00" + type="datetime" + placeholder="选择日期时间" + /> + </el-form-item> + <el-form-item> + <el-date-picker + v-model="queryParams.endTime" + format="YYYY-MM-DD HH:mm:00" + value-format="YYYY-MM-DD HH:mm:00" + type="datetime" + placeholder="选择日期时间" + /> + </el-form-item> + <el-form-item> + <el-button @click="handleQuery"> + <Icon icon="ep:search" class="mr-5px" /> + 搜索 + </el-button> + <el-button @click="resetQuery"> + <Icon icon="ep:refresh" class="mr-5px" /> + 重置 + </el-button> + </el-form-item> + </el-form> + </ContentWrap> + <!-- 列表 --> + <ContentWrap> + <el-table v-loading="loading" :data="list"> + <el-table-column + prop="scheduleTime" + label="调度时间" + header-align="center" + align="left" + min-width="150" + /> + <el-table-column + prop="resultCode" + label="结果状态" + header-align="center" + align="center" + /> + <el-table-column + prop="resultData" + label="结果数据" + header-align="center" + align="center" + min-width="400" + /> + </el-table> + <!-- 分页 --> + <Pagination + :total="total" + v-model:page="queryParams.pageNo" + v-model:limit="queryParams.pageSize" + @pagination="getList" + /> + </ContentWrap> + </el-drawer> +</template> +<script lang="ts" setup> +import type { DrawerProps } from 'element-plus' +import * as ScheduleRecordApi from "@/api/model/sche/record"; +import {reactive, ref} from "vue"; + +defineOptions({name: 'RecordList'}) + +const message = useMessage() // 消息弹窗 +const {t} = useI18n() // 国际化 + +const drawer = ref(false) +const direction = ref<DrawerProps['direction']>('rtl') +const loading = ref(true) // 列表的加载中 +const total = ref(0) // 列表的总页数 +const list = ref([]) // 列表的数据 +const queryParams = reactive({ + pageNo: 1, + pageSize: 10, + schemeId: undefined, + startTime: undefined, + endTime: undefined, +}) +const queryFormRef = ref() // 搜索的表单 +const exportLoading = ref(false) // 导出的加载中 + +/** 查询列表 */ +const getList = async () => { + loading.value = true + try { + const page = await ScheduleRecordApi.getScheduleRecordPage(queryParams) + list.value = page.list + total.value = page.total + } finally { + loading.value = false + } +} + +/** 搜索按钮操作 */ +const handleQuery = () => { + queryParams.pageNo = 1 + getList() +} + +/** 重置按钮操作 */ +const resetQuery = () => { + queryFormRef.value.resetFields() + handleQuery() +} + +/** 打开弹窗 */ +const open = async (id?: string) => { + resetForm() + drawer.value = true + queryParams.schemeId = id + if (id) { + getList() + } +} +defineExpose({open}) // 提供 open 方法,用于打开弹窗 + +/** 重置表单 */ +const resetForm = () => { + queryParams.pageNo = 1 + queryParams.pageSize = 10 + queryParams.schemeId = '' + queryParams.startTime = undefined + queryParams.endTime = undefined +} +const handleClose = (done: () => void) => { + drawer.value = false +} +</script> -- Gitblit v1.9.3