source_type.js 1.6 KB

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