From f91ebd93d2b60400d7e90e9967da1d2336c580a3 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 23 八月 2021 18:28:33 +0800
Subject: [PATCH] update 重构 将下载excel工具提取到全局

---
 ruoyi-ui/src/views/system/dict/data.vue         |    3 +--
 ruoyi-ui/src/views/system/dict/index.vue        |    3 +--
 ruoyi-ui/src/views/monitor/job/log.vue          |    3 +--
 ruoyi-ui/src/views/demo/demo/index.vue          |    3 +--
 ruoyi-ui/src/main.js                            |    3 ++-
 ruoyi-ui/src/views/system/role/index.vue        |    3 +--
 ruoyi-ui/src/views/system/user/index.vue        |    5 ++---
 ruoyi-ui/src/views/monitor/job/index.vue        |    3 +--
 ruoyi-ui/src/views/monitor/logininfor/index.vue |    3 +--
 ruoyi-ui/src/views/monitor/operlog/index.vue    |    3 +--
 ruoyi-ui/src/views/system/config/index.vue      |    3 +--
 ruoyi-ui/src/views/system/post/index.vue        |    3 +--
 12 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js
index 5bc2b6c..f926e66 100644
--- a/ruoyi-ui/src/main.js
+++ b/ruoyi-ui/src/main.js
@@ -16,7 +16,7 @@
 import './permission' // permission control
 import { getDicts } from "@/api/system/dict/data";
 import { getConfigKey } from "@/api/system/config";
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
+import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
 import Pagination from "@/components/Pagination";
 // 鑷畾涔夎〃鏍煎伐鍏风粍浠�
 import RightToolbar from "@/components/RightToolbar"
@@ -40,6 +40,7 @@
 Vue.prototype.selectDictLabel = selectDictLabel
 Vue.prototype.selectDictLabels = selectDictLabels
 Vue.prototype.handleTree = handleTree
+Vue.prototype.downLoadExcel = downLoadExcel
 
 Vue.prototype.msgSuccess = function (msg) {
   this.$message({ showClose: true, message: msg, type: "success" });
diff --git a/ruoyi-ui/src/views/demo/demo/index.vue b/ruoyi-ui/src/views/demo/demo/index.vue
index a0d9edc..791ab7e 100644
--- a/ruoyi-ui/src/views/demo/demo/index.vue
+++ b/ruoyi-ui/src/views/demo/demo/index.vue
@@ -170,7 +170,6 @@
 
 <script>
 import { listDemo, pageDemo, getDemo, delDemo, addDemo, updateDemo } from "@/api/demo/demo";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Demo",
@@ -361,7 +360,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/demo/demo/export', this.queryParams);
+      this.downLoadExcel('/demo/demo/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue
index d12e73e..7cbcd82 100644
--- a/ruoyi-ui/src/views/monitor/job/index.vue
+++ b/ruoyi-ui/src/views/monitor/job/index.vue
@@ -281,7 +281,6 @@
 
 <script>
 import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Job",
@@ -506,7 +505,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/monitor/job/export', this.queryParams);
+      this.downLoadExcel('/monitor/job/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue
index 8ce0111..5a1984c 100644
--- a/ruoyi-ui/src/views/monitor/job/log.vue
+++ b/ruoyi-ui/src/views/monitor/job/log.vue
@@ -179,7 +179,6 @@
 <script>
 import { getJob } from "@/api/monitor/job";
 import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "JobLog",
@@ -311,7 +310,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/monitor/jobLog/export', this.queryParams);
+      this.downLoadExcel('/monitor/jobLog/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue
index 5d6c051..79ccb61 100644
--- a/ruoyi-ui/src/views/monitor/logininfor/index.vue
+++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue
@@ -120,7 +120,6 @@
 
 <script>
 import { list, delLogininfor, cleanLogininfor } from "@/api/monitor/logininfor";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Logininfor",
@@ -229,7 +228,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/monitor/logininfor/export', this.queryParams);
+      this.downLoadExcel('/monitor/logininfor/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue
index 6462cd2..c6fe486 100644
--- a/ruoyi-ui/src/views/monitor/operlog/index.vue
+++ b/ruoyi-ui/src/views/monitor/operlog/index.vue
@@ -189,7 +189,6 @@
 
 <script>
 import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Operlog",
@@ -317,7 +316,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/monitor/operlog/export', this.queryParams);
+      this.downLoadExcel('/monitor/operlog/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue
index 69d8564..56654c8 100644
--- a/ruoyi-ui/src/views/system/config/index.vue
+++ b/ruoyi-ui/src/views/system/config/index.vue
@@ -182,7 +182,6 @@
 
 <script>
 import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Config",
@@ -343,7 +342,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/system/config/export', this.queryParams);
+      this.downLoadExcel('/system/config/export', this.queryParams);
     },
     /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
     handleRefreshCache() {
diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue
index cd86963..3b8ec4b 100644
--- a/ruoyi-ui/src/views/system/dict/data.vue
+++ b/ruoyi-ui/src/views/system/dict/data.vue
@@ -185,7 +185,6 @@
 <script>
 import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
 import { listType, getType } from "@/api/system/dict/type";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Data",
@@ -389,7 +388,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/system/dict/data/export', this.queryParams);
+      this.downLoadExcel('/system/dict/data/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue
index d7a0b00..b4ac1da 100644
--- a/ruoyi-ui/src/views/system/dict/index.vue
+++ b/ruoyi-ui/src/views/system/dict/index.vue
@@ -194,7 +194,6 @@
 
 <script>
 import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Dict",
@@ -347,7 +346,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/system/dict/type/export', this.queryParams);
+      this.downLoadExcel('/system/dict/type/export', this.queryParams);
     },
     /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
     handleRefreshCache() {
diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue
index f5b77c7..a68e460 100644
--- a/ruoyi-ui/src/views/system/post/index.vue
+++ b/ruoyi-ui/src/views/system/post/index.vue
@@ -157,7 +157,6 @@
 
 <script>
 import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Post",
@@ -314,7 +313,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/system/post/export', this.queryParams);
+      this.downLoadExcel('/system/post/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue
index 0057413..59880bd 100644
--- a/ruoyi-ui/src/views/system/role/index.vue
+++ b/ruoyi-ui/src/views/system/role/index.vue
@@ -262,7 +262,6 @@
 import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus } from "@/api/system/role";
 import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
 import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "Role",
@@ -626,7 +625,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/system/role/export', this.queryParams);
+      this.downLoadExcel('/system/role/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue
index 3214a72..d06d500 100644
--- a/ruoyi-ui/src/views/system/user/index.vue
+++ b/ruoyi-ui/src/views/system/user/index.vue
@@ -351,7 +351,6 @@
 import { treeselect } from "@/api/system/dept";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { downLoadExcel } from "@/utils/download";
 
 export default {
   name: "User",
@@ -661,7 +660,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      downLoadExcel('/system/user/export', this.queryParams);
+      this.downLoadExcel('/system/user/export', this.queryParams);
     },
     /** 瀵煎叆鎸夐挳鎿嶄綔 */
     handleImport() {
@@ -670,7 +669,7 @@
     },
     /** 涓嬭浇妯℃澘鎿嶄綔 */
     importTemplate() {
-      downLoadExcel('/system/user/importTemplate');
+      this.downLoadExcel('/system/user/importTemplate');
     },
     // 鏂囦欢涓婁紶涓鐞�
     handleFileUploadProgress(event, file, fileList) {

--
Gitblit v1.9.3