guangdong_zhongshan.js 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  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. 工地转移: "GDZYFFL",
  21. 施工辅助费: "SGFZFFL",
  22. 施工辅助: "SGFZFFL",
  23. 基本费用: "JBFYFL",
  24. 主副食运费补贴: "ZFSYFBTFL",
  25. 职工探亲路费: "ZGTQLFFL",
  26. 职工探亲: "ZGTQLFFL",
  27. 职工取暖补贴: "ZGQNBTFL",
  28. 职工取暖: "ZGQNBTFL",
  29. 财务费用: "CWFYFL",
  30. 养老保险费: "YANGLBXFFL",
  31. 失业保险费: "SYBXFFL",
  32. 医疗保险费: "YILBXFFL",
  33. 工伤保险费: "GSBXFL",
  34. 养老保险: "YANGLBXFFL",
  35. 失业保险: "SYBXFFL",
  36. 医疗保险: "YILBXFFL",
  37. 工伤保险: "GSBXFL",
  38. 住房公积金: "ZFGJJFL",
  39. 规费: "GFZHFL",
  40. 利润: "LRL",
  41. 税金: "SL",
  42. 土方: "TF",
  43. 石方: "SF",
  44. 运输: "YS",
  45. 路面: "LM",
  46. "路面(不计雨)": "LM",
  47. 隧道: "SD",
  48. 构造物I: "GZW1",
  49. "构造物I(不计冬)": "GZW1",
  50. "构造物I(不计雨)": "GZW1",
  51. 构造物II: "GZW2",
  52. "构造物III(桥梁)": "GZW3",
  53. "构造物III(除桥以外)": "GZW3",
  54. "构造物III(除桥以外不计雨夜)": "GZW3",
  55. 技术复杂大桥: "JSFZDQ",
  56. "钢材及钢结构(桥梁)": "GJG",
  57. "钢材及钢结构(除桥以外)": "GJG",
  58. "钢材及钢结构(除桥以外不计夜)": "GJG",
  59. };
  60. //计算程序有,这里没有:施工机械使用费\施工机械人工费\定额人工费\定额材料费\定额施工机械使用费
  61. const itemFeeMap = {
  62. 'marketLabour': 'RGF',
  63. 'marketMaterial': 'CLF',
  64. 'marketEquipment': 'SBGZF',
  65. 'direct': 'DEZJF',
  66. 'equipment': 'DESBF',
  67. 'marketDirect': 'ZJF',
  68. 'measure': 'CSF',
  69. 'manage': 'QYGLF',
  70. 'force': 'GF',
  71. 'profit': 'LR',
  72. 'tax': 'SJ',
  73. 'common': 'JAF',
  74. 'rationCommon': 'DEJAF'
  75. };
  76. /**
  77. *
  78. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  79. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  80. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  81. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  82. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  83. */
  84. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  85. const {
  86. UTIL,
  87. Element
  88. } = INTERFACE_EXPORT_BASE;
  89. const {
  90. EXPORT_KIND: {
  91. BID_INVITATION,
  92. BID_SUBMISSION,
  93. CONTROL
  94. },
  95. fixedFlag,
  96. } = window.commonConstants;
  97. let cprjType = {
  98. 1: "ZBKZJ", // 招标
  99. 2: "TBBJ", // 投标
  100. 3: "GCLQD", // 控制价
  101. };
  102. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  103. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  104. const isControl = exportKind === CONTROL; // 是否是控制价
  105. function emptyElement(name) {
  106. this.name = name;
  107. this.attrs = [];
  108. this.children = [];
  109. }
  110. // 建设项目根节点信息
  111. function CprjInfo(projectName) {
  112. const attrs = [{
  113. name: "CprjName",
  114. value: projectName,
  115. },
  116. {
  117. name: "CprjType",
  118. value: cprjType[exportKind],
  119. },
  120. ];
  121. Element.call(this, "CprjInfo", attrs);
  122. }
  123. // 项目基本信息
  124. function SystemInfo(projectData) {
  125. let hardID = UTIL.generateHardwareId();
  126. let [cpuId, diskId, macId] = hardID.split(";");
  127. const attrs = [{
  128. name: "Name",
  129. value: "公路工程造价数据标准",
  130. },
  131. {
  132. name: "Version",
  133. value: "1.0",
  134. },
  135. {
  136. name: "SoftwareName",
  137. value: "纵横公路云造价",
  138. },
  139. {
  140. name: "SoftwareVer",
  141. value: "V" + VERSION,
  142. },
  143. {
  144. name: "SoftwareCompany",
  145. value: "珠海纵横创新软件有限公司",
  146. },
  147. {
  148. name: "MakeDate",
  149. value: UTIL.getNowFormatTime(),
  150. },
  151. {
  152. name: "Key1",
  153. value: window.btoa(VERSION),
  154. },
  155. {
  156. name: "Key2",
  157. value: window.btoa(diskId),
  158. },
  159. {
  160. name: "Key3",
  161. value: window.btoa(macId),
  162. },
  163. ];
  164. if (isBidSubmission)
  165. attrs.splice(6, 0, {
  166. name: "BidderVer",
  167. value: UTIL.getNowFormatTime(),
  168. });
  169. Element.call(this, "SystemInfo", attrs);
  170. }
  171. //造价依据
  172. function CostBasis() {
  173. // ItemStandardNo="GYSFX-000000-2018-86"
  174. const attrs = [{
  175. name: "MakeRuleNo",
  176. value: "GYSBB-000000-2018-86",
  177. },
  178. {
  179. name: "MakeRuleName",
  180. value: "公路工程建设项目概算预算编制办法",
  181. },
  182. {
  183. name: "ItemStandardNo",
  184. value: "GYSFX-000000-2018-86",
  185. },
  186. ];
  187. Element.call(this, "CostBasis", attrs);
  188. //定额库信息
  189. //to do 改成实际的值
  190. function NormLib() {
  191. const attrs = [{
  192. name: "NormLibNo",
  193. value: "0",
  194. },
  195. {
  196. name: "NormLibName",
  197. value: "部颁公路工程预算定额(2018)",
  198. },
  199. {
  200. name: "Type",
  201. value: "ZDEK",
  202. },
  203. ];
  204. Element.call(this, "NormLib", attrs);
  205. }
  206. this.children.push(new NormLib());
  207. }
  208. function Rate(tenderProject, feeRateInfo, seirNo) {
  209. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  210. const attrs = [{
  211. name: "RateNo",
  212. value: seirNo,
  213. },
  214. {
  215. name: "Name",
  216. value: feeRateInfo.name,
  217. },
  218. {
  219. name: "RateLibNo",
  220. value: feeRateInfo.libID,
  221. },
  222. ];
  223. Element.call(this, "Rate", attrs);
  224. let RateParams = new emptyElement("RateParams");
  225. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  226. for (let s of subRates) {
  227. let sname = s.name.replace("(%)", "");
  228. sname = sname.replace("(%)", "");
  229. if (feeRateMap[sname]) {
  230. let value = "";
  231. if (s.editable) {
  232. let sel = _.find(s.optionList, {
  233. selected: true,
  234. });
  235. if (sel) {
  236. value = sel.name;
  237. } else if (gljUtil.isDef(s.value)) {
  238. value = s.value;
  239. }
  240. } else {
  241. value = _.findIndex(s.optionList, {
  242. selected: true,
  243. });
  244. if (value == -1) value = 0;
  245. }
  246. if (sname == '利润') tenderProject.ProfitRate = value;
  247. if (sname == '税金') tenderProject.TaxRate = value;
  248. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  249. }
  250. }
  251. this.children.push(RateParams);
  252. function RateParam(RateTypeNo, RateParamNo) {
  253. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  254. const attrs = [{
  255. name: "RateTypeNo",
  256. value: RateTypeNo,
  257. },
  258. {
  259. name: "RateParamNo",
  260. value: RateParamNo,
  261. },
  262. {
  263. name: "Ratio",
  264. value: "100",
  265. },
  266. ];
  267. Element.call(this, "RateParam", attrs);
  268. }
  269. let RateValues = new emptyElement("RateValues");
  270. function RateValue(CostTypeNo, RateTypeNo, value) {
  271. const attrs = [{
  272. name: "CostTypeNo",
  273. value: CostTypeNo,
  274. },
  275. {
  276. name: "RateTypeNo",
  277. value: RateTypeNo,
  278. },
  279. {
  280. name: "RateValue",
  281. value: value,
  282. },
  283. ];
  284. Element.call(this, "RateValue", attrs);
  285. }
  286. let prefix = "";
  287. for (let r of feeRateInfo.rates) {
  288. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  289. if (feeRateMap[r.name] && r.ParentID) {
  290. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  291. }
  292. }
  293. this.children.push(RateValues);
  294. }
  295. function Pract(tpdata, seriNo) {
  296. let pgljData = tpdata.projectGLJ.datas;
  297. const attrs = [{
  298. name: "PractNo",
  299. value: seriNo,
  300. },
  301. {
  302. name: "Name",
  303. value: pgljData.constData.usedUnitPriceInfo.name,
  304. },
  305. ];
  306. Element.call(this, "Pract", attrs);
  307. let Param = {
  308. name: "Param",
  309. attrs: [{
  310. name: "TaxLibNo",
  311. value: "CCSBZ-440000-2019-544",
  312. },
  313. {
  314. name: "AuxRate",
  315. value: pgljData.constData.assistProductionFeeRate,
  316. },
  317. ],
  318. children: [],
  319. };
  320. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  321. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  322. for (let e of elecDatas) {
  323. let Electro = {
  324. name: "Electro",
  325. attrs: [{
  326. name: "Code",
  327. value: e.code,
  328. },
  329. {
  330. name: "Price",
  331. value: e.electPrice,
  332. },
  333. {
  334. name: "Ratio",
  335. value: e.coe,
  336. },
  337. ],
  338. children: [],
  339. };
  340. Param.children.push(Electro);
  341. }
  342. this.children.push(Param);
  343. function MP(g) {
  344. const attrs = [{
  345. name: "Code",
  346. value: g.code,
  347. },
  348. {
  349. name: "PractName",
  350. value: g.name,
  351. },
  352. {
  353. name: "Spec",
  354. value: g.specs,
  355. },
  356. {
  357. name: "Unit",
  358. value: g.unit,
  359. },
  360. {
  361. name: "BugetPrice",
  362. value: g.priceInfo.tenderPrice,
  363. },
  364. {
  365. name: "NormPrice",
  366. value: g.priceInfo.basePrice,
  367. },
  368. {
  369. name: "IsAdd",
  370. value: g.unit_price.is_add,
  371. },
  372. ];
  373. Element.call(this, "MP", attrs);
  374. }
  375. function Material(g) {
  376. const attrs = [{
  377. name: "Code",
  378. value: g.code,
  379. },
  380. {
  381. name: "PractName",
  382. value: g.name,
  383. },
  384. {
  385. name: "Spec",
  386. value: g.specs,
  387. },
  388. {
  389. name: "Unit",
  390. value: g.unit,
  391. },
  392. {
  393. name: "BugetPrice",
  394. value: g.priceInfo.tenderPrice,
  395. },
  396. {
  397. name: "NormPrice",
  398. value: g.priceInfo.basePrice,
  399. },
  400. {
  401. name: "IsAdd",
  402. value: g.unit_price.is_add,
  403. },
  404. {
  405. name: "OrgPrice",
  406. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  407. },
  408. {
  409. name: "TransFee",
  410. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  411. },
  412. {
  413. name: "GwRate",
  414. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  415. },
  416. {
  417. name: "OffSiteLf",
  418. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  419. },
  420. {
  421. name: "OnSiteLf",
  422. value: 0,
  423. },
  424. {
  425. name: "LoadLf",
  426. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  427. },
  428. {
  429. name: "StoreRate",
  430. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  431. },
  432. {
  433. name: "PackageRecycleFee",
  434. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  435. },
  436. ];
  437. Element.call(this, "Material", attrs);
  438. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  439. // let index = gljUtil.getIndex(g);
  440. // let orList = [];
  441. // for (let o of pgljData.originalList) {
  442. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  443. // }
  444. // if (orList.length > 0) this.children = orList;
  445. // }
  446. function CostStructure(r) {
  447. //待获取
  448. this.name = "CostStructure";
  449. this.attrs = [];
  450. this.children = [];
  451. }
  452. function Consume(r, o) {
  453. this.name = "Consume";
  454. this.attrs = [];
  455. this.children = [];
  456. for (let g of o.ration_gljs) {
  457. if (g.rationID == r.ID) {
  458. let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  459. this.children.push(new ConsumeItem(g, r_quantity));
  460. }
  461. }
  462. }
  463. function ConsumeItem(g, ration_quantity) {
  464. const attrs = [{
  465. name: "Code", //待获取
  466. value: g.code,
  467. },
  468. {
  469. name: "Consumption",
  470. value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  471. },
  472. ];
  473. Element.call(this, "ConsumeItem", attrs);
  474. }
  475. function Norm(r, o) {
  476. const attrs = [{
  477. name: "NormLibNo", //待获取
  478. value: "",
  479. },
  480. {
  481. name: "DisplayCode",
  482. value: r.code,
  483. },
  484. {
  485. name: "Name",
  486. value: r.name,
  487. },
  488. {
  489. name: "Unit",
  490. value: r.unit,
  491. },
  492. {
  493. name: "Num",
  494. value: r.quantity,
  495. },
  496. {
  497. name: "CostTypeNo",
  498. value: "", //待获取
  499. },
  500. {
  501. name: "FabricationCost", //待获取
  502. value: "",
  503. },
  504. {
  505. name: "AdjustStatus",
  506. value: "",
  507. },
  508. ];
  509. Element.call(this, "Norm", attrs);
  510. this.children.push(new CostStructure(r));
  511. this.children.push(new Consume(r, o));
  512. }
  513. function SelfCollect(o) {
  514. const attrs = [{
  515. name: "OtherCost",
  516. value: 0,
  517. }, ];
  518. Element.call(this, "SelfCollect", attrs);
  519. for (let r of o.rations) {
  520. this.children.push(new Norm(r, o));
  521. }
  522. }
  523. function OrgPrices(o) {
  524. const attrs = [{
  525. name: "OrgPricevalue",
  526. value: o.supplyPrice,
  527. },
  528. {
  529. name: "Ratio",
  530. value: o.coe,
  531. },
  532. ];
  533. Element.call(this, "OrgPrices", attrs);
  534. if (!o.rations) return;
  535. this.children.push(new SelfCollect(o));
  536. }
  537. }
  538. function Mech(g) {
  539. const attrs = [{
  540. name: "Code",
  541. value: g.code,
  542. },
  543. {
  544. name: "PractName",
  545. value: g.name,
  546. },
  547. {
  548. name: "Spec",
  549. value: g.specs,
  550. },
  551. {
  552. name: "Unit",
  553. value: g.unit,
  554. },
  555. {
  556. name: "BugetPrice",
  557. value: g.priceInfo.tenderPrice,
  558. },
  559. {
  560. name: "NormPrice",
  561. value: g.priceInfo.basePrice,
  562. },
  563. {
  564. name: "IsAdd",
  565. value: g.unit_price.is_add,
  566. },
  567. ];
  568. Element.call(this, "Mech", attrs);
  569. }
  570. let Mps = new emptyElement("Mps");
  571. let Materials = new emptyElement("Materials");
  572. let Mechs = new emptyElement("Mechs");
  573. for (let g of pgljData.gljList) {
  574. let type = g.type + "";
  575. type = type.charAt(0);
  576. if (type == "1") {
  577. Mps.children.push(new MP(g));
  578. } else if (type == "2" || type == 5) {
  579. Materials.children.push(new Material(g));
  580. } else if (type == "3") {
  581. Mechs.children.push(new Mech(g));
  582. }
  583. }
  584. this.children.push(Mps);
  585. this.children.push(Materials);
  586. this.children.push(Mechs);
  587. }
  588. function EprjInfo(tenderProject) {
  589. let bills = tenderProject.Bills.datas;
  590. let totalItem = null;
  591. let proItem = null; //暂列金额项
  592. for (let b of bills) {
  593. if (b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  594. if (b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  595. }
  596. const attrs = [{
  597. name: "Name",
  598. value: tenderProject.projectInfo.name,
  599. },
  600. {
  601. name: "Sums",
  602. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  603. },
  604. ];
  605. Element.call(this, "EprjInfo", attrs);
  606. this.children.push(new SummaryOfCost(totalItem, proItem));
  607. this.children.push(new MakeInfo(tenderProject));
  608. this.children.push(new Params(tenderProject));
  609. this.children.push(new getBillsItems(tenderProject));
  610. }
  611. function getBillsItems(tenderProject) {
  612. let items = new emptyElement("Items");
  613. let rootNodes = tenderProject.mainTree.roots;
  614. for (let r of rootNodes) {
  615. setItem(r, -1, items.children);
  616. }
  617. return items;
  618. function setItem(bNode, level, list) {
  619. if (bNode.sourceType == ModuleNames.ration) return;
  620. list.push(new bill(bNode, level));
  621. if (bNode.children && bNode.children.length > 0) {
  622. level += 1;
  623. for (let c of bNode.children) {
  624. setItem(c, level, list);
  625. }
  626. }
  627. function bill(bNode, level) {
  628. let data = bNode.data;
  629. let CostKind = 3;
  630. if (data.name.indexOf("安全生产费") != -1) CostKind = 1;
  631. if (data.name.indexOf("暂列金额") != -1) CostKind = 2;
  632. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  633. let CalcType = 2;
  634. if (data.calcFlag == 2) CalcType = 3;
  635. if (data.calcFlag == 1) CalcType = 1;
  636. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  637. let ProvisionalType = "";
  638. if (data.specialProvisional == "材料") ProvisionalType = 0;
  639. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  640. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  641. //MpRatio
  642. let MpRatio = "";
  643. let MaterialRatio = "";
  644. let MechRatio = "";
  645. if (data.quantityCoe) {
  646. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  647. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  648. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  649. }
  650. const attrs = [{
  651. name: "ListCode",
  652. value: data.code,
  653. },
  654. {
  655. name: "ListName",
  656. value: data.name,
  657. },
  658. {
  659. name: "Unit",
  660. value: data.unit,
  661. },
  662. {
  663. name: "Num",
  664. value: data.quantity,
  665. },
  666. {
  667. name: "QtyFomula",
  668. value: data.calcBase //data.calcBase ? cbParser.toFExpr(data.calcBase, tenderProject.mainTree.items) : "",
  669. },
  670. {
  671. name: "Price",
  672. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.unitFee : "",
  673. },
  674. {
  675. name: "Rate",
  676. value: 100,
  677. },
  678. {
  679. name: "Sum",
  680. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.totalFee : "",
  681. },
  682. {
  683. name: "ChapterKind",
  684. value: level,
  685. },
  686. {
  687. name: "CostKind",
  688. value: CostKind,
  689. },
  690. {
  691. name: "CalcType",
  692. value: CalcType,
  693. },
  694. {
  695. name: "ProvisionalType",
  696. value: ProvisionalType,
  697. },
  698. {
  699. name: "MeterRules",
  700. value: "",
  701. },
  702. {
  703. name: "Content",
  704. value: data.jobContentText,
  705. },
  706. {
  707. name: "Remarks",
  708. value: data.remark,
  709. },
  710. {
  711. name: "MpRatio",
  712. value: MpRatio,
  713. },
  714. {
  715. name: "MaterialRatio",
  716. value: MaterialRatio,
  717. },
  718. {
  719. name: "MechRatio",
  720. value: MechRatio,
  721. },
  722. {
  723. name: "AdjustedPrice",
  724. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  725. },
  726. {
  727. name: "AdjustedSums",
  728. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  729. },
  730. {
  731. name: "ItemType",
  732. value: 1,
  733. },
  734. {
  735. name: "FomulaCode",
  736. value: "",
  737. },
  738. ];
  739. Element.call(this, "Item", attrs);
  740. let cc = CostComposition(bNode);
  741. if (cc) this.children.push(cc);
  742. this.children.push(CostStructure(data))
  743. function CostComposition(bNode) {
  744. let CostComposition = new emptyElement('CostComposition');
  745. let Norms = [];
  746. let Costs = [];
  747. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  748. for (let r of bNode.children) {
  749. if (r.data.type == rationType.ration) {
  750. Norms.push(new Ration(r.data));
  751. }
  752. }
  753. }
  754. return CostComposition;
  755. function Ration(ration) {
  756. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  757. let CostTypeNo = '';
  758. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  759. const attrs = [{
  760. name: "NormLibNo",
  761. value: 'YSDE-000000-2018-86',
  762. }, {
  763. name: 'DisplayCode',
  764. value: ration.code
  765. }, {
  766. name: 'Name',
  767. value: ration.name
  768. }, {
  769. name: 'Unit',
  770. value: ration.unit
  771. }, {
  772. name: 'Num',
  773. value: ration.tenderQuantity
  774. },
  775. {
  776. name: 'CostTypeNo',
  777. value: CostTypeNo
  778. },
  779. {
  780. name: 'ProfitRate',
  781. value: tenderProject.ProfitRate
  782. },
  783. {
  784. name: 'TaxRate',
  785. value: tenderProject.TaxRate
  786. },
  787. {
  788. name: 'FabricationCost',
  789. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  790. },
  791. {
  792. name: 'AdjustStatus',
  793. value: ration.adjustState
  794. }
  795. ]
  796. Element.call(this, "Norm", attrs);
  797. this.children.push(CostStructure(ration))
  798. }
  799. // 1.NormLibNo
  800. // 定额库编码。根据后台设置读取。
  801. // 2.DisplayCode
  802. // 定额子目编码。
  803. // 3.Name
  804. // 定额子目名称。
  805. // 4.Unit
  806. // 定额子目单位。
  807. // 5.Num
  808. // 定额的工程量。
  809. // 6.CostTypeNo
  810. // 取费类别编号。如土方编号为“TF”。
  811. // 7.ProfitRate
  812. // 取利润率。取费率界面右侧的利润参数值。
  813. // 8.TaxRate
  814. // 取税率。取费率界面右侧的税率参数值。
  815. // 9.FabricationCost
  816. // 金额合计。取造价书界面定额的调价后金额。
  817. // 10.AdjustStatus
  818. // 定额调整状态。输出目前造价书显示的定额调整文本。
  819. }
  820. function CostStructure(item) {
  821. let CostStructure = new emptyElement('CostStructure');
  822. for (let f of cpFeeTypes) {
  823. if (item.feesIndex && item.feesIndex[f.type] && itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item.feesIndex[f.type]));
  824. }
  825. function CostItem(fee) {
  826. const attrs = [{
  827. name: "ItemNo",
  828. value: itemFeeMap[fee.fieldName],
  829. }, {
  830. name: 'Sum',
  831. value: fee.tenderTotalFee
  832. }]
  833. Element.call(this, "CostItem", attrs);
  834. }
  835. return CostStructure;
  836. }
  837. }
  838. }
  839. }
  840. function Params(tenderProject) {
  841. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  842. let featrueMap = {};
  843. for (let f of feature) {
  844. featrueMap[f.dispName] = f;
  845. }
  846. let BuildType = "";
  847. if (featrueMap["建设性质"] == 0) BuildType = "新建";
  848. if (featrueMap["建设性质"] == 1) BuildType = "改(扩)建";
  849. let Terrain = "";
  850. if (featrueMap["地形类别"] == 0) Terrain = "平原微丘陵区";
  851. if (featrueMap["地形类别"] == 1) Terrain = "山岭重丘陵区";
  852. let DesignSpeed = "";
  853. if (featrueMap["设计时速"] == 0) DesignSpeed = "高速公路";
  854. if (featrueMap["设计时速"] == 1) DesignSpeed = "一级公路";
  855. if (featrueMap["设计时速"] == 2) DesignSpeed = "二级公路";
  856. if (featrueMap["设计时速"] == 3) DesignSpeed = "三级公路";
  857. if (featrueMap["设计时速"] == 4) DesignSpeed = "四级公路";
  858. let Structure = "";
  859. if (featrueMap["路面结构"] == 0) Structure = "沥青路面";
  860. if (featrueMap["路面结构"] == 1) Structure = "水泥混凝土路面";
  861. if (featrueMap["路面结构"] == 2) Structure = "其他类型路面";
  862. const attrs = [{
  863. name: "PrjArea",
  864. value: featrueMap["工程所在地"] ? featrueMap["工程所在地"].value : "",
  865. },
  866. {
  867. name: "StartPileNo",
  868. value: featrueMap["起点桩号"] ? featrueMap["起点桩号"].value : "",
  869. },
  870. {
  871. name: "EndPileNo",
  872. value: featrueMap["终点桩号"] ? featrueMap["终点桩号"].value : "",
  873. },
  874. {
  875. name: "BuildType",
  876. value: BuildType,
  877. },
  878. {
  879. name: "Terrain",
  880. value: Terrain,
  881. },
  882. {
  883. name: "RoadGrade",
  884. value: featrueMap["公路等级"] ? featrueMap["公路等级"].value : "",
  885. },
  886. {
  887. name: "DesignSpeed",
  888. value: DesignSpeed,
  889. },
  890. {
  891. name: "Structure",
  892. value: Structure,
  893. },
  894. {
  895. name: "SubgradeWidth",
  896. value: featrueMap["路基宽度"] ? featrueMap["路基宽度"].value : "",
  897. },
  898. {
  899. name: "RoadLength",
  900. value: featrueMap["路线长度"] ? featrueMap["路线长度"].value : "",
  901. },
  902. {
  903. name: "BridgeLength",
  904. value: featrueMap["桥梁长度"] ? featrueMap["桥梁长度"].value : "",
  905. },
  906. {
  907. name: "TunnelLength",
  908. value: featrueMap["隧道长度"] ? featrueMap["隧道长度"].value : "",
  909. },
  910. {
  911. name: "BriTunRate",
  912. value: featrueMap["桥隧比"] ? featrueMap["桥隧比"].value : "",
  913. },
  914. {
  915. name: "InterchangeNum",
  916. value: featrueMap["互通式立交数"] ? featrueMap["互通式立交数"].value : "",
  917. },
  918. {
  919. name: "StubLengths",
  920. value: featrueMap["支线、联络线长度"] ? featrueMap["支线、联络线长度"].value : "",
  921. },
  922. {
  923. name: "LaneLength",
  924. value: featrueMap["辅道、连接线长度"] ? featrueMap["辅道、连接线长度"].value : "",
  925. },
  926. ];
  927. Element.call(this, "Params", attrs);
  928. }
  929. function SummaryOfCost(totalItem, proItem) {
  930. const attrs = [{
  931. name: "TenderSumLimit",
  932. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  933. },
  934. {
  935. name: "BidTotal",
  936. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  937. },
  938. {
  939. name: "BillTotal",
  940. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  941. },
  942. {
  943. name: "CostForHSE",
  944. value: 0,
  945. },
  946. {
  947. name: "ProvisionalSums",
  948. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  949. },
  950. {
  951. name: "Appraisal",
  952. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  953. },
  954. ];
  955. if (isBidInvitation || isControl) attrs.splice(1, 1); //招标 - 控制价
  956. if (isBidSubmission) attrs.splice(0, 1); //投标
  957. Element.call(this, "SummaryOfCost", attrs);
  958. }
  959. function MakeInfo(tenderProject) {
  960. let property = tenderProject.property;
  961. let baseMap = {};
  962. let baseInfo = _.find(property.basicInformation, {
  963. dispName: "基本信息",
  964. });
  965. for (let i of baseInfo.items) {
  966. let key = i.dispName;
  967. if (i.dispName == "编制日期") key = "编制时间";
  968. baseMap[key] = i;
  969. }
  970. const attrs = [{
  971. name: "ValuationModel",
  972. value: property.taxType,
  973. },
  974. {
  975. name: "Manage",
  976. value: baseMap["建设单位"] ? baseMap["建设单位"].value : "",
  977. },
  978. {
  979. name: "Designer",
  980. value: baseMap["设计单位"] ? baseMap["设计单位"].value : "",
  981. },
  982. {
  983. name: "Compile",
  984. value: baseMap["编制单位"] ? baseMap["编制单位"].value : "",
  985. },
  986. {
  987. name: "CompileApprover",
  988. value: baseMap["编制人"] ? baseMap["编制人"].value : "",
  989. },
  990. {
  991. name: "CompileCertNo",
  992. value: baseMap["编制人证书号"] ? baseMap["编制人证书号"].value : "",
  993. },
  994. {
  995. name: "CompileDate",
  996. value: baseMap["编制时间"] ? baseMap["编制时间"].value : "",
  997. },
  998. {
  999. name: "Review",
  1000. value: baseMap["复核单位"] ? baseMap["复核单位"].value : "",
  1001. },
  1002. {
  1003. name: "ReviewApprover",
  1004. value: baseMap["复核人"] ? baseMap["复核人"].value : "",
  1005. },
  1006. {
  1007. name: "ReviewCertNo",
  1008. value: baseMap["复核人证书"] ? baseMap["复核人证书"].value : "",
  1009. },
  1010. {
  1011. name: "ReviewDate",
  1012. value: baseMap["复核日期"] ? baseMap["复核日期"].value : "",
  1013. },
  1014. {
  1015. name: "Examine",
  1016. value: baseMap["审核单位"] ? baseMap["审核单位"].value : "",
  1017. },
  1018. {
  1019. name: "ExamineApprover",
  1020. value: baseMap["审核人"] ? baseMap["审核人"].value : "",
  1021. },
  1022. {
  1023. name: "ExamineCertNo",
  1024. value: baseMap["审核人证书"] ? baseMap["审核人证书"].value : "",
  1025. },
  1026. {
  1027. name: "ExamineDate",
  1028. value: baseMap["审核日期"] ? baseMap["审核日期"].value : "",
  1029. },
  1030. {
  1031. name: "CompileExplain",
  1032. value: baseMap["编制说明"] ? baseMap["编制说明"].value : "",
  1033. },
  1034. {
  1035. name: "ExamineExplain",
  1036. value: baseMap["审核说明"] ? baseMap["审核说明"].value : "",
  1037. },
  1038. {
  1039. name: "ProjectExplain",
  1040. value: baseMap["工程说明"] ? baseMap["工程说明"].value : "",
  1041. },
  1042. ];
  1043. Element.call(this, "MakeInfo", attrs);
  1044. }
  1045. let data = new CprjInfo(projectData.name);
  1046. data.children.push(new SystemInfo());
  1047. data.children.push(new CostBasis());
  1048. let seriNo = 1;
  1049. for (let c of projectData.children) {
  1050. let tenderProject = tenderDetailMap[c.ID];
  1051. let feeRataDatas = tenderProject.FeeRate.datas;
  1052. data.children.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1053. data.children.push(new Pract(tenderProject, seriNo));
  1054. data.children.push(new EprjInfo(tenderProject));
  1055. seriNo++;
  1056. }
  1057. return [{
  1058. data: data,
  1059. exportKind: exportKind,
  1060. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1061. }, ];
  1062. }
  1063. return {
  1064. entry,
  1065. };
  1066. })();