guangdong_zhongshan.js 52 KB

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