guangdong_zhongshan.js 52 KB

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