Browse Source

fix: 数据后台报错问题

lishihao 2 tháng trước cách đây
mục cha
commit
7b439fc4db
1 tập tin đã thay đổi với 6 bổ sung23 xóa
  1. 6 23
      modules/reports/controllers/rpt_tpl_controller.js

+ 6 - 23
modules/reports/controllers/rpt_tpl_controller.js

@@ -588,30 +588,13 @@ let mExport = {
       });
   },
   // 导出所有的报表数据
-  getAllBackupData: async function (req, res) {
+  async getAllBackupData(req, res) {
     try {
-      const filePath = "./public/building_reportBackup.zip";
-      let rptTemplate = [];
-      let rptTplTree = [];
-      let rptConfig = [];
-      let rptField = [];
-      await new Promise(async function (resolve) {
-        rptTemplate = await RptTplModel.find({}, "-_id");
-        resolve();
-      });
-
-      await new Promise(async function (resolve) {
-        rptTplTree = await TreeNodeModel.find({}, "-_id");
-        resolve();
-      });
-      await new Promise(async function (resolve) {
-        rptConfig = await rpt_cfg_mdl.find({}, "-_id");
-        resolve();
-      });
-      await new Promise(async function (resolve) {
-        rptField = await Rpt_Map_Fld_Mdl.find({}, "-_id");
-        resolve();
-      });
+      const filePath = "./public/highWay_reportBackup.zip";
+      const rptConfig = await rpt_cfg_mdl.find({}, "-_id");
+      const rptTemplate = await RptTplModel.find({}, "-_id");
+      const rptTplTree = await TreeNodeModel.find({}, "-_id");
+      const rptField = await Rpt_Map_Fld_Mdl.find({}, "-_id");
       var zip = new JSZip();
       zip.file(
         "报表模板备份.json",