<template>
|
<Dialog v-model="dialogVisible" :title="dialogTitle" width="80%">
|
<!-- 搜索工作栏 -->
|
<ContentWrap>
|
<el-form
|
class="-mb-15px"
|
:model="queryParams"
|
ref="queryFormRef"
|
:inline="true"
|
label-width="68px"
|
>
|
<el-form-item prop="startTime">
|
<el-date-picker
|
v-model="queryParams.startTime"
|
type="datetime"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
placeholder="选择日期时间"/>
|
</el-form-item>
|
<el-form-item prop="endTime">
|
<el-date-picker
|
v-model="queryParams.endTime"
|
type="datetime"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
placeholder="选择日期时间"/>
|
</el-form-item>
|
<el-form-item>
|
<el-button @click="getList"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
</el-form-item>
|
</el-form>
|
</ContentWrap>
|
|
<!-- 列表 -->
|
<ContentWrap>
|
<el-table
|
v-loading="loading"
|
:data="list"
|
row-key="id"
|
border
|
>
|
<el-table-column label="文件名" header-align="center" align="center">
|
<template #default="scope">
|
<a style="cursor: pointer;color: #409eff" @click="downloadHistory(scope.row.id,scope.row.fileName)">{{ scope.row.fileName }}</a>
|
</template>
|
</el-table-column>
|
<el-table-column prop="remark" label="备注" header-align="center" align="center"/>
|
<el-table-column prop="createTime" label="生成时间" :formatter="dateFormatter" header-align="center" align="center" width="200"/>
|
</el-table>
|
<!-- 分页 -->
|
<Pagination
|
v-model:limit="queryParams.pageSize"
|
v-model:page="queryParams.page"
|
:total="total"
|
@pagination="getList"
|
/>
|
</ContentWrap>
|
</Dialog>
|
</template>
|
<script lang="ts" setup>
|
import download from "@/utils/download";
|
import * as HistoryApi from "@/api/model/mpk/mpkHistory";
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
const { t } = useI18n() // 国际化
|
const message = useMessage() // 消息弹窗
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogTitle = ref('生成历史') // 弹窗的标题
|
|
const loading = ref(true) // 列表的加载中
|
const total = ref(0) // 列表的总页数
|
const list = ref([]) // 字典表格数据
|
const queryParams = reactive({
|
page: 1,
|
pageSize: 10,
|
mdkId: '',
|
startTime: undefined,
|
endTime: undefined,
|
})
|
|
/** 打开弹窗 */
|
const open = async (mdkId: String) => {
|
dialogVisible.value = true
|
queryParams.mdkId = mdkId;
|
queryParams.startTime = undefined;
|
queryParams.endTime = undefined;
|
getList()
|
}
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
const getList = async () => {
|
loading.value = true
|
try {
|
const data = await HistoryApi.getPage(queryParams)
|
list.value = data.list
|
total.value = data.total
|
} finally {
|
loading.value = false
|
}
|
}
|
|
const downloadHistory = async (id,fileName) => {
|
const param = {
|
'id': id,
|
}
|
const data = await HistoryApi.download(param)
|
download.zip(data, fileName)
|
}
|
</script>
|