瀏覽代碼

添加批量导出功能

zhuf 1 年之前
父節點
當前提交
825d7a439d
共有 2 個文件被更改,包括 8 次插入5 次删除
  1. 7 5
      src/pages/admin/back/ctfx.vue
  2. 1 0
      src/utils/request.ts

+ 7 - 5
src/pages/admin/back/ctfx.vue

@@ -3,6 +3,7 @@ import { Search } from '@element-plus/icons-vue'
 import { RouteLocationRaw, useRouter } from 'vue-router'
 import { Grade, Status, Subject } from '~/store/info'
 import user from '~/store/user'
+import { download } from "~/utils/request";
 
 const router = useRouter()
 function routerPush(_route: RouteLocationRaw) {
@@ -66,13 +67,14 @@ function doDelete() {
 function doExport() {
   if (multipleSelection.value.length === 0)
     return ElMessage.error('请先勾选导出的数据')
-  request({
-    url: '/dyaw/ctfx/index',
-    data: {
+
+
+  download('/dyaw/ctfx/index',
+    {
       dc_id: multipleSelection.value.map(item => item.dc_id).join(','),
-      api: 'xls'
+      site: 'dyaw'
     }
-  })
+  )
 }
 
 

+ 1 - 0
src/utils/request.ts

@@ -94,6 +94,7 @@ export function download(url: string, data?: object | null) {
   const paramsStr = Object.entries(params).map(([k, v]) => `${k}=${v}`).join('&')
   const el = document.createElement('a')
   const href = `${window.GLOBAL_CONFIG.api}${url}?${paramsStr}`
+  console.log('download : ', href)
   el.setAttribute('href', href)
   el.click()
 }