TonyKang 7 gadi atpakaļ
vecāks
revīzija
e0c11050bc

+ 3 - 3
modules/reports/controllers/rpt_cfg_controller.js

@@ -2,15 +2,15 @@
  * Created by Tony on 2017/7/5.
  */
 
-let mongoose = require('mongoose');
-let rpt_util = require('../util/rpt_util');
+import mongoose from "mongoose";
+import rpt_util from "../util/rpt_util";
 let Rpt_Map_Fld_Mdl = mongoose.model('rpt_mapping_field');
 
 
 //统一回调函数
 let callback = function(req, res, err, message, data){
     res.json({error: err, message: message, data: data});
-}
+};
 
 module.exports = {
     getReportUserCfg: function(req, res){

+ 18 - 20
modules/reports/controllers/rpt_controller.js

@@ -2,21 +2,21 @@
  * Created by Tony on 2017/3/13.
  */
 
-let mongoose = require('mongoose');
-let async = require('async');
+import mongoose from "mongoose";
+import async from "async";
 
-let JV = require('../rpt_component/jpc_value_define');
+import JV from "../rpt_component/jpc_value_define";
 
 let Template = mongoose.model('rpt_templates');
-let rptTplFacade = require('../facade/rpt_template_facade');
-let demoTemplateFacade = require('../facade/rpt_tpl_data_demo_facade');
+import rptTplFacade from "../facade/rpt_template_facade";
+import demoTemplateFacade from "../facade/rpt_tpl_data_demo_facade";
 
-let JpcEx = require('../rpt_component/jpc_ex');
-let rptUtil = require("../util/rpt_util");
-let rpt_xl_util = require('../util/rpt_excel_util');
-let rpt_pdf_util = require('../util/rpt_pdf_util');
-let fs = require('fs');
-let strUtil = require('../../../public/stringUtil');
+import JpcEx from "../rpt_component/jpc_ex";
+import rptUtil from "../util/rpt_util";
+import rpt_xl_util from "../util/rpt_excel_util";
+import rpt_pdf_util from "../util/rpt_pdf_util";
+import fs from "fs";
+import strUtil from "../../../public/stringUtil";
 
 //统一回调函数
 let callback = function(req, res, err, data){
@@ -66,7 +66,7 @@ function getAllPagesCommonOrg(rpt_id, pageSize, option, cb) {
             }
         }
     );
-};
+}
 
 function getAllPagesCommon(rpt_id, pageSize, cb) {
     let rptTpl = null;
@@ -76,23 +76,23 @@ function getAllPagesCommon(rpt_id, pageSize, cb) {
             let tplData = {};
             if (rptTpl[JV.NODE_FIELD_MAP]) {
                 //1. 离散数据
-                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DISCRETE_FIELDS] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DISCRETE_FIELDS].leng > 0) {
+                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DISCRETE_FIELDS] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DISCRETE_FIELDS].length > 0) {
                     tplData[JV.DATA_DISCRETE_DATA] = [];
                 }
                 //2. 主数据
-                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS].leng > 0) {
+                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS].length > 0) {
                     tplData[JV.DATA_MASTER_DATA] = [];
                 }
                 //3. 从数据
-                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS].leng > 0) {
+                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS].length > 0) {
                     tplData[JV.DATA_DETAIL_DATA] = [];
                 }
                 //2. Ex主数据
-                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS_EX] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS_EX].leng > 0) {
+                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS_EX] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS_EX].length > 0) {
                     tplData[JV.DATA_MASTER_DATA_EX] = [];
                 }
                 //3. Ex从数据
-                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS_EX] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS_EX].leng > 0) {
+                if (rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS_EX] && rptTpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS_EX].length > 0) {
                     tplData[JV.DATA_DETAIL_DATA_EX] = [];
                 }
                 //4. 重点: 开始组装$PROJECT对象
@@ -108,7 +108,7 @@ function getAllPagesCommon(rpt_id, pageSize, cb) {
             cb('No report template was found!', null);
         }
     })
-};
+}
 
 module.exports = {
     getReportAllPages: function(req, res){
@@ -125,7 +125,6 @@ module.exports = {
             rptName = req.params.rptName,
             isOneSheet = req.params.isOneSheet,
             option = req.params.option;
-        ;
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         getAllPagesCommonOrg(rpt_id, pageSize, dftOption, function(err, pageRst){
             fs.writeFileSync('D:/GitHome/ConstructionOperation/tmp/testRpt.js', JSON.stringify(pageRst));
@@ -151,7 +150,6 @@ module.exports = {
             pageSize = req.params.size,
             rptName = req.params.rptName,
             option = req.params.option;
-        ;
         let parallelFucs = [];
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         for (let id of rpt_ids) {

+ 11 - 9
modules/reports/controllers/rpt_tpl_controller.js

@@ -2,24 +2,26 @@
  * Created by Tony on 2017/6/1.
  */
 
-let mongoose = require('mongoose');
+import mongoose from "mongoose";
 
-let async = require("async");
-let counter = require('../../../public/counter/counter');
+import async from "async";
+import counter from "../../../public/counter/counter";
 
 let RptTplModel = mongoose.model('rpt_templates');
 let TreeNodeModel = mongoose.model('rpt_tpl_tree');
 
-let rptTplDef = require("../../../public/rpt_tpl_def").getUtil();
-let stringUtil = require("../../../public/stringUtil");
-let JV = require('../rpt_component/jpc_value_define');
+import rpttplDefObj from "../../../public/rpt_tpl_def";
+let rptTplDef = rpttplDefObj.getUtil();
 
-//let test_glj_type_util = require("../../../public/cache/std_glj_type_util");
+//import stringUtil from "../../../public/stringUtil";
+import JV from "../rpt_component/jpc_value_define";
+
+//import test_glj_type_util from "../../../public/cache/std_glj_type_util");
 
 //统一回调函数
 let callback = function(req, res, err, message, data){
     res.json({error: err, message: message, data: data});
-}
+};
 
 module.exports = {
     getDftTemplates(req, res) {
@@ -174,4 +176,4 @@ module.exports = {
             }
         });
     }
-}
+};

+ 2 - 3
modules/reports/facade/rpt_template_facade.js

@@ -1,7 +1,7 @@
 /**
  * Created by Tony on 2017/8/9.
  */
-let mongoose = require("mongoose");
+import mongoose from "mongoose";
 let rpt_tpl_mdl = mongoose.model("rpt_templates");
 
 module.exports = {
@@ -10,6 +10,5 @@ module.exports = {
 
 async function getRptTemplate(tplId) {
     //console.log('templateId: ' + parseInt(tplId));
-    let rst = await  rpt_tpl_mdl.findOne({"ID": parseInt(tplId)}, '-_id');
-    return rst;
+    return await  rpt_tpl_mdl.findOne({"ID": parseInt(tplId)}, '-_id');
 }

+ 1 - 1
modules/reports/facade/rpt_tpl_data_demo_facade.js

@@ -1,7 +1,7 @@
 /**
  * Created by Tony on 2017/8/9.
  */
-let mongoose = require("mongoose");
+import mongoose from "mongoose";
 let rpt_tpl_data_demo_mdl = mongoose.model("rpt_temp_tpl_data");
 
 module.exports = {

+ 1 - 1
modules/reports/facade/rpt_tpl_data_facade.js

@@ -2,7 +2,7 @@
  * Created by Tony on 2017/8/9.
  */
 
-let mongoose = require("mongoose");
+import mongoose from "mongoose";
 let rpt_tpl_mdl = mongoose.model("rpt_templates");
 
 module.exports = {

+ 1 - 1
modules/reports/models/rpt_cfg.js

@@ -2,7 +2,7 @@
  * Created by Tony on 2017/6/14.
  * 把报表相关的配置(字体、边框、格式等都放在一条记录中,方便整理,毕竟用户的报表格式基本是固定的,无需怎样调整)
  */
-let mongoose = require('mongoose');
+import mongoose from "mongoose";
 let Schema = mongoose.Schema;
 let FormatSchema = new Schema({
     "ID" : String,

+ 1 - 1
modules/reports/models/rpt_mapping_field.js

@@ -2,7 +2,7 @@
  * Created by Tony on 2017/7/11.
  * 为后台报表模板选择指标用
  */
-let mongoose = require('mongoose');
+import mongoose from "mongoose";
 let MapFieldSchema = new mongoose.Schema({
     "fieldMapGrpName" : String,
     "Name": String,

+ 1 - 1
modules/reports/models/rpt_template.js

@@ -2,7 +2,7 @@
  * Created by Tony on 2016/12/23.
  * 仅仅是存放报表模板的地方,由谁来引用是TreeNodeSchema的事情
  */
-let mongoose = require('mongoose');
+import mongoose from "mongoose";
 let Schema = mongoose.Schema;
 let RptTemplateSchema = new Schema({
     "ID" : Number,

+ 1 - 1
modules/reports/models/rpt_tpl_data.js

@@ -2,7 +2,7 @@
  * Created by Tony on 2017/7/24.
  */
 
-let mongoose = require('mongoose');
+import mongoose from "mongoose";
 let Schema = mongoose.Schema;
 
 let rptTplPrjSchema = new Schema({

+ 1 - 1
modules/reports/models/rpt_tpl_data_demo.js

@@ -1,7 +1,7 @@
 /**
  * Created by Tony on 2016/12/28.
  */
-let mongoose = require('mongoose');
+import mongoose from "mongoose";
 // let dbm = require("../../../config/db/db_manager");
 // let smartcostdb = dbm.getCfgConnection("scConstruct");
 let Schema = mongoose.Schema;

+ 1 - 1
modules/reports/models/tpl_tree_node.js

@@ -2,7 +2,7 @@
  * Created by Tony on 2017/5/31.
  * 不同的用户会有一套自己的模板结构列表
  */
-let mongoose = require('mongoose');
+import mongoose from "mongoose";
 let Schema = mongoose.Schema;
 let TreeNodeSchema = new Schema({
     ID:Number,

+ 3 - 3
modules/reports/routes/report_router.js

@@ -2,9 +2,9 @@
  * Created by Tony on 2017/3/13.
  */
 
-let express = require('express');
+import express from "express";
 let rptRouter = express.Router();
-let reportController = require('./../controllers/rpt_controller');
+import reportController from "./../controllers/rpt_controller";
 
 module.exports =function (app) {
     app.get('/report',  function(req, res) {
@@ -24,4 +24,4 @@ module.exports =function (app) {
 
     rptRouter.get('/getPDF/:id/:size/:rptName', reportController.getPDF);//2/A4/07-1表
     app.use("/report_api", rptRouter);
-}
+};

+ 4 - 4
modules/reports/routes/rpt_tpl_router.js

@@ -1,7 +1,7 @@
-let express = require("express");
+import express from "express";
 let rptTplRouter = express.Router();
-let reportTplController = require('./../controllers/rpt_tpl_controller');
-let reportCfgController = require('./../controllers/rpt_cfg_controller');
+import reportTplController from "./../controllers/rpt_tpl_controller";
+import reportCfgController from "./../controllers/rpt_cfg_controller";
 
 module.exports = function (app) {
     app.get('/rpt_tpl',  function(req, res) {
@@ -26,4 +26,4 @@ module.exports = function (app) {
     rptTplRouter.post('/getUserRptCfg', reportCfgController.getReportUserCfg);
     rptTplRouter.post('/getMappingFields', reportCfgController.getAllMappingFields);
     app.use("/report_tpl_api", rptTplRouter);
-}
+};