From 72b0ec23f596f873a527aacf467266588530c068 Mon Sep 17 00:00:00 2001
From: YunaiV <zhijiantianya@gmail.com>
Date: Fri, 10 Mar 2023 08:15:30 +0800
Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=AE=8C=E5=96=84?=
 =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86=E7=9A=84=E5=AF=BC=E5=87=BA?=
 =?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/views/infra/config/index.vue | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/views/infra/config/index.vue b/src/views/infra/config/index.vue
index 4e8b64b6..dd15ff8c 100644
--- a/src/views/infra/config/index.vue
+++ b/src/views/infra/config/index.vue
@@ -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()