anhui_chizhou.js 39 KB

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