guangxi_common.js 68 KB

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