rpt_archive.js 894 B

12345678910111213141516171819202122232425262728293031323334353637
  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 getBusinessType = function(stageId) {
  18. const sid = parseInt(stageId);
  19. if (sid > 0) return 'stage';
  20. const bType = BusinessType.find(x => { return x.stageId === sid; });
  21. return bType ? bType.type : 'other';
  22. };
  23. // { payment_safe: -100, budget: -200, change: -300, ... }
  24. const BusinessStageId = (function(businessType) {
  25. const result = {};
  26. for (const bt of businessType) {
  27. result[bt.type] = bt.stageId;
  28. }
  29. })(BusinessType);
  30. module.exports = {
  31. BusinessType,
  32. getBusinessType,
  33. BusinessStageId,
  34. };