소스 검색

Merge branch 'master' of http://62.234.61.92:3000/wjm/mec-cloud_IntelligentManufacturing_CRM

lph 1 년 전
부모
커밋
343afe67eb
2개의 변경된 파일54개의 추가작업 그리고 18개의 파일을 삭제
  1. 2 1
      zkqy-ui/src/api/system/engineering.js
  2. 52 17
      zkqy-ui/src/views/system/engineeringManage/index.vue

+ 2 - 1
zkqy-ui/src/api/system/engineering.js

@@ -47,6 +47,7 @@ export function delEngineering(id) {
 export function downloadEngineering() {
   return request({
     url: '/system/engineering/download',
-    method: 'get'
+    method: 'get',
+    responseType: 'blob'
   })
 }

+ 52 - 17
zkqy-ui/src/views/system/engineeringManage/index.vue

@@ -30,11 +30,11 @@
           icon="el-icon-search"
           size="mini"
           @click="handleQuery"
-          >搜索</el-button
-        >
+          >搜索
+        </el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
-          >重置</el-button
-        >
+          >重置
+        </el-button>
       </el-form-item>
     </el-form>
 
@@ -47,8 +47,8 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['system:engineering:add']"
-          >新增</el-button
-        >
+          >新增
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -59,8 +59,8 @@
           :disabled="single"
           @click="handleUpdate"
           v-hasPermi="['system:engineering:edit']"
-          >修改</el-button
-        >
+          >修改
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -71,8 +71,8 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['system:engineering:remove']"
-          >删除</el-button
-        >
+          >删除
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -82,8 +82,8 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['system:engineering:export']"
-          >导出</el-button
-        >
+          >导出
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -91,10 +91,10 @@
           plain
           icon="el-icon-download"
           size="mini"
-          @click="handleDownload"
+          @click="handleDownloadEnd"
           v-hasPermi="['system:engineering:download']"
-          >下载</el-button
-        >
+          >下载
+        </el-button>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -285,6 +285,35 @@ export default {
     this.getList();
   },
   methods: {
+    handleDownloadEnd(row) {
+      this.loading = true;
+      let applicationType = "application/zip";
+      var fileTheName = "123";
+
+      downloadEngineering().then((res) => {
+        if (res) {
+          const content = res;
+          const blob = new Blob([content], { type: applicationType });
+          const fileName = fileTheName;
+          if ("download" in document.createElement("a")) {
+            // 非IE下载
+            const elink = document.createElement("a");
+            elink.download = fileName;
+            elink.style.display = "none";
+            elink.href = URL.createObjectURL(blob);
+            document.body.appendChild(elink);
+            elink.click();
+            URL.revokeObjectURL(elink.href); // 释放URL 对象
+            document.body.removeChild(elink);
+            this.loading = false;
+          } else {
+            // IE10+下载
+            navigator.msSaveBlob(blob, fileName);
+            this.loading = false;
+          }
+        }
+      });
+    },
     /** 查询工程部署列表 */
     getList() {
       this.loading = true;
@@ -450,8 +479,14 @@ export default {
         spinner: "el-icon-loading",
         background: "rgba(0, 0, 0, 0.7)",
       });
-      return axios
-        .get(url, { responseType: "blob" })
+      return service
+        .get(url, params, {
+          headers: {
+            "Content-Disposition": `attachment;filename="${filename}"`,
+            "Content-Type": `application/zip`,
+          },
+          responseType: "blob",
+        })
         .then(async (data) => {
           const isBlob = blobValidate(data);
           if (isBlob) {