Browse Source

Merge branch 'master' into 测试

lxf 1 năm trước cách đây
mục cha
commit
d5d791bbc0

+ 11 - 2
src/views/group/data-board/material-in-transit/index.vue

@@ -30,7 +30,7 @@
 <script setup>
 import byTable from "/src/components/byTable/index";
 import moment from "moment";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 
 const { proxy } = getCurrentInstance();
 const sourceList = ref({
@@ -155,7 +155,16 @@ const deriveExcel = () => {
   })
     .then(() => {
       proxy.postFile("/purchaseInTransitBom/export", sourceList.value.pagination).then((res) => {
-        proxy.downloadFile(res, "在途物料-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "在途物料-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        }
       });
     })
     .catch(() => {});

+ 11 - 2
src/views/group/data-board/sku-quoted-price/index.vue

@@ -38,7 +38,7 @@
 
 <script setup>
 import byTable from "/src/components/byTable/index";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -193,7 +193,16 @@ const deriveExcel = () => {
   })
     .then(() => {
       proxy.postFile("/skuSpecQuotationBoard/exportExcel", sourceList.value.pagination).then((res) => {
-        proxy.downloadFile(res, "SKU报价看板-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "SKU报价看板-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        }
       });
     })
     .catch(() => {});

+ 13 - 4
src/views/group/data-board/turnover-rate/index.vue

@@ -75,7 +75,7 @@
 <script setup>
 import byTable from "/src/components/byTable/index";
 import { nextTick } from "vue";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -236,10 +236,19 @@ const deriveExcel = () => {
   })
     .then(() => {
       proxy.postFile("/turnoverRateBoard/exportExcel", { bomClassify: activeName.value, ...sourceList.value.pagination }).then((res) => {
-        if (activeName.value == "1") {
-          proxy.downloadFile(res, "周转率-裸垫-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
         } else {
-          proxy.downloadFile(res, "周转率-裸砖-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          if (activeName.value == "1") {
+            proxy.downloadFile(res, "周转率-裸垫-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          } else {
+            proxy.downloadFile(res, "周转率-裸砖-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          }
         }
       });
     })

+ 11 - 2
src/views/group/finance/check-bill/printBOM.vue

@@ -192,8 +192,17 @@ const deriveExcel = () => {
   loading.value = true;
   proxy.getFile("/statementOfAccount/exportDocumentByBom", { id: props.rowData.id, orderClassify: props.tabValues.tabsCard }).then(
     (res) => {
-      proxy.downloadFile(res, "BOM对账单-" + moment().format("yyyy-MM-DD") + ".xlsx");
-      loading.value = false;
+      if (res.type === "application/json") {
+        const fileReader = new FileReader();
+        fileReader.onloadend = () => {
+          const jsonData = JSON.parse(fileReader.result);
+          ElMessage({ message: jsonData.msg, type: "error" });
+        };
+        fileReader.readAsText(res);
+      } else {
+        proxy.downloadFile(res, "BOM对账单-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        loading.value = false;
+      }
     },
     (err) => {
       console.log(err);

+ 11 - 2
src/views/group/finance/check-bill/printSKU.vue

@@ -179,8 +179,17 @@ const deriveExcel = () => {
   loading.value = true;
   proxy.getFile("/statementOfAccount/exportDocumentBySku", { id: props.rowData.id, orderClassify: props.tabValues.tabsCard }).then(
     (res) => {
-      proxy.downloadFile(res, "SKU对账单-" + moment().format("yyyy-MM-DD") + ".xlsx");
-      loading.value = false;
+      if (res.type === "application/json") {
+        const fileReader = new FileReader();
+        fileReader.onloadend = () => {
+          const jsonData = JSON.parse(fileReader.result);
+          ElMessage({ message: jsonData.msg, type: "error" });
+        };
+        fileReader.readAsText(res);
+      } else {
+        proxy.downloadFile(res, "SKU对账单-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        loading.value = false;
+      }
     },
     (err) => {
       console.log(err);

+ 11 - 2
src/views/group/finance/sales-return/index.vue

@@ -22,7 +22,7 @@
 
 <script setup>
 import byTable from "/src/components/byTable/index";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -198,7 +198,16 @@ const deriveExcel = () => {
   })
     .then(() => {
       proxy.getFile("/orderExchangeDetail/excelExport", sourceList.value.pagination).then((res) => {
-        proxy.downloadFile(res, "销售退货明细表-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "销售退货明细表-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        }
       });
     })
     .catch(() => {});

+ 11 - 2
src/views/group/finance/summary/printBOM.vue

@@ -199,8 +199,17 @@ const deriveExcel = () => {
     })
     .then(
       (res) => {
-        proxy.downloadFile(res, "BOM对账单-" + moment().format("yyyy-MM-DD") + ".xlsx");
-        loading.value = false;
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "BOM对账单-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          loading.value = false;
+        }
       },
       (err) => {
         console.log(err);

+ 11 - 2
src/views/group/finance/summary/printSKU.vue

@@ -186,8 +186,17 @@ const deriveExcel = () => {
     })
     .then(
       (res) => {
-        proxy.downloadFile(res, "SKU对账单-" + moment().format("yyyy-MM-DD") + ".xlsx");
-        loading.value = false;
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "SKU对账单-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          loading.value = false;
+        }
       },
       (err) => {
         console.log(err);

+ 10 - 1
src/views/group/order/management/index.vue

@@ -807,7 +807,16 @@ const deriveExcel = (row) => {
   })
     .then(() => {
       proxy.postFile("/orderInfo/orderExportExcel", { id: row.id }).then((res) => {
-        proxy.downloadFile(res, row.code + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, row.code + ".xlsx");
+        }
       });
     })
     .catch(() => {});

+ 11 - 1
src/views/production/warehouse/check/index.vue

@@ -68,6 +68,7 @@
 <script setup>
 import byTable from "/src/components/byTable/index";
 import moment from "moment";
+import { ElMessage } from "element-plus";
 
 const { proxy } = getCurrentInstance();
 const activeName = ref("first");
@@ -438,7 +439,16 @@ const clickSubmit = () => {
   proxy.$refs.derive.validate((valid) => {
     if (valid) {
       proxy.postFile("/check/inventoryExportExcel", { id: formData.data.warehouseId }).then((res) => {
-        proxy.downloadFile(res, "盘点-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "盘点-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        }
       });
     }
   });

+ 14 - 4
src/views/production/warehouse/finished-parts-storage/index.vue

@@ -294,10 +294,20 @@ const giveawayServerLog = (params) => {
   formFile.append("file", file);
   proxy.postUploadAndDownloadFile("/inventoryFinishedOrder/erpExcelExport", formFile).then(
     (res) => {
-      ElMessage({ message: "操作成功", type: "success" });
-      proxy.downloadFile(res, "成品库明细-" + moment().format("yyyy-MM-DD") + ".xlsx");
-      loadingGiveaway.value = false;
-      openGiveaway.value = false;
+      if (res.type === "application/json") {
+        const fileReader = new FileReader();
+        fileReader.onloadend = () => {
+          const jsonData = JSON.parse(fileReader.result);
+          ElMessage({ message: jsonData.msg, type: "error" });
+          loadingGiveaway.value = false;
+        };
+        fileReader.readAsText(res);
+      } else {
+        ElMessage({ message: "操作成功", type: "success" });
+        proxy.downloadFile(res, "成品库明细-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        loadingGiveaway.value = false;
+        openGiveaway.value = false;
+      }
     },
     (err) => {
       console.log(err);

+ 11 - 2
src/views/production/warehouse/flow-record/index.vue

@@ -21,7 +21,7 @@
 
 <script setup>
 import byTable from "/src/components/byTable/index";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -253,7 +253,16 @@ const deriveExcel = () => {
   })
     .then(() => {
       proxy.postFile("/inOutStorageBom/exportExcelSummary", sourceList.value.pagination).then((res) => {
-        proxy.downloadFile(res, "出入库流水-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "出入库流水-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        }
       });
     })
     .catch(() => {});

+ 21 - 3
src/views/production/warehouse/inventory/index.vue

@@ -55,7 +55,7 @@
 import byTable from "/src/components/byTable/index";
 import { useRoute } from "vue-router";
 import useTagsViewStore from "/src/store/modules/tagsView";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -391,11 +391,29 @@ const deriveExcel = () => {
     .then(() => {
       if (route.query && route.query.backupDate) {
         proxy.getFile("/inventory/exportBackExcel", sourceList.value.pagination).then((res) => {
-          proxy.downloadFile(res, "库存-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          if (res.type === "application/json") {
+            const fileReader = new FileReader();
+            fileReader.onloadend = () => {
+              const jsonData = JSON.parse(fileReader.result);
+              ElMessage({ message: jsonData.msg, type: "error" });
+            };
+            fileReader.readAsText(res);
+          } else {
+            proxy.downloadFile(res, "库存-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          }
         });
       } else {
         proxy.getFile("/inventory/exportExcel", sourceList.value.pagination).then((res) => {
-          proxy.downloadFile(res, "库存-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          if (res.type === "application/json") {
+            const fileReader = new FileReader();
+            fileReader.onloadend = () => {
+              const jsonData = JSON.parse(fileReader.result);
+              ElMessage({ message: jsonData.msg, type: "error" });
+            };
+            fileReader.readAsText(res);
+          } else {
+            proxy.downloadFile(res, "库存-" + moment().format("yyyy-MM-DD") + ".xlsx");
+          }
         });
       }
     })

+ 11 - 2
src/views/production/warehouse/outbound/index.vue

@@ -62,7 +62,7 @@
 
 <script setup>
 import byTable from "/src/components/byTable/index";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -450,7 +450,16 @@ const deriveExcel = () => {
   })
     .then(() => {
       proxy.postFile("/inOutStorageBom/exportExcel", sourceListTwo.value.pagination).then((res) => {
-        proxy.downloadFile(res, "出库明细-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "出库明细-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        }
       });
     })
     .catch(() => {});

+ 11 - 2
src/views/production/warehouse/putInStorage/index.vue

@@ -58,7 +58,7 @@
 
 <script setup>
 import byTable from "/src/components/byTable/index";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -437,7 +437,16 @@ const deriveExcel = () => {
   })
     .then(() => {
       proxy.postFile("/inOutStorageBom/exportExcel", sourceListTwo.value.pagination).then((res) => {
-        proxy.downloadFile(res, "入库明细-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "入库明细-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        }
       });
     })
     .catch(() => {});

+ 11 - 2
src/views/subsidiary/warehouse/inventory/index.vue

@@ -53,7 +53,7 @@
 
 <script setup>
 import byTable from "/src/components/byTable/index";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -313,7 +313,16 @@ const deriveExcel = () => {
   })
     .then(() => {
       proxy.getFile("/inventory/exportExcel", sourceList.value.pagination).then((res) => {
-        proxy.downloadFile(res, "库存-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        if (res.type === "application/json") {
+          const fileReader = new FileReader();
+          fileReader.onloadend = () => {
+            const jsonData = JSON.parse(fileReader.result);
+            ElMessage({ message: jsonData.msg, type: "error" });
+          };
+          fileReader.readAsText(res);
+        } else {
+          proxy.downloadFile(res, "库存-" + moment().format("yyyy-MM-DD") + ".xlsx");
+        }
       });
     })
     .catch(() => {});