source_type.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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: 100, name: '支付审批', key: 'payment', params: { tender_id: 1, detail_id: 1 } },
  11. { id: 101, name: '安全生产费', key: 'payment_safe', params: { tender_id: 1, detail_id: 1 } },
  12. { id: 200, name: '动态投资', key: 'budget', params: { sp_id: 'uuid', budget_id: 1 } },
  13. { id: 300, name: '合同管理', key: 'contract_management', params: {} },
  14. // { id: 301, name: '标段合同', key: 'tender_contract' },
  15. ];
  16. // sourceType = { tender: 1, advance: 10, ... };
  17. const sourceType = (function(data) {
  18. const result = {};
  19. for (const d of data) {
  20. result[d.key] = d.id;
  21. }
  22. return result;
  23. })(sourceTypeData);
  24. const sourceTypeKey = (function(data) {
  25. const result = {};
  26. for (const d of data) {
  27. result[d.id] = d.key;
  28. }
  29. return result;
  30. })(sourceTypeData);
  31. module.exports = {
  32. sourceType,
  33. sourceTypeKey,
  34. sourceTypeData,
  35. defaultSourceType: sourceTypeData[0].id,
  36. };