template_param.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. // 默认全局参数
  41. const defaultGlobalParams = [
  42. {
  43. template_id: 1,
  44. node_id: 0,
  45. param_id: 1,
  46. code: 'g_a',
  47. name: '公路基本造价',
  48. match_type: matchType.fixed_id,
  49. match_key: '10',
  50. match_num: matchNum.total_price,
  51. },{
  52. template_id: 1,
  53. node_id: 0,
  54. param_id: 2,
  55. code: 'g_b',
  56. name: '建安费',
  57. match_type: matchType.fixed_id,
  58. match_key: '1',
  59. match_num: matchNum.total_price,
  60. },{
  61. template_id: 1,
  62. node_id: 0,
  63. param_id: 3,
  64. code: 'g_c',
  65. name: '工程建设其他费用',
  66. match_type: matchType.fixed_id,
  67. match_key: '3',
  68. match_num: matchNum.total_price,
  69. },{
  70. template_id: 1,
  71. node_id: 0,
  72. param_id: 4,
  73. code: 'g_d',
  74. name: '路线总长度(主线长度)',
  75. match_type: matchType.non_match,
  76. },{
  77. template_id: 1,
  78. node_id: 0,
  79. param_id: 5,
  80. code: 'g_e',
  81. name: '建筑总面积{路线总长度(主线长度)×路基(或桥隧)宽度}',
  82. match_type: matchType.non_match,
  83. },{
  84. template_id: 1,
  85. node_id: 0,
  86. param_id: 6,
  87. code: 'g_f',
  88. name: '路基长度(指不含桥梁、隧道的路基长度(双幅平均计))',
  89. match_type: matchType.non_match,
  90. },
  91. ];
  92. // 默认节点参数
  93. const defaultNodeParams = [
  94. {
  95. template_id: 1,
  96. param_id: 1,
  97. code: 'a',
  98. name: '本项合价',
  99. match_type: matchType.node_default,
  100. match_num: matchNum.total_price,
  101. }, {
  102. template_id: 1,
  103. param_id: 2,
  104. code: 'b',
  105. name: '本项数量1',
  106. match_type: matchType.node_default,
  107. match_num: matchNum.dgn_quantity1,
  108. }, {
  109. template_id: 1,
  110. param_id: 3,
  111. code: 'c',
  112. name: '本项数量2',
  113. match_type: matchType.node_default,
  114. match_num: matchNum.dgn_quantity2,
  115. }, {
  116. template_id: 1,
  117. param_id: 4,
  118. code: 'd',
  119. name: '本项清单数量',
  120. match_type: matchType.node_default,
  121. match_num: matchNum.quantity,
  122. }
  123. ];
  124. module.exports = {
  125. matchType,
  126. matchTypeStr,
  127. validMatchType,
  128. validProperties,
  129. matchNum,
  130. matchNumStr,
  131. defaultGlobalParams,
  132. defaultNodeParams
  133. }