guangdong_zhongshan.js 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627
  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. type: TYPE.DECIMAL
  844. },
  845. {
  846. name: "LimitedPrice",
  847. value: b.tenderPrice,
  848. type: TYPE.DECIMAL
  849. },
  850. {
  851. name: "Quantity",
  852. value: 0//b.quantity
  853. },
  854. {
  855. name: "Total",
  856. value: 0//b.totalPrice
  857. },
  858. {
  859. name: "Remark",
  860. value: b.remark
  861. }
  862. ];
  863. if (isBidSubmission || isControl) {
  864. attrs[7].value = b.quantity;
  865. attrs[8].value = b.totalPrice;
  866. }
  867. Element.call(this, "BidEvaluationMainMaterial", attrs);
  868. }
  869. }
  870. function getIndexs(tenderProject) {
  871. let Indexs = new emptyElement('Indexs');
  872. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  873. for (let f of feature) {
  874. if (f.code) Indexs.children.push(new IndexItem(f))
  875. }
  876. return Indexs;
  877. function IndexItem(fea) {
  878. const attrs = [{
  879. name: "Code",
  880. value: fea.code,
  881. },
  882. {
  883. name: "Name",
  884. value: fea.dispName,
  885. },
  886. {
  887. name: "Unit",
  888. value: fea.unit,
  889. },
  890. {
  891. name: "Value",
  892. value: fea.value,
  893. },
  894. {
  895. name: "Remark",
  896. value: fea.remark,
  897. }
  898. ]
  899. Element.call(this, "IndexItem", attrs);
  900. }
  901. }
  902. function getBillsItems(tenderProject) {
  903. let items = new emptyElement("Items");
  904. let rootNodes = tenderProject.mainTree.roots;
  905. for (let r of rootNodes) {
  906. setItem(r, -1, items.children);
  907. }
  908. return items;
  909. function setItem(bNode, level, list) {
  910. if (bNode.sourceType == ModuleNames.ration) return;
  911. let item = new bill(bNode, level);
  912. if (bNode.children && bNode.children.length > 0) {
  913. level += 1;
  914. for (let c of bNode.children) {
  915. setItem(c, level, item.children);
  916. }
  917. }
  918. list.push(item);
  919. function getCalcType(node) {
  920. /*
  921. 判断是否父项:
  922. 是父项,则取1;
  923. 是叶子项,则判断其下有无套定额/量价/工料机:
  924. 有则取1;
  925. 无则判断有无基数计算:
  926. 有则取2;
  927. 无则取3 */
  928. if (node.children && node.children.length > 0) {
  929. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  930. } else {
  931. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  932. }
  933. }
  934. function bill(bNode, level) {
  935. let data = bNode.data;
  936. let CostKind = 3;
  937. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  938. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  939. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  940. let CalcType = getCalcType(bNode);
  941. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  942. let ProvisionalType = "";
  943. if (data.specialProvisional == "材料") ProvisionalType = 0;
  944. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  945. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  946. //MpRatio
  947. let MpRatio = "";
  948. let MaterialRatio = "";
  949. let MechRatio = "";
  950. if (data.quantityCoe) {
  951. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  952. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  953. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  954. }
  955. let fail = billNameChecking(bNode,tenderProject.projectInfo.name,fixedFlag)
  956. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  957. const attrs = [{
  958. name: "ListCode",
  959. value: data.code,
  960. },
  961. {
  962. name: "ListName",
  963. value: data.name,
  964. fail:fail
  965. },
  966. {
  967. name: "Unit",
  968. value: data.unit,
  969. },
  970. {
  971. name: "Num",
  972. value: data.quantity,
  973. type: TYPE.DECIMAL,
  974. toFix:3
  975. },
  976. {
  977. name: "QtyFormula",
  978. value: data.calcBase //data.calcBase ? cbParser.toFExpr(data.calcBase, tenderProject.mainTree.items) : "",
  979. },
  980. {
  981. name: "Price",
  982. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  983. type: TYPE.DECIMAL,
  984. toFix:2
  985. },
  986. {
  987. name: "Rate",
  988. value: 100,
  989. },
  990. {
  991. name: "Sum",
  992. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  993. type: TYPE.DECIMAL,
  994. toFix:2
  995. },
  996. {
  997. name: "ChapterKind",
  998. value: level,
  999. },
  1000. {
  1001. name: "CostKind",
  1002. value: CostKind,
  1003. },
  1004. {
  1005. name: "CalcType",
  1006. value: CalcType,
  1007. },
  1008. {
  1009. name: "ProvisionalType",
  1010. value: ProvisionalType,
  1011. mustHasValue:true
  1012. },
  1013. {
  1014. name: "MeterRules",
  1015. value: "",
  1016. },
  1017. {
  1018. name: "Content",
  1019. value: data.jobContentText,
  1020. },
  1021. {
  1022. name: "Remarks",
  1023. value: data.remark,
  1024. },
  1025. /* {
  1026. name: "MpRatio",
  1027. value: MpRatio,
  1028. },
  1029. {
  1030. name: "MaterialRatio",
  1031. value: MaterialRatio,
  1032. },
  1033. {
  1034. name: "MechRatio",
  1035. value: MechRatio,
  1036. },
  1037. {
  1038. name: "AdjustedPrice",
  1039. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1040. },
  1041. {
  1042. name: "AdjustedSums",
  1043. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1044. }, */
  1045. {
  1046. name: "ItemType",
  1047. value: 1,
  1048. },
  1049. /* {
  1050. name: "FomulaCode",
  1051. value: ""
  1052. }, */
  1053. ];
  1054. if (isBidSubmission || isControl) {
  1055. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1056. attrs[7].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1057. }
  1058. Element.call(this, "Item", attrs);
  1059. let cc = CostComposition(bNode);
  1060. if (cc) this.children.push(cc);
  1061. this.children.push(CostStructure(data))
  1062. function CostComposition(bNode) {
  1063. if (isBidInvitation) return null;
  1064. let CostComposition = new emptyElement('CostComposition');
  1065. let Norms = [];
  1066. let Costs = [];
  1067. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1068. for (let r of bNode.children) {
  1069. if (r.data.type == rationType.ration) {
  1070. Norms.push(new Ration(r.data));
  1071. } else {
  1072. Costs.push(new Cost(r.data));
  1073. }
  1074. }
  1075. }
  1076. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1077. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1078. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1079. return CostComposition.children.length > 0 ? CostComposition : null;
  1080. function Formula(bills) {
  1081. const attrs = [{
  1082. name: "Name",
  1083. value: bills.name
  1084. },
  1085. {
  1086. name: "Formulas",
  1087. value: bills.calcBase
  1088. },
  1089. {
  1090. name: "Ratio",
  1091. value: 1
  1092. },
  1093. {
  1094. name: "Sum",
  1095. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1096. type:TYPE.DECIMAL
  1097. },
  1098. {
  1099. name: "Remarks",
  1100. value: bills.remark
  1101. }
  1102. ]
  1103. Element.call(this, "Formula", attrs);
  1104. // 1.Name
  1105. // 名称/描述。取清单的名称。
  1106. // 2.Formulas
  1107. // 计算式。读取计算基数的文本。
  1108. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1109. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1110. // 3.Ratio
  1111. // 系数。输出为1,非必填。
  1112. // 4.Sum
  1113. // 取金额。
  1114. // 5.Remarks
  1115. }
  1116. function Cost(item) {
  1117. let BasePrice = 0;
  1118. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1119. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1120. } else {
  1121. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1122. }
  1123. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1124. let CostTypeNo = '';
  1125. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1126. const attrs = [{
  1127. name: "Code",
  1128. value: item.code,
  1129. }, {
  1130. name: 'Name',
  1131. value: item.name
  1132. }, {
  1133. name: 'Spec',
  1134. value: item.specs
  1135. }, {
  1136. name: 'Unit',
  1137. value: item.unit
  1138. }, {
  1139. name: 'Num',
  1140. value: item.tenderQuantity
  1141. }, {
  1142. name: 'BasePrice',
  1143. value: BasePrice
  1144. }, {
  1145. name: 'Price',
  1146. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1147. }, {
  1148. name: 'IsEquipment',
  1149. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1150. }, {
  1151. name: 'CostTypeNo',
  1152. value: CostTypeNo
  1153. }, {
  1154. name: 'ProfitRate',
  1155. value: getFeeRate(item.programID, 'profit', tenderProject)
  1156. },
  1157. {
  1158. name: 'TaxRate',
  1159. value: getFeeRate(item.programID, 'tax', tenderProject)
  1160. },
  1161. {
  1162. name: 'MpRatio',
  1163. value: item.subType == gljType.LABOUR ? 100 : 0
  1164. },
  1165. {
  1166. name: 'MaterialRatio',
  1167. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1168. },
  1169. {
  1170. name: 'MechRatio',
  1171. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1172. }
  1173. ]
  1174. Element.call(this, "Cost", attrs);
  1175. this.children.push(CostStructure(item));
  1176. }
  1177. function Ration(ration) {
  1178. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1179. let CostTypeNo = '';
  1180. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1181. const attrs = [{
  1182. name: "NormLibNo",
  1183. value: 'YSDE-000000-2018-86',
  1184. }, {
  1185. name: 'DisplayCode',
  1186. value: ration.code
  1187. }, {
  1188. name: 'Name',
  1189. value: ration.name
  1190. }, {
  1191. name: 'Unit',
  1192. value: ration.unit
  1193. }, {
  1194. name: 'Num',
  1195. value: ration.tenderQuantity
  1196. },
  1197. {
  1198. name: 'CostTypeNo',
  1199. value: CostTypeNo
  1200. },
  1201. {
  1202. name: 'ProfitRate',
  1203. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1204. },
  1205. {
  1206. name: 'TaxRate',
  1207. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1208. },
  1209. {
  1210. name: 'FabricationCost',
  1211. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1212. },
  1213. {
  1214. name: 'AdjustStatus',
  1215. value: ration.adjustState
  1216. }
  1217. ]
  1218. Element.call(this, "Norm", attrs);
  1219. this.children.push(CostStructure(ration));
  1220. this.children.push(Consume(ration));
  1221. }
  1222. }
  1223. function Consume(ration) {
  1224. let consume = new emptyElement('Consume');
  1225. for (let rg of ration.rationGLJList) {
  1226. consume.children.push(new ConsumeItem(rg));
  1227. }
  1228. return consume;
  1229. function ConsumeItem(rg) {
  1230. const attrs = [{
  1231. name: "Code",
  1232. value: rg.code,
  1233. }, {
  1234. name: "Consumption",
  1235. value: rg.tenderQuantity
  1236. }];
  1237. Element.call(this, "ConsumeItem", attrs);
  1238. }
  1239. }
  1240. function CostStructure(item) {
  1241. let CostStructure = new emptyElement('CostStructure');
  1242. for (let f of cpFeeTypes) {
  1243. if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
  1244. }
  1245. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
  1246. function CostItem(item,type) {
  1247. const attrs = [{
  1248. name: "ItemNo",
  1249. value: itemFeeMap[type],
  1250. }, {
  1251. name: 'Sum',
  1252. value: 0 //fee.tenderTotalFee
  1253. }]
  1254. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1255. Element.call(this, "CostItem", attrs);
  1256. }
  1257. return CostStructure;
  1258. }
  1259. }
  1260. }
  1261. }
  1262. function Params(tenderProject) {
  1263. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1264. let featrueMap = {};
  1265. let baseMap = {};
  1266. for (let f of feature) {
  1267. featrueMap[f.key] = f;
  1268. }
  1269. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1270. dispName: "基本信息",
  1271. });
  1272. for (let i of baseInfo.items) {
  1273. let key = i.key;
  1274. //if (i.dispName == "编制日期") key = "编制时间";
  1275. baseMap[key] = i;
  1276. }
  1277. let BuildType = "";
  1278. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1279. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1280. let Terrain = "";
  1281. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1282. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1283. let DesignSpeed = featrueMap["designSpeed"].value;
  1284. let Structure = "";
  1285. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1286. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1287. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1288. let RoadGrade = "";
  1289. if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1290. const attrs = [{
  1291. name: "PrjArea",
  1292. value: baseMap["location"] ? baseMap["location"].value : ""
  1293. },
  1294. {
  1295. name: "StartPileNo",
  1296. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1297. mustHasValue: true
  1298. },
  1299. {
  1300. name: "EndPileNo",
  1301. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1302. mustHasValue: true
  1303. },
  1304. {
  1305. name: "BuildType",
  1306. value: BuildType,
  1307. },
  1308. {
  1309. name: "Terrain",
  1310. value: Terrain,
  1311. mustHasValue: true
  1312. },
  1313. {
  1314. name: "RoadGrade",
  1315. value: RoadGrade,
  1316. mustHasValue: true
  1317. },
  1318. {
  1319. name: "DesignSpeed",
  1320. value: DesignSpeed,
  1321. mustHasValue: true
  1322. },
  1323. {
  1324. name: "Structure",
  1325. value: Structure,
  1326. mustHasValue: true
  1327. },
  1328. {
  1329. name: "SubgradeWidth",
  1330. value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
  1331. mustHasValue: true
  1332. },
  1333. {
  1334. name: "RoadLength",
  1335. value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
  1336. mustHasValue: true
  1337. },
  1338. {
  1339. name: "BridgeLength",
  1340. value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
  1341. mustHasValue: true
  1342. },
  1343. {
  1344. name: "TunnelLength",
  1345. value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
  1346. mustHasValue: true
  1347. },
  1348. {
  1349. name: "BriTunRate",
  1350. value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
  1351. mustHasValue: true
  1352. },
  1353. {
  1354. name: "InterchangeNum",
  1355. value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
  1356. mustHasValue: true
  1357. },
  1358. {
  1359. name: "StubLengths",
  1360. value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
  1361. mustHasValue: true
  1362. },
  1363. {
  1364. name: "LaneLength",
  1365. value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
  1366. mustHasValue: true
  1367. },
  1368. ];
  1369. Element.call(this, "Params", attrs);
  1370. }
  1371. function SummaryOfCost(totalItem, proItem,safeItem,feature) {
  1372. let attrs = [{
  1373. name: "TenderSumLimit",
  1374. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1375. },
  1376. {
  1377. name: "BidTotal",
  1378. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1379. },
  1380. {
  1381. name: "BillTotal",
  1382. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1383. },
  1384. {
  1385. name: "CostForHSE",
  1386. value: safeItem&&safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1387. },
  1388. {
  1389. name: "ProvisionalSums",
  1390. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1391. },
  1392. {
  1393. name: "Appraisal",
  1394. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1395. },
  1396. ];
  1397. if (isBidInvitation) {
  1398. attrs.splice(0, 3) //招标
  1399. }
  1400. //if (isControl) attrs.splice(1, 5); //控制价
  1401. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1402. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1403. if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1404. }
  1405. Element.call(this, "SummaryOfCost", attrs);
  1406. }
  1407. function MakeInfo(tenderProject) {
  1408. let property = tenderProject.property;
  1409. let baseMap = {};
  1410. let baseInfo = _.find(property.basicInformation, {
  1411. dispName: "基本信息",
  1412. });
  1413. for (let i of baseInfo.items) {
  1414. let key = i.key;
  1415. //if (i.dispName == "编制日期") key = "编制时间";
  1416. baseMap[key] = i;
  1417. }
  1418. //mustHasValue
  1419. const attrs = [{
  1420. name: "ValuationModel",
  1421. value: property.taxType,
  1422. },
  1423. {
  1424. name: "Manage",
  1425. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1426. },
  1427. {
  1428. name: "Designer",
  1429. value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
  1430. mustHasValue:true
  1431. },
  1432. {
  1433. name: "Compile",
  1434. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1435. },
  1436. {
  1437. name: "CompileApprover",
  1438. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1439. },
  1440. {
  1441. name: "CompileCertNo",
  1442. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
  1443. mustHasValue:true
  1444. },
  1445. {
  1446. name: "CompileDate",
  1447. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : "",
  1448. mustHasValue:true
  1449. },
  1450. {
  1451. name: "Review",
  1452. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
  1453. mustHasValue:true
  1454. },
  1455. {
  1456. name: "ReviewApprover",
  1457. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
  1458. mustHasValue:true
  1459. },
  1460. {
  1461. name: "ReviewCertNo",
  1462. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
  1463. mustHasValue:true
  1464. },
  1465. {
  1466. name: "ReviewDate",
  1467. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : "",
  1468. mustHasValue:true
  1469. },
  1470. {
  1471. name: "Examine",
  1472. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1473. mustHasValue:true
  1474. },
  1475. {
  1476. name: "ExamineApprover",
  1477. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1478. mustHasValue:true
  1479. },
  1480. {
  1481. name: "ExamineCertNo",
  1482. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1483. mustHasValue:true
  1484. },
  1485. {
  1486. name: "ExamineDate",
  1487. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1488. mustHasValue:true
  1489. },
  1490. {
  1491. name: "CompileExplain",
  1492. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1493. mustHasValue:true
  1494. },
  1495. {
  1496. name: "ExamineExplain",
  1497. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1498. mustHasValue:true
  1499. },
  1500. {
  1501. name: "ProjectExplain",
  1502. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  1503. mustHasValue:true
  1504. },
  1505. ];
  1506. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  1507. attrs.splice(11, 7);
  1508. attrs.splice(7, 1);
  1509. }
  1510. Element.call(this, "MakeInfo", attrs);
  1511. }
  1512. let data = new CprjInfo(projectData.name);
  1513. data.children.push(new SystemInfo(projectData));
  1514. data.children.push(new CostBasis());
  1515. let seriNo = 1;
  1516. let Rates = [];
  1517. let Practs = [];
  1518. let EprjInfos = [];
  1519. for (let c of projectData.children) {
  1520. let tenderProject = tenderDetailMap[c.ID];
  1521. let feeRataDatas = tenderProject.FeeRate.datas;
  1522. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1523. Practs.push(new Pract(tenderProject, seriNo));
  1524. EprjInfos.push(new EprjInfo(tenderProject));
  1525. seriNo++;
  1526. }
  1527. data.children.push(...Rates,...Practs,...EprjInfos);
  1528. return [{
  1529. data: data,
  1530. exportKind: exportKind,
  1531. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1532. }, ];
  1533. }
  1534. return {
  1535. entry,
  1536. };
  1537. })();