anhui_chizhou.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. INTERFACE_EXPORT = (() => {
  2. 'use strict';
  3. /**
  4. *
  5. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  6. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  7. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  8. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  9. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  10. */
  11. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  12. const {
  13. CONFIG: {
  14. TYPE,
  15. WHITE_SPACE
  16. },
  17. UTIL: {
  18. getValueByKey,
  19. getHan,
  20. getFee,
  21. generateHardwareId,
  22. },
  23. Element,
  24. } = INTERFACE_EXPORT_BASE;
  25. const {
  26. EXPORT_KIND: { BID_INVITATION, BID_SUBMISSION, CONTROL },
  27. fixedFlag,
  28. RationType,
  29. } = window.commonConstants
  30. const GljType = gljUtil.gljType;
  31. const { isEmptyVal, isDef } = window.commonUtil;
  32. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  33. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  34. const isControl = exportKind === CONTROL; // 是否是控制价
  35. // 节点定义--------------------------------
  36. const subArea = areaKey.split('@')[1];
  37. function CreateNode(nodeName) {
  38. Element.call(this, nodeName);
  39. }
  40. function GongCXX(information) {
  41. const attrs = [
  42. { name: '项目编号', value: getValueByKey(information, 'projNum') },
  43. { name: '项目名称', value: getValueByKey(information, '') },
  44. { name: '建设单位', value: getValueByKey(information, 'constructingUnits') },
  45. { name: '起始桩号', value: getValueByKey(information, 'startAndChainages') },
  46. { name: '终点桩号', value: getValueByKey(information, 'startAndChainages') },
  47. { name: '建设地址', value: getValueByKey(information, '') },
  48. { name: '项目概况', value: getValueByKey(information, '') },
  49. { name: '建设性质', value: getValueByKey(information, '') },
  50. { name: '专业划分', value: getValueByKey(information, '') },
  51. { name: '道路里程', value: getValueByKey(information, '') },
  52. { name: '设计单位', value: getValueByKey(information, '') },
  53. { name: '计税方式', value: getValueByKey(information, 'taxMode') },
  54. { name: '文件类型', value: getValueByKey(information, 'projType') },
  55. { name: '标准版本号', value: getValueByKey(information, '') },
  56. { name: 'GUID', value: getValueByKey(information, '') }
  57. ];
  58. Element.call(this, '工程信息', attrs);
  59. }
  60. function ZhaoBiaoXx(information) {
  61. const attrs = [
  62. { name: '招标人', value: getValueByKey(information, 'tendereeName') },
  63. { name: '招标人纳税识别号', value: getValueByKey(information, 'tendereeTaxpayerIdentificationNo') },
  64. { name: '招标法定代表人或其授权人', value: getValueByKey(information, 'tenderAuthorizer') },
  65. { name: '招标法人或其授权人身份证号', value: getValueByKey(information, 'tenderAuthorizerIDNo') },
  66. { name: '造价咨询人', value: getValueByKey(information, 'costConsultant') },
  67. { name: '造价咨询人纳税识别号', value: getValueByKey(information, 'costConsultantTaxpayerIdentificationNo') },
  68. { name: '造价咨询人法定代表人或其授权人', value: getValueByKey(information, 'consultantAuthorizer') },
  69. { name: '造价咨询法人或其授权人身份证号', value: getValueByKey(information, 'consultantAuthorizerTaxpayerIdentificationNo') },
  70. { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
  71. { name: '编制人资格证号', value: getValueByKey(information, '') },
  72. { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
  73. { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
  74. { name: '复核人资格证号', value: getValueByKey(information, '') },
  75. { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE }
  76. ];
  77. Element.call(this, '招标信息', attrs);
  78. }
  79. function ZhaoBiaoKzXx(information, totalCost) {
  80. const attrs = [
  81. { name: '招标人', value: getValueByKey(information, 'tendereeName') },
  82. { name: '招标人纳税识别号', value: getValueByKey(information, 'tendereeTaxpayerIdentificationNo') },
  83. { name: '招标法定代表人或其授权人', value: getValueByKey(information, 'tenderAuthorizer') },
  84. { name: '招标法人或其授权人身份证号', value: getValueByKey(information, 'tenderAuthorizerIDNo') },
  85. { name: '造价咨询人', value: getValueByKey(information, 'costConsultant') },
  86. { name: '造价咨询人纳税识别号', value: getValueByKey(information, 'costConsultantTaxpayerIdentificationNo') },
  87. { name: '造价咨询人法定代表人或其授权人', value: getValueByKey(information, 'consultantAuthorizer') },
  88. { name: '造价咨询法人或其授权人身份证号', value: getValueByKey(information, 'consultantAuthorizerTaxpayerIdentificationNo') },
  89. { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
  90. { name: '编制人资格证号', value: getValueByKey(information, '') },
  91. { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
  92. { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
  93. { name: '复核人资格证号', value: getValueByKey(information, '') },
  94. { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
  95. { name: '审核人', value: getValueByKey(information, 'tenderExaminer') },
  96. { name: '审核人资格证号', value: getValueByKey(information, '') },
  97. { name: '审核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
  98. { name: '控制价总价', value: totalCost, type: TYPE.DECIMAL },
  99. { name: '工期', value: getValueByKey(information, '') },
  100. { name: '质量要求', value: getValueByKey(information, '') }
  101. ];
  102. Element.call(this, '招标控制价', attrs);
  103. }
  104. function TouBiaoXx(information, totalCost) {
  105. const attrs = [
  106. { name: '投标人', value: getValueByKey(information, 'bidderName') },
  107. { name: '投标人纳税识别号', value: getValueByKey(information, '') },
  108. { name: '投标人法定代表或其授权人', value: getValueByKey(information, 'bidderAuthorizer') },
  109. { name: '投标人法人或其授权人身份证号', value: getValueByKey(information, '') },
  110. { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
  111. { name: '编制人资格证号', value: getValueByKey(information, '') },
  112. { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
  113. { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
  114. { name: '复核人资格证号', value: getValueByKey(information, '') },
  115. { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
  116. { name: '审核人', value: getValueByKey(information, 'tenderExaminer') },
  117. { name: '审核人资格证号', value: getValueByKey(information, '') },
  118. { name: '审核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
  119. { name: '投标总价', value: totalCost, type: TYPE.DECIMAL },
  120. { name: '工期', value: getValueByKey(information, '') },
  121. { name: '投标担保金额', value: getValueByKey(information, '') },
  122. { name: '质量承诺', value: getValueByKey(information, '') },
  123. { name: '投标担保方式', value: getValueByKey(information, '') },
  124. { name: '造价软件品牌', value: getValueByKey(information, '') },
  125. { name: '造价软件版本', value: getValueByKey(information, '') },
  126. { name: '造价软件加密锁编号', value: getValueByKey(information, '') },
  127. { name: '计算机硬件信息', value: getValueByKey(information, '') },
  128. { name: '', value: getValueByKey(information, '') }
  129. ];
  130. Element.call(this, '投标信息', attrs);
  131. }
  132. // 单位工程信息
  133. function Dwgcxx(tenderName, feature) {
  134. const attrs = [
  135. { name: 'Dwgcbh', value: getValueByKey(feature, 'unitProjNo'), minLen: 1, whiteSpace: WHITE_SPACE.COLLAPSE }, // 单位工程编号
  136. { name: 'Dwgcmc', value: tenderName }, // 单位工程名称
  137. ];
  138. Element.call(this, 'Dwgcxx', attrs);
  139. }
  140. // 取费信息(费率信息)
  141. function Qfxx() {
  142. Element.call(this, 'Qfxx');
  143. }
  144. // 计价费率表
  145. function JjFlb() {
  146. Element.call(this, 'JjFlb');
  147. }
  148. // 计价费率表明细,造价书费率页面左侧最底层数据
  149. function JjFlbMx(rootItem, item) {
  150. // 费率明细名称-编码映射表
  151. const FeeRateCodeMap = {
  152. '冬季施工增加费': 'DJF',
  153. '雨季施工增加费': 'YJF',
  154. '夜间施工增加费': 'YEF',
  155. '工地转移费': 'ZYF',
  156. '高原地区施工增加费': 'GYF',
  157. '风沙地区施工增加费': 'FSF',
  158. '沿海地区施工增加费': 'YHF',
  159. '行车干扰施工增加费': 'XCF',
  160. '施工辅助费': 'SFF',
  161. '养老保险费': 'YLF',
  162. '失业保险费': 'SYF',
  163. '医疗保险费': 'YBF',
  164. '住房公积金': 'ZFF',
  165. '工伤保险费': 'GSF',
  166. '基本费用': 'JBF',
  167. '主副食运费补贴': 'YFF',
  168. '职工探亲补贴': 'TQF',
  169. '职工取暖补贴': 'QNF',
  170. '财务费用': 'CWF',
  171. '利润': 'LR',
  172. '税金': 'SJ',
  173. };
  174. // 费率工程名称-取费类别映射表
  175. const FeeRateTypeMap = {
  176. '土方': 1,
  177. '石方': 3,
  178. '运输': 2,
  179. '路面': 4,
  180. '隧道': 11,
  181. '构造物Ⅰ': 5,
  182. '构造物Ⅰ(不计冬)': 16,
  183. '构造物Ⅱ': 6,
  184. '构造物Ⅲ(桥梁)': 9,
  185. '构造物Ⅲ(除桥以外不计雨夜)': 8,
  186. '技术复杂大桥': 10,
  187. '钢材及钢结构(桥梁)': 12,
  188. '钢材及钢结构(除桥以外不计夜)': 13,
  189. '费率为0': 17,
  190. '路面(不计雨)': 4,
  191. '构造物Ⅰ(不计雨)': 16,
  192. '构造物Ⅲ(除桥以外)': 8,
  193. '钢材及钢结构(除桥以外)': 13,
  194. '设备': 15,
  195. '量价': 14,
  196. };
  197. const rate = isEmptyVal(item.rate) ? '100' : item.rate; // 为空时输出=100,为0时输出=0
  198. /* if (!FeeRateTypeMap[rootItem.name]) {
  199. debugger;
  200. } */
  201. const attrs = [
  202. { name: 'Bm', value: FeeRateCodeMap[item.name] }, // 编码
  203. { name: 'Name', value: item.name }, // 名称
  204. { name: 'Fl', value: rate, type: TYPE.DECIMAL }, // 费率
  205. { name: 'Qflb', value: FeeRateTypeMap[rootItem.name], type: TYPE.INT }, // 取费类别
  206. ];
  207. Element.call(this, 'JjFlbMx', attrs);
  208. }
  209. // 计价费率项
  210. function JjFlx() {
  211. Element.call(this, 'JjFlx');
  212. }
  213. // 计价费率项明细,造价书费率页面右侧最顶层数据
  214. function JjFlxMx(item) {
  215. // 编码取名称拼音首字母
  216. const allHanName = getHan(item.name || '');
  217. const code = pinyinUtil.getFirstLetter(allHanName).toLowerCase();
  218. let value;
  219. if (isDef(item.value)) {
  220. value = item.value;
  221. } else {
  222. const selected = item.optionList.find(item => item.selected);
  223. value = selected.name;
  224. }
  225. const attrs = [
  226. { name: 'Bm', value: code }, // 编码
  227. { name: 'Mc', value: item.name }, // 名称
  228. { name: 'ShuZhi', value: value }, // 数值
  229. ];
  230. Element.call(this, 'JjFlxMx', attrs);
  231. }
  232. // 清单项目
  233. function QdXm() {
  234. Element.call(this, 'QdXm');
  235. }
  236. // 标题类别:1=100~700清单合计,2=暂估价合计,3=清单不包含暂估价合计,4=计日工,5=暂列金额(不含计日工总额)),6=投标报价,0=其他
  237. const BillsTitleType = {
  238. [fixedFlag.ONE_SEVEN_BILLS]: '1',
  239. [fixedFlag.PROVISIONAL_TOTAL]: '2',
  240. [fixedFlag.BILLS_TOTAL_WT_PROV]: '3',
  241. [fixedFlag.DAYWORK_LABOR]: '4',
  242. [fixedFlag.PROVISIONAL]: '5',
  243. [fixedFlag.TOTAL_COST]: '6',
  244. };
  245. // 清单标题 造价书的第一层数据。
  246. function QdBt(node) {
  247. const row = node.row();
  248. const fee = isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderTotalFee')
  249. const attrs = [
  250. { name: 'Xh', value: row, type: TYPE.INT }, // 序号
  251. { name: 'Bm', value: node.data.code }, // 编码
  252. { name: 'Name', value: node.data.name }, // 名称
  253. { name: 'Je', value: fee, type: TYPE.DECIMAL }, // 金额
  254. { name: 'Code', value: `F${row}` }, // 行引用
  255. { name: 'Jsgs', value: node.data.calcBase }, // 计算基数
  256. { name: 'Lb', value: BillsTitleType[node.getFlag()], type: TYPE.INT }, // 类别
  257. { name: 'Bz', value: node.data.remark }, // 备注
  258. ];
  259. Element.call(this, 'QdBt', attrs);
  260. }
  261. // 清单明细 (只有100-700章清单标题输出)
  262. function QdMx(node) {
  263. const row = node.row();
  264. const attrs = [
  265. { name: 'Xh', value: row, type: TYPE.INT }, // 序号
  266. { name: 'Qdbm', value: node.data.code, minLen: 1 }, // 编码
  267. { name: 'Name', value: node.data.name }, // 名称
  268. { name: 'Dw', value: node.data.unit }, // 单位
  269. { name: 'Sl', value: node.data.quantity, type: TYPE.DECIMAL }, // 工程量
  270. { name: 'Sl2', value: '0', type: TYPE.DECIMAL }, // 工程量2
  271. { name: 'Rgf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL }, // 人工费
  272. { name: 'Clf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL }, // 材料费
  273. { name: 'Jxf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL }, // 机械费
  274. { name: 'Sbf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'marketEquipment.tenderTotalFee'), type: TYPE.DECIMAL }, // 设备费
  275. { name: 'Csf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL }, // 措施费
  276. { name: 'Glf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL }, // 企业管理费
  277. { name: 'Gf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL }, // 规费
  278. { name: 'Lr', value: isBidInvitation ? '0' : getFee(node.data.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL }, // 利润
  279. { name: 'Sj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL }, // 税金
  280. { name: 'Zhdj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderUnitFee'), type: TYPE.DECIMAL }, // 单价
  281. { name: 'Zhhj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderTotalFee'), type: TYPE.DECIMAL }, // 合价
  282. { name: 'Zgj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'estimate.tenderTotalFee'), type: TYPE.DECIMAL }, // 暂估价
  283. { name: 'Iszg', value: node.data.specialProvisional === '专业工程', type: TYPE.BOOL }, // 是否暂定 如果专项暂定列选择了“专业工程”,则输出true,否则是false。
  284. { name: 'Djfx', value: !!node.data.unitPriceAnalysis, type: TYPE.BOOL }, // 单价分析
  285. { name: 'Jsgs', value: node.data.calcBase }, // 计算基数
  286. { name: 'Bl', value: '' }, // 变量
  287. { name: 'Bz', value: node.data.remark }, // 备注
  288. ];
  289. Element.call(this, 'QdMx', attrs);
  290. }
  291. // 定额组价
  292. function Qdxdezj() {
  293. Element.call(this, 'Qdxdezj');
  294. }
  295. // 定额租价明细 招标文件不输出
  296. function QdxdezjMx(ration) {
  297. const typeMap = {
  298. [RationType.RATION]: '1',
  299. [RationType.VOLUME_PRICE + GljType.LABOUR]: '2',
  300. [RationType.VOLUME_PRICE + GljType.GENERAL_MATERIAL]: '3',
  301. [RationType.VOLUME_PRICE + GljType.GENERAL_MACHINE]: '4',
  302. [RationType.VOLUME_PRICE + GljType.EQUIPMENT]: '2',
  303. };
  304. const typeKey = (ration.type || '') + (ration.subType || '');
  305. const type = typeMap[typeKey];
  306. const attrs = [
  307. { name: 'Debm', value: ration.code }, // 编码
  308. { name: 'Mc', value: ration.name }, // 名称
  309. { name: 'Dw', value: ration.unit }, // 单位
  310. { name: 'Sl', value: ration.tenderQuantity }, // 工程量
  311. { name: 'Dj', value: getFee(ration.fees, 'common.tenderUnitFee'), type: TYPE.DECIMAL }, // 单价
  312. { name: 'Hj', value: getFee(ration.fees, 'common.tenderTotalFee'), type: TYPE.DECIMAL }, // 合价
  313. { name: 'Rgf', value: getFee(ration.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL }, // 人工费
  314. { name: 'Clf', value: getFee(ration.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL }, // 材料费
  315. { name: 'Jxf', value: getFee(ration.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL }, // 机械费
  316. { name: 'Sbf', value: getFee(ration.fees, 'marketEquipment.tenderTotalFee'), type: TYPE.DECIMAL }, // 设备费
  317. { name: 'Csf', value: getFee(ration.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL }, // 措施费
  318. { name: 'Glf', value: getFee(ration.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL }, // 企业管理费
  319. { name: 'Gf', value: getFee(ration.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL }, // 规费
  320. { name: 'Lr', value: getFee(ration.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL }, // 利润
  321. { name: 'Sj', value: getFee(ration.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL }, // 税金
  322. { name: 'Delb', value: type, type: TYPE.INT }, // 取定额/量价/设备的类别。(1=普通定额,2=人工,3=材料,4=机械,5=设备)
  323. { name: 'Iszd', value: 'false', type: TYPE.BOOL }, // 暂时,全部取fals
  324. ];
  325. Element.call(this, 'QdxdezjMx', attrs);
  326. }
  327. // 定额人材机含量
  328. function Qdxdercjhl() {
  329. Element.call(this, 'Qdxdercjhl');
  330. }
  331. // 定额人材机含量明细
  332. function QdxdercjhlMx(rcjID, quantity) {
  333. const attrs = [
  334. { name: 'RcjId', value: rcjID }, // 人材机资源ID
  335. { name: 'Sl', value: quantity, type: TYPE.DECIMAL }, // 消耗量
  336. ]
  337. Element.call(this, 'QdxdercjhlMx', attrs);
  338. }
  339. // 清单人材机含量
  340. function Qdxrcjhl() {
  341. Element.call(this, 'Qdxrcjhl');
  342. }
  343. // 清单人材机含量明细
  344. function QdxrcjhlMx(item) {
  345. const attrs = [
  346. { name: 'RcjId', value: item.rcjID }, // 人材机资源ID
  347. { name: 'Rcjhl', value: item.contain, type: TYPE.DECIMAL }, // 含量:取叶子清单下所有的人材机的含量,=各定额下的人材机总消耗量之和,再除以清单工程量
  348. { name: 'Rcjhj', value: item.totalPrice, type: TYPE.DECIMAL }, // 合价:人材机含量*人材机预算价
  349. { name: 'Zgjbz', value: item.isEvaluate, type: TYPE.BOOL }, // 是否暂估,根据资源ID,读取工料机汇总界面对应的“是否暂估”
  350. { name: 'Zcbz', value: 'false', type: TYPE.BOOL }, // 主材标记,公路上无此概念,默认输出=fales
  351. { name: 'Zyclbz', value: item.isMainMaterial, type: TYPE.BOOL }, // 根据资源ID,读取工料机汇总界面对应的“主要材料”
  352. ]
  353. Element.call(this, 'QdxrcjhlMx', attrs);
  354. }
  355. // 计日工
  356. function Jrg() {
  357. Element.call(this, 'Jrg');
  358. }
  359. // 计日工标题
  360. function JrgBt(node) {
  361. const typeMap = {
  362. [fixedFlag.LABOUR_SERVICE]: '1',
  363. [fixedFlag.MATERIAL]: '2',
  364. [fixedFlag.CONSTRUCTION_MACHINE]: '3',
  365. };
  366. const attrs = [
  367. { name: 'Name', value: node.data.name }, // 名称
  368. { name: 'Je', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderTotalFee'), type: TYPE.DECIMAL }, // 金额
  369. { name: 'Lb', value: typeMap[node.getFlag()], type: TYPE.INT }, // 类别:1=劳务;2=材料;3=施工机械
  370. { name: 'Bz', value: node.data.remark }, // 备注
  371. ];
  372. Element.call(this, 'JrgBt', attrs);
  373. }
  374. // 计日工明细
  375. function JrgMx(node) {
  376. const attrs = [
  377. { name: 'Bh', value: node.data.code }, // 编码
  378. { name: 'Name', value: node.data.name }, // 名称
  379. { name: 'Dw', value: node.data.unit }, // 单位
  380. { name: 'Sl', value: node.data.quantity }, // 工程量
  381. { name: 'Dj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderTotalFee'), type: TYPE.DECIMAL }, // 单价
  382. { name: 'Hj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderUnitFee'), type: TYPE.DECIMAL }, // 合价
  383. ];
  384. Element.call(this, 'JrgMx', attrs);
  385. }
  386. // 暂估材料表、评标材料表
  387. function gljRefRoot(eleName) {
  388. Element.call(this, eleName);
  389. }
  390. // 暂估材料表、评标材料表明细
  391. function gljRefElement(eleName, glj) {
  392. const attrs = [
  393. { name: 'Xh', value: glj.seq }, // 序号
  394. { name: 'RcjId', value: projectGLJIDToRcjID[glj.projectGLJID] }, // 资源ID
  395. { name: 'Bm', value: glj.code }, // 编码
  396. { name: 'Mc', value: glj.name }, // 名称
  397. { name: 'Ggxh', value: glj.specs }, // 规格型号
  398. { name: 'Dw', value: glj.unit }, // 单位
  399. { name: 'Sl', value: BID_INVITATION ? '0' : glj.quantity, type: TYPE.DECIMAL }, // 工程量
  400. { name: 'Dj', value: glj.marketPrice, type: TYPE.DECIMAL }, // 暂定价、单价
  401. { name: 'Hj', value: BID_INVITATION ? '0' : glj.totalPrice, type: TYPE.DECIMAL }, // 合价
  402. { name: 'Bz', value: glj.remark }, // 备注
  403. ];
  404. Element.call(this, eleName, attrs);
  405. }
  406. // 人材机汇总
  407. function Rcjhz() {
  408. Element.call(this, 'Rcjhz');
  409. }
  410. // 人材机汇总明细
  411. function RcjhzMx(glj) {
  412. const rootTypeReg = /\d/;
  413. let rootType = rootTypeReg.exec(glj.type)[0];
  414. if (!['1', '2', '3'].includes(rootType)) {
  415. rootType = '2';
  416. }
  417. const attrs = [
  418. { name: 'RcjId', value: projectGLJIDToRcjID[glj.id] }, // 资源ID
  419. { name: 'RcjBm', value: glj.code }, // 编码
  420. { name: 'Name', value: glj.name }, // 名称
  421. { name: 'Ggxh', value: glj.specs }, // 规格型号
  422. { name: 'Dw', value: glj.unit }, // 单位
  423. { name: 'Dj', value: glj.priceInfo.tenderPrice, type: TYPE.DECIMAL }, // 预算价,调后
  424. { name: 'Sl', value: glj.tenderQuantity, type: TYPE.DECIMAL }, // 总消耗量
  425. { name: 'Hj', value: glj.totalPrice, type: TYPE.DECIMAL }, // 合价,人材料总消耗量*预算价
  426. { name: 'Cd', value: '' }, // 产地
  427. { name: 'Gycs', value: '' }, // 厂商
  428. { name: 'Rcjlb', value: rootType, type: TYPE.INT }, // 人材机类型 1=人工;2=材料;3=机械
  429. { name: 'Jgbz', value: 'false', type: TYPE.BOOL }, // 供材方
  430. { name: 'Zyclbz', value: !!glj.is_main_material, type: TYPE.BOOL }, // 主要材料
  431. { name: 'Zgjbz', value: !!glj.is_evaluate, type: TYPE.BOOL }, // 是否暂估
  432. { name: 'Zcbz', value: 'false', type: TYPE.BOOL }, // 主材标记
  433. ];
  434. Element.call(this, 'RcjhzMx', attrs);
  435. }
  436. // 配比组成
  437. function PbZc() {
  438. Element.call(this, 'PbZc');
  439. }
  440. // 配比明细
  441. function PbZcMx(ratio) {
  442. const attrs = [
  443. { name: 'RcjId', value: projectGLJIDToRcjID[ratio.projectGLJID] }, // 组成物对应人材机汇总的资源ID
  444. { name: 'Sl', value: ratio.consumption, type: TYPE.DECIMAL }, // 组成物消耗量
  445. ];
  446. Element.call(this, 'PbZcMx', attrs);
  447. }
  448. // 校验信息
  449. function Jyxx(cpuID, diskID, macID, toMD5Value) {
  450. const attrs = [
  451. { name: 'SoftName', value: '纵横创新软件有限公司' }, // 公司名
  452. { name: 'SoftNum', value: md5(toMD5Value) }, // 校验数据
  453. { name: 'MacAdress', value: macID }, // mac地址
  454. { name: 'DogNum', value: userID }, // 加密锁号,取用户ID
  455. { name: 'ComputerName', value: USER_NAME }, // 计算机名,取用户名称
  456. { name: 'HDDSerial', value: diskID }, // 硬盘序列号
  457. { name: 'CPUSerial', value: cpuID }, // CPU序列号
  458. ];
  459. Element.call(this, 'Jyxx', attrs);
  460. }
  461. // 组装数据 --------------------------------------
  462. // 组装建设项目数据
  463. function setupConstruction(constructionData) {
  464. const information = constructionData.property && constructionData.property.basicInformation || [];
  465. const summaryInfo = constructionData.summaryInfo[constructionData.ID];
  466. const chiZGLGC = new CreateNode('池州公路工程');
  467. chiZGLGC.children.push(new GongCXX(information));
  468. const zhaoTBXX = new CreateNode('招投标信息');
  469. chiZGLGC.children.push(zhaoTBXX);
  470. const gongLGCSJ = new CreateNode('公路工程数据');
  471. chiZGLGC.children.push(gongLGCSJ);
  472. if (isBidInvitation) {
  473. zhaoTBXX.children.push(new ZhaoBiaoXx(information));
  474. } else if (isControl) {
  475. zhaoTBXX.children.push(new ZhaoBiaoKzXx(information, summaryInfo.totalCost));
  476. } else {
  477. zhaoTBXX.children.push(new TouBiaoXx(information, summaryInfo.totalCost));
  478. };
  479. // 将单位工程工程特征中,单项工程编号、名称相同的,插入到建设项目和分段(单位工程)的中间层。
  480. const midLayerMap = {}; // 单项工程key(code@name)与单项工程节点映射
  481. debugger;
  482. for (const tenderData of constructionData.children) {
  483. const gongLBDGC = new CreateNode('公路标段工程');
  484. gongLGCSJ.children.push(gongLBDGC);
  485. const attrs = [
  486. { name: '序号', value: getValueByKey(information, '') },
  487. { name: '标段名称', value: getValueByKey(information, '') },
  488. { name: '金额', value: getValueByKey(information, '') },
  489. { name: '唯一标识-Guid', value: getValueByKey(information, 'xxxxxxxxxxxxxxxxxx') }
  490. ];
  491. const feature = tenderData.property && tenderData.property.projectFeature || [];
  492. const midLayerCode = getValueByKey(feature, 'singleProjNo');
  493. const midLayerName = getValueByKey(feature, 'singleProjName');
  494. // const midLayerKey = `${midLayerCode}@${midLayerName}`;
  495. // if (!midLayerMap[midLayerKey]) {
  496. // chiZGLGC.children.push(midLayerMap[midLayerKey] = new Dxgcxx(midLayerCode, midLayerName));
  497. // }
  498. // midLayerMap[midLayerKey].children.push(setupTender(tenderData, feature));
  499. }
  500. const gongLGCHZ = new CreateNode('公路工程汇总');
  501. gongLGCSJ.children.push(gongLGCHZ);
  502. // 校验信息
  503. const [cpuID, diskID, macID] = generateHardwareId().split(';');
  504. const suffix = INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind];
  505. // 需要md5的值:MD5(“WHGLZTB”+项目名称+机器码+加密锁锁号)机器码取mac地址,加密锁锁号取用户账号id
  506. const toMD5Suffix = suffix.split('.')[1];
  507. const toMD5Value = `${toMD5Suffix}${constructionData.name}${macID}${userID}`;
  508. // chiZGLGC.children.push(new Jyxx(cpuID, diskID, macID, suffix, toMD5Value));
  509. return [{
  510. data: chiZGLGC,
  511. exportKind,
  512. fileName: `${constructionData.name}${suffix}`
  513. }];
  514. }
  515. // getData接口数据
  516. let curDetail;
  517. // 需要先设置项目人材机的关联ID(从1开始),因为定额人材机等一些节点需要用到这个关联ID
  518. const projectGLJIDToRcjID = {}; // 项目人材机ID与新生成的整形ID映射
  519. const projectGLJMap = {}; // 项目人材机与项目人材机数据映射
  520. // 组装单位工程数据
  521. function setupTender(tenderData, feature) {
  522. curDetail = tenderDetailMap[tenderData.ID];
  523. curDetail.projectGLJ.datas.gljList.forEach((glj, index) => {
  524. projectGLJIDToRcjID[glj.id] = index + 1;
  525. projectGLJMap[glj.id] = glj;
  526. });
  527. const dwgcxx = new Dwgcxx(tenderData.name, feature);
  528. dwgcxx.children.push(
  529. setupFeeRate(curDetail.FeeRate),
  530. setupBills(curDetail.mainTree),
  531. ...setupGLJList(curDetail)
  532. );
  533. return dwgcxx;
  534. }
  535. // 组装费率数据
  536. function setupFeeRate(feeRateDetail) {
  537. const qfxx = new Qfxx();
  538. const jjflb = new JjFlb();
  539. // 费率界面左侧底层数据
  540. let curRootItem;
  541. feeRateDetail.datas.rates.forEach(item => {
  542. if (!item.ParentID) {
  543. curRootItem = item;
  544. } else if (!item.sum) { // 最底层
  545. jjflb.children.push(new JjFlbMx(curRootItem, item));
  546. }
  547. });
  548. // 费率界面右侧顶层数据
  549. const jjflx = new JjFlx();
  550. const flxmxData = feeRateDetail
  551. .getAllSubRates()
  552. .filter(item => !item.isSub)
  553. .map(item => new JjFlxMx(item));
  554. jjflx.children.push(...flxmxData);
  555. qfxx.children.push(jjflb, jjflx);
  556. return qfxx;
  557. }
  558. // 组装清单数据
  559. function setupBills(mainTree) {
  560. const qdxm = new QdXm();
  561. const qdbtData = mainTree.roots.map(node => new QdBt(node));
  562. qdxm.children.push(...qdbtData);
  563. mainTree.roots.forEach(node => {
  564. const flag = node.getFlag();
  565. const qdbt = new QdBt(node);
  566. if (flag === fixedFlag.ONE_SEVEN_BILLS) { // 100章到700章清单需要输出详细数据
  567. qdbt.children.push(...setupSubBills(node.children));
  568. } else if (flag === fixedFlag.DAYWORK_LABOR) {
  569. qdbt.children.push(setupDaywork(node.children));
  570. }
  571. qdxm.children.push(qdbt);
  572. });
  573. function setupSubBills(nodes) {
  574. const rst = [];
  575. nodes.forEach(node => {
  576. const qdmx = new QdMx(node);
  577. rst.push(qdmx);
  578. const subIsRations = node.children.length && !node.source.children.length;
  579. if (subIsRations) {
  580. qdmx.children.push(...setupRations(node.children));
  581. qdmx.children.push(...setupBillsContain(node.data));
  582. } else {
  583. qdmx.children.push(...setupSubBills(node.children));
  584. }
  585. });
  586. return rst;
  587. }
  588. function setupDaywork(nodes) {
  589. const dayworkRoot = new Jrg();
  590. const dayworkBT = nodes.map(node => {
  591. const bt = new JrgBt(node);
  592. const dayworkMX = node.children.map(child => new JrgMx(child));
  593. bt.children.push(...dayworkMX);
  594. return bt;
  595. });
  596. dayworkRoot.children.push(...dayworkBT);
  597. return dayworkRoot;
  598. }
  599. return qdxm;
  600. }
  601. // 组装定额、定额人材机数据
  602. function setupRations(rationNodes) {
  603. // 招标文件不输出
  604. if (isBidInvitation) {
  605. return [];
  606. }
  607. const rationRoot = new Qdxdezj();
  608. const rationEles = rationNodes.map(node => {
  609. const rationEle = new QdxdezjMx(node.data);
  610. /* // 定额人材机
  611. let rationGLJList = curDetail.ration_glj.datas.filter(glj => glj.rationID === node.data.ID);
  612. rationGLJList = gljUtil.sortRationGLJ(rationGLJList); */
  613. const rationGLJRoot = new Qdxdercjhl();
  614. const rationGLJEles = node.data.rationGLJList.map(glj => new QdxdercjhlMx(projectGLJIDToRcjID[glj.projectGLJID], glj.tenderQuantity));
  615. rationGLJRoot.children.push(...rationGLJEles);
  616. rationEle.children.push(rationGLJRoot);
  617. return rationEle;
  618. });
  619. rationRoot.children.push(...rationEles);
  620. return [rationRoot];
  621. }
  622. // 组装清单人材机含量数据
  623. function setupBillsContain(bills) {
  624. if (isBidInvitation) {
  625. return [];
  626. }
  627. // 读取清单下的人材机,先将各定额下的人材机汇总,相同的合并(相同的项目人材机ID)
  628. const gljList = curDetail.ration_glj.datas.filter(glj => glj.billsItemID === bills.ID);
  629. if (!gljList) {
  630. return [];
  631. }
  632. const map = {};
  633. gljList.forEach(glj => {
  634. if (!map[glj.projectGLJID]) {
  635. const projectGLJ = projectGLJMap[glj.projectGLJID];
  636. map[glj.projectGLJID] = {
  637. rcjID: projectGLJIDToRcjID[glj.projectGLJID],
  638. totalQuantity: glj.tenderQuantity,
  639. price: glj.tenderPrice,
  640. isEvaluate: !!projectGLJ.is_evaluate,
  641. isMainMaterial: !!projectGLJ.is_main_material
  642. };
  643. } else {
  644. map[glj.projectGLJID].totalQuantity = scMathUtil.roundTo(map[glj.projectGLJID].totalQuantity + glj.tenderQuantity, -6);
  645. }
  646. });
  647. const containItems = Object
  648. .values(map)
  649. .map(glj => {
  650. const contain = glj.totalQuantity / (bills.quantity || 1);
  651. return {
  652. rcjID: glj.rcjID,
  653. contain: scMathUtil.roundTo(contain, -6), // 固定取6位
  654. totalPrice: scMathUtil.roundTo(contain * glj.price, -2), // 固定取2位
  655. isEvaluate: glj.isEvaluate,
  656. isMainMaterial: glj.isMainMaterial
  657. };
  658. });
  659. const root = new Qdxrcjhl();
  660. root.children.push(...containItems.map(item => new QdxrcjhlMx(item)));
  661. return [root]
  662. }
  663. // 组装人材机汇总相关表数据
  664. function setupGLJList(tenderDetail) {
  665. // 暂估材料
  666. const zgcl = new gljRefRoot('ZgCl');
  667. zgcl.children = tenderDetail.evaluateMaterialData.map(glj => new gljRefElement('ZgClMx', glj));
  668. // 评标材料
  669. const jpcl = new gljRefRoot('JpCl');
  670. jpcl.children = tenderDetail.bidMaterialData.map(glj => new gljRefElement('JpClMx', glj));
  671. if (isBidInvitation) {
  672. return [zgcl, jpcl];
  673. }
  674. // 人材机汇总 (招标不导出)
  675. const rcjhz = new Rcjhz();
  676. rcjhz.children = tenderDetail.projectGLJ.datas.gljList.map(pGLJ => {
  677. const gljElement = new RcjhzMx(pGLJ);
  678. // 组成物
  679. const connectKey = gljUtil.getIndex(pGLJ, gljKeyArray);
  680. const ratioData = tenderDetail.projectGLJ.datas.mixRatioMap[connectKey];
  681. if (ratioData && ratioData.length) {
  682. const pbzc = new PbZc();
  683. pbzc.children = ratioData.map(ratio => new PbZcMx(ratio));
  684. gljElement.children.push(pbzc);
  685. }
  686. return gljElement;
  687. });
  688. return [zgcl, jpcl, rcjhz];
  689. }
  690. return setupConstruction(projectData);
  691. }
  692. return {
  693. entry
  694. };
  695. })();