source_type.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict';
  2. const sourceTypeData = [
  3. { id: 1, name: '标段&期', key: 'tender', params: { tender_id: 1, stage_id: 1 } },
  4. { id: 2, name: '合同支付', key: 'phase_pay', params: { phase_pay_id: 'uuid'} },
  5. { id: 10, name: '预付款', key: 'advance', params: { advance_id: 1 } },
  6. { id: 20, name: '变更令', key: 'change', params: { change_id: 'uuid' } },
  7. { id: 21, name: '变更方案', key: 'change_plan', params: { change_plan_id: 1 } },
  8. { id: 22, name: '变更立项', key: 'change_project', params: { change_project_id: 1 } },
  9. { id: 23, name: '变更申请', key: 'change_apply', params: { change_apply_id: 1 } },
  10. { id: 30, name: '材料调差', key: 'material', params: { material_id: 1 } },
  11. { id: 40, name: '安全计量', key: 'safe_stage', params: { safe_stage_id: 'uuid' } },
  12. { id: 100, name: '支付审批', key: 'payment', params: { tender_id: 1, detail_id: 1 } },
  13. { id: 101, name: '安全生产费', key: 'payment_safe', params: { tender_id: 1, detail_id: 1 } },
  14. { id: 200, name: '项目进度', key: 'budget', params: { sp_id: 'uuid', budget_id: 1 } },
  15. { id: 300, name: '合同管理', key: 'contract', params: { tender_id: 1 } },
  16. // { id: 301, name: '标段合同', key: 'tender_contract' },
  17. ];
  18. // sourceType = { tender: 1, advance: 10, ... };
  19. const sourceType = (function(data) {
  20. const result = {};
  21. for (const d of data) {
  22. result[d.key] = d.id;
  23. }
  24. return result;
  25. })(sourceTypeData);
  26. const sourceTypeKey = (function(data) {
  27. const result = {};
  28. for (const d of data) {
  29. result[d.id] = d.key;
  30. }
  31. return result;
  32. })(sourceTypeData);
  33. module.exports = {
  34. sourceType,
  35. sourceTypeKey,
  36. sourceTypeData,
  37. defaultSourceType: sourceTypeData[0].id,
  38. };