guangdong_zhongshan.js 52 KB

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