shandong_common.js 88 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444
  1. // INTERFACE_EXPORT =,必须这么写,这样才能在导出时动态加载脚本后,覆盖前端代码
  2. // 参考广东中山导出接口
  3. INTERFACE_EXPORT = (() => {
  4. "use strict";
  5. const feeRateMap = {
  6. 冬季施工增加费: "DJSGZJFFL",
  7. 冬季施工: "DJSGZJFFL",
  8. 雨季施工增加费: "YUJSGZJFFL",
  9. 雨季施工: "YUJSGZJFFL",
  10. 夜间施工增加费: "YEJSGZJFFL",
  11. 夜间施工: "YEJSGZJFFL",
  12. 高原地区施工增加费: "GYDQSGZJFFL",
  13. 高原施工: "GYDQSGZJFFL",
  14. 风沙地区施工增加费: "FSDQSGZJFFL",
  15. 风沙施工: "FSDQSGZJFFL",
  16. 沿海地区施工增加费: "YHDQSGZJFFL",
  17. 沿海施工: "YHDQSGZJFFL",
  18. 行车干扰施工增加费: "XCGRGCSGZJFFL",
  19. 行车干扰: "XCGRGCSGZJFFL",
  20. 工地转移费: "GDZYFFL",
  21. '工地转移(km)': "GDZYFFL",
  22. 施工辅助费: "SGFZFFL",
  23. 施工辅助: "SGFZFFL",
  24. 基本费用: "JBFYFL",
  25. 主副食运费补贴: "ZFSYFBTFL",
  26. '综合里程(km)': "ZFSYFBTFL",
  27. 职工探亲路费: "ZGTQLFFL",
  28. 职工探亲: "ZGTQLFFL",
  29. 职工取暖补贴: "ZGQNBTFL",
  30. 职工取暖: "ZGQNBTFL",
  31. 财务费用: "CWFYFL",
  32. 养老保险费: "YANGLBXFFL",
  33. 失业保险费: "SYBXFFL",
  34. 医疗保险费: "YILBXFFL",
  35. 工伤保险费: "GSBXFL",
  36. 养老保险: "YANGLBXFFL",
  37. 失业保险: "SYBXFFL",
  38. 医疗保险: "YILBXFFL",
  39. 工伤保险: "GSBXFL",
  40. 住房公积金: "ZFGJJFL",
  41. 规费: "GFZHFL",
  42. 利润: "LRL",
  43. 税金: "SL",
  44. 土方: "TF",
  45. 石方: "SF",
  46. 运输: "YS",
  47. 路面: "LM",
  48. "路面(不计雨)": "LM",
  49. 隧道: "SD",
  50. 构造物I: "GZW1",
  51. "构造物I(不计冬)": "GZW1",
  52. "构造物I(不计雨)": "GZW1",
  53. 构造物II: "GZW2",
  54. "构造物III(桥梁)": "GZW3",
  55. "构造物III(除桥以外)": "GZW3",
  56. "构造物III(除桥以外不计雨夜)": "GZW3",
  57. 技术复杂大桥: "JSFZDQ",
  58. "钢材及钢结构(桥梁)": "GJG",
  59. "钢材及钢结构(除桥以外)": "GJG",
  60. "钢材及钢结构(除桥以外不计夜)": "GJG",
  61. };
  62. //计算程序有,这里没有:施工机械使用费\施工机械人工费\定额人工费\定额材料费\定额施工机械使用费
  63. const itemFeeMap = {
  64. 'marketLabour': 'RGF',
  65. 'marketMaterial': 'CLF',
  66. 'marketMachine':'JXSYF',
  67. 'marketEquipment': 'SBGZF',
  68. 'direct': 'DEZJF',
  69. 'equipment': 'DESBF',
  70. 'marketDirect': 'ZJF',
  71. 'measure': 'CSF',
  72. 'measure1': 'CSF1',
  73. 'measure2': 'CSF2',
  74. 'manage': 'QYGLF',
  75. 'force': 'GF',
  76. 'profit': 'LR',
  77. 'tax': 'SJ',
  78. 'common': 'JAF',
  79. 'rationCommon': 'DEJAF'
  80. };
  81. const feeLibNoMap = {
  82. 'eba0e7c0-cfe6-11ea-ba15-739be477d1fe': 'GYSFL-000000-2018-86',
  83. '451d3180-e02e-11ea-8056-1514dfc2f39e': 'GYSFL-340000-2019-210',
  84. '32923ff0-e912-11ea-8b20-d93bc370e960': 'GYSFL-440000-2019-544'
  85. };
  86. const FixedCostMap = {
  87. //折旧费、检修费、维护费、安拆辅助费
  88. '折旧费': 1,
  89. '检修费': 1,
  90. '维护费': 1,
  91. '安拆辅助费':1
  92. }
  93. const RoadGradeMap = {
  94. "高速公路": "0",
  95. "一级公路": "1",
  96. "二级公路": "2",
  97. "三级公路": "3",
  98. "四级公路": "4",
  99. "等外公路": "5",
  100. "独立桥梁": "6",
  101. "独立隧道": "7"
  102. }
  103. const sectionNameMap = {
  104. "清单 第100章 总则": true,
  105. "清单 第200章 路基": true,
  106. "清单 第300章 路面": true,
  107. "清单 第400章 桥梁、涵洞": true,
  108. "清单 第500章 隧道": true,
  109. "清单 第600章 安全设施及预埋管线": true,
  110. "清单 第700章 绿化及环境保护设施": true,
  111. // "清单 第800章 机电工程": true,
  112. // "清单 第900章 附属区房建工程":true
  113. }
  114. const ListCodeMap = {
  115. "第100章至700章清单":"1",
  116. "清单 第100章 总则": "一",
  117. "清单 第200章 路基": "二",
  118. "清单 第300章 路面": "三",
  119. "清单 第400章 桥梁、涵洞": "四",
  120. "清单 第500章 隧道": "五",
  121. "清单 第600章 安全设施及预埋管线": "六",
  122. "清单 第700章 绿化及环境保护设施": "七",
  123. // "清单 第800章 机电工程": "八",
  124. // "清单 第900章 附属区房建工程": "九",
  125. "已包含在清单合计中的材料、工程设备、专业工程暂估价合计": "10",
  126. "清单合计减去材料、工程设备、专业工程暂估价合计": "11",
  127. "计日工合计": "12",
  128. "劳务": "12.1",
  129. "材料": "12.2",
  130. "机械": "12.3",
  131. "暂列金额(不含计日工总额)": "13",
  132. "投标报价": "14"
  133. }
  134. const ratioCodeMap = {
  135. "01ZJF":"0",
  136. "02JXF":"1",
  137. "03WHF":"2",
  138. "04ACFZF":"3"
  139. }
  140. function getBasePrice(projectGLJID, tenderProject) {
  141. let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
  142. id: projectGLJID
  143. })
  144. return glj ? gljUtil.getBasePrice(glj, null, null, null, decimalObj, false, _, scMathUtil) : 0;
  145. }
  146. function getFeeRate(programID, fieldName, tenderProject) {
  147. let rate = 0;
  148. let template = tenderProject.calcProgram.compiledTemplates;
  149. if (template[programID]) {
  150. let item = _.find(template[programID].calcItems, {
  151. fieldName: fieldName
  152. })
  153. if (item) rate = item.feeRate;
  154. }
  155. return rate
  156. }
  157. function billNameChecking(bNode,projectName,fixedFlag) {
  158. let data = bNode.data;
  159. let fail = null;
  160. let pass = true;
  161. if (data.flagsIndex && data.flagsIndex.fixed) {
  162. let flag = data.flagsIndex.fixed.flag;
  163. switch (flag) {
  164. case fixedFlag.ONE_SEVEN_BILLS:
  165. pass = data.name == "第100章至700章清单" || data.name == "第100章至700章清单合计";
  166. break;
  167. case fixedFlag.PROVISIONAL_TOTAL:
  168. pass = data.name == "已包含在清单合计中的材料、工程设备、专业工程暂估价合计";
  169. break;
  170. case fixedFlag.BILLS_TOTAL_WT_PROV:
  171. pass = data.name == "清单合计减去材料、工程设备、专业工程暂估价合计";
  172. break;
  173. case fixedFlag.DAYWORK_LABOR:
  174. pass = data.name == "计日工合计";
  175. break;
  176. /* case fixedFlag.LABOUR_SERVICE:
  177. pass = data.name == "劳务";
  178. break;
  179. case fixedFlag.MATERIAL:
  180. pass = data.name == "材料";
  181. break;
  182. case fixedFlag.CONSTRUCTION_MACHINE:
  183. pass = data.name == "机械";
  184. break; */
  185. case fixedFlag.PROVISIONAL:
  186. pass = data.name == "暂列金额(不含计日工总额)";
  187. break;
  188. case fixedFlag.TOTAL_COST:
  189. pass = data.name == "投标报价";
  190. break;
  191. case fixedFlag.ONE_HUNDRED_BILLS:
  192. pass = data.name == "清单 第100章 总则";
  193. break;
  194. }
  195. } else {
  196. if (bNode.parent) {
  197. const pdata = bNode.parent.data;
  198. if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
  199. if (!sectionNameMap[data.name]) pass = false
  200. }
  201. }
  202. }
  203. if(pass == false)fail = { hint: `清单:"${data.name?data.name:""}",名字不符合规范!`, type: projectName }
  204. return fail;
  205. }
  206. /**
  207. *
  208. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  209. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  210. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  211. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  212. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  213. */
  214. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  215. const {
  216. CONFIG: {
  217. TYPE
  218. },
  219. UTIL,
  220. Element
  221. } = INTERFACE_EXPORT_BASE;
  222. const {
  223. EXPORT_KIND: {
  224. BID_INVITATION,
  225. BID_SUBMISSION,
  226. CONTROL
  227. },
  228. fixedFlag,
  229. } = window.commonConstants;
  230. let cprjType = {
  231. 1: "GCLQD", // 招标
  232. 2: "TBBJ", // 投标
  233. 3: "ZBKZJ", // 控制价
  234. };
  235. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  236. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  237. const isControl = exportKind === CONTROL; // 是否是控制价
  238. function emptyElement(name) {
  239. this.name = name;
  240. this.attrs = [];
  241. this.children = [];
  242. }
  243. // 建设项目根节点信息
  244. function CprjInfo(projectName) {
  245. const attrs = [{
  246. name: "CprjName",
  247. value: projectName,
  248. },
  249. {
  250. name: "CprjType",
  251. value: cprjType[exportKind],
  252. },
  253. ];
  254. Element.call(this, "CprjInfo", attrs);
  255. }
  256. // 项目基本信息
  257. function SystemInfo(projectData) {
  258. let baseInfo = _.find(projectData.property.basicInformation, {
  259. dispName: "基本信息",
  260. });
  261. //“招标工程量清单”、“招标控制价”时,输出该字段,为导出该文件的当前时间
  262. let makeData = {
  263. value : UTIL.getNowFormatTime(true)
  264. }
  265. //投标的时候取基本信息的makeData字段
  266. if(isBidSubmission) makeData = _.find(baseInfo.items, { "key": "makeDate" });
  267. // 取编制软件序列号所属单位。读取项目属性-建设项目基本信息的“投标单位”字段。该字段需要模板中新增。等确定后再修改
  268. // let softwareNumHolder = _.find(baseInfo.items, { "key": "???" });
  269. let softwareNumHolder = userCompany; // userCompany是在main界面上已经有现成的(类似userAccount, userID)
  270. let hardID = UTIL.generateHardwareId();
  271. let [cpuId, diskId, macId] = hardID.split(";");
  272. // const orgScretInfoStr = `SoftwareName=纵横公路工程造价管理软件,SoftwareVer=V${VERSION},SoftwareCompany=珠海纵横创新软件有限公司,SoftwareNumber=${userID},HardNumber=${diskId},MacAddress=${macId},SoftwareNumberHolder=${softwareNumHolder}`
  273. const orgScretInfoStr = `SoftwareName=纵横公路工程造价管理软件,SoftwareVer=V${VERSION},SoftwareCompany=珠海纵横创新软件有限公司,SoftwareNumber=${window.btoa(userID)},HardNumber=${window.btoa(diskId)},MacAddress=${window.btoa(macId)},SoftwareNumberHolder=${softwareNumHolder}`
  274. let scretInfo = sm3Digest(orgScretInfoStr);
  275. const attrs = [{
  276. name: "Name",
  277. value: "公路工程造价数据标准",
  278. },
  279. {
  280. name: "Version",
  281. value: "1.0",
  282. },
  283. {
  284. name: "SoftwareName",
  285. value: "纵横公路工程造价管理软件",
  286. },
  287. {
  288. name: "SoftwareVer",
  289. value: "V" + VERSION,
  290. },
  291. {
  292. name: "SoftwareCompany",
  293. value: "珠海纵横创新软件有限公司",
  294. },
  295. {
  296. name: "MakeDate",
  297. value: makeData?makeData.value:"",
  298. },
  299. {
  300. name: "SoftwareNumber",
  301. value: window.btoa(userID),
  302. },
  303. {
  304. name: "HardNumber",
  305. value: window.btoa(diskId),
  306. },
  307. {
  308. name: "MacAddress",
  309. value: window.btoa(macId),
  310. },
  311. {
  312. name: "SoftwareNumberHolder",
  313. value: softwareNumHolder,
  314. },
  315. {
  316. name: "SecretInfo",
  317. value: scretInfo,
  318. },
  319. ];
  320. Element.call(this, "SystemInfo", attrs);
  321. }
  322. //造价依据
  323. function CostBasis() {
  324. // ItemStandardNo="GYSFX-000000-2018-86"
  325. const attrs = [{
  326. name: "MakeRuleNo",
  327. value: "GYSBB-000000-2018-86",
  328. },
  329. {
  330. name: "MakeRuleName",
  331. value: "公路工程建设项目概算预算编制办法",
  332. },
  333. {
  334. name: "ItemStandardNo",
  335. value: "GYSFX-000000-2018-86",
  336. },
  337. ];
  338. Element.call(this, "CostBasis", attrs);
  339. //定额库信息
  340. //to do 改成实际的值
  341. function NormLib() {
  342. const attrs = [{
  343. name: "NormLibNo",
  344. value: "YSDE-000000-2018-86",
  345. },
  346. {
  347. name: "NormLibName",
  348. value: "部颁公路工程预算定额(2018)",
  349. },
  350. {
  351. name: "Type",
  352. value: "ZDEK",
  353. },
  354. ];
  355. Element.call(this, "NormLib", attrs);
  356. }
  357. this.children.push(new NormLib());
  358. }
  359. function Rate(tenderProject, feeRateInfo, seirNo) {
  360. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  361. const attrs = [{
  362. name: "RateNo",
  363. value: seirNo,
  364. },
  365. {
  366. name: "Name",
  367. value: feeRateInfo.name,
  368. },
  369. {
  370. name: "RateLibNo",
  371. value: feeLibNoMap[feeRateInfo.libID],
  372. },
  373. ];
  374. Element.call(this, "Rate", attrs);
  375. let RateParams = new emptyElement("RateParams");
  376. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  377. for (let s of subRates) {
  378. let sname = s.name.replace("(%)", "");
  379. sname = sname.replace("(%)", "");
  380. if (feeRateMap[sname]) {
  381. let value = "";
  382. if (s.editable) {
  383. let sel = _.find(s.optionList, {
  384. selected: true,
  385. });
  386. if (sel) {
  387. value = sel.name;
  388. } else if (gljUtil.isDef(s.value)) {
  389. value = s.value;
  390. }
  391. } else {
  392. value = _.findIndex(s.optionList, {
  393. selected: true,
  394. });
  395. if (value == -1) value = 0;
  396. }
  397. /* if (sname == '利润') tenderProject.ProfitRate = value;
  398. if (sname == '税金') tenderProject.TaxRate = value; */
  399. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  400. }
  401. }
  402. this.children.push(RateParams);
  403. function RateParam(RateTypeNo, RateParamNo) {
  404. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  405. const attrs = [{
  406. name: "RateTypeNo",
  407. value: RateTypeNo,
  408. },
  409. {
  410. name: "RateParamNo",
  411. value: RateParamNo,
  412. },
  413. {
  414. name: "Ratio",
  415. value: "100",
  416. },
  417. ];
  418. Element.call(this, "RateParam", attrs);
  419. }
  420. let RateValues = new emptyElement("RateValues");
  421. function RateValue(CostTypeNo, RateTypeNo, value) {
  422. const attrs = [{
  423. name: "CostTypeNo",
  424. value: CostTypeNo,
  425. },
  426. {
  427. name: "RateTypeNo",
  428. value: RateTypeNo,
  429. },
  430. {
  431. name: "RateValue",
  432. value: value,
  433. },
  434. ];
  435. Element.call(this, "RateValue", attrs);
  436. }
  437. let prefix = "";
  438. for (let r of feeRateInfo.rates) {
  439. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  440. if (feeRateMap[r.name] && r.ParentID) {
  441. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  442. }
  443. }
  444. this.children.push(RateValues);
  445. }
  446. function Pract(tpdata, seriNo) {
  447. let pgljData = tpdata.projectGLJ.datas;
  448. let decimalObj = tpdata.property.decimal;
  449. const attrs = [{
  450. name: "PractNo",
  451. value: seriNo,
  452. },
  453. {
  454. name: "Name",
  455. value: pgljData.constData.usedUnitPriceInfo.name,
  456. },
  457. ];
  458. Element.call(this, "Pract", attrs);
  459. let Param = {
  460. name: "Param",
  461. attrs: [{
  462. name: "TaxLibNo",
  463. value: "CCSBZ-440000-2019-544",
  464. },
  465. {
  466. name: "AuxRate",
  467. value: pgljData.constData.assistProductionFeeRate,
  468. },
  469. ],
  470. children: [],
  471. };
  472. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  473. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  474. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  475. for (let e of elecDatas) {
  476. let Electro = {
  477. name: "Electro",
  478. attrs: [{
  479. name: "Code",
  480. value: e.code,
  481. },
  482. {
  483. name: "Price",
  484. value: e.electPrice,
  485. },
  486. {
  487. name: "Ratio",
  488. value: e.coe,
  489. },
  490. ],
  491. children: [],
  492. };
  493. Param.children.push(Electro);
  494. }
  495. }
  496. this.children.push(Param);
  497. function Mp(g) {
  498. const attrs = [{
  499. name: "Code",
  500. value: g.code,
  501. },
  502. {
  503. name: "PractName",
  504. value: g.name,
  505. },
  506. {
  507. name: "Spec",
  508. value: g.specs,
  509. },
  510. {
  511. name: "Unit",
  512. value: g.unit,
  513. },
  514. {
  515. name: "BudgetPrice",
  516. value: g.priceInfo.tenderPrice,
  517. },
  518. {
  519. name: "NormPrice",
  520. value: g.priceInfo.basePrice,
  521. },
  522. {
  523. name: "IsAdd",
  524. value: g.unit_price.is_add,
  525. },
  526. ];
  527. Element.call(this, "Mp", attrs);
  528. }
  529. function Material(g) {
  530. const attrs = [{
  531. name: "Code",
  532. value: g.code,
  533. },
  534. {
  535. name: "PractName",
  536. value: g.name,
  537. },
  538. {
  539. name: "Spec",
  540. value: g.specs,
  541. },
  542. {
  543. name: "Unit",
  544. value: g.unit,
  545. },
  546. {
  547. name: "BudgetPrice",
  548. value: g.priceInfo.tenderPrice,
  549. },
  550. {
  551. name: "NormPrice",
  552. value: g.priceInfo.basePrice,
  553. },
  554. {
  555. name: "IsAdd",
  556. value: g.unit_price.is_add,
  557. },
  558. {
  559. name: "OrgPrice",
  560. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  561. },
  562. {
  563. name: "TransFee",
  564. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  565. },
  566. {
  567. name: "GwRate",
  568. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  569. },
  570. {
  571. name: "OffSiteLf",
  572. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  573. },
  574. {
  575. name: "OnSiteLf",
  576. value: 0,
  577. },
  578. {
  579. name: "LoadLf",
  580. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  581. },
  582. {
  583. name: "StoreRate",
  584. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  585. },
  586. {
  587. name: "PackageRecycleFee",
  588. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  589. },
  590. ];
  591. Element.call(this, "Material", attrs);
  592. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  593. // let index = gljUtil.getIndex(g);
  594. // let orList = [];
  595. // for (let o of pgljData.originalList) {
  596. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  597. // }
  598. // if (orList.length > 0) this.children = orList;
  599. // }
  600. function CostStructure(r) {
  601. //待获取
  602. this.name = "CostStructure";
  603. this.attrs = [];
  604. this.children = [];
  605. }
  606. function Consume(r, o) {
  607. this.name = "Consume";
  608. this.attrs = [];
  609. this.children = [];
  610. for (let g of o.ration_gljs) {
  611. if (g.rationID == r.ID) {
  612. let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  613. this.children.push(new ConsumeItem(g, r_quantity));
  614. }
  615. }
  616. }
  617. function ConsumeItem(g, ration_quantity) {
  618. const attrs = [{
  619. name: "Code", //待获取
  620. value: g.code,
  621. },
  622. {
  623. name: "Consumption",
  624. value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  625. },
  626. ];
  627. Element.call(this, "ConsumeItem", attrs);
  628. }
  629. function Norm(r, o) {
  630. const attrs = [{
  631. name: "NormLibNo", //待获取
  632. value: "",
  633. },
  634. {
  635. name: "DisplayCode",
  636. value: r.code,
  637. },
  638. {
  639. name: "Name",
  640. value: r.name,
  641. },
  642. {
  643. name: "Unit",
  644. value: r.unit,
  645. },
  646. {
  647. name: "Num",
  648. value: r.quantity,
  649. },
  650. {
  651. name: "CostTypeNo",
  652. value: "", //待获取
  653. },
  654. {
  655. name: "FabricationCost", //待获取
  656. value: "",
  657. },
  658. {
  659. name: "AdjustStatus",
  660. value: "",
  661. },
  662. ];
  663. Element.call(this, "Norm", attrs);
  664. this.children.push(new CostStructure(r));
  665. this.children.push(new Consume(r, o));
  666. }
  667. function SelfCollect(o) {
  668. const attrs = [{
  669. name: "OtherCost",
  670. value: 0,
  671. }, ];
  672. Element.call(this, "SelfCollect", attrs);
  673. for (let r of o.rations) {
  674. this.children.push(new Norm(r, o));
  675. }
  676. }
  677. function OrgPrices(o) {
  678. const attrs = [{
  679. name: "OrgPricevalue",
  680. value: o.supplyPrice,
  681. },
  682. {
  683. name: "Ratio",
  684. value: o.coe,
  685. },
  686. ];
  687. Element.call(this, "OrgPrices", attrs);
  688. if (!o.rations) return;
  689. this.children.push(new SelfCollect(o));
  690. }
  691. }
  692. function Mech(g,gljKeyMap) {
  693. const attrs = [{
  694. name: "Code",
  695. value: g.code,
  696. },
  697. {
  698. name: "PractName",
  699. value: g.name,
  700. },
  701. {
  702. name: "Spec",
  703. value: g.specs,
  704. },
  705. {
  706. name: "Unit",
  707. value: g.unit,
  708. },
  709. {
  710. name: "BudgetPrice",
  711. value: g.priceInfo.tenderPrice,
  712. },
  713. {
  714. name: "NormPrice",
  715. value: g.priceInfo.basePrice,
  716. },
  717. {
  718. name: "IsAdd",
  719. value: g.unit_price.is_add,
  720. },
  721. ];
  722. Element.call(this, "Mech", attrs);
  723. let FixedCostItems = [];
  724. let fcsum = 0;
  725. let VariableCostItems = [];
  726. let vcsum = 0;
  727. if (g.ratio_data && g.ratio_data.length > 0) {
  728. for (let ratio of g.ratio_data) {
  729. let rIndex = gljUtil.getIndex(ratio);
  730. let rglj = gljKeyMap[rIndex];
  731. let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
  732. if (FixedCostMap[ratio.name]) {
  733. FixedCostItems.push(new FixedCostItem(ratio));
  734. fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
  735. } else {
  736. VariableCostItems.push(new VariableCostItem(ratio));
  737. vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
  738. }
  739. }
  740. }
  741. if (FixedCostItems.length > 0) {
  742. let fc = new FixedCost(fcsum);
  743. fc.children = FixedCostItems;
  744. this.children.push(fc);
  745. }
  746. if (VariableCostItems.length > 0) {
  747. let vc = new VariableCost(vcsum);
  748. vc.children = VariableCostItems;
  749. this.children.push(vc);
  750. }
  751. function VariableCost(sum) {
  752. const attrs = [{
  753. name: "VariableCostSum",
  754. value: sum,
  755. }];
  756. Element.call(this, "VariableCost", attrs);
  757. }
  758. function VariableCostItem(item) {
  759. const attrs = [{
  760. name: "VariableCostNo",
  761. value: item.code,
  762. },{
  763. name: "Consumption",
  764. value: item.consumption,
  765. }]
  766. Element.call(this, "VariableCostItem", attrs);
  767. }
  768. function FixedCost(sum) {
  769. const attrs = [{
  770. name: "FixedCostSum",
  771. value: sum,
  772. }, {
  773. name: "FixedRate",
  774. value: 1,
  775. }];
  776. Element.call(this, "FixedCost", attrs);
  777. }
  778. function FixedCostItem(item) {
  779. const attrs = [{
  780. name: "FixedCostNo",
  781. value: ratioCodeMap[item.code],
  782. },{
  783. name: "Sum",
  784. value: item.consumption,
  785. }]
  786. Element.call(this, "FixedCostItem", attrs);
  787. }
  788. }
  789. let Mps = new emptyElement("Mps");
  790. let Materials = new emptyElement("Materials");
  791. let Mechs = new emptyElement("Mechs");
  792. let gljKeyMap = {};
  793. let temMechs = [];
  794. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  795. for (let g of pgljData.gljList) {
  796. if (!g.quantity) {
  797. continue;
  798. }
  799. let type = g.type + "";
  800. gljKeyMap[gljUtil.getIndex(g)] = g;
  801. type = type.charAt(0);
  802. if (type == "1") {
  803. Mps.children.push(new Mp(g));
  804. } else if (type == "2" || type == 5) {
  805. Materials.children.push(new Material(g));
  806. } else if (type == "3") {
  807. temMechs.push(g);
  808. }
  809. }
  810. for (let t of temMechs) {
  811. Mechs.children.push(new Mech(t,gljKeyMap));
  812. }
  813. }
  814. this.children.push(Mps);
  815. this.children.push(Materials);
  816. this.children.push(Mechs);
  817. }
  818. function EprjInfo(tenderProject) {
  819. let bills = tenderProject.Bills.datas;
  820. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  821. let totalItem = null;
  822. let proItem = null; //暂列金额项
  823. let safeItem = null;
  824. let oneToSevenItem = null;
  825. for (let b of bills) {
  826. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  827. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  828. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) oneToSevenItem = b;
  829. if(b.code == "102-3" && b.name=="安全生产费") safeItem = b;
  830. }
  831. const attrs = [{
  832. name: "Name",
  833. value: tenderProject.projectInfo.name,
  834. },
  835. {
  836. name: "Sums",
  837. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  838. },
  839. ];
  840. //输出控制价、投标文件时,取调价后的标段总造价。
  841. //输出招标文件时,取0
  842. if (isBidInvitation) attrs[1].value = 0;
  843. Element.call(this, "EprjInfo", attrs);
  844. this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature));
  845. this.children.push(new MakeInfo(tenderProject));
  846. this.children.push(new Params(tenderProject));
  847. this.children.push(new getBillsItems(tenderProject));
  848. this.children.push(new getIndexs(tenderProject));
  849. let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
  850. if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
  851. //山东接口还需要增加几个表的数据(就是把原报表的显示数据转到投标文件里)
  852. // 1. 投标报价汇总表
  853. this.children.push(new quoteSummary(tenderProject));
  854. // 2. 计日工表
  855. let spdw = sporadicWork(tenderProject);
  856. if (spdw) {
  857. this.children.push(spdw);
  858. }
  859. // 3. 材料暂估价表
  860. let estMaterialRpt = materialEstimate(tenderProject);
  861. if (estMaterialRpt) {
  862. this.children.push(estMaterialRpt);
  863. }
  864. // 4. 工程设备暂估价表
  865. let estMachineRpt = getMachineTempEst(tenderProject);
  866. if (estMachineRpt) {
  867. this.children.push(estMachineRpt);
  868. }
  869. // 5. 专业工程暂估价表
  870. let estSpecPrjRpt = getSpecPrjEst(tenderProject);
  871. if (estSpecPrjRpt) {
  872. this.children.push(estSpecPrjRpt);
  873. }
  874. // 6. 工程量清单单价分析表
  875. }
  876. function _getBidGljCode(tenderProject, orgGlj) {
  877. let rst = orgGlj.code;
  878. if (tenderProject.bid_evaluation_list && tenderProject.bid_evaluation_list.datas) {
  879. for (let bGlj of tenderProject.bid_evaluation_list.datas) {
  880. if (bGlj.projectGLJID === orgGlj.id) {
  881. rst = bGlj.seq;
  882. break;
  883. }
  884. }
  885. }
  886. return rst;
  887. }
  888. function _getFee(bill, key = 'common', valueKey = 'tenderTotalFee') {
  889. let rstSum = 0;
  890. if (bill) {
  891. let dtlB = (bill.data) ? bill.data : bill;
  892. if (dtlB.fees) {
  893. for (let fee of dtlB.fees) {
  894. if (fee.fieldName === key) {
  895. rstSum = fee[valueKey];
  896. break;
  897. }
  898. }
  899. }
  900. }
  901. return rstSum;
  902. };
  903. function _getSum(orgSum) {
  904. let rst = orgSum;
  905. // const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  906. // const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  907. // const isControl = exportKind === CONTROL; // 是否是控制价
  908. //根据导出类型(上面3个),输出实际合计或price
  909. if (isBidInvitation) {
  910. rst = 0;
  911. }
  912. return rst;
  913. }
  914. function quoteSummary(tenderProject) {
  915. let quoteSummaryItem = new emptyElement('QuoteSummary');
  916. // let attrs = [];
  917. //1. 取固定清单,
  918. // 1.1 100~700章总清单(flags有属性为19的那个) -> topNode100To700
  919. // 1.2 已包含在清单合计中的材料、工程设备、专业工程暂估价合计 标记:20
  920. // 1.3 清单合计减去材料、工程设备、专业工程暂估价|合计 标记:21
  921. // 1.4 计日工合计 标记:22
  922. // 1.5 暂列金额(不含计日工总额) 标记:26
  923. // 1.6 投标报价 标记:9
  924. let topNode100To700, nodeZXZDJ, nodeQDKCZXZDJ, nodeJRG, nodeZLJE, nodeTBBJ;
  925. let chapterNodes = [];
  926. tenderProject.Bills.datas.forEach((bill)=> {
  927. if (bill.flags && bill.flags.length > 0) {
  928. for (let flag of bill.flags) {
  929. switch(flag.flag) {
  930. case 19 :
  931. topNode100To700 = bill;
  932. break;
  933. case 20 :
  934. nodeZXZDJ = bill;
  935. break;
  936. case 21 :
  937. nodeQDKCZXZDJ = bill;
  938. break;
  939. case 22 :
  940. nodeJRG = bill;
  941. break;
  942. case 26 :
  943. nodeZLJE = bill;
  944. break;
  945. case 9 :
  946. nodeTBBJ = bill;
  947. break;
  948. default :
  949. break;
  950. }
  951. }
  952. }
  953. });
  954. //2. 然后获取topNode100To700下的所有次一级清单(100章...700章)
  955. if (topNode100To700) {
  956. for (let rootBill of tenderProject.Bills.tree.roots) {
  957. // 100~700章总清单在top级别(山东养护)
  958. if (rootBill.data.ID === topNode100To700.ID) {
  959. rootBill.children.forEach((subBill)=> {
  960. if (subBill.data.name.includes('00章')) {
  961. chapterNodes.push(subBill);
  962. }
  963. });
  964. break;
  965. }
  966. }
  967. }
  968. //3. 拼凑数据
  969. let nodeAttrs = [];
  970. if (topNode100To700) {
  971. let order = 1;
  972. //读取投标报价汇总表信息。1.ItemNo 序号。2.ChapterNo 章次。 3.Name 科目名称。 4.Sum 金额。
  973. chapterNodes.forEach((cnode)=> {
  974. let chapterIdx = cnode.data.name.indexOf("00章");
  975. nodeAttrs.push({ItemNo: order, ChapterNo: cnode.data.name.substr(chapterIdx - 1, 3), Name: cnode.data.name, Sum: _getFee(cnode)});
  976. order++;
  977. });
  978. nodeAttrs.push({ItemNo: order, ChapterNo: '', Name: '第100章至700章清单合计', Sum: _getFee(topNode100To700)});
  979. order++;
  980. if (nodeZXZDJ) {
  981. nodeAttrs.push({ItemNo: order, ChapterNo: '', Name: '已包含在清单合计中的材料、工程设备、专业工程暂估价合计', Sum: _getFee(nodeZXZDJ)});
  982. order++;
  983. }
  984. if (nodeQDKCZXZDJ) {
  985. nodeAttrs.push({ItemNo: order, ChapterNo: '', Name: `清单合计减去材料、工程设备、专业工程暂估价合计(即${order - 2}-${order - 1})=${order}`, Sum: _getFee(nodeQDKCZXZDJ)});
  986. order++;
  987. }
  988. if (nodeJRG) {
  989. nodeAttrs.push({ItemNo: order, ChapterNo: '', Name: `计日工合计`, Sum: _getFee(nodeJRG)});
  990. order++;
  991. }
  992. if (nodeZLJE) {
  993. nodeAttrs.push({ItemNo: order, ChapterNo: '', Name: `暂列金额(不含计日工总额)`, Sum: _getFee(nodeZLJE)});
  994. order++;
  995. }
  996. if (nodeTBBJ) {
  997. nodeAttrs.push({ItemNo: order, ChapterNo: '', Name: `投标报价(${chapterNodes.length + 1} + ${order - 2}+${order - 1})=${order}`, Sum: _getFee(nodeTBBJ)});
  998. order++;
  999. }
  1000. }
  1001. function _Item(item) {
  1002. const attrs = [
  1003. { name: 'ItemNo',
  1004. value: item.ItemNo
  1005. },
  1006. { name: 'ChapterNo',
  1007. value: item.ChapterNo
  1008. },
  1009. { name: 'Name',
  1010. value: item.Name
  1011. },
  1012. { name: 'Sum',
  1013. value: _getSum(item.Sum)
  1014. // value: 0 // 所有清单的金额都是0
  1015. }
  1016. ];
  1017. let rst = new emptyElement('Item');
  1018. rst.attrs.push(...attrs);
  1019. return rst;
  1020. }
  1021. for (let attr of nodeAttrs) {
  1022. quoteSummaryItem.children.push(_Item(attr));
  1023. }
  1024. return quoteSummaryItem;
  1025. }
  1026. function sporadicWork(tenderProject) {
  1027. //计日工表,含:劳务、材料、施工机械、计日工汇总
  1028. let hasSporadicWork = false;
  1029. let sporadicWorkItem = new Element('SporadicWork');
  1030. let nodeLabour, nodeMaterial, nodeMachine;
  1031. //首先收集过滤计日工相关清单
  1032. tenderProject.Bills.datas.forEach((bill)=> {
  1033. if (bill.flags && bill.flags.length > 0) {
  1034. for (let flag of bill.flags) {
  1035. switch(flag.flag) {
  1036. case 23 :
  1037. nodeLabour = bill;
  1038. break;
  1039. case 24 :
  1040. nodeMaterial = bill;
  1041. break;
  1042. case 25 :
  1043. nodeMachine = bill;
  1044. break;
  1045. default :
  1046. break;
  1047. }
  1048. }
  1049. }
  1050. });
  1051. const _buildWorkNodeItem = function(orgNode, subNodes, parentKey, childKey) {
  1052. let parentNode = new Element(parentKey);
  1053. sporadicWorkItem.children.push(parentNode);
  1054. const pSumAttrs = [
  1055. {
  1056. name: 'Sum',
  1057. value: _getSum(_getFee(orgNode))
  1058. // value: 0
  1059. }
  1060. ];
  1061. // Element.call(this, parentKey, pSumAttrs);
  1062. parentNode.attrs.push(...pSumAttrs);
  1063. subNodes.forEach((node)=> {
  1064. let childNode = new Element(childKey);
  1065. parentNode.children.push(childNode);
  1066. const attrs = [
  1067. { name: 'ItemNo',
  1068. value: node.code
  1069. }, {
  1070. name: 'Name',
  1071. value: node.name
  1072. }, {
  1073. name: 'Unit',
  1074. value: node.unit
  1075. }, {
  1076. name: 'Num',
  1077. value: node.quantity
  1078. }, {
  1079. name: 'Price',
  1080. value: _getSum(_getFee(node, 'common', 'tenderUnitFee'))
  1081. // value: 0
  1082. }, {
  1083. name: 'Sum',
  1084. value: _getSum(_getFee(node))
  1085. // value: 0
  1086. }
  1087. ];
  1088. childNode.attrs.push(...attrs);
  1089. });
  1090. };
  1091. //1. 判断劳务
  1092. if (nodeLabour) {
  1093. let subNodes = [];
  1094. tenderProject.Bills.datas.forEach((bill)=> {
  1095. if (bill.ParentID === nodeLabour.ID) {
  1096. subNodes.push(bill);
  1097. }
  1098. });
  1099. if (subNodes.length > 0) {
  1100. hasSporadicWork = true;
  1101. //创建劳务Mps节点及劳务Mps下Mp子节点
  1102. _buildWorkNodeItem(nodeLabour, subNodes, 'Mps', 'Mp');
  1103. }
  1104. }
  1105. //2. 判断材料
  1106. if (nodeMaterial) {
  1107. let subNodes = [];
  1108. tenderProject.Bills.datas.forEach((bill)=> {
  1109. if (bill.ParentID === nodeMaterial.ID) {
  1110. subNodes.push(bill);
  1111. }
  1112. });
  1113. if (subNodes.length > 0) {
  1114. hasSporadicWork = true;
  1115. //创建材料Materials节点及劳务Materials下Material子节点
  1116. _buildWorkNodeItem(nodeMaterial, subNodes, 'Materials', 'Material');
  1117. }
  1118. }
  1119. //3. 判断施工机械
  1120. if (nodeMachine) {
  1121. let subNodes = [];
  1122. tenderProject.Bills.datas.forEach((bill)=> {
  1123. if (bill.ParentID === nodeMachine.ID) {
  1124. subNodes.push(bill);
  1125. }
  1126. });
  1127. if (subNodes.length > 0) {
  1128. hasSporadicWork = true;
  1129. //创建施工机械Meehs节点及劳务Meehs下Meeh子节点
  1130. _buildWorkNodeItem(nodeMachine, subNodes, 'Mechs', 'Mech');
  1131. }
  1132. }
  1133. //4. 判断计日工汇总
  1134. if (hasSporadicWork) {
  1135. let summaryNode = new Element('Summary');
  1136. sporadicWorkItem.children.push(summaryNode);
  1137. const pSumAttrs = [
  1138. {
  1139. name: 'Sum',
  1140. // value: _getFee(nodeLabour) + _getFee(nodeMaterial) + _getFee(nodeMachine)
  1141. value: _getSum(_getFee(nodeLabour) + _getFee(nodeMaterial) + _getFee(nodeMachine))
  1142. }
  1143. ];
  1144. summaryNode.attrs = pSumAttrs;
  1145. //把劳务、材料、施工机械
  1146. function _workItem(node, name, remark='') {
  1147. let childNode = new Element('Item');
  1148. summaryNode.children.push(childNode);
  1149. const attrs = [
  1150. {
  1151. name: "Name",
  1152. value: name,
  1153. },
  1154. {
  1155. name: "Sum",
  1156. value: _getSum(_getFee(node)),
  1157. },
  1158. {
  1159. name: "Remark",
  1160. value: remark,
  1161. }
  1162. ]
  1163. childNode.attrs.push(...attrs);
  1164. }
  1165. _workItem(nodeLabour, '劳务');
  1166. _workItem(nodeMaterial, '材料');
  1167. _workItem(nodeMachine, '机械');
  1168. }
  1169. //返回
  1170. if (hasSporadicWork) {
  1171. return sporadicWorkItem;
  1172. } else {
  1173. return null;
  1174. }
  1175. }
  1176. function materialEstimate(tenderProject) {
  1177. let mEstNode = new emptyElement('MaterialEstimate');
  1178. let items = [];
  1179. let billItems = [];
  1180. let itemNo = 1;
  1181. //材料暂估价明细
  1182. tenderProject.Bills.datas.forEach((bill)=> {
  1183. if (bill.specialProvisional === '材料暂估') {
  1184. billItems.push(bill);
  1185. }
  1186. });
  1187. if (billItems.length > 0) {
  1188. billItems.forEach((bill)=> {
  1189. let mEstItemNode = new emptyElement('Item');
  1190. mEstNode.children.push(mEstItemNode);
  1191. let attrs = [
  1192. {name: 'ItemNo', value: itemNo},
  1193. {name: 'Code', value: bill.code},
  1194. {name: 'Number', value: bill.code},
  1195. {name: 'Name', value: bill.name},
  1196. {name: 'Unit', value: bill.unit},
  1197. {name: 'Num', value: bill.quantity},
  1198. {name: 'Price', value: _getSum(_getFee(bill, 'common', 'tenderUnitFee'))},
  1199. {name: 'Sum', value: _getSum(_getFee(bill)), type:TYPE.DECIMAL},
  1200. // {name: 'Price', value: 0},
  1201. // {name: 'Sum', value: 0},
  1202. {name: 'Remark', value: (bill.remark) ? glj.remark : ''}
  1203. ];
  1204. itemNo++;
  1205. mEstItemNode.attrs.push(...attrs);
  1206. });
  1207. }
  1208. tenderProject.projectGLJ.datas.gljList.forEach((glj)=> {
  1209. if (glj.is_evaluate && glj.type !== 5 && glj.type !== 301) {
  1210. items.push(glj);
  1211. }
  1212. });
  1213. if (items.length > 0) {
  1214. items.forEach((glj)=> {
  1215. let mEstItemNode = new emptyElement('Item');
  1216. mEstNode.children.push(mEstItemNode);
  1217. let attrs = [
  1218. {name: 'ItemNo', value: itemNo},
  1219. {name: 'Code', value: _getBidGljCode(tenderProject, glj)},
  1220. {name: 'Number', value: glj.code},
  1221. {name: 'Name', value: glj.name},
  1222. {name: 'Unit', value: glj.unit},
  1223. {name: 'Num', value: glj.tenderQuantity},
  1224. {name: 'Price', value: _getSum(glj.unit_price.market_price)},
  1225. {name: 'Sum', value: _getSum(glj.tenderQuantity * glj.unit_price.market_price), type:TYPE.DECIMAL},
  1226. // {name: 'Price', value: 0},
  1227. // {name: 'Sum', value: 0},
  1228. {name: 'Remark', value: (glj.remark) ? glj.remark : ''}
  1229. ];
  1230. itemNo++;
  1231. mEstItemNode.attrs.push(...attrs);
  1232. });
  1233. }
  1234. if (billItems.length > 0 || items.length > 0) {
  1235. return mEstNode;
  1236. } else {
  1237. return null;
  1238. }
  1239. }
  1240. function getMachineTempEst(tenderProject) {
  1241. let mEstNode = new emptyElement('PrjDeviceEstimate');
  1242. let items = [];
  1243. let billItems = [];
  1244. let itemNo = 1;
  1245. //工程设备明细
  1246. tenderProject.Bills.datas.forEach((bill)=> {
  1247. console.log(`bill.specialProvisional: ${bill.specialProvisional}`);
  1248. if (bill.specialProvisional === '工程设备') {
  1249. billItems.push(bill);
  1250. }
  1251. });
  1252. if (billItems.length > 0) {
  1253. billItems.forEach((bill)=> {
  1254. let mEstItemNode = new emptyElement('Item');
  1255. mEstNode.children.push(mEstItemNode);
  1256. let attrs = [
  1257. {name: 'ItemNo', value: itemNo},
  1258. {name: 'Code', value: bill.code},
  1259. {name: 'Number', value: bill.code},
  1260. {name: 'Name', value: bill.name},
  1261. {name: 'Unit', value: bill.unit},
  1262. {name: 'Num', value: bill.quantity},
  1263. {name: 'Price', value: _getSum(_getFee(bill, 'common', 'tenderUnitFee'))},
  1264. {name: 'Sum', value: _getSum(_getFee(bill)), type:TYPE.DECIMAL},
  1265. // {name: 'Price', value: 0},
  1266. // {name: 'Sum', value: 0},
  1267. {name: 'Remark', value: (bill.remark) ? glj.remark : ''}
  1268. ];
  1269. itemNo++;
  1270. mEstItemNode.attrs.push(...attrs);
  1271. });
  1272. }
  1273. tenderProject.projectGLJ.datas.gljList.forEach((glj)=> {
  1274. if (glj.is_evaluate && glj.type === 5) {
  1275. items.push(glj);
  1276. }
  1277. });
  1278. if (items.length > 0) {
  1279. items.forEach((glj, sno)=> {
  1280. let mEstItemNode = new emptyElement('Item');
  1281. mEstNode.children.push(mEstItemNode);
  1282. let attrs = [
  1283. {name: 'ItemNo', value: itemNo},
  1284. {name: 'Code', value: _getBidGljCode(tenderProject, glj)},
  1285. {name: 'Number', value: glj.code},
  1286. {name: 'Name', value: glj.name},
  1287. {name: 'Unit', value: glj.unit},
  1288. {name: 'Num', value: glj.tenderQuantity},
  1289. {name: 'Price', value: _getSum(glj.unit_price.market_price)},
  1290. {name: 'Sum', value: _getSum(glj.tenderQuantity * glj.unit_price.market_price), type:TYPE.DECIMAL},
  1291. // {name: 'Price', value: 0},
  1292. // {name: 'Sum', value: 0},
  1293. {name: 'Remark', value: (glj.remark) ? glj.remark : ''}
  1294. ];
  1295. itemNo++;
  1296. mEstItemNode.attrs.push(...attrs);
  1297. });
  1298. }
  1299. if (billItems.length > 0 || items.length > 0) {
  1300. return mEstNode;
  1301. } else {
  1302. return null;
  1303. }
  1304. }
  1305. function getSpecPrjEst(tenderProject) {
  1306. let mEstNode = new emptyElement('SpecPrjEstimate');
  1307. let sum = 0;
  1308. let items = [];
  1309. //专业工程暂估明细
  1310. tenderProject.Bills.datas.forEach((bill)=> {
  1311. if (bill.specialProvisional === '专业工程') {
  1312. items.push(bill);
  1313. }
  1314. });
  1315. if (items.length > 0) {
  1316. items.forEach((bill, sno)=> {
  1317. let mEstItemNode = new emptyElement('Item');
  1318. mEstNode.children.push(mEstItemNode);
  1319. let ttl = _getFee(bill);
  1320. sum += ttl;
  1321. let attrs = [
  1322. {name: 'ItemNo', value: sno + 1},
  1323. {name: 'Code', value: bill.code},
  1324. {name: 'Number', value: bill.code},
  1325. {name: 'Name', value: bill.name},
  1326. {name: 'Content', value: bill.jobContent.toString()},
  1327. {name: 'Sum', value: _getSum(ttl), type:TYPE.DECIMAL},
  1328. // {name: 'Sum', value: 0, type:TYPE.DECIMAL},
  1329. ];
  1330. mEstItemNode.attrs.push(...attrs);
  1331. });
  1332. mEstNode.attrs.push({name: 'Sum', value: sum});
  1333. return mEstNode;
  1334. } else {
  1335. return null;
  1336. }
  1337. }
  1338. function getBillsAnalyze(tenderProject) {
  1339. // 本函数是尽量复刻【5.5表】工程量清单单价分析表的‘综合’计算式脚本的相关逻辑,具体细节根据实际环境有所调整(前端环境已有不少现成的结构及数据,能少跑不少逻辑)
  1340. let djfxbNode = new emptyElement('ListUnitPriceAnalysis');
  1341. // 工程量清单单价分析(100~700章 清单下所有定额工料机的综合)
  1342. let topNode100To700;
  1343. let sno = 1;
  1344. const prefix = '_';
  1345. let filterMtlTypes = [202, 203, 204, 301];
  1346. for (let bill of tenderProject.Bills.datas) {
  1347. if (bill.flags && bill.flags.length > 0) {
  1348. for (let flag of bill.flags) {
  1349. if (flag.flag === 19) {
  1350. for (let rootBill of tenderProject.Bills.tree.roots) {
  1351. if (rootBill.ID === bill.ID) {
  1352. topNode100To700 = rootBill;
  1353. break;
  1354. }
  1355. }
  1356. break;
  1357. }
  1358. }
  1359. }
  1360. }
  1361. const cacheObj = {};
  1362. const proKeysArr = [];
  1363. const addedGljCodeCache = {};
  1364. //说明:根据实际情况,用户会直接在清单下加工料机,此工料机属于定额层次,那么算工程量的时候要加上这个(沟通后这种几率很小,暂时返回0,如有再补上)
  1365. const _getAdhocGljQty = function(billsId, rationCode, rstType = 1) {
  1366. let rst = 0;
  1367. // for (let nbidx = 0; nbidx < newRBillsIdArr.length; nbidx++) {
  1368. // if (newRBillsIdArr[nbidx] === billsId && newRCodeArr[nbidx] === rationCode) {
  1369. // rst = (rstType === 1) ? newRQtyArr[nbidx] : newTtlArr[nbidx];
  1370. // break;
  1371. // }
  1372. // }
  1373. return rst;
  1374. };
  1375. const _getCacheObjInitialedItem = function(bill = null, glj = null) {
  1376. return {
  1377. code: (bill) ? bill.code : ((glj) ? glj.code : ''),
  1378. name: (bill) ? bill.name : ((glj) ? glj.name : ''),
  1379. quantity: 0,
  1380. labourConsume: 0,
  1381. labourUnitPrice: 0,
  1382. labourTotalPrice: 0,
  1383. mainMaterialFee: 0,
  1384. auxiliaryMaterialFee: 0,
  1385. materialUnitFee: (bill) ? _getFee(bill, 'marketMaterial', 'unitFee') : 0,
  1386. machineFee: (bill) ? _getFee(bill, 'marketMachine') : 0,
  1387. otherFee: (bill) ? _getFee(bill, 'measure') : 0, //措施费
  1388. managementFee: (bill) ? (_getFee(bill, 'manage') + _getFee(bill, 'force')) : 0, //管理+规费
  1389. taxFee: (bill) ? _getFee(bill, 'tax') : 0,
  1390. profitFee: (bill) ? _getFee(bill, 'profit') : 0,
  1391. unitPrice: (bill) ? _getFee(bill, 'common', 'unitFee') : 0
  1392. };
  1393. };
  1394. const _getPrjGLJ = function(gljID) {
  1395. let rst = null;
  1396. for (let glj of tenderProject.projectGLJ.datas.gljList) {
  1397. if (glj.id === gljID) {
  1398. rst = glj;
  1399. break;
  1400. }
  1401. }
  1402. };
  1403. const _createNode = function(billIdKey, bill) {
  1404. if (cacheObj[billIdKey]) {
  1405. //1. 叶子清单,先创建清单Item
  1406. let bQtn = 1;
  1407. if (bill.hasOwnProperty('quantity')) {
  1408. bQtn = parseFloat(bill.quantity);
  1409. if (isNaN(bQtn)) bQtn = 1;
  1410. }
  1411. let billMainMaterialTtl = cacheObj[billIdKey].mainMaterialFee/bQtn;
  1412. let billAuxiliaryMaterialTtl = cacheObj[billIdKey].auxiliaryMaterialFee/bQtn;
  1413. let leafBillAttrs = [
  1414. {name: 'ItemNo', vlaue: sno},
  1415. {name: 'Code', vlaue: cacheObj[billIdKey].code},
  1416. {name: 'Name', vlaue: cacheObj[billIdKey].name},
  1417. {name: 'LaborWorkDays', vlaue: cacheObj[billIdKey].labourConsume / bQtn},
  1418. {name: 'LaborUnitPrice', vlaue: cacheObj[billIdKey].labourUnitPrice},
  1419. {name: 'LaborUnitTotal', vlaue: cacheObj[billIdKey].labourTotalPrice / bQtn},
  1420. {name: 'MainMaterialConsume', vlaue: 0},
  1421. {name: 'MainMaterialUnit', vlaue: ''},
  1422. {name: 'MainMaterialUnitPrice', vlaue: 0},
  1423. {name: 'MainMaterialTotal', vlaue: billMainMaterialTtl},
  1424. {name: 'AuxiliaryMaterialFee', vlaue: billAuxiliaryMaterialTtl},
  1425. {name: 'MaterialSum', vlaue: billMainMaterialTtl + billAuxiliaryMaterialTtl},
  1426. {name: 'MachUsageFee', vlaue: cacheObj[billIdKey].machineFee/bQtn},
  1427. {name: 'OtherFee', vlaue: cacheObj[billIdKey].otherFee/bQtn},
  1428. {name: 'ManageFee', vlaue: cacheObj[billIdKey].managementFee/bQtn},
  1429. {name: 'Tax', vlaue: cacheObj[billIdKey].taxFee/bQtn},
  1430. {name: 'Profit', vlaue: cacheObj[billIdKey].profitFee/bQtn},
  1431. {name: 'Price', vlaue: _getFee(bill)},
  1432. ];
  1433. sno++;
  1434. let itemNode = new emptyElement('Item');
  1435. itemNode.attrs.push(...leafBillAttrs);
  1436. djfxbNode.children.push(itemNode);
  1437. //2. 清单下工料机
  1438. cacheObj[billIdKey].items.forEach((gljItem)=> {
  1439. let showQty = gljItem.mainMaterialConsume/cacheObj[billIdKey].quantity;
  1440. showQty = Math.round(showQty * 1000000) / 1000000;
  1441. let gljAttrs = [
  1442. {name: 'ItemNo', vlaue: sno},
  1443. {name: 'Code', vlaue: gljItem.code},
  1444. {name: 'Name', vlaue: gljItem.name},
  1445. {name: 'LaborWorkDays', vlaue: 0},
  1446. {name: 'LaborUnitPrice', vlaue: 0},
  1447. {name: 'LaborUnitTotal', vlaue: 0},
  1448. {name: 'MainMaterialConsume', vlaue: showQty},
  1449. {name: 'MainMaterialUnit', vlaue: gljItem.mainMaterialUnit},
  1450. {name: 'MainMaterialUnitPrice', vlaue: gljItem.mainMaterialUnitPrice},
  1451. {name: 'MainMaterialTotal', vlaue: showQty * gljItem.mainMaterialUnitPrice},
  1452. {name: 'AuxiliaryMaterialFee', vlaue: 0},
  1453. {name: 'MaterialSum', vlaue: 0},
  1454. {name: 'MachUsageFee', vlaue: 0},
  1455. {name: 'OtherFee', vlaue: 0},
  1456. {name: 'ManageFee', vlaue: 0},
  1457. {name: 'Tax', vlaue: 0},
  1458. {name: 'Profit', vlaue: 0},
  1459. {name: 'Price', vlaue: _getFee(bill)},
  1460. ];
  1461. sno++;
  1462. });
  1463. }
  1464. };
  1465. const _getAllGlj = function(parentBill) {
  1466. if (parentBill.children.length > 0) {
  1467. parentBill.children.forEach((subBill)=> {
  1468. _getAllGlj(subBill);
  1469. });
  1470. } else {
  1471. let billIdKey = prefix + parentBill.ID;
  1472. if (!cacheObj.hasOwnProperty(billIdKey)) {
  1473. cacheObj[billIdKey] = _getCacheObjInitialedItem(parentBill);
  1474. addedGljCodeCache[billIdKey] = [];
  1475. proKeysArr.push(billIdKey);
  1476. }
  1477. tenderProject.ration_glj.forEach((rglj)=> {
  1478. if (rglj.billsItemID === parentBill.ID) {
  1479. let gljQty = parseFloat(rglj.quantity);
  1480. if (isNaN(gljQty)) gljQty = 0;
  1481. let gljRationQty = parseFloat(rglj.rationItemQuantity);
  1482. if (isNaN(gljRationQty)) gljRationQty = 0;
  1483. let gljCns = gljQty * gljRationQty;
  1484. let prjGlj = _getPrjGLJ(rglj.projectGLJID);
  1485. let gljUnitPrice = parseFloat(prjGlj.unit_price.market_price);
  1486. let gljTotalPrice = gljCns * gljUnitPrice;
  1487. let gljCode = rglj.code;
  1488. if (rglj.type === 1) {
  1489. //人工
  1490. cacheObj[billIdKey].labourConsume = cacheObj[billIdKey].labourConsume + gljCns;
  1491. cacheObj[billIdKey].labourUnitPrice = gljUnitPrice;
  1492. cacheObj[billIdKey].labourTotalPrice = cacheObj[billIdKey].labourTotalPrice + gljTotalPrice;
  1493. } else if (filterMtlTypes.indexOf(dtlType) < 0) {
  1494. if (!addedGljCodeCache[billIdKey].includes(gljCode)) {
  1495. addedGljCodeCache[billIdKey].push(gljCode);
  1496. }
  1497. if (prjGlj.is_main_material) {
  1498. let dtlObj = {};
  1499. dtlObj.code = gljCode;
  1500. dtlObj.name = rglj.name;
  1501. dtlObj.specs = rglj.specs;
  1502. //
  1503. let adhocGljQty = _getAdhocGljQty(parentBill.ID, dtlObj.code);
  1504. let adhocGljTtl = adhocGljQty * gljUnitPrice;
  1505. dtlObj.mainMaterialConsume = gljCns + adhocGljQty; //考虑清单单独加工料机的情况,需要补上消耗量
  1506. dtlObj.mainMaterialUnitPrice = gljUnitPrice;
  1507. dtlObj.mainMaterialTotalPrice = gljTotalPrice;
  1508. dtlObj.mainMaterialUnit = rglj.unit;
  1509. let isAdd = 0;
  1510. for (let i = 0; i < cacheObj[billIdKey].items.length; i++) {
  1511. //先比较对象中是否已存在同一条工料机,存在,则累加汇总消耗量和金额;否则添加。
  1512. if (dtlObj.code === cacheObj[billIdKey].items[i].code && dtlObj.name === cacheObj[billIdKey].items[i].name && dtlObj.mainMaterialUnit === cacheObj[billIdKey].items[i].mainMaterialUnit && dtlObj.specs === cacheObj[billIdKey].items[i].specs) {
  1513. cacheObj[billIdKey].items[i].mainMaterialConsume = cacheObj[billIdKey].items[i].mainMaterialConsume + gljCns;
  1514. cacheObj[billIdKey].items[i].mainMaterialTotalPrice = cacheObj[billIdKey].items[i].mainMaterialTotalPrice + gljTotalPrice;
  1515. isAdd = 1;
  1516. break;
  1517. }
  1518. }
  1519. if (isAdd === 0) {
  1520. cacheObj[billIdKey].items.push(dtlObj);
  1521. }
  1522. cacheObj[billIdKey].mainMaterialFee = cacheObj[billIdKey].mainMaterialFee + gljTotalPrice + adhocGljTtl;
  1523. } else {
  1524. cacheObj[billIdKey].auxiliaryMaterialFee = cacheObj[billIdKey].auxiliaryMaterialFee + gljTotalPrice;
  1525. }
  1526. }
  1527. }
  1528. });
  1529. // 整理完后,开始创建XML节点(这里与参考脚本逻辑不一样了,直接开始创建)
  1530. _createNode(billIdKey, parentBill);
  1531. }
  1532. };
  1533. if (topNode100To700) {
  1534. topNode100To700.children.forEach((topChapterBill)=> {
  1535. _getAllGlj(topChapterBill);
  1536. });
  1537. }
  1538. //...
  1539. return djfxbNode;
  1540. }
  1541. function getBidEvaluationMainMaterial(tenderProject) {
  1542. let bidMaterials = [];
  1543. let i = 1;
  1544. for (let b of tenderProject.bidMaterialData) {
  1545. bidMaterials.push(new BidEvaluationMainMaterial(b, i));
  1546. i++
  1547. }
  1548. return bidMaterials;
  1549. function BidEvaluationMainMaterial(b, index) {
  1550. const attrs = [{
  1551. name: "Code",
  1552. value: b.seq,
  1553. },
  1554. {
  1555. name: "Number",
  1556. value: b.code
  1557. },
  1558. {
  1559. name: "Name",
  1560. value: b.name
  1561. },
  1562. {
  1563. name: "Specification",
  1564. value: b.specs
  1565. },
  1566. {
  1567. name: "Unit",
  1568. value: b.unit
  1569. },
  1570. {
  1571. name: "Price",
  1572. value: b.marketPrice || '0',
  1573. type: TYPE.DECIMAL
  1574. },
  1575. {
  1576. name: "LimitedPrice",
  1577. value: b.marketPrice || '0',
  1578. type: TYPE.DECIMAL
  1579. },
  1580. {
  1581. name: "Quantity",
  1582. value: 0,//b.quantity
  1583. type: TYPE.DECIMAL
  1584. },
  1585. {
  1586. name: "Total",
  1587. value: 0//b.totalPrice
  1588. },
  1589. {
  1590. name: "Remark",
  1591. value: b.remark
  1592. }
  1593. ];
  1594. if (isBidSubmission || isControl) {
  1595. attrs[7].value = b.quantity;
  1596. attrs[8].value = b.totalPrice;
  1597. }
  1598. Element.call(this, "BidEvaluationMainMaterial", attrs);
  1599. }
  1600. }
  1601. function getIndexs(tenderProject) {
  1602. let Indexs = new emptyElement('Indexs');
  1603. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1604. for (let f of feature) {
  1605. if (f.code) Indexs.children.push(new IndexItem(f))
  1606. }
  1607. return Indexs;
  1608. function IndexItem(fea) {
  1609. const attrs = [{
  1610. name: "Code",
  1611. value: fea.code,
  1612. },
  1613. {
  1614. name: "Name",
  1615. value: fea.dispName,
  1616. },
  1617. {
  1618. name: "Unit",
  1619. value: fea.unit,
  1620. },
  1621. {
  1622. name: "Value",
  1623. value: fea.value,
  1624. },
  1625. {
  1626. name: "Remark",
  1627. value: fea.remark,
  1628. }
  1629. ]
  1630. Element.call(this, "IndexItem", attrs);
  1631. }
  1632. }
  1633. function getBillsItems(tenderProject) {
  1634. let items = new emptyElement("Items");
  1635. let rootNodes = tenderProject.mainTree.roots;
  1636. for (let r of rootNodes) {
  1637. setItem(r, -1, items.children);
  1638. }
  1639. return items;
  1640. function setItem(bNode, level, list) {
  1641. if (bNode.sourceType == ModuleNames.ration) return;
  1642. let item = new bill(bNode, level);
  1643. if (bNode.children && bNode.children.length > 0) {
  1644. level += 1;
  1645. for (let c of bNode.children) {
  1646. setItem(c, level, item.children);
  1647. }
  1648. }
  1649. list.push(item);
  1650. function getCalcType(node) {
  1651. /*
  1652. 判断是否父项:
  1653. 是父项,则取1;
  1654. 是叶子项,则判断其下有无套定额/量价/工料机:
  1655. 有则取1;
  1656. 无则判断有无基数计算:
  1657. 有则取2;
  1658. 无则取3 */
  1659. if (node.children && node.children.length > 0) {
  1660. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  1661. } else {
  1662. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  1663. }
  1664. }
  1665. function getItemType(node) {
  1666. let Bills = projectObj.project.Bills;
  1667. //是100~900章部分、或是计日工部分,叶子清单输出1,父项输出0;
  1668. if (Bills.isBelongOneToSeven(node)||Bills.isBelongDayWork(node)) {
  1669. if (node.children && node.children.length > 0) {
  1670. return node.children[0].sourceType == ModuleNames.ration ? 1 : 0
  1671. }
  1672. return 1 //叶子清单输出1
  1673. } else {
  1674. return 0;
  1675. /* //非100~900章部分,
  1676. // 是暂列金额,判断暂列金额的金额等于0,则输出为0;暂列金额的金额不等于0,则输出为1;
  1677. if (node.data.name && node.data.name.indexOf("暂列金额") != -1) {
  1678. let sum = node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : "";
  1679. return gljUtil.isNotEmpty(sum) ? 1 : 0
  1680. } else { //非暂列金额,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
  1681. return gljUtil.isNotEmpty(node.data.quantity) ? 1 : 0
  1682. } */
  1683. }
  1684. }
  1685. function bill(bNode, level) {
  1686. let data = bNode.data;
  1687. let CostKind = 3;
  1688. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  1689. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  1690. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  1691. let CalcType = getCalcType(bNode);
  1692. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  1693. let ProvisionalType = "";
  1694. if (data.specialProvisional == "材料暂估") ProvisionalType = 0;
  1695. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  1696. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  1697. //MpRatio
  1698. let MpRatio = "";
  1699. let MaterialRatio = "";
  1700. let MechRatio = "";
  1701. if (data.quantityCoe) {
  1702. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  1703. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  1704. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  1705. }
  1706. let fail = billNameChecking(bNode,tenderProject.projectInfo.name,fixedFlag)
  1707. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  1708. let ListCode = "";
  1709. if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name];
  1710. if (data.code && data.code != "") ListCode = data.code;
  1711. const attrs = [{
  1712. name: "ListCode",
  1713. value: ListCode,
  1714. },
  1715. {
  1716. name: "ListName",
  1717. value: data.name,
  1718. fail:fail
  1719. },
  1720. {
  1721. name: "Unit",
  1722. value: data.unit,
  1723. },
  1724. {
  1725. name: "Num",
  1726. value: data.quantity,
  1727. type: TYPE.DECIMAL,
  1728. toFix:3
  1729. },
  1730. {
  1731. name: "QtyFormula",
  1732. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",//data.calcBase //data.calcBase ? cbParser.toFExpr(data.calcBase, tenderProject.mainTree.items) : "",
  1733. type: TYPE.DECIMAL,
  1734. toFix:2
  1735. },
  1736. {
  1737. name: "Price",
  1738. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1739. type: TYPE.DECIMAL,
  1740. toFix:2
  1741. },
  1742. {
  1743. name: "Rate",
  1744. value: 100,
  1745. },
  1746. {
  1747. name: "Sum",
  1748. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1749. type: TYPE.DECIMAL,
  1750. toFix:2
  1751. },
  1752. {
  1753. name: "ChapterKind",
  1754. value: level > 3 ? 3 : level,
  1755. },
  1756. {
  1757. name: "CostKind",
  1758. value: CostKind,
  1759. },
  1760. {
  1761. name: "CalcType",
  1762. value: CalcType,
  1763. },
  1764. {
  1765. name: "ProvisionalType",
  1766. value: ProvisionalType,
  1767. mustHasValue:true
  1768. },
  1769. {
  1770. name: "MeterRules",
  1771. value: "",
  1772. },
  1773. {
  1774. name: "Content",
  1775. value: data.jobContentText,
  1776. },
  1777. {
  1778. name: "Remarks",
  1779. value: data.remark,
  1780. },
  1781. /* {
  1782. name: "MpRatio",
  1783. value: MpRatio,
  1784. },
  1785. {
  1786. name: "MaterialRatio",
  1787. value: MaterialRatio,
  1788. },
  1789. {
  1790. name: "MechRatio",
  1791. value: MechRatio,
  1792. },
  1793. {
  1794. name: "AdjustedPrice",
  1795. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1796. },
  1797. {
  1798. name: "AdjustedSums",
  1799. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1800. }, */
  1801. {
  1802. name: "ItemType",
  1803. value: getItemType(bNode),
  1804. },
  1805. /* {
  1806. name: "FomulaCode",
  1807. value: ""
  1808. }, */
  1809. ];
  1810. //投标、招标控制价时。取单价。
  1811. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1812. if (isBidSubmission || isControl || CostKind==1 ||CostKind==2) {
  1813. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1814. attrs[7].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1815. //暂列金额 数量为0的时候,单价输出0
  1816. if( CostKind==2 && !gljUtil.isNotEmpty(data.quantity)) attrs[5].value = 0
  1817. }
  1818. Element.call(this, "Item", attrs);
  1819. let cc = CostComposition(bNode);
  1820. if (cc) this.children.push(cc);
  1821. this.children.push(CostStructure(data))
  1822. function CostComposition(bNode) {
  1823. if (isBidInvitation) return null;
  1824. let CostComposition = new emptyElement('CostComposition');
  1825. let Norms = [];
  1826. let Costs = [];
  1827. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1828. for (let r of bNode.children) {
  1829. if (r.data.type == rationType.ration) {
  1830. if(isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
  1831. Norms.push(new Ration(r.data));
  1832. } else {
  1833. Costs.push(new Cost(r.data));
  1834. }
  1835. }
  1836. }
  1837. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1838. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1839. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1840. return CostComposition.children.length > 0 ? CostComposition : null;
  1841. //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
  1842. function isEmptyRation(ration){
  1843. return !gljUtil.isNotEmpty(ration.code)&&!gljUtil.isNotEmpty(ration.name)&&!gljUtil.isNotEmpty(ration.unit)&&(!gljUtil.isNotEmpty(ration.quantity)||ration.quantity == 0)
  1844. }
  1845. function Formula(bills) {
  1846. const attrs = [{
  1847. name: "Name",
  1848. value: bills.name
  1849. },
  1850. {
  1851. name: "Formulas",
  1852. value: bills.calcBase
  1853. },
  1854. {
  1855. name: "Ratio",
  1856. value: 1
  1857. },
  1858. {
  1859. name: "Sum",
  1860. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1861. type:TYPE.DECIMAL
  1862. },
  1863. {
  1864. name: "Remarks",
  1865. value: bills.remark
  1866. }
  1867. ]
  1868. Element.call(this, "Formula", attrs);
  1869. // 1.Name
  1870. // 名称/描述。取清单的名称。
  1871. // 2.Formulas
  1872. // 计算式。读取计算基数的文本。
  1873. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1874. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1875. // 3.Ratio
  1876. // 系数。输出为1,非必填。
  1877. // 4.Sum
  1878. // 取金额。
  1879. // 5.Remarks
  1880. }
  1881. function Cost(item) {
  1882. let BasePrice = 0;
  1883. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1884. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1885. } else {
  1886. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1887. }
  1888. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1889. let CostTypeNo = '';
  1890. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1891. const attrs = [{
  1892. name: "Code",
  1893. value: item.code,
  1894. }, {
  1895. name: 'Name',
  1896. value: item.name
  1897. }, {
  1898. name: 'Spec',
  1899. value: item.specs
  1900. }, {
  1901. name: 'Unit',
  1902. value: item.unit
  1903. }, {
  1904. name: 'Num',
  1905. value: item.tenderQuantity
  1906. }, {
  1907. name: 'BasePrice',
  1908. value: BasePrice
  1909. }, {
  1910. name: 'Price',
  1911. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1912. }, {
  1913. name: 'IsEquipment',
  1914. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1915. }, {
  1916. name: 'CostTypeNo',
  1917. value: CostTypeNo
  1918. }, {
  1919. name: 'ProfitRate',
  1920. value: getFeeRate(item.programID, 'profit', tenderProject)
  1921. },
  1922. {
  1923. name: 'TaxRate',
  1924. value: getFeeRate(item.programID, 'tax', tenderProject)
  1925. },
  1926. {
  1927. name: 'MpRatio',
  1928. value: item.subType == gljType.LABOUR ? 100 : 0
  1929. },
  1930. {
  1931. name: 'MaterialRatio',
  1932. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1933. },
  1934. {
  1935. name: 'MechRatio',
  1936. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1937. }
  1938. ]
  1939. Element.call(this, "Cost", attrs);
  1940. this.children.push(CostStructure(item));
  1941. }
  1942. function Ration(ration) {
  1943. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1944. let CostTypeNo = '';
  1945. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1946. const attrs = [{
  1947. name: "NormLibNo",
  1948. value: 'YSDE-000000-2018-86',
  1949. }, {
  1950. name: 'DisplayCode',
  1951. value: ration.code
  1952. }, {
  1953. name: 'Name',
  1954. value: ration.name
  1955. }, {
  1956. name: 'Unit',
  1957. value: ration.unit
  1958. }, {
  1959. name: 'Num',
  1960. value: ration.tenderQuantity
  1961. },
  1962. {
  1963. name: 'CostTypeNo',
  1964. value: CostTypeNo
  1965. },
  1966. {
  1967. name: 'ProfitRate',
  1968. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1969. },
  1970. {
  1971. name: 'TaxRate',
  1972. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1973. },
  1974. {
  1975. name: 'FabricationCost',
  1976. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1977. },
  1978. {
  1979. name: 'AdjustStatus',
  1980. value: ration.adjustState
  1981. }
  1982. ]
  1983. Element.call(this, "Norm", attrs);
  1984. this.children.push(CostStructure(ration));
  1985. this.children.push(Consume(ration));
  1986. }
  1987. }
  1988. function Consume(ration) {
  1989. let consume = new emptyElement('Consume');
  1990. for (let rg of ration.rationGLJList) {
  1991. consume.children.push(new ConsumeItem(rg));
  1992. }
  1993. return consume;
  1994. function ConsumeItem(rg) {
  1995. const attrs = [{
  1996. name: "Code",
  1997. value: rg.code,
  1998. }, {
  1999. name: "Consumption",
  2000. value: rg.tenderQuantity
  2001. }];
  2002. Element.call(this, "ConsumeItem", attrs);
  2003. }
  2004. }
  2005. function CostStructure(item) {
  2006. let CostStructure = new emptyElement('CostStructure');
  2007. for (let f of cpFeeTypes) {
  2008. if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
  2009. }
  2010. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
  2011. function CostItem(item,type) {
  2012. const attrs = [{
  2013. name: "ItemNo",
  2014. value: itemFeeMap[type],
  2015. }, {
  2016. name: 'Sum',
  2017. value: 0 //fee.tenderTotalFee
  2018. }]
  2019. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  2020. Element.call(this, "CostItem", attrs);
  2021. }
  2022. return CostStructure;
  2023. }
  2024. }
  2025. }
  2026. }
  2027. function Params(tenderProject) {
  2028. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  2029. let featrueMap = {};
  2030. let baseMap = {};
  2031. for (let f of feature) {
  2032. featrueMap[f.key] = f;
  2033. }
  2034. let baseInfo = _.find(tenderProject.property.basicInformation, {
  2035. dispName: "基本信息",
  2036. });
  2037. for (let i of baseInfo.items) {
  2038. let key = i.key;
  2039. //if (i.dispName == "编制日期") key = "编制时间";
  2040. baseMap[key] = i;
  2041. }
  2042. let BuildType = "";
  2043. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  2044. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  2045. let Terrain = "";
  2046. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  2047. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  2048. let DesignSpeed = featrueMap["designSpeed"].value;
  2049. let Structure = "";
  2050. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  2051. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  2052. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  2053. let RoadGrade = "";
  2054. if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  2055. const attrs = [{
  2056. name: "PrjArea",
  2057. value: baseMap["location"] ? baseMap["location"].value : ""
  2058. },
  2059. {
  2060. name: "StartPileNo",
  2061. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  2062. mustHasValue: true
  2063. },
  2064. {
  2065. name: "EndPileNo",
  2066. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  2067. mustHasValue: true
  2068. },
  2069. {
  2070. name: "BuildType",
  2071. value: BuildType,
  2072. },
  2073. {
  2074. name: "Terrain",
  2075. value: Terrain,
  2076. mustHasValue: true
  2077. },
  2078. {
  2079. name: "RoadGrade",
  2080. value: RoadGrade,
  2081. mustHasValue: true
  2082. },
  2083. {
  2084. name: "DesignSpeed",
  2085. value: DesignSpeed,
  2086. mustHasValue: true
  2087. },
  2088. {
  2089. name: "Structure",
  2090. value: Structure,
  2091. mustHasValue: true
  2092. },
  2093. {
  2094. name: "SubgradeWidth",
  2095. value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
  2096. mustHasValue: true
  2097. },
  2098. {
  2099. name: "RoadLength",
  2100. value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
  2101. mustHasValue: true
  2102. },
  2103. {
  2104. name: "BridgeLength",
  2105. value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
  2106. mustHasValue: true
  2107. },
  2108. {
  2109. name: "TunnelLength",
  2110. value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
  2111. mustHasValue: true
  2112. },
  2113. {
  2114. name: "BriTunRate",
  2115. value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
  2116. mustHasValue: true
  2117. },
  2118. {
  2119. name: "InterchangeNum",
  2120. value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
  2121. mustHasValue: true
  2122. },
  2123. {
  2124. name: "StubLengths",
  2125. value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
  2126. mustHasValue: true
  2127. },
  2128. {
  2129. name: "LaneLength",
  2130. value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
  2131. mustHasValue: true
  2132. },
  2133. ];
  2134. Element.call(this, "Params", attrs);
  2135. }
  2136. function SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature) {
  2137. let attrs = [{
  2138. name: "TenderSumLimit",
  2139. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  2140. type: TYPE.DECIMAL,
  2141. toFix:2,
  2142. },
  2143. {
  2144. name: "BidTotal",
  2145. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  2146. type: TYPE.DECIMAL,
  2147. toFix:2,
  2148. },
  2149. {
  2150. name: "BillTotal",
  2151. value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
  2152. type: TYPE.DECIMAL,
  2153. toFix:2,
  2154. },
  2155. {
  2156. name: "CostForHSE",
  2157. value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  2158. type: TYPE.DECIMAL,
  2159. toFix:2,
  2160. },
  2161. {
  2162. name: "ProvisionalSums",
  2163. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  2164. type: TYPE.DECIMAL,
  2165. toFix:2,
  2166. },
  2167. {
  2168. name: "Appraisal",
  2169. // value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  2170. value: 0,
  2171. type: TYPE.DECIMAL,
  2172. toFix:2,
  2173. },
  2174. ];
  2175. if (isBidInvitation) {
  2176. attrs.splice(0, 3) //招标
  2177. }
  2178. //if (isControl) attrs.splice(1, 5); //控制价
  2179. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  2180. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  2181. if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
  2182. }
  2183. Element.call(this, "SummaryOfCost", attrs);
  2184. }
  2185. function MakeInfo(tenderProject) {
  2186. let property = tenderProject.property;
  2187. let baseMap = {};
  2188. let baseInfo = _.find(property.basicInformation, {
  2189. dispName: "基本信息",
  2190. });
  2191. for (let i of baseInfo.items) {
  2192. let key = i.key;
  2193. //if (i.dispName == "编制日期") key = "编制时间";
  2194. baseMap[key] = i;
  2195. }
  2196. //mustHasValue
  2197. const attrs = [{
  2198. name: "ValuationModel",
  2199. value: property.taxType,
  2200. },
  2201. {
  2202. name: "Manage",
  2203. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  2204. },
  2205. {
  2206. name: "Designer",
  2207. value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
  2208. mustHasValue:true
  2209. },
  2210. {
  2211. name: "Compile",
  2212. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  2213. },
  2214. {
  2215. name: "CompileApprover",
  2216. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  2217. },
  2218. {
  2219. name: "CompileCertNo",
  2220. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
  2221. mustHasValue:true
  2222. },
  2223. {
  2224. name: "CompileDate",
  2225. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : "",
  2226. mustHasValue:true
  2227. },
  2228. {
  2229. name: "Review",
  2230. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
  2231. mustHasValue:true
  2232. },
  2233. {
  2234. name: "ReviewApprover",
  2235. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
  2236. mustHasValue:true
  2237. },
  2238. {
  2239. name: "ReviewCertNo",
  2240. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
  2241. mustHasValue:true
  2242. },
  2243. {
  2244. name: "ReviewDate",
  2245. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : "",
  2246. mustHasValue:true
  2247. },
  2248. {
  2249. name: "Examine",
  2250. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  2251. mustHasValue:true
  2252. },
  2253. {
  2254. name: "ExamineApprover",
  2255. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  2256. mustHasValue:true
  2257. },
  2258. {
  2259. name: "ExamineCertNo",
  2260. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  2261. mustHasValue:true
  2262. },
  2263. {
  2264. name: "ExamineDate",
  2265. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  2266. mustHasValue:true
  2267. },
  2268. {
  2269. name: "CompileExplain",
  2270. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  2271. mustHasValue:true
  2272. },
  2273. {
  2274. name: "ExamineExplain",
  2275. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  2276. mustHasValue:true
  2277. },
  2278. {
  2279. name: "ProjectExplain",
  2280. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  2281. mustHasValue:true
  2282. },
  2283. {
  2284. name: "Bidder",
  2285. value: baseMap["bidderCompany"] ? baseMap["bidderCompany"].value : "",
  2286. mustHasValue:true
  2287. },
  2288. ];
  2289. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  2290. attrs.splice(11, 7);
  2291. attrs.splice(7, 1);
  2292. }
  2293. Element.call(this, "MakeInfo", attrs);
  2294. }
  2295. let data = new CprjInfo(projectData.name);
  2296. data.children.push(new SystemInfo(projectData));
  2297. data.children.push(new CostBasis());
  2298. let seriNo = 1;
  2299. let Rates = [];
  2300. let Practs = [];
  2301. let EprjInfos = [];
  2302. for (let c of projectData.children) {
  2303. let tenderProject = tenderDetailMap[c.ID];
  2304. let feeRataDatas = tenderProject.FeeRate.datas;
  2305. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  2306. Practs.push(new Pract(tenderProject, seriNo));
  2307. EprjInfos.push(new EprjInfo(tenderProject));
  2308. seriNo++;
  2309. }
  2310. data.children.push(...Rates,...Practs,...EprjInfos);
  2311. return [{
  2312. data: data,
  2313. exportKind: exportKind,
  2314. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  2315. }, ];
  2316. }
  2317. // 山东需求,要有密文校验信息(SM3算法,在界面上已导入sm3对象)
  2318. /**
  2319. * SM3加密主函数
  2320. * @param msg
  2321. * @returns
  2322. */
  2323. function sm3Digest(msg){
  2324. let hashHex = sm3(msg);
  2325. // return hashHex;
  2326. return hashHex.toUpperCase();
  2327. }
  2328. return {
  2329. entry,
  2330. };
  2331. })();