source_type.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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: 400, name: '成本报审', key: 'cost_ledger', params: { tender_id: 1, cost_stage_id: 'uuid' } },
  17. { id: 401, name: '财务账面', key: 'cost_book', params: { tender_id: 1, cost_stage_id: 'uuid' } },
  18. { id: 402, name: '成本分析', key: 'cost_analysis', params: { tender_id: 1, cost_stage_id: 'uuid' } },
  19. // { id: 301, name: '标段合同', key: 'tender_contract' },
  20. ];
  21. // sourceType = { tender: 1, advance: 10, ... };
  22. const sourceType = (function(data) {
  23. const result = {};
  24. for (const d of data) {
  25. result[d.key] = d.id;
  26. }
  27. return result;
  28. })(sourceTypeData);
  29. const sourceTypeKey = (function(data) {
  30. const result = {};
  31. for (const d of data) {
  32. result[d.id] = d.key;
  33. }
  34. return result;
  35. })(sourceTypeData);
  36. module.exports = {
  37. sourceType,
  38. sourceTypeKey,
  39. sourceTypeData,
  40. defaultSourceType: sourceTypeData[0].id,
  41. };