guangdong_zhongshan.js 41 KB

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