guangxi_common.js 68 KB

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