ソースを参照

update 重构 将下载excel工具提取到全局

疯狂的狮子li 3 年 前
コミット
f91ebd93d2

+ 2 - 1
ruoyi-ui/src/main.js

@@ -16,7 +16,7 @@ import './assets/icons' // icon
 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.addDateRange = addDateRange
 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" });

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/demo/demo/export', this.queryParams);
+      this.downLoadExcel('/demo/demo/export', this.queryParams);
     }
   }
 };

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/monitor/job/export', this.queryParams);
+      this.downLoadExcel('/monitor/job/export', this.queryParams);
     }
   }
 };

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/monitor/jobLog/export', this.queryParams);
+      this.downLoadExcel('/monitor/jobLog/export', this.queryParams);
     }
   }
 };

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/monitor/logininfor/export', this.queryParams);
+      this.downLoadExcel('/monitor/logininfor/export', this.queryParams);
     }
   }
 };

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/monitor/operlog/export', this.queryParams);
+      this.downLoadExcel('/monitor/operlog/export', this.queryParams);
     }
   }
 };

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/system/config/export', this.queryParams);
+      this.downLoadExcel('/system/config/export', this.queryParams);
     },
     /** 刷新缓存按钮操作 */
     handleRefreshCache() {

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/system/dict/data/export', this.queryParams);
+      this.downLoadExcel('/system/dict/data/export', this.queryParams);
     }
   }
 };

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/system/dict/type/export', this.queryParams);
+      this.downLoadExcel('/system/dict/type/export', this.queryParams);
     },
     /** 刷新缓存按钮操作 */
     handleRefreshCache() {

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/system/post/export', this.queryParams);
+      this.downLoadExcel('/system/post/export', this.queryParams);
     }
   }
 };

+ 1 - 2
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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/system/role/export', this.queryParams);
+      this.downLoadExcel('/system/role/export', this.queryParams);
     }
   }
 };

+ 2 - 3
ruoyi-ui/src/views/system/user/index.vue

@@ -351,7 +351,6 @@ import { getToken } from "@/utils/auth";
 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 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      downLoadExcel('/system/user/export', this.queryParams);
+      this.downLoadExcel('/system/user/export', this.queryParams);
     },
     /** 导入按钮操作 */
     handleImport() {
@@ -670,7 +669,7 @@ export default {
     },
     /** 下载模板操作 */
     importTemplate() {
-      downLoadExcel('/system/user/importTemplate');
+      this.downLoadExcel('/system/user/importTemplate');
     },
     // 文件上传中处理
     handleFileUploadProgress(event, file, fileList) {