rpt_util.js 770 B

123456789101112131415161718192021222324252627
  1. /**
  2. * Created by Tony on 2017/3/24.
  3. */
  4. let cache = require('../../../public/cache/cacheUtil');
  5. let rpt_cfg = require('../models/rpt_cfg');
  6. const RPT_CFG_GRP = 'rpt_cfg';
  7. module.exports = {
  8. setReportDefaultCache: function () {
  9. rpt_cfg.getByUserId("Administrator", function (err, cfgs) {
  10. if (cfgs) {
  11. cache.setCache(RPT_CFG_GRP,'admin_cfg',cfgs);
  12. }
  13. })
  14. },
  15. getReportDefaultCache: function () {
  16. let rst = {ctrls: null, fonts: null, styles: null},
  17. admin_cfg = cache.getCache(RPT_CFG_GRP,'admin_cfg');
  18. ;
  19. rst.ctrls = admin_cfg.formats;
  20. rst.fonts = admin_cfg.fonts;
  21. rst.styles = admin_cfg.borders;
  22. admin_cfg = null;
  23. return rst;
  24. }
  25. }