'use strict'; const sourceTypeData = [ { id: 1, name: '标段&期', key: 'tender', params: { tender_id: 1, stage_id: 1 } }, { id: 10, name: '预付款', key: 'advance', params: { advance_id: 1 } }, { id: 20, name: '变更令', key: 'change', params: { change_id: 'uuid' } }, { id: 21, name: '变更方案', key: 'change_plan', params: { change_plan_id: 1 } }, { id: 22, name: '变更立项', key: 'change_project', params: { change_project_id: 1 } }, { id: 23, name: '变更申请', key: 'change_apply', params: { change_apply_id: 1 } }, { id: 30, name: '材料调差', key: 'material', params: { material_id: 1 } }, { id: 100, name: '支付审批', key: 'payment', params: { tender_id: 1, detail_id: 1 } }, { id: 101, name: '安全生产费', key: 'payment_safe', params: { tender_id: 1, detail_id: 1 } }, { id: 200, name: '动态投资', key: 'budget', params: { sp_id: 'uuid', budget_id: 1 } }, { id: 300, name: '合同管理', key: 'contract_management', params: {} }, // { id: 301, name: '标段合同', key: 'tender_contract' }, ]; // sourceType = { tender: 1, advance: 10, ... }; const sourceType = (function(data) { const result = {}; for (const d of data) { result[d.key] = d.id; } return result; })(sourceTypeData); const sourceTypeKey = (function(data) { const result = {}; for (const d of data) { result[d.id] = d.key; } return result; })(sourceTypeData); module.exports = { sourceType, sourceTypeKey, sourceTypeData, defaultSourceType: sourceTypeData[0].id, };