rpt_archive.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date
  7. * @version
  8. */
  9. const BusinessType = [
  10. { stageId: -100, type: 'payment_safe' },
  11. { stageId: -200, type: 'budget' },
  12. { stageId: -300, type: 'change' },
  13. { stageId: -301, type: 'change_plan' },
  14. { stageId: -302, type: 'change_project' },
  15. { stageId: -303, type: 'change_apply' },
  16. ];
  17. const getStageId = function(type) {
  18. const bType = BusinessType.find(x => { return x.type === type; });
  19. return bType ? bType.stageId : null;
  20. };
  21. const getBusinessType = function(stageId) {
  22. const sid = parseInt(stageId);
  23. if (sid > 0) return 'stage';
  24. const bType = BusinessType.find(x => { return x.stageId === sid; });
  25. return bType ? bType.type : 'other';
  26. };
  27. // { payment_safe: -100, budget: -200, change: -300, ... }
  28. const BusinessStageId = (function(businessType) {
  29. const result = {};
  30. for (const bt of businessType) {
  31. result[bt.type] = bt.stageId;
  32. }
  33. })(BusinessType);
  34. module.exports = {
  35. BusinessType,
  36. getStageId,
  37. getBusinessType,
  38. BusinessStageId,
  39. };