guangxi_common.js 65 KB

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