rpt_util.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Created by Tony on 2017/3/24.
  3. */
  4. var cache = require('../../../public/cache/cacheUtil');
  5. var cmn_ctrl = require('../models/cfg_control');
  6. var cmn_font = require('../models/cfg_font');
  7. var cmn_style = require('../models/cfg_style');
  8. const RPT_CFG_GRP = 'rpt_cfg';
  9. module.exports = {
  10. setReportDefaultCache: function () {
  11. cmn_ctrl.getAll(null, function(err, ctrls){
  12. if (ctrls) {
  13. cache.setCache(RPT_CFG_GRP,'common_ctrls',ctrls);
  14. }
  15. });
  16. cmn_font.getAll(null, function(err, fonts){
  17. if (fonts) {
  18. cache.setCache(RPT_CFG_GRP,'common_fonts',fonts);
  19. }
  20. });
  21. cmn_style.getAll(null, function(err, styles){
  22. if (styles) {
  23. cache.setCache(RPT_CFG_GRP,'common_styles',styles);
  24. }
  25. });
  26. },
  27. getReportDefaultCache: function () {
  28. var rst = {ctrls: null, fonts: null, styles: null};
  29. rst.ctrls = cache.getCache(RPT_CFG_GRP,'common_ctrls');
  30. rst.fonts = cache.getCache(RPT_CFG_GRP,'common_fonts');
  31. rst.styles = cache.getCache(RPT_CFG_GRP,'common_styles');
  32. return rst;
  33. }
  34. }