重构:完善配置管理的导出功能

This commit is contained in:
YunaiV 2023-03-10 08:15:30 +08:00
parent faaa47abdc
commit 72b0ec23f5

View File

@ -144,6 +144,7 @@ import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import * as ConfigApi from '@/api/infra/config'
import ConfigForm from './form.vue'
import dayjs from 'dayjs'
import download from '@/utils/download'
const message = useMessage() //
const { t } = useI18n() //
@ -162,12 +163,6 @@ const queryParams = reactive({
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 查询参数列表 */
const getList = async () => {
loading.value = true
@ -180,6 +175,12 @@ const getList = async () => {
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
@ -195,7 +196,7 @@ const openModal = (type: string, id?: number) => {
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
//
await message.delConfirm()
//
await ConfigApi.deleteConfig(id)
@ -205,6 +206,20 @@ const handleDelete = async (id: number) => {
} catch {}
}
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ConfigApi.exportConfigApi(queryParams)
download.excel(data, '参数配置.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()