guangxi_common.js 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099
  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 bill(bNode, level) {
  1245. let data = bNode.data;
  1246. let CostKind = 3;
  1247. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  1248. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  1249. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  1250. let CalcType = getCalcType(bNode);
  1251. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  1252. let ProvisionalType = "";
  1253. if (data.specialProvisional == "材料暂估") ProvisionalType = 0;
  1254. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  1255. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  1256. //MpRatio
  1257. let MpRatio = "";
  1258. let MaterialRatio = "";
  1259. let MechRatio = "";
  1260. if (data.quantityCoe) {
  1261. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  1262. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  1263. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  1264. }
  1265. let fail = null;
  1266. // if (!isBidSubmission) {
  1267. fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag);
  1268. // }
  1269. // 投标的不去判断
  1270. // let fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag)
  1271. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  1272. let ListCode = "";
  1273. if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name][0];
  1274. if (data.code && data.code != "") ListCode = data.code;
  1275. let formulaCode = "";
  1276. if (ListCodeMap[data.name]) formulaCode = ListCodeMap[data.name][1];
  1277. let perKeyId = '';
  1278. if (data.ParentID != -1) {
  1279. const parent = bNode.tree.findNode(bNode.data.ParentID)
  1280. if (parent) {
  1281. perKeyId = parent.data.keyIDData?.item || parent.data.ID;
  1282. }
  1283. }
  1284. const attrs = [{
  1285. name: "ListCode",
  1286. value: ListCode,
  1287. },
  1288. {
  1289. name: "ListName",
  1290. value: data.name,
  1291. fail: fail
  1292. },
  1293. {
  1294. name: "Unit",
  1295. value: data.unit,
  1296. },
  1297. {
  1298. name: "Num",
  1299. value: data.quantity,
  1300. type: TYPE.DECIMAL,
  1301. toFix: _getDecimal(data.unit)
  1302. },
  1303. // {
  1304. // name: "QtyFormula",
  1305. // value: _getStrValueByExportKind(data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : ""),
  1306. // type: TYPE.DECIMAL,
  1307. // toFix:2
  1308. // },
  1309. {
  1310. name: "Price",
  1311. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1312. type: TYPE.DECIMAL,
  1313. toFix: 2
  1314. },
  1315. {
  1316. name: "Sum",
  1317. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1318. type: TYPE.DECIMAL,
  1319. toFix: 2
  1320. },
  1321. {
  1322. name: "ProvisionalType",
  1323. value: ProvisionalType,
  1324. mustHasValue: true
  1325. },
  1326. {
  1327. name: "MeterRules",
  1328. value: "",
  1329. },
  1330. {
  1331. name: "Content",
  1332. value: data.jobContentText,
  1333. },
  1334. {
  1335. name: "Remarks",
  1336. value: data.remark,
  1337. },
  1338. {
  1339. name: "ItemType",
  1340. value: getItemType(bNode),
  1341. },
  1342. {
  1343. name: "FormulaCode",
  1344. value: formulaCode
  1345. },
  1346. {
  1347. name: "KeyId",
  1348. value: data.keyIDData?.item || data.ID
  1349. },
  1350. {
  1351. name: "PerKeyId",
  1352. value: perKeyId
  1353. }
  1354. ];
  1355. //投标、招标控制价时。取单价。
  1356. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1357. if (isBidSubmission || isControl || CostKind == 1 || CostKind == 2) {
  1358. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1359. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1360. //暂列金额 数量为0的时候,单价输出0
  1361. if (CostKind == 2 && !gljUtil.isNotEmpty(data.quantity)) attrs[4].value = 0
  1362. }
  1363. // 计日工合计下的劳务、材料、机械Item节点单价及合价(Price, Sum)也要输出
  1364. if (bNode.children && bNode.children.length === 0 && _getFee(bNode) > 0) { //先检测是否有费用
  1365. // 再检测是否计日工合计清单下
  1366. if (_chkIfJRGHJ(bNode, ['计日工合计'])) {
  1367. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1368. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1369. }
  1370. }
  1371. // 清单的专项暂定有选择了专业工程的清单Item节点单价及合价(Price, Sum)也要输出
  1372. if (ProvisionalType === 2) {
  1373. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1374. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1375. }
  1376. //特殊清单
  1377. if (isBidInvitation) {
  1378. // 招标工程量清单 读计日工和已包含在清单合计中的材料、工程设备、专业工程暂估价合计。
  1379. const specialBills = ['计日工合计', '已包含在清单合计中的材料、工程设备、专业工程暂估价合计'];
  1380. if (bNode.children && bNode.children.length > 0 && _chkIfJRGHJ(bNode, specialBills)) {
  1381. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1382. }
  1383. if (bNode.data.name === '投标报价') {
  1384. let rootNodes = tenderProject.mainTree.roots;
  1385. let ttlSum = 0;
  1386. for (let r of rootNodes) {
  1387. if (specialBills.includes(r.data.name)) {
  1388. ttlSum += _getFee(r);
  1389. }
  1390. }
  1391. attrs[5].value = '' + ttlSum;
  1392. }
  1393. }
  1394. Element.call(this, "Item", attrs);
  1395. let cc = CostComposition(bNode);
  1396. if (cc) this.children.push(cc);
  1397. this.children.push(CostStructure(data))
  1398. // function _chkIfHas
  1399. function _chkIfJRGHJ(bNode, exArr = []) {
  1400. //检测是否在指定清单的子目录下(如:计日工合计等)
  1401. let rst = false;
  1402. let pNode = bNode;
  1403. while (pNode !== null && pNode !== undefined) {
  1404. if ((typeof pNode.data.name === 'string') && exArr.includes(pNode.data.name)) {
  1405. rst = true;
  1406. break;
  1407. }
  1408. pNode = pNode.parent;
  1409. }
  1410. return rst;
  1411. }
  1412. function _getFee(bNode, key = 'common', valueKey = 'tenderTotalFee') {
  1413. let rstSum = 0;
  1414. if (bNode) {
  1415. let dtlB = (bNode.data) ? bNode.data : bNode;
  1416. if (dtlB.fees) {
  1417. for (let fee of dtlB.fees) {
  1418. if (fee.fieldName === key) {
  1419. rstSum = parseFloat(fee[valueKey]);
  1420. if (isNaN(rstSum)) rstSum = 0;
  1421. break;
  1422. }
  1423. }
  1424. }
  1425. }
  1426. return rstSum;
  1427. }
  1428. function _chkIfNeedCostComposition(bNode) {
  1429. let rst = isBidInvitation && !(ProvisionalType === 0 || ProvisionalType === 1);
  1430. if (rst) {
  1431. //计日工合计下的劳务、材料、机械 有费用也要输出
  1432. if (bNode.children && bNode.children.length === 0 && _getFee(bNode) > 0) { //先检测是否有费用
  1433. // 再检测是否计日工合计清单下
  1434. rst = !_chkIfJRGHJ(bNode, ['计日工合计']);
  1435. }
  1436. }
  1437. return rst;
  1438. }
  1439. function CostComposition(bNode) {
  1440. if (_chkIfNeedCostComposition(bNode)) return null;
  1441. let CostComposition = new emptyElement('CostComposition');
  1442. CostComposition.attrs = [{
  1443. name: "KeyId",
  1444. value: bNode.data.keyIDData?.costComposition || uuid.v1()
  1445. }];
  1446. let Norms = [];
  1447. let Costs = [];
  1448. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1449. for (let r of bNode.children) {
  1450. if (r.data.type == rationType.ration) {
  1451. if (isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
  1452. Norms.push(new Ration(r.data));
  1453. } else {
  1454. Costs.push(new Cost(r.data));
  1455. }
  1456. }
  1457. }
  1458. if (Costs.length === 0 && _chkIfJRGHJ(bNode, ['计日工合计'])) {
  1459. Costs.push(new Cost(bNode.data));
  1460. for (let idx = 0; idx < Costs[Costs.length - 1].attrs.length; idx++) {
  1461. if (Costs[Costs.length - 1].attrs[idx].name === 'Num') {
  1462. Costs[Costs.length - 1].attrs[idx].value = '' + bNode.data.quantity;
  1463. } else if (Costs[Costs.length - 1].attrs[idx].name === 'BasePrice') {
  1464. Costs[Costs.length - 1].attrs[idx].value = '' + _getFee(bNode, 'common', 'tenderUnitFee');
  1465. }
  1466. }
  1467. }
  1468. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1469. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1470. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1471. return (CostComposition.children.length > 0) ? CostComposition : null;
  1472. //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
  1473. function isEmptyRation(ration) {
  1474. return !gljUtil.isNotEmpty(ration.code) && !gljUtil.isNotEmpty(ration.name) && !gljUtil.isNotEmpty(ration.unit) && (!gljUtil.isNotEmpty(ration.quantity) || ration.quantity == 0)
  1475. }
  1476. function Formula(bills) {
  1477. const attrs = [{
  1478. name: "Name",
  1479. value: bills.name
  1480. },
  1481. {
  1482. name: "Formulas",
  1483. value: bills.calcBase
  1484. },
  1485. {
  1486. name: "Ratio",
  1487. value: 1
  1488. },
  1489. {
  1490. name: "Sum",
  1491. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1492. type: TYPE.DECIMAL
  1493. },
  1494. {
  1495. name: "Remarks",
  1496. value: bills.remark
  1497. },
  1498. {
  1499. name: "KeyId",
  1500. value: bills.keyIDData?.formula || uuid.v1()
  1501. }
  1502. ]
  1503. Element.call(this, "Formula", attrs);
  1504. // 1.Name
  1505. // 名称/描述。取清单的名称。
  1506. // 2.Formulas
  1507. // 计算式。读取计算基数的文本。
  1508. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1509. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1510. // 3.Ratio
  1511. // 系数。输出为1,非必填。
  1512. // 4.Sum
  1513. // 取金额。
  1514. // 5.Remarks
  1515. }
  1516. function Cost(item) {
  1517. let BasePrice = 0;
  1518. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1519. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1520. } else {
  1521. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1522. }
  1523. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1524. let CostTypeNo = '';
  1525. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1526. const attrs = [{
  1527. name: "Code",
  1528. value: item.code,
  1529. }, {
  1530. name: 'Name',
  1531. value: item.name
  1532. }, {
  1533. name: 'Spec',
  1534. value: item.specs
  1535. }, {
  1536. name: 'Unit',
  1537. value: item.unit
  1538. }, {
  1539. name: 'Num',
  1540. value: item.tenderQuantity
  1541. }, {
  1542. name: 'BasePrice',
  1543. value: BasePrice
  1544. }, {
  1545. name: 'Price',
  1546. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1547. }, {
  1548. name: 'IsEquipment',
  1549. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1550. }, {
  1551. name: 'CostTypeNo',
  1552. value: CostTypeNo
  1553. }, {
  1554. name: 'ProfitRate',
  1555. value: getFeeRate(item.programID, 'profit', tenderProject)
  1556. },
  1557. {
  1558. name: 'TaxRate',
  1559. value: getFeeRate(item.programID, 'tax', tenderProject)
  1560. },
  1561. {
  1562. name: 'MpRatio',
  1563. value: item.subType == gljType.LABOUR ? 100 : 0
  1564. },
  1565. {
  1566. name: 'MaterialRatio',
  1567. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1568. },
  1569. {
  1570. name: 'MechRatio',
  1571. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1572. },
  1573. {
  1574. name: "KeyId",
  1575. value: uuid.v1()
  1576. }
  1577. ]
  1578. Element.call(this, "Cost", attrs);
  1579. this.children.push(CostStructure(item));
  1580. }
  1581. function Ration(ration) {
  1582. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1583. let CostTypeNo = '';
  1584. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1585. const attrs = [{
  1586. name: "NormLibNo",
  1587. value: 'YSDE-000000-2018-86',
  1588. }, {
  1589. name: 'DisplayCode',
  1590. value: ration.code
  1591. }, {
  1592. name: 'Name',
  1593. value: ration.name
  1594. }, {
  1595. name: 'Unit',
  1596. value: ration.unit
  1597. }, {
  1598. name: 'Num',
  1599. value: ration.tenderQuantity
  1600. },
  1601. {
  1602. name: 'CostTypeNo',
  1603. value: CostTypeNo
  1604. },
  1605. {
  1606. name: 'ProfitRate',
  1607. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1608. },
  1609. {
  1610. name: 'TaxRate',
  1611. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1612. },
  1613. {
  1614. name: 'FabricationCost',
  1615. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1616. },
  1617. {
  1618. name: 'AdjustStatus',
  1619. value: ration.adjustState
  1620. },
  1621. {
  1622. name: "KeyId",
  1623. value: uuid.v1()
  1624. }
  1625. ]
  1626. Element.call(this, "Norm", attrs);
  1627. this.children.push(CostStructure(ration));
  1628. this.children.push(Consume(ration));
  1629. }
  1630. }
  1631. function Consume(ration) {
  1632. let consume = new emptyElement('Consume');
  1633. consume.attrs = [{
  1634. name: "KeyId",
  1635. value: uuid.v1()
  1636. }];
  1637. for (let rg of ration.rationGLJList) {
  1638. consume.children.push(new ConsumeItem(rg));
  1639. }
  1640. return consume;
  1641. function ConsumeItem(rg) {
  1642. const attrs = [{
  1643. name: "Code",
  1644. value: rg.code,
  1645. }, {
  1646. name: "Consumption",
  1647. value: rg.tenderQuantity
  1648. }, {
  1649. name: "KeyId",
  1650. value: uuid.v1()
  1651. }];
  1652. Element.call(this, "ConsumeItem", attrs);
  1653. }
  1654. }
  1655. function CostStructure(item) {
  1656. let CostStructure = new emptyElement('CostStructure');
  1657. CostStructure.attrs = [{
  1658. name: "KeyId",
  1659. value: item.keyIDData?.costStructure || uuid.v1()
  1660. }];
  1661. for (let f of cpFeeTypes) {
  1662. if (itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item, f.type))
  1663. }
  1664. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({}, ""))
  1665. function CostItem(item, type) {
  1666. const attrs = [{
  1667. name: "ItemNo",
  1668. value: itemFeeMap[type],
  1669. }, {
  1670. name: 'Sum',
  1671. value: 0 //fee.tenderTotalFee
  1672. }, {
  1673. name: "KeyId",
  1674. value: uuid.v1()
  1675. }
  1676. ]
  1677. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1678. Element.call(this, "CostItem", attrs);
  1679. }
  1680. return CostStructure;
  1681. }
  1682. }
  1683. }
  1684. }
  1685. function Params(tenderProject) {
  1686. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1687. let featrueMap = {};
  1688. debugger;
  1689. let baseMap = {};
  1690. for (let f of feature) {
  1691. featrueMap[f.key] = f;
  1692. }
  1693. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1694. dispName: "基本信息",
  1695. });
  1696. for (let i of baseInfo.items) {
  1697. let key = i.key;
  1698. //if (i.dispName == "编制日期") key = "编制时间";
  1699. baseMap[key] = i;
  1700. }
  1701. let BuildType = "";
  1702. if (baseMap["natureConstruction"]) {
  1703. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1704. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1705. }
  1706. let Terrain = "";
  1707. if (baseMap["terrainCategory"]) {
  1708. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1709. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1710. }
  1711. let DesignSpeed = parseFloat(featrueMap["designSpeed"].value);
  1712. if (isNaN(DesignSpeed)) DesignSpeed = 0;
  1713. let Structure = 0;
  1714. if (featrueMap["pavementStructure"]) {
  1715. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1716. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1717. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1718. }
  1719. let RoadGrade = "";
  1720. if (baseMap["roadGrade"] && RoadGradeMap[baseMap["roadGrade"].value]) {
  1721. RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1722. }
  1723. const attrs = [{
  1724. name: "PrjArea",
  1725. value: baseMap["location"] ? baseMap["location"].value : ""
  1726. },
  1727. {
  1728. name: "StartPileNo",
  1729. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1730. mustHasValue: true
  1731. },
  1732. {
  1733. name: "EndPileNo",
  1734. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1735. mustHasValue: true
  1736. },
  1737. {
  1738. name: "BuildType",
  1739. value: BuildType,
  1740. },
  1741. {
  1742. name: "Terrain",
  1743. value: Terrain,
  1744. mustHasValue: true
  1745. },
  1746. {
  1747. name: "RoadGrade",
  1748. value: RoadGrade,
  1749. mustHasValue: true
  1750. },
  1751. {
  1752. name: "DesignSpeed",
  1753. value: DesignSpeed
  1754. },
  1755. {
  1756. name: "Structure",
  1757. value: Structure
  1758. },
  1759. {
  1760. name: "SubgradeWidth",
  1761. value: featrueMap["subgradeWidth"] ? _getZeroValueIfNotValid(featrueMap["subgradeWidth"].value) : 0
  1762. },
  1763. {
  1764. name: "RoadLength",
  1765. value: featrueMap["roadLength"] ? _getZeroValueIfNotValid(featrueMap["roadLength"].value) : 0
  1766. },
  1767. {
  1768. name: "BridgeLength",
  1769. value: featrueMap["bridgeLength"] ? _getZeroValueIfNotValid(featrueMap["bridgeLength"].value) : 0
  1770. },
  1771. {
  1772. name: "TunnelLength",
  1773. value: featrueMap["tunnelLength"] ? _getZeroValueIfNotValid(featrueMap["tunnelLength"].value) : 0
  1774. },
  1775. {
  1776. name: "BriTunRate",
  1777. value: featrueMap["briTunRate"] ? _getZeroValueIfNotValid(featrueMap["briTunRate"].value) : 0
  1778. },
  1779. {
  1780. name: "InterchangeNum",
  1781. value: featrueMap["interchangeNum"] ? _getZeroValueIfNotValid(featrueMap["interchangeNum"].value) : 0
  1782. },
  1783. {
  1784. name: "RisingRate",
  1785. value: 0,
  1786. mustHasValue: true
  1787. },
  1788. {
  1789. name: "RisingYears",
  1790. value: 0,
  1791. mustHasValue: true
  1792. },
  1793. {
  1794. name: "RateNo",
  1795. value: uuid.v1()
  1796. },
  1797. {
  1798. name: "PractNo",
  1799. value: uuid.v1()
  1800. },
  1801. {
  1802. name: "StubLengths",
  1803. value: featrueMap["stubLengths"] ? _getZeroValueIfNotValid(featrueMap["stubLengths"].value) : 0
  1804. },
  1805. {
  1806. name: "LaneLength",
  1807. value: featrueMap["laneLength"] ? _getZeroValueIfNotValid(featrueMap["laneLength"].value) : 0
  1808. },
  1809. {
  1810. name: "KeyId",
  1811. value: projectData.keyIDData.params || uuid.v1()
  1812. }
  1813. ];
  1814. Element.call(this, "Params", attrs);
  1815. }
  1816. function SummaryOfCost(totalItem, proItem, safeItem, oneToSevenItem, feature) {
  1817. let attrs = [{
  1818. name: "TenderSumLimit",
  1819. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1820. type: TYPE.DECIMAL,
  1821. toFix: 2,
  1822. },
  1823. {
  1824. name: "BidTotal",
  1825. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1826. type: TYPE.DECIMAL,
  1827. toFix: 2,
  1828. },
  1829. {
  1830. name: "BillTotal",
  1831. value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
  1832. type: TYPE.DECIMAL,
  1833. toFix: 2,
  1834. },
  1835. {
  1836. name: "CostForHSE",
  1837. value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1838. type: TYPE.DECIMAL,
  1839. toFix: 2,
  1840. },
  1841. {
  1842. name: "ProvisionalSums",
  1843. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1844. type: TYPE.DECIMAL,
  1845. toFix: 2,
  1846. },
  1847. {
  1848. name: "Appraisal",
  1849. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1850. type: TYPE.DECIMAL,
  1851. toFix: 2,
  1852. },
  1853. ];
  1854. if (isBidInvitation) {
  1855. attrs.splice(0, 3) //招标
  1856. }
  1857. //if (isControl) attrs.splice(1, 5); //控制价
  1858. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1859. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1860. if (tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1861. }
  1862. Element.call(this, "SummaryOfCost", attrs);
  1863. }
  1864. function MakeInfo(tenderProject) {
  1865. let property = tenderProject.property;
  1866. let baseMap = {};
  1867. let baseInfo = _.find(property.basicInformation, {
  1868. dispName: "基本信息",
  1869. });
  1870. for (let i of baseInfo.items) {
  1871. let key = i.key;
  1872. //if (i.dispName == "编制日期") key = "编制时间";
  1873. baseMap[key] = i;
  1874. }
  1875. //mustHasValue
  1876. const attrs = [
  1877. // {
  1878. // name: "ValuationModel",
  1879. // value: property.taxType,
  1880. // },
  1881. {
  1882. name: "Manage",
  1883. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1884. },
  1885. {
  1886. name: "Designer",
  1887. value: baseMap["designUnit"] ? baseMap["designUnit"].value : ""
  1888. },
  1889. {
  1890. name: "Compile",
  1891. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1892. },
  1893. {
  1894. name: "CompileApprover",
  1895. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1896. },
  1897. {
  1898. name: "CompileCertNo",
  1899. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : ""
  1900. },
  1901. {
  1902. name: "CompileDate",
  1903. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : ""
  1904. },
  1905. {
  1906. name: "Review",
  1907. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : ""
  1908. },
  1909. {
  1910. name: "ReviewApprover",
  1911. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : ""
  1912. },
  1913. {
  1914. name: "ReviewCertNo",
  1915. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : ""
  1916. },
  1917. {
  1918. name: "ReviewDate",
  1919. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : ""
  1920. },
  1921. {
  1922. name: "Examine",
  1923. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1924. mustHasValue: true
  1925. },
  1926. {
  1927. name: "ExamineApprover",
  1928. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1929. mustHasValue: true
  1930. },
  1931. {
  1932. name: "ExamineCertNo",
  1933. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1934. mustHasValue: true
  1935. },
  1936. {
  1937. name: "ExamineDate",
  1938. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1939. mustHasValue: true
  1940. },
  1941. {
  1942. name: "CompileExplain",
  1943. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1944. mustHasValue: true
  1945. },
  1946. {
  1947. name: "ExamineExplain",
  1948. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1949. mustHasValue: true
  1950. },
  1951. {
  1952. name: "ProjectExplain",
  1953. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  1954. mustHasValue: true
  1955. },
  1956. {
  1957. name: "KeyId",
  1958. value: projectData.keyIDData.makeInfo || uuid.v1()
  1959. }
  1960. ];
  1961. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  1962. // attrs.splice(11, 7);
  1963. // attrs.splice(7, 1);
  1964. }
  1965. Element.call(this, "MakeInfo", attrs);
  1966. }
  1967. let data = new CprjInfo(projectData.name);
  1968. data.children.push(new SystemInfo(projectData));
  1969. data.children.push(new CostBasis());
  1970. let seriNo = 1;
  1971. let Rates = [];
  1972. let Practs = [];
  1973. let EprjInfos = [];
  1974. let Indexs = [];
  1975. for (let c of projectData.children) {
  1976. let tenderProject = tenderDetailMap[c.ID];
  1977. let feeRataDatas = tenderProject.FeeRate.datas;
  1978. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1979. Practs.push(new Pract(tenderProject, seriNo));
  1980. EprjInfos.push(new EprjInfo(tenderProject));
  1981. if (seriNo === 1) Indexs.push(new getIndexs(tenderProject));
  1982. seriNo++;
  1983. }
  1984. data.children.push(...Rates, ...Practs, ...EprjInfos, ...Indexs);
  1985. return [{
  1986. data: data,
  1987. exportKind: exportKind,
  1988. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1989. },];
  1990. }
  1991. return {
  1992. entry,
  1993. };
  1994. })();