guangdong_zhongshan.js 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622
  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. };
  84. const FixedCostMap = {
  85. //折旧费、检修费、维护费、安拆辅助费
  86. '折旧费': 1,
  87. '检修费': 1,
  88. '维护费': 1,
  89. '安拆辅助费':1
  90. }
  91. const RoadGradeMap = {
  92. "高速公路": "0",
  93. "一级公路": "1",
  94. "二级公路": "2",
  95. "三级公路": "3",
  96. "四级公路": "4",
  97. "等外公路": "5",
  98. "独立桥梁": "6",
  99. "独立隧道": "7"
  100. }
  101. const sectionNameMap = {
  102. "清单 第100章 总则": true,
  103. "清单 第200章 路基": true,
  104. "清单 第300章 路面": true,
  105. "清单 第400章 桥梁、涵洞工程": true,
  106. "清单 第500章 隧道": true,
  107. "清单 第600章 交通安全设施": true,
  108. "清单 第700章 绿化及环境保护设施": true,
  109. "清单 第800章 机电工程": true,
  110. "清单 第900章 附属区房建工程":true
  111. }
  112. const ratioCodeMap = {
  113. "01ZJF":"0",
  114. "02JXF":"1",
  115. "03WHF":"2",
  116. "04ACFZF":"3"
  117. }
  118. function getBasePrice(projectGLJID, tenderProject) {
  119. let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
  120. id: projectGLJID
  121. })
  122. return glj ? gljUtil.getBasePrice(glj, null, null, null, decimalObj, false, _, scMathUtil) : 0;
  123. }
  124. function getFeeRate(programID, fieldName, tenderProject) {
  125. let rate = 0;
  126. let template = tenderProject.calcProgram.compiledTemplates;
  127. if (template[programID]) {
  128. let item = _.find(template[programID].calcItems, {
  129. fieldName: fieldName
  130. })
  131. if (item) rate = item.feeRate;
  132. }
  133. return rate
  134. }
  135. function billNameChecking(bNode,projectName,fixedFlag) {
  136. let data = bNode.data;
  137. let fail = null;
  138. let pass = true;
  139. if (data.flagsIndex && data.flagsIndex.fixed) {
  140. let flag = data.flagsIndex.fixed.flag;
  141. switch (flag) {
  142. case fixedFlag.ONE_SEVEN_BILLS:
  143. pass = data.name == "第100章至900章清单";
  144. break;
  145. case fixedFlag.PROVISIONAL_TOTAL:
  146. pass = data.name == "已包含在清单合计中的材料、工程设备、专业工程暂估价合计";
  147. break;
  148. case fixedFlag.BILLS_TOTAL_WT_PROV:
  149. pass = data.name == "清单合计减去材料、工程设备、专业工程暂估价合计";
  150. break;
  151. case fixedFlag.DAYWORK_LABOR:
  152. pass = data.name == "计日工合计";
  153. break;
  154. case fixedFlag.LABOUR_SERVICE:
  155. pass = data.name == "劳务";
  156. break;
  157. case fixedFlag.MATERIAL:
  158. pass = data.name == "材料";
  159. break;
  160. case fixedFlag.CONSTRUCTION_MACHINE:
  161. pass = data.name == "机械";
  162. break;
  163. case fixedFlag.PROVISIONAL:
  164. pass = data.name == "暂列金额(不含计日工总额)";
  165. break;
  166. case fixedFlag.TOTAL_COST:
  167. pass = data.name == "投标报价";
  168. break;
  169. case fixedFlag.ONE_HUNDRED_BILLS:
  170. pass = data.name == "清单 第100章 总则";
  171. break;
  172. }
  173. } else {
  174. if (bNode.parent) {
  175. const pdata = bNode.parent.data;
  176. if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
  177. if (!sectionNameMap[data.name]) pass = false
  178. }
  179. }
  180. }
  181. if(pass == false)fail = { hint: `清单:"${data.name?data.name:""}",名字不符合规范!`, type: projectName }
  182. return fail;
  183. }
  184. /**
  185. *
  186. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  187. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  188. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  189. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  190. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  191. */
  192. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  193. const {
  194. CONFIG: {
  195. TYPE
  196. },
  197. UTIL,
  198. Element
  199. } = INTERFACE_EXPORT_BASE;
  200. const {
  201. EXPORT_KIND: {
  202. BID_INVITATION,
  203. BID_SUBMISSION,
  204. CONTROL
  205. },
  206. fixedFlag,
  207. } = window.commonConstants;
  208. let cprjType = {
  209. 1: "GCLQD", // 招标
  210. 2: "TBBJ", // 投标
  211. 3: "ZBKZJ", // 控制价
  212. };
  213. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  214. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  215. const isControl = exportKind === CONTROL; // 是否是控制价
  216. function emptyElement(name) {
  217. this.name = name;
  218. this.attrs = [];
  219. this.children = [];
  220. }
  221. // 建设项目根节点信息
  222. function CprjInfo(projectName) {
  223. const attrs = [{
  224. name: "CprjName",
  225. value: projectName,
  226. },
  227. {
  228. name: "CprjType",
  229. value: cprjType[exportKind],
  230. },
  231. ];
  232. Element.call(this, "CprjInfo", attrs);
  233. }
  234. // 项目基本信息
  235. function SystemInfo(projectData) {
  236. let baseInfo = _.find(projectData.property.basicInformation, {
  237. dispName: "基本信息",
  238. });
  239. let makeData = _.find(baseInfo.items, { "key": "makeDate" });
  240. let hardID = UTIL.generateHardwareId();
  241. let [cpuId, diskId, macId] = hardID.split(";");
  242. const attrs = [{
  243. name: "Name",
  244. value: "公路工程造价数据标准",
  245. },
  246. {
  247. name: "Version",
  248. value: "1.0",
  249. },
  250. {
  251. name: "SoftwareName",
  252. value: "纵横公路云造价",
  253. },
  254. {
  255. name: "SoftwareVer",
  256. value: "V" + VERSION,
  257. },
  258. {
  259. name: "SoftwareCompany",
  260. value: "珠海纵横创新软件有限公司",
  261. },
  262. {
  263. name: "MakeDate",
  264. value: makeData?makeData.value:"",
  265. },
  266. {
  267. name: "Key1",
  268. value: window.btoa(VERSION),
  269. },
  270. {
  271. name: "Key2",
  272. value: window.btoa(diskId),
  273. },
  274. {
  275. name: "Key3",
  276. value: window.btoa(macId),
  277. },
  278. ];
  279. if (isBidSubmission)
  280. attrs.splice(6, 0, {
  281. name: "BidderVer",
  282. value: UTIL.getNowFormatTime(true),
  283. });
  284. Element.call(this, "SystemInfo", attrs);
  285. }
  286. //造价依据
  287. function CostBasis() {
  288. // ItemStandardNo="GYSFX-000000-2018-86"
  289. const attrs = [{
  290. name: "MakeRuleNo",
  291. value: "GYSBB-000000-2018-86",
  292. },
  293. {
  294. name: "MakeRuleName",
  295. value: "公路工程建设项目概算预算编制办法",
  296. },
  297. {
  298. name: "ItemStandardNo",
  299. value: "GYSFX-000000-2018-86",
  300. },
  301. ];
  302. Element.call(this, "CostBasis", attrs);
  303. //定额库信息
  304. //to do 改成实际的值
  305. function NormLib() {
  306. const attrs = [{
  307. name: "NormLibNo",
  308. value: "YSDE-000000-2018-86",
  309. },
  310. {
  311. name: "NormLibName",
  312. value: "部颁公路工程预算定额(2018)",
  313. },
  314. {
  315. name: "Type",
  316. value: "ZDEK",
  317. },
  318. ];
  319. Element.call(this, "NormLib", attrs);
  320. }
  321. this.children.push(new NormLib());
  322. }
  323. function Rate(tenderProject, feeRateInfo, seirNo) {
  324. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  325. const attrs = [{
  326. name: "RateNo",
  327. value: seirNo,
  328. },
  329. {
  330. name: "Name",
  331. value: feeRateInfo.name,
  332. },
  333. {
  334. name: "RateLibNo",
  335. value: feeLibNoMap[feeRateInfo.libID],
  336. },
  337. ];
  338. Element.call(this, "Rate", attrs);
  339. let RateParams = new emptyElement("RateParams");
  340. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  341. for (let s of subRates) {
  342. let sname = s.name.replace("(%)", "");
  343. sname = sname.replace("(%)", "");
  344. if (feeRateMap[sname]) {
  345. let value = "";
  346. if (s.editable) {
  347. let sel = _.find(s.optionList, {
  348. selected: true,
  349. });
  350. if (sel) {
  351. value = sel.name;
  352. } else if (gljUtil.isDef(s.value)) {
  353. value = s.value;
  354. }
  355. } else {
  356. value = _.findIndex(s.optionList, {
  357. selected: true,
  358. });
  359. if (value == -1) value = 0;
  360. }
  361. /* if (sname == '利润') tenderProject.ProfitRate = value;
  362. if (sname == '税金') tenderProject.TaxRate = value; */
  363. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  364. }
  365. }
  366. this.children.push(RateParams);
  367. function RateParam(RateTypeNo, RateParamNo) {
  368. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  369. const attrs = [{
  370. name: "RateTypeNo",
  371. value: RateTypeNo,
  372. },
  373. {
  374. name: "RateParamNo",
  375. value: RateParamNo,
  376. },
  377. {
  378. name: "Ratio",
  379. value: "100",
  380. },
  381. ];
  382. Element.call(this, "RateParam", attrs);
  383. }
  384. let RateValues = new emptyElement("RateValues");
  385. function RateValue(CostTypeNo, RateTypeNo, value) {
  386. const attrs = [{
  387. name: "CostTypeNo",
  388. value: CostTypeNo,
  389. },
  390. {
  391. name: "RateTypeNo",
  392. value: RateTypeNo,
  393. },
  394. {
  395. name: "RateValue",
  396. value: value,
  397. },
  398. ];
  399. Element.call(this, "RateValue", attrs);
  400. }
  401. let prefix = "";
  402. for (let r of feeRateInfo.rates) {
  403. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  404. if (feeRateMap[r.name] && r.ParentID) {
  405. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  406. }
  407. }
  408. this.children.push(RateValues);
  409. }
  410. function Pract(tpdata, seriNo) {
  411. let pgljData = tpdata.projectGLJ.datas;
  412. let decimalObj = tpdata.property.decimal;
  413. const attrs = [{
  414. name: "PractNo",
  415. value: seriNo,
  416. },
  417. {
  418. name: "Name",
  419. value: pgljData.constData.usedUnitPriceInfo.name,
  420. },
  421. ];
  422. Element.call(this, "Pract", attrs);
  423. let Param = {
  424. name: "Param",
  425. attrs: [{
  426. name: "TaxLibNo",
  427. value: "CCSBZ-440000-2019-544",
  428. },
  429. {
  430. name: "AuxRate",
  431. value: pgljData.constData.assistProductionFeeRate,
  432. },
  433. ],
  434. children: [],
  435. };
  436. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  437. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  438. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  439. for (let e of elecDatas) {
  440. let Electro = {
  441. name: "Electro",
  442. attrs: [{
  443. name: "Code",
  444. value: e.code,
  445. },
  446. {
  447. name: "Price",
  448. value: e.electPrice,
  449. },
  450. {
  451. name: "Ratio",
  452. value: e.coe,
  453. },
  454. ],
  455. children: [],
  456. };
  457. Param.children.push(Electro);
  458. }
  459. }
  460. this.children.push(Param);
  461. function Mp(g) {
  462. const attrs = [{
  463. name: "Code",
  464. value: g.code,
  465. },
  466. {
  467. name: "PractName",
  468. value: g.name,
  469. },
  470. {
  471. name: "Spec",
  472. value: g.specs,
  473. },
  474. {
  475. name: "Unit",
  476. value: g.unit,
  477. },
  478. {
  479. name: "BudgetPrice",
  480. value: g.priceInfo.tenderPrice,
  481. },
  482. {
  483. name: "NormPrice",
  484. value: g.priceInfo.basePrice,
  485. },
  486. {
  487. name: "IsAdd",
  488. value: g.unit_price.is_add,
  489. },
  490. ];
  491. Element.call(this, "Mp", attrs);
  492. }
  493. function Material(g) {
  494. const attrs = [{
  495. name: "Code",
  496. value: g.code,
  497. },
  498. {
  499. name: "PractName",
  500. value: g.name,
  501. },
  502. {
  503. name: "Spec",
  504. value: g.specs,
  505. },
  506. {
  507. name: "Unit",
  508. value: g.unit,
  509. },
  510. {
  511. name: "BudgetPrice",
  512. value: g.priceInfo.tenderPrice,
  513. },
  514. {
  515. name: "NormPrice",
  516. value: g.priceInfo.basePrice,
  517. },
  518. {
  519. name: "IsAdd",
  520. value: g.unit_price.is_add,
  521. },
  522. {
  523. name: "OrgPrice",
  524. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  525. },
  526. {
  527. name: "TransFee",
  528. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  529. },
  530. {
  531. name: "GwRate",
  532. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  533. },
  534. {
  535. name: "OffSiteLf",
  536. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  537. },
  538. {
  539. name: "OnSiteLf",
  540. value: 0,
  541. },
  542. {
  543. name: "LoadLf",
  544. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  545. },
  546. {
  547. name: "StoreRate",
  548. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  549. },
  550. {
  551. name: "PackageRecycleFee",
  552. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  553. },
  554. ];
  555. Element.call(this, "Material", attrs);
  556. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  557. // let index = gljUtil.getIndex(g);
  558. // let orList = [];
  559. // for (let o of pgljData.originalList) {
  560. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  561. // }
  562. // if (orList.length > 0) this.children = orList;
  563. // }
  564. function CostStructure(r) {
  565. //待获取
  566. this.name = "CostStructure";
  567. this.attrs = [];
  568. this.children = [];
  569. }
  570. function Consume(r, o) {
  571. this.name = "Consume";
  572. this.attrs = [];
  573. this.children = [];
  574. for (let g of o.ration_gljs) {
  575. if (g.rationID == r.ID) {
  576. let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  577. this.children.push(new ConsumeItem(g, r_quantity));
  578. }
  579. }
  580. }
  581. function ConsumeItem(g, ration_quantity) {
  582. const attrs = [{
  583. name: "Code", //待获取
  584. value: g.code,
  585. },
  586. {
  587. name: "Consumption",
  588. value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  589. },
  590. ];
  591. Element.call(this, "ConsumeItem", attrs);
  592. }
  593. function Norm(r, o) {
  594. const attrs = [{
  595. name: "NormLibNo", //待获取
  596. value: "",
  597. },
  598. {
  599. name: "DisplayCode",
  600. value: r.code,
  601. },
  602. {
  603. name: "Name",
  604. value: r.name,
  605. },
  606. {
  607. name: "Unit",
  608. value: r.unit,
  609. },
  610. {
  611. name: "Num",
  612. value: r.quantity,
  613. },
  614. {
  615. name: "CostTypeNo",
  616. value: "", //待获取
  617. },
  618. {
  619. name: "FabricationCost", //待获取
  620. value: "",
  621. },
  622. {
  623. name: "AdjustStatus",
  624. value: "",
  625. },
  626. ];
  627. Element.call(this, "Norm", attrs);
  628. this.children.push(new CostStructure(r));
  629. this.children.push(new Consume(r, o));
  630. }
  631. function SelfCollect(o) {
  632. const attrs = [{
  633. name: "OtherCost",
  634. value: 0,
  635. }, ];
  636. Element.call(this, "SelfCollect", attrs);
  637. for (let r of o.rations) {
  638. this.children.push(new Norm(r, o));
  639. }
  640. }
  641. function OrgPrices(o) {
  642. const attrs = [{
  643. name: "OrgPricevalue",
  644. value: o.supplyPrice,
  645. },
  646. {
  647. name: "Ratio",
  648. value: o.coe,
  649. },
  650. ];
  651. Element.call(this, "OrgPrices", attrs);
  652. if (!o.rations) return;
  653. this.children.push(new SelfCollect(o));
  654. }
  655. }
  656. function Mech(g,gljKeyMap) {
  657. const attrs = [{
  658. name: "Code",
  659. value: g.code,
  660. },
  661. {
  662. name: "PractName",
  663. value: g.name,
  664. },
  665. {
  666. name: "Spec",
  667. value: g.specs,
  668. },
  669. {
  670. name: "Unit",
  671. value: g.unit,
  672. },
  673. {
  674. name: "BudgetPrice",
  675. value: g.priceInfo.tenderPrice,
  676. },
  677. {
  678. name: "NormPrice",
  679. value: g.priceInfo.basePrice,
  680. },
  681. {
  682. name: "IsAdd",
  683. value: g.unit_price.is_add,
  684. },
  685. ];
  686. Element.call(this, "Mech", attrs);
  687. let FixedCostItems = [];
  688. let fcsum = 0;
  689. let VariableCostItems = [];
  690. let vcsum = 0;
  691. if (g.ratio_data && g.ratio_data.length > 0) {
  692. for (let ratio of g.ratio_data) {
  693. let rIndex = gljUtil.getIndex(ratio);
  694. let rglj = gljKeyMap[rIndex];
  695. let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
  696. if (FixedCostMap[ratio.name]) {
  697. FixedCostItems.push(new FixedCostItem(ratio));
  698. fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
  699. } else {
  700. VariableCostItems.push(new VariableCostItem(ratio));
  701. vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
  702. }
  703. }
  704. }
  705. if (FixedCostItems.length > 0) {
  706. let fc = new FixedCost(fcsum);
  707. fc.children = FixedCostItems;
  708. this.children.push(fc);
  709. }
  710. if (VariableCostItems.length > 0) {
  711. let vc = new VariableCost(vcsum);
  712. vc.children = VariableCostItems;
  713. this.children.push(vc);
  714. }
  715. function VariableCost(sum) {
  716. const attrs = [{
  717. name: "VariableCostSum",
  718. value: sum,
  719. }];
  720. Element.call(this, "VariableCost", attrs);
  721. }
  722. function VariableCostItem(item) {
  723. const attrs = [{
  724. name: "VariableCostNo",
  725. value: item.code,
  726. },{
  727. name: "Consumption",
  728. value: item.consumption,
  729. }]
  730. Element.call(this, "VariableCostItem", attrs);
  731. }
  732. function FixedCost(sum) {
  733. const attrs = [{
  734. name: "FixedCostSum",
  735. value: sum,
  736. }, {
  737. name: "FixedRate",
  738. value: 1,
  739. }];
  740. Element.call(this, "FixedCost", attrs);
  741. }
  742. function FixedCostItem(item) {
  743. const attrs = [{
  744. name: "FixedCostNo",
  745. value: ratioCodeMap[item.code],
  746. },{
  747. name: "Sum",
  748. value: item.consumption,
  749. }]
  750. Element.call(this, "FixedCostItem", attrs);
  751. }
  752. }
  753. let Mps = new emptyElement("Mps");
  754. let Materials = new emptyElement("Materials");
  755. let Mechs = new emptyElement("Mechs");
  756. let gljKeyMap = {};
  757. let temMechs = [];
  758. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  759. for (let g of pgljData.gljList) {
  760. let type = g.type + "";
  761. gljKeyMap[gljUtil.getIndex(g)] = g;
  762. type = type.charAt(0);
  763. if (type == "1") {
  764. Mps.children.push(new Mp(g));
  765. } else if (type == "2" || type == 5) {
  766. Materials.children.push(new Material(g));
  767. } else if (type == "3") {
  768. temMechs.push(g);
  769. }
  770. }
  771. for (let t of temMechs) {
  772. Mechs.children.push(new Mech(t,gljKeyMap));
  773. }
  774. }
  775. this.children.push(Mps);
  776. this.children.push(Materials);
  777. this.children.push(Mechs);
  778. }
  779. function EprjInfo(tenderProject) {
  780. let bills = tenderProject.Bills.datas;
  781. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  782. let totalItem = null;
  783. let proItem = null; //暂列金额项
  784. let safeItem = null;
  785. for (let b of bills) {
  786. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  787. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  788. if(b.code == "102-3" && b.name=="安全生产费") safeItem = b;
  789. }
  790. const attrs = [{
  791. name: "Name",
  792. value: tenderProject.projectInfo.name,
  793. },
  794. {
  795. name: "Sums",
  796. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  797. },
  798. ];
  799. //输出控制价、投标文件时,取调价后的标段总造价。
  800. //输出招标文件时,取0
  801. if (isBidInvitation) attrs[1].value = 0;
  802. Element.call(this, "EprjInfo", attrs);
  803. this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,feature));
  804. this.children.push(new MakeInfo(tenderProject));
  805. this.children.push(new Params(tenderProject));
  806. this.children.push(new getBillsItems(tenderProject));
  807. this.children.push(new getIndexs(tenderProject));
  808. let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
  809. if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
  810. }
  811. function getBidEvaluationMainMaterial(tenderProject) {
  812. let bidMaterials = [];
  813. let i = 1;
  814. for (let b of tenderProject.bidMaterialData) {
  815. bidMaterials.push(new BidEvaluationMainMaterial(b, i));
  816. i++
  817. }
  818. return bidMaterials;
  819. function BidEvaluationMainMaterial(b, index) {
  820. const attrs = [{
  821. name: "Code",
  822. value: index,
  823. },
  824. {
  825. name: "Number",
  826. value: b.code
  827. },
  828. {
  829. name: "Name",
  830. value: b.name
  831. },
  832. {
  833. name: "Specification",
  834. value: b.specs
  835. },
  836. {
  837. name: "Unit",
  838. value: b.unit
  839. },
  840. {
  841. name: "Price",
  842. value: b.tenderPrice
  843. },
  844. {
  845. name: "LimitedPrice",
  846. value: b.tenderPrice
  847. },
  848. {
  849. name: "Quantity",
  850. value: 0//b.quantity
  851. },
  852. {
  853. name: "Total",
  854. value: 0//b.totalPrice
  855. },
  856. {
  857. name: "Remark",
  858. value: b.remark
  859. }
  860. ];
  861. if (isBidSubmission || isControl) {
  862. attrs[7].value = b.quantity;
  863. attrs[8].value = b.totalPrice;
  864. }
  865. Element.call(this, "BidEvaluationMainMaterial", attrs);
  866. }
  867. }
  868. function getIndexs(tenderProject) {
  869. let Indexs = new emptyElement('Indexs');
  870. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  871. for (let f of feature) {
  872. if (f.code) Indexs.children.push(new IndexItem(f))
  873. }
  874. return Indexs;
  875. function IndexItem(fea) {
  876. const attrs = [{
  877. name: "Code",
  878. value: fea.code,
  879. },
  880. {
  881. name: "Name",
  882. value: fea.dispName,
  883. },
  884. {
  885. name: "Unit",
  886. value: fea.unit,
  887. },
  888. {
  889. name: "Value",
  890. value: fea.value,
  891. },
  892. {
  893. name: "Remark",
  894. value: fea.remark,
  895. }
  896. ]
  897. Element.call(this, "IndexItem", attrs);
  898. }
  899. }
  900. function getBillsItems(tenderProject) {
  901. let items = new emptyElement("Items");
  902. let rootNodes = tenderProject.mainTree.roots;
  903. for (let r of rootNodes) {
  904. setItem(r, -1, items.children);
  905. }
  906. return items;
  907. function setItem(bNode, level, list) {
  908. if (bNode.sourceType == ModuleNames.ration) return;
  909. let item = new bill(bNode, level);
  910. if (bNode.children && bNode.children.length > 0) {
  911. level += 1;
  912. for (let c of bNode.children) {
  913. setItem(c, level, item.children);
  914. }
  915. }
  916. list.push(item);
  917. function getCalcType(node) {
  918. /*
  919. 判断是否父项:
  920. 是父项,则取1;
  921. 是叶子项,则判断其下有无套定额/量价/工料机:
  922. 有则取1;
  923. 无则判断有无基数计算:
  924. 有则取2;
  925. 无则取3 */
  926. if (node.children && node.children.length > 0) {
  927. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  928. } else {
  929. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  930. }
  931. }
  932. function bill(bNode, level) {
  933. let data = bNode.data;
  934. let CostKind = 3;
  935. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  936. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  937. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  938. let CalcType = getCalcType(bNode);
  939. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  940. let ProvisionalType = "";
  941. if (data.specialProvisional == "材料") ProvisionalType = 0;
  942. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  943. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  944. //MpRatio
  945. let MpRatio = "";
  946. let MaterialRatio = "";
  947. let MechRatio = "";
  948. if (data.quantityCoe) {
  949. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  950. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  951. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  952. }
  953. let fail = billNameChecking(bNode,tenderProject.projectInfo.name,fixedFlag)
  954. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  955. const attrs = [{
  956. name: "ListCode",
  957. value: data.code,
  958. },
  959. {
  960. name: "ListName",
  961. value: data.name,
  962. fail:fail
  963. },
  964. {
  965. name: "Unit",
  966. value: data.unit,
  967. },
  968. {
  969. name: "Num",
  970. value: data.quantity,
  971. type:TYPE.DECIMAL
  972. },
  973. {
  974. name: "QtyFormula",
  975. value: data.calcBase //data.calcBase ? cbParser.toFExpr(data.calcBase, tenderProject.mainTree.items) : "",
  976. },
  977. {
  978. name: "Price",
  979. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  980. type:TYPE.DECIMAL
  981. },
  982. {
  983. name: "Rate",
  984. value: 100,
  985. },
  986. {
  987. name: "Sum",
  988. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  989. type:TYPE.DECIMAL
  990. },
  991. {
  992. name: "ChapterKind",
  993. value: level,
  994. },
  995. {
  996. name: "CostKind",
  997. value: CostKind,
  998. },
  999. {
  1000. name: "CalcType",
  1001. value: CalcType,
  1002. },
  1003. {
  1004. name: "ProvisionalType",
  1005. value: ProvisionalType,
  1006. mustHasValue:true
  1007. },
  1008. {
  1009. name: "MeterRules",
  1010. value: "",
  1011. },
  1012. {
  1013. name: "Content",
  1014. value: data.jobContentText,
  1015. },
  1016. {
  1017. name: "Remarks",
  1018. value: data.remark,
  1019. },
  1020. /* {
  1021. name: "MpRatio",
  1022. value: MpRatio,
  1023. },
  1024. {
  1025. name: "MaterialRatio",
  1026. value: MaterialRatio,
  1027. },
  1028. {
  1029. name: "MechRatio",
  1030. value: MechRatio,
  1031. },
  1032. {
  1033. name: "AdjustedPrice",
  1034. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1035. },
  1036. {
  1037. name: "AdjustedSums",
  1038. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1039. }, */
  1040. {
  1041. name: "ItemType",
  1042. value: 1,
  1043. },
  1044. /* {
  1045. name: "FomulaCode",
  1046. value: ""
  1047. }, */
  1048. ];
  1049. if (isBidSubmission || isControl) {
  1050. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1051. attrs[7].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1052. }
  1053. Element.call(this, "Item", attrs);
  1054. let cc = CostComposition(bNode);
  1055. if (cc) this.children.push(cc);
  1056. this.children.push(CostStructure(data))
  1057. function CostComposition(bNode) {
  1058. if (isBidInvitation) return null;
  1059. let CostComposition = new emptyElement('CostComposition');
  1060. let Norms = [];
  1061. let Costs = [];
  1062. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1063. for (let r of bNode.children) {
  1064. if (r.data.type == rationType.ration) {
  1065. Norms.push(new Ration(r.data));
  1066. } else {
  1067. Costs.push(new Cost(r.data));
  1068. }
  1069. }
  1070. }
  1071. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1072. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1073. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1074. return CostComposition.children.length > 0 ? CostComposition : null;
  1075. function Formula(bills) {
  1076. const attrs = [{
  1077. name: "Name",
  1078. value: bills.name
  1079. },
  1080. {
  1081. name: "Formulas",
  1082. value: bills.calcBase
  1083. },
  1084. {
  1085. name: "Ratio",
  1086. value: 1
  1087. },
  1088. {
  1089. name: "Sum",
  1090. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1091. type:TYPE.DECIMAL
  1092. },
  1093. {
  1094. name: "Remarks",
  1095. value: bills.remark
  1096. }
  1097. ]
  1098. Element.call(this, "Formula", attrs);
  1099. // 1.Name
  1100. // 名称/描述。取清单的名称。
  1101. // 2.Formulas
  1102. // 计算式。读取计算基数的文本。
  1103. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1104. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1105. // 3.Ratio
  1106. // 系数。输出为1,非必填。
  1107. // 4.Sum
  1108. // 取金额。
  1109. // 5.Remarks
  1110. }
  1111. function Cost(item) {
  1112. let BasePrice = 0;
  1113. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1114. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1115. } else {
  1116. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1117. }
  1118. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1119. let CostTypeNo = '';
  1120. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1121. const attrs = [{
  1122. name: "Code",
  1123. value: item.code,
  1124. }, {
  1125. name: 'Name',
  1126. value: item.name
  1127. }, {
  1128. name: 'Spec',
  1129. value: item.specs
  1130. }, {
  1131. name: 'Unit',
  1132. value: item.unit
  1133. }, {
  1134. name: 'Num',
  1135. value: item.tenderQuantity
  1136. }, {
  1137. name: 'BasePrice',
  1138. value: BasePrice
  1139. }, {
  1140. name: 'Price',
  1141. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1142. }, {
  1143. name: 'IsEquipment',
  1144. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1145. }, {
  1146. name: 'CostTypeNo',
  1147. value: CostTypeNo
  1148. }, {
  1149. name: 'ProfitRate',
  1150. value: getFeeRate(item.programID, 'profit', tenderProject)
  1151. },
  1152. {
  1153. name: 'TaxRate',
  1154. value: getFeeRate(item.programID, 'tax', tenderProject)
  1155. },
  1156. {
  1157. name: 'MpRatio',
  1158. value: item.subType == gljType.LABOUR ? 100 : 0
  1159. },
  1160. {
  1161. name: 'MaterialRatio',
  1162. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1163. },
  1164. {
  1165. name: 'MechRatio',
  1166. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1167. }
  1168. ]
  1169. Element.call(this, "Cost", attrs);
  1170. this.children.push(CostStructure(item));
  1171. }
  1172. function Ration(ration) {
  1173. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1174. let CostTypeNo = '';
  1175. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1176. const attrs = [{
  1177. name: "NormLibNo",
  1178. value: 'YSDE-000000-2018-86',
  1179. }, {
  1180. name: 'DisplayCode',
  1181. value: ration.code
  1182. }, {
  1183. name: 'Name',
  1184. value: ration.name
  1185. }, {
  1186. name: 'Unit',
  1187. value: ration.unit
  1188. }, {
  1189. name: 'Num',
  1190. value: ration.tenderQuantity
  1191. },
  1192. {
  1193. name: 'CostTypeNo',
  1194. value: CostTypeNo
  1195. },
  1196. {
  1197. name: 'ProfitRate',
  1198. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1199. },
  1200. {
  1201. name: 'TaxRate',
  1202. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1203. },
  1204. {
  1205. name: 'FabricationCost',
  1206. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1207. },
  1208. {
  1209. name: 'AdjustStatus',
  1210. value: ration.adjustState
  1211. }
  1212. ]
  1213. Element.call(this, "Norm", attrs);
  1214. this.children.push(CostStructure(ration));
  1215. this.children.push(Consume(ration));
  1216. }
  1217. }
  1218. function Consume(ration) {
  1219. let consume = new emptyElement('Consume');
  1220. for (let rg of ration.rationGLJList) {
  1221. consume.children.push(new ConsumeItem(rg));
  1222. }
  1223. return consume;
  1224. function ConsumeItem(rg) {
  1225. const attrs = [{
  1226. name: "Code",
  1227. value: rg.code,
  1228. }, {
  1229. name: "Consumption",
  1230. value: rg.tenderQuantity
  1231. }];
  1232. Element.call(this, "ConsumeItem", attrs);
  1233. }
  1234. }
  1235. function CostStructure(item) {
  1236. let CostStructure = new emptyElement('CostStructure');
  1237. for (let f of cpFeeTypes) {
  1238. if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
  1239. }
  1240. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
  1241. function CostItem(item,type) {
  1242. const attrs = [{
  1243. name: "ItemNo",
  1244. value: itemFeeMap[type],
  1245. }, {
  1246. name: 'Sum',
  1247. value: 0 //fee.tenderTotalFee
  1248. }]
  1249. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1250. Element.call(this, "CostItem", attrs);
  1251. }
  1252. return CostStructure;
  1253. }
  1254. }
  1255. }
  1256. }
  1257. function Params(tenderProject) {
  1258. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1259. let featrueMap = {};
  1260. let baseMap = {};
  1261. for (let f of feature) {
  1262. featrueMap[f.key] = f;
  1263. }
  1264. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1265. dispName: "基本信息",
  1266. });
  1267. for (let i of baseInfo.items) {
  1268. let key = i.key;
  1269. //if (i.dispName == "编制日期") key = "编制时间";
  1270. baseMap[key] = i;
  1271. }
  1272. let BuildType = "";
  1273. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1274. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1275. let Terrain = "";
  1276. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1277. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1278. let DesignSpeed = featrueMap["designSpeed"].value;
  1279. let Structure = "";
  1280. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1281. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1282. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1283. let RoadGrade = "";
  1284. if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1285. const attrs = [{
  1286. name: "PrjArea",
  1287. value: baseMap["location"] ? baseMap["location"].value : ""
  1288. },
  1289. {
  1290. name: "StartPileNo",
  1291. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1292. mustHasValue: true
  1293. },
  1294. {
  1295. name: "EndPileNo",
  1296. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1297. mustHasValue: true
  1298. },
  1299. {
  1300. name: "BuildType",
  1301. value: BuildType,
  1302. },
  1303. {
  1304. name: "Terrain",
  1305. value: Terrain,
  1306. mustHasValue: true
  1307. },
  1308. {
  1309. name: "RoadGrade",
  1310. value: RoadGrade,
  1311. mustHasValue: true
  1312. },
  1313. {
  1314. name: "DesignSpeed",
  1315. value: DesignSpeed,
  1316. mustHasValue: true
  1317. },
  1318. {
  1319. name: "Structure",
  1320. value: Structure,
  1321. mustHasValue: true
  1322. },
  1323. {
  1324. name: "SubgradeWidth",
  1325. value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
  1326. mustHasValue: true
  1327. },
  1328. {
  1329. name: "RoadLength",
  1330. value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
  1331. mustHasValue: true
  1332. },
  1333. {
  1334. name: "BridgeLength",
  1335. value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
  1336. mustHasValue: true
  1337. },
  1338. {
  1339. name: "TunnelLength",
  1340. value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
  1341. mustHasValue: true
  1342. },
  1343. {
  1344. name: "BriTunRate",
  1345. value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
  1346. mustHasValue: true
  1347. },
  1348. {
  1349. name: "InterchangeNum",
  1350. value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
  1351. mustHasValue: true
  1352. },
  1353. {
  1354. name: "StubLengths",
  1355. value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
  1356. mustHasValue: true
  1357. },
  1358. {
  1359. name: "LaneLength",
  1360. value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
  1361. mustHasValue: true
  1362. },
  1363. ];
  1364. Element.call(this, "Params", attrs);
  1365. }
  1366. function SummaryOfCost(totalItem, proItem,safeItem,feature) {
  1367. let attrs = [{
  1368. name: "TenderSumLimit",
  1369. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1370. },
  1371. {
  1372. name: "BidTotal",
  1373. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1374. },
  1375. {
  1376. name: "BillTotal",
  1377. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1378. },
  1379. {
  1380. name: "CostForHSE",
  1381. value: safeItem&&safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1382. },
  1383. {
  1384. name: "ProvisionalSums",
  1385. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1386. },
  1387. {
  1388. name: "Appraisal",
  1389. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1390. },
  1391. ];
  1392. if (isBidInvitation) {
  1393. attrs.splice(0, 3) //招标
  1394. }
  1395. //if (isControl) attrs.splice(1, 5); //控制价
  1396. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1397. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1398. if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1399. }
  1400. Element.call(this, "SummaryOfCost", attrs);
  1401. }
  1402. function MakeInfo(tenderProject) {
  1403. let property = tenderProject.property;
  1404. let baseMap = {};
  1405. let baseInfo = _.find(property.basicInformation, {
  1406. dispName: "基本信息",
  1407. });
  1408. for (let i of baseInfo.items) {
  1409. let key = i.key;
  1410. //if (i.dispName == "编制日期") key = "编制时间";
  1411. baseMap[key] = i;
  1412. }
  1413. //mustHasValue
  1414. const attrs = [{
  1415. name: "ValuationModel",
  1416. value: property.taxType,
  1417. },
  1418. {
  1419. name: "Manage",
  1420. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1421. },
  1422. {
  1423. name: "Designer",
  1424. value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
  1425. mustHasValue:true
  1426. },
  1427. {
  1428. name: "Compile",
  1429. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1430. },
  1431. {
  1432. name: "CompileApprover",
  1433. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1434. },
  1435. {
  1436. name: "CompileCertNo",
  1437. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
  1438. mustHasValue:true
  1439. },
  1440. {
  1441. name: "CompileDate",
  1442. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : "",
  1443. mustHasValue:true
  1444. },
  1445. {
  1446. name: "Review",
  1447. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
  1448. mustHasValue:true
  1449. },
  1450. {
  1451. name: "ReviewApprover",
  1452. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
  1453. mustHasValue:true
  1454. },
  1455. {
  1456. name: "ReviewCertNo",
  1457. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
  1458. mustHasValue:true
  1459. },
  1460. {
  1461. name: "ReviewDate",
  1462. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : "",
  1463. mustHasValue:true
  1464. },
  1465. {
  1466. name: "Examine",
  1467. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1468. mustHasValue:true
  1469. },
  1470. {
  1471. name: "ExamineApprover",
  1472. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1473. mustHasValue:true
  1474. },
  1475. {
  1476. name: "ExamineCertNo",
  1477. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1478. mustHasValue:true
  1479. },
  1480. {
  1481. name: "ExamineDate",
  1482. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1483. mustHasValue:true
  1484. },
  1485. {
  1486. name: "CompileExplain",
  1487. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1488. mustHasValue:true
  1489. },
  1490. {
  1491. name: "ExamineExplain",
  1492. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1493. mustHasValue:true
  1494. },
  1495. {
  1496. name: "ProjectExplain",
  1497. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  1498. mustHasValue:true
  1499. },
  1500. ];
  1501. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  1502. attrs.splice(11, 7);
  1503. attrs.splice(7, 1);
  1504. }
  1505. Element.call(this, "MakeInfo", attrs);
  1506. }
  1507. let data = new CprjInfo(projectData.name);
  1508. data.children.push(new SystemInfo(projectData));
  1509. data.children.push(new CostBasis());
  1510. let seriNo = 1;
  1511. let Rates = [];
  1512. let Practs = [];
  1513. let EprjInfos = [];
  1514. for (let c of projectData.children) {
  1515. let tenderProject = tenderDetailMap[c.ID];
  1516. let feeRataDatas = tenderProject.FeeRate.datas;
  1517. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1518. Practs.push(new Pract(tenderProject, seriNo));
  1519. EprjInfos.push(new EprjInfo(tenderProject));
  1520. seriNo++;
  1521. }
  1522. data.children.push(...Rates,...Practs,...EprjInfos);
  1523. return [{
  1524. data: data,
  1525. exportKind: exportKind,
  1526. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1527. }, ];
  1528. }
  1529. return {
  1530. entry,
  1531. };
  1532. })();