template_param.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date 2018/4/24
  7. * @version
  8. */
  9. // 参数绑定类别
  10. const matchType = {
  11. fixed_id: 1,
  12. node_default: 2,
  13. properties: 3,
  14. code: 4,
  15. non_match: 5,
  16. }
  17. const matchTypeStr = [];
  18. matchTypeStr[matchType.fixed_id] = '全局匹配参数';
  19. matchTypeStr[matchType.node_default] = '节点默认参数';
  20. matchTypeStr[matchType.properties] = '属性匹配参数';
  21. matchTypeStr[matchType.code] = '编号匹配参数';
  22. matchTypeStr[matchType.non_match] = '非匹配参数';
  23. const validMatchType = [matchType.properties, matchType.code, matchType.non_match];
  24. const validProperties = {
  25. loadLength: 'loadLength',
  26. loadWidth: 'loadWidth'
  27. }
  28. // 参数取值
  29. const matchNum = {
  30. total_price: 1,
  31. dgn_quantity1: 2,
  32. dgn_quantity2: 3,
  33. quantity: 4,
  34. };
  35. const matchNumStr = [];
  36. matchNumStr[matchNum.total_price] = '合价';
  37. matchNumStr[matchNum.dgn_quantity1] = '设计数量1';
  38. matchNumStr[matchNum.dgn_quantity2] = '设计数量2';
  39. matchNumStr[matchNum.quantity] = '清单数量';
  40. const globalParamNodeId = 0;
  41. // 默认全局参数
  42. const defaultGlobalParams = [
  43. {
  44. template_id: 1,
  45. node_id: 0,
  46. param_id: 1,
  47. code: 'g_a',
  48. name: '公路基本造价',
  49. match_type: matchType.fixed_id,
  50. match_key: '10',
  51. match_num: matchNum.total_price,
  52. },{
  53. template_id: 1,
  54. node_id: 0,
  55. param_id: 2,
  56. code: 'g_b',
  57. name: '建安费',
  58. match_type: matchType.fixed_id,
  59. match_key: '1',
  60. match_num: matchNum.total_price,
  61. },{
  62. template_id: 1,
  63. node_id: 0,
  64. param_id: 3,
  65. code: 'g_c',
  66. name: '工程建设其他费用',
  67. match_type: matchType.fixed_id,
  68. match_key: '3',
  69. match_num: matchNum.total_price,
  70. },{
  71. template_id: 1,
  72. node_id: 0,
  73. param_id: 4,
  74. code: 'g_d',
  75. name: '路线总长度(主线长度)',
  76. match_type: matchType.non_match,
  77. },{
  78. template_id: 1,
  79. node_id: 0,
  80. param_id: 5,
  81. code: 'g_e',
  82. name: '建筑总面积{路线总长度(主线长度)×路基(或桥隧)宽度}',
  83. match_type: matchType.non_match,
  84. },{
  85. template_id: 1,
  86. node_id: 0,
  87. param_id: 6,
  88. code: 'g_f',
  89. name: '路基长度(指不含桥梁、隧道的路基长度(双幅平均计))',
  90. match_type: matchType.non_match,
  91. },
  92. ];
  93. // 默认节点参数
  94. const defaultNodeParams = [
  95. {
  96. template_id: 1,
  97. param_id: 1,
  98. code: 'a',
  99. name: '本项合价',
  100. match_type: matchType.node_default,
  101. match_num: matchNum.total_price,
  102. }, {
  103. template_id: 1,
  104. param_id: 2,
  105. code: 'b',
  106. name: '本项数量1',
  107. match_type: matchType.node_default,
  108. match_num: matchNum.dgn_quantity1,
  109. }, {
  110. template_id: 1,
  111. param_id: 3,
  112. code: 'c',
  113. name: '本项数量2',
  114. match_type: matchType.node_default,
  115. match_num: matchNum.dgn_quantity2,
  116. }, {
  117. template_id: 1,
  118. param_id: 4,
  119. code: 'd',
  120. name: '本项清单数量',
  121. match_type: matchType.node_default,
  122. match_num: matchNum.quantity,
  123. }
  124. ];
  125. module.exports = {
  126. matchType,
  127. matchTypeStr,
  128. validMatchType,
  129. validProperties,
  130. matchNum,
  131. matchNumStr,
  132. globalParamNodeId,
  133. defaultGlobalParams,
  134. defaultNodeParams
  135. }