anhui_maanshan.js 35 KB

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