guangdong_zhongshan.js 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644
  1. // INTERFACE_EXPORT =,必须这么写,这样才能在导出时动态加载脚本后,覆盖前端代码
  2. INTERFACE_EXPORT = (() => {
  3. "use strict";
  4. const feeRateMap = {
  5. 冬季施工增加费: "DJSGZJFFL",
  6. 冬季施工: "DJSGZJFFL",
  7. 雨季施工增加费: "YUJSGZJFFL",
  8. 雨季施工: "YUJSGZJFFL",
  9. 夜间施工增加费: "YEJSGZJFFL",
  10. 夜间施工: "YEJSGZJFFL",
  11. 高原地区施工增加费: "GYDQSGZJFFL",
  12. 高原施工: "GYDQSGZJFFL",
  13. 风沙地区施工增加费: "FSDQSGZJFFL",
  14. 风沙施工: "FSDQSGZJFFL",
  15. 沿海地区施工增加费: "YHDQSGZJFFL",
  16. 沿海施工: "YHDQSGZJFFL",
  17. 行车干扰施工增加费: "XCGRGCSGZJFFL",
  18. 行车干扰: "XCGRGCSGZJFFL",
  19. 工地转移费: "GDZYFFL",
  20. '工地转移(km)': "GDZYFFL",
  21. 施工辅助费: "SGFZFFL",
  22. 施工辅助: "SGFZFFL",
  23. 基本费用: "JBFYFL",
  24. 主副食运费补贴: "ZFSYFBTFL",
  25. '综合里程(km)': "ZFSYFBTFL",
  26. 职工探亲路费: "ZGTQLFFL",
  27. 职工探亲: "ZGTQLFFL",
  28. 职工取暖补贴: "ZGQNBTFL",
  29. 职工取暖: "ZGQNBTFL",
  30. 财务费用: "CWFYFL",
  31. 养老保险费: "YANGLBXFFL",
  32. 失业保险费: "SYBXFFL",
  33. 医疗保险费: "YILBXFFL",
  34. 工伤保险费: "GSBXFL",
  35. 养老保险: "YANGLBXFFL",
  36. 失业保险: "SYBXFFL",
  37. 医疗保险: "YILBXFFL",
  38. 工伤保险: "GSBXFL",
  39. 住房公积金: "ZFGJJFL",
  40. 规费: "GFZHFL",
  41. 利润: "LRL",
  42. 税金: "SL",
  43. 土方: "TF",
  44. 石方: "SF",
  45. 运输: "YS",
  46. 路面: "LM",
  47. "路面(不计雨)": "LM",
  48. 隧道: "SD",
  49. 构造物I: "GZW1",
  50. "构造物I(不计冬)": "GZW1",
  51. "构造物I(不计雨)": "GZW1",
  52. 构造物II: "GZW2",
  53. "构造物III(桥梁)": "GZW3",
  54. "构造物III(除桥以外)": "GZW3",
  55. "构造物III(除桥以外不计雨夜)": "GZW3",
  56. 技术复杂大桥: "JSFZDQ",
  57. "钢材及钢结构(桥梁)": "GJG",
  58. "钢材及钢结构(除桥以外)": "GJG",
  59. "钢材及钢结构(除桥以外不计夜)": "GJG",
  60. };
  61. //计算程序有,这里没有:施工机械使用费\施工机械人工费\定额人工费\定额材料费\定额施工机械使用费
  62. const itemFeeMap = {
  63. 'marketLabour': 'RGF',
  64. 'marketMaterial': 'CLF',
  65. 'marketMachine':'JXSYF',
  66. 'marketEquipment': 'SBGZF',
  67. 'direct': 'DEZJF',
  68. 'equipment': 'DESBF',
  69. 'marketDirect': 'ZJF',
  70. 'measure': 'CSF',
  71. 'measure1': 'CSF1',
  72. 'measure2': 'CSF2',
  73. 'manage': 'QYGLF',
  74. 'force': 'GF',
  75. 'profit': 'LR',
  76. 'tax': 'SJ',
  77. 'common': 'JAF',
  78. 'rationCommon': 'DEJAF'
  79. };
  80. const feeLibNoMap = {
  81. 'eba0e7c0-cfe6-11ea-ba15-739be477d1fe': 'GYSFL-000000-2018-86',
  82. '451d3180-e02e-11ea-8056-1514dfc2f39e': 'GYSFL-340000-2019-210',
  83. '32923ff0-e912-11ea-8b20-d93bc370e960': 'GYSFL-440000-2019-544'
  84. };
  85. const FixedCostMap = {
  86. //折旧费、检修费、维护费、安拆辅助费
  87. '折旧费': 1,
  88. '检修费': 1,
  89. '维护费': 1,
  90. '安拆辅助费':1
  91. }
  92. const RoadGradeMap = {
  93. "高速公路": "0",
  94. "一级公路": "1",
  95. "二级公路": "2",
  96. "三级公路": "3",
  97. "四级公路": "4",
  98. "等外公路": "5",
  99. "独立桥梁": "6",
  100. "独立隧道": "7"
  101. }
  102. const sectionNameMap = {
  103. "清单 第100章 总则": true,
  104. "清单 第200章 路基": true,
  105. "清单 第300章 路面": true,
  106. "清单 第400章 桥梁、涵洞工程": true,
  107. "清单 第500章 隧道": true,
  108. "清单 第600章 交通安全设施": true,
  109. "清单 第700章 绿化及环境保护设施": true,
  110. "清单 第800章 机电工程": true,
  111. "清单 第900章 附属区房建工程":true
  112. }
  113. const ratioCodeMap = {
  114. "01ZJF":"0",
  115. "02JXF":"1",
  116. "03WHF":"2",
  117. "04ACFZF":"3"
  118. }
  119. function getBasePrice(projectGLJID, tenderProject) {
  120. let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
  121. id: projectGLJID
  122. })
  123. return glj ? gljUtil.getBasePrice(glj, null, null, null, decimalObj, false, _, scMathUtil) : 0;
  124. }
  125. function getFeeRate(programID, fieldName, tenderProject) {
  126. let rate = 0;
  127. let template = tenderProject.calcProgram.compiledTemplates;
  128. if (template[programID]) {
  129. let item = _.find(template[programID].calcItems, {
  130. fieldName: fieldName
  131. })
  132. if (item) rate = item.feeRate;
  133. }
  134. return rate
  135. }
  136. function billNameChecking(bNode,projectName,fixedFlag) {
  137. let data = bNode.data;
  138. let fail = null;
  139. let pass = true;
  140. if (data.flagsIndex && data.flagsIndex.fixed) {
  141. let flag = data.flagsIndex.fixed.flag;
  142. switch (flag) {
  143. case fixedFlag.ONE_SEVEN_BILLS:
  144. pass = data.name == "第100章至900章清单";
  145. break;
  146. case fixedFlag.PROVISIONAL_TOTAL:
  147. pass = data.name == "已包含在清单合计中的材料、工程设备、专业工程暂估价合计";
  148. break;
  149. case fixedFlag.BILLS_TOTAL_WT_PROV:
  150. pass = data.name == "清单合计减去材料、工程设备、专业工程暂估价合计";
  151. break;
  152. case fixedFlag.DAYWORK_LABOR:
  153. pass = data.name == "计日工合计";
  154. break;
  155. case fixedFlag.LABOUR_SERVICE:
  156. pass = data.name == "劳务";
  157. break;
  158. case fixedFlag.MATERIAL:
  159. pass = data.name == "材料";
  160. break;
  161. case fixedFlag.CONSTRUCTION_MACHINE:
  162. pass = data.name == "机械";
  163. break;
  164. case fixedFlag.PROVISIONAL:
  165. pass = data.name == "暂列金额(不含计日工总额)";
  166. break;
  167. case fixedFlag.TOTAL_COST:
  168. pass = data.name == "投标报价";
  169. break;
  170. case fixedFlag.ONE_HUNDRED_BILLS:
  171. pass = data.name == "清单 第100章 总则";
  172. break;
  173. }
  174. } else {
  175. if (bNode.parent) {
  176. const pdata = bNode.parent.data;
  177. if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
  178. if (!sectionNameMap[data.name]) pass = false
  179. }
  180. }
  181. }
  182. if(pass == false)fail = { hint: `清单:"${data.name?data.name:""}",名字不符合规范!`, type: projectName }
  183. return fail;
  184. }
  185. /**
  186. *
  187. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  188. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  189. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  190. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  191. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  192. */
  193. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  194. const {
  195. CONFIG: {
  196. TYPE
  197. },
  198. UTIL,
  199. Element
  200. } = INTERFACE_EXPORT_BASE;
  201. const {
  202. EXPORT_KIND: {
  203. BID_INVITATION,
  204. BID_SUBMISSION,
  205. CONTROL
  206. },
  207. fixedFlag,
  208. } = window.commonConstants;
  209. let cprjType = {
  210. 1: "GCLQD", // 招标
  211. 2: "TBBJ", // 投标
  212. 3: "ZBKZJ", // 控制价
  213. };
  214. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  215. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  216. const isControl = exportKind === CONTROL; // 是否是控制价
  217. function emptyElement(name) {
  218. this.name = name;
  219. this.attrs = [];
  220. this.children = [];
  221. }
  222. // 建设项目根节点信息
  223. function CprjInfo(projectName) {
  224. const attrs = [{
  225. name: "CprjName",
  226. value: projectName,
  227. },
  228. {
  229. name: "CprjType",
  230. value: cprjType[exportKind],
  231. },
  232. ];
  233. Element.call(this, "CprjInfo", attrs);
  234. }
  235. // 项目基本信息
  236. function SystemInfo(projectData) {
  237. let baseInfo = _.find(projectData.property.basicInformation, {
  238. dispName: "基本信息",
  239. });
  240. let makeData = _.find(baseInfo.items, { "key": "makeDate" });
  241. let hardID = UTIL.generateHardwareId();
  242. let [cpuId, diskId, macId] = hardID.split(";");
  243. const attrs = [{
  244. name: "Name",
  245. value: "公路工程造价数据标准",
  246. },
  247. {
  248. name: "Version",
  249. value: "1.0",
  250. },
  251. {
  252. name: "SoftwareName",
  253. value: "纵横公路云造价",
  254. },
  255. {
  256. name: "SoftwareVer",
  257. value: "V" + VERSION,
  258. },
  259. {
  260. name: "SoftwareCompany",
  261. value: "珠海纵横创新软件有限公司",
  262. },
  263. {
  264. name: "MakeDate",
  265. value: makeData?makeData.value:"",
  266. },
  267. {
  268. name: "Key1",
  269. value: window.btoa(VERSION),
  270. },
  271. {
  272. name: "Key2",
  273. value: window.btoa(diskId),
  274. },
  275. {
  276. name: "Key3",
  277. value: window.btoa(macId),
  278. },
  279. ];
  280. if (isBidSubmission)
  281. attrs.splice(6, 0, {
  282. name: "BidderVer",
  283. value: UTIL.getNowFormatTime(true),
  284. });
  285. Element.call(this, "SystemInfo", attrs);
  286. }
  287. //造价依据
  288. function CostBasis() {
  289. // ItemStandardNo="GYSFX-000000-2018-86"
  290. const attrs = [{
  291. name: "MakeRuleNo",
  292. value: "GYSBB-000000-2018-86",
  293. },
  294. {
  295. name: "MakeRuleName",
  296. value: "公路工程建设项目概算预算编制办法",
  297. },
  298. {
  299. name: "ItemStandardNo",
  300. value: "GYSFX-000000-2018-86",
  301. },
  302. ];
  303. Element.call(this, "CostBasis", attrs);
  304. //定额库信息
  305. //to do 改成实际的值
  306. function NormLib() {
  307. const attrs = [{
  308. name: "NormLibNo",
  309. value: "YSDE-000000-2018-86",
  310. },
  311. {
  312. name: "NormLibName",
  313. value: "部颁公路工程预算定额(2018)",
  314. },
  315. {
  316. name: "Type",
  317. value: "ZDEK",
  318. },
  319. ];
  320. Element.call(this, "NormLib", attrs);
  321. }
  322. this.children.push(new NormLib());
  323. }
  324. function Rate(tenderProject, feeRateInfo, seirNo) {
  325. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  326. const attrs = [{
  327. name: "RateNo",
  328. value: seirNo,
  329. },
  330. {
  331. name: "Name",
  332. value: feeRateInfo.name,
  333. },
  334. {
  335. name: "RateLibNo",
  336. value: feeLibNoMap[feeRateInfo.libID],
  337. },
  338. ];
  339. Element.call(this, "Rate", attrs);
  340. let RateParams = new emptyElement("RateParams");
  341. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  342. for (let s of subRates) {
  343. let sname = s.name.replace("(%)", "");
  344. sname = sname.replace("(%)", "");
  345. if (feeRateMap[sname]) {
  346. let value = "";
  347. if (s.editable) {
  348. let sel = _.find(s.optionList, {
  349. selected: true,
  350. });
  351. if (sel) {
  352. value = sel.name;
  353. } else if (gljUtil.isDef(s.value)) {
  354. value = s.value;
  355. }
  356. } else {
  357. value = _.findIndex(s.optionList, {
  358. selected: true,
  359. });
  360. if (value == -1) value = 0;
  361. }
  362. /* if (sname == '利润') tenderProject.ProfitRate = value;
  363. if (sname == '税金') tenderProject.TaxRate = value; */
  364. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  365. }
  366. }
  367. this.children.push(RateParams);
  368. function RateParam(RateTypeNo, RateParamNo) {
  369. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  370. const attrs = [{
  371. name: "RateTypeNo",
  372. value: RateTypeNo,
  373. },
  374. {
  375. name: "RateParamNo",
  376. value: RateParamNo,
  377. },
  378. {
  379. name: "Ratio",
  380. value: "100",
  381. },
  382. ];
  383. Element.call(this, "RateParam", attrs);
  384. }
  385. let RateValues = new emptyElement("RateValues");
  386. function RateValue(CostTypeNo, RateTypeNo, value) {
  387. const attrs = [{
  388. name: "CostTypeNo",
  389. value: CostTypeNo,
  390. },
  391. {
  392. name: "RateTypeNo",
  393. value: RateTypeNo,
  394. },
  395. {
  396. name: "RateValue",
  397. value: value,
  398. },
  399. ];
  400. Element.call(this, "RateValue", attrs);
  401. }
  402. let prefix = "";
  403. for (let r of feeRateInfo.rates) {
  404. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  405. if (feeRateMap[r.name] && r.ParentID) {
  406. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  407. }
  408. }
  409. this.children.push(RateValues);
  410. }
  411. function Pract(tpdata, seriNo) {
  412. let pgljData = tpdata.projectGLJ.datas;
  413. let decimalObj = tpdata.property.decimal;
  414. const attrs = [{
  415. name: "PractNo",
  416. value: seriNo,
  417. },
  418. {
  419. name: "Name",
  420. value: pgljData.constData.usedUnitPriceInfo.name,
  421. },
  422. ];
  423. Element.call(this, "Pract", attrs);
  424. let Param = {
  425. name: "Param",
  426. attrs: [{
  427. name: "TaxLibNo",
  428. value: "CCSBZ-440000-2019-544",
  429. },
  430. {
  431. name: "AuxRate",
  432. value: pgljData.constData.assistProductionFeeRate,
  433. },
  434. ],
  435. children: [],
  436. };
  437. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  438. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  439. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  440. for (let e of elecDatas) {
  441. let Electro = {
  442. name: "Electro",
  443. attrs: [{
  444. name: "Code",
  445. value: e.code,
  446. },
  447. {
  448. name: "Price",
  449. value: e.electPrice,
  450. },
  451. {
  452. name: "Ratio",
  453. value: e.coe,
  454. },
  455. ],
  456. children: [],
  457. };
  458. Param.children.push(Electro);
  459. }
  460. }
  461. this.children.push(Param);
  462. function Mp(g) {
  463. const attrs = [{
  464. name: "Code",
  465. value: g.code,
  466. },
  467. {
  468. name: "PractName",
  469. value: g.name,
  470. },
  471. {
  472. name: "Spec",
  473. value: g.specs,
  474. },
  475. {
  476. name: "Unit",
  477. value: g.unit,
  478. },
  479. {
  480. name: "BudgetPrice",
  481. value: g.priceInfo.tenderPrice,
  482. },
  483. {
  484. name: "NormPrice",
  485. value: g.priceInfo.basePrice,
  486. },
  487. {
  488. name: "IsAdd",
  489. value: g.unit_price.is_add,
  490. },
  491. ];
  492. Element.call(this, "Mp", attrs);
  493. }
  494. function Material(g) {
  495. const attrs = [{
  496. name: "Code",
  497. value: g.code,
  498. },
  499. {
  500. name: "PractName",
  501. value: g.name,
  502. },
  503. {
  504. name: "Spec",
  505. value: g.specs,
  506. },
  507. {
  508. name: "Unit",
  509. value: g.unit,
  510. },
  511. {
  512. name: "BudgetPrice",
  513. value: g.priceInfo.tenderPrice,
  514. },
  515. {
  516. name: "NormPrice",
  517. value: g.priceInfo.basePrice,
  518. },
  519. {
  520. name: "IsAdd",
  521. value: g.unit_price.is_add,
  522. },
  523. {
  524. name: "OrgPrice",
  525. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  526. },
  527. {
  528. name: "TransFee",
  529. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  530. },
  531. {
  532. name: "GwRate",
  533. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  534. },
  535. {
  536. name: "OffSiteLf",
  537. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  538. },
  539. {
  540. name: "OnSiteLf",
  541. value: 0,
  542. },
  543. {
  544. name: "LoadLf",
  545. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  546. },
  547. {
  548. name: "StoreRate",
  549. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  550. },
  551. {
  552. name: "PackageRecycleFee",
  553. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  554. },
  555. ];
  556. Element.call(this, "Material", attrs);
  557. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  558. // let index = gljUtil.getIndex(g);
  559. // let orList = [];
  560. // for (let o of pgljData.originalList) {
  561. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  562. // }
  563. // if (orList.length > 0) this.children = orList;
  564. // }
  565. function CostStructure(r) {
  566. //待获取
  567. this.name = "CostStructure";
  568. this.attrs = [];
  569. this.children = [];
  570. }
  571. function Consume(r, o) {
  572. this.name = "Consume";
  573. this.attrs = [];
  574. this.children = [];
  575. for (let g of o.ration_gljs) {
  576. if (g.rationID == r.ID) {
  577. let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  578. this.children.push(new ConsumeItem(g, r_quantity));
  579. }
  580. }
  581. }
  582. function ConsumeItem(g, ration_quantity) {
  583. const attrs = [{
  584. name: "Code", //待获取
  585. value: g.code,
  586. },
  587. {
  588. name: "Consumption",
  589. value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  590. },
  591. ];
  592. Element.call(this, "ConsumeItem", attrs);
  593. }
  594. function Norm(r, o) {
  595. const attrs = [{
  596. name: "NormLibNo", //待获取
  597. value: "",
  598. },
  599. {
  600. name: "DisplayCode",
  601. value: r.code,
  602. },
  603. {
  604. name: "Name",
  605. value: r.name,
  606. },
  607. {
  608. name: "Unit",
  609. value: r.unit,
  610. },
  611. {
  612. name: "Num",
  613. value: r.quantity,
  614. },
  615. {
  616. name: "CostTypeNo",
  617. value: "", //待获取
  618. },
  619. {
  620. name: "FabricationCost", //待获取
  621. value: "",
  622. },
  623. {
  624. name: "AdjustStatus",
  625. value: "",
  626. },
  627. ];
  628. Element.call(this, "Norm", attrs);
  629. this.children.push(new CostStructure(r));
  630. this.children.push(new Consume(r, o));
  631. }
  632. function SelfCollect(o) {
  633. const attrs = [{
  634. name: "OtherCost",
  635. value: 0,
  636. }, ];
  637. Element.call(this, "SelfCollect", attrs);
  638. for (let r of o.rations) {
  639. this.children.push(new Norm(r, o));
  640. }
  641. }
  642. function OrgPrices(o) {
  643. const attrs = [{
  644. name: "OrgPricevalue",
  645. value: o.supplyPrice,
  646. },
  647. {
  648. name: "Ratio",
  649. value: o.coe,
  650. },
  651. ];
  652. Element.call(this, "OrgPrices", attrs);
  653. if (!o.rations) return;
  654. this.children.push(new SelfCollect(o));
  655. }
  656. }
  657. function Mech(g,gljKeyMap) {
  658. const attrs = [{
  659. name: "Code",
  660. value: g.code,
  661. },
  662. {
  663. name: "PractName",
  664. value: g.name,
  665. },
  666. {
  667. name: "Spec",
  668. value: g.specs,
  669. },
  670. {
  671. name: "Unit",
  672. value: g.unit,
  673. },
  674. {
  675. name: "BudgetPrice",
  676. value: g.priceInfo.tenderPrice,
  677. },
  678. {
  679. name: "NormPrice",
  680. value: g.priceInfo.basePrice,
  681. },
  682. {
  683. name: "IsAdd",
  684. value: g.unit_price.is_add,
  685. },
  686. ];
  687. Element.call(this, "Mech", attrs);
  688. let FixedCostItems = [];
  689. let fcsum = 0;
  690. let VariableCostItems = [];
  691. let vcsum = 0;
  692. if (g.ratio_data && g.ratio_data.length > 0) {
  693. for (let ratio of g.ratio_data) {
  694. let rIndex = gljUtil.getIndex(ratio);
  695. let rglj = gljKeyMap[rIndex];
  696. let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
  697. if (FixedCostMap[ratio.name]) {
  698. FixedCostItems.push(new FixedCostItem(ratio));
  699. fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
  700. } else {
  701. VariableCostItems.push(new VariableCostItem(ratio));
  702. vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
  703. }
  704. }
  705. }
  706. if (FixedCostItems.length > 0) {
  707. let fc = new FixedCost(fcsum);
  708. fc.children = FixedCostItems;
  709. this.children.push(fc);
  710. }
  711. if (VariableCostItems.length > 0) {
  712. let vc = new VariableCost(vcsum);
  713. vc.children = VariableCostItems;
  714. this.children.push(vc);
  715. }
  716. function VariableCost(sum) {
  717. const attrs = [{
  718. name: "VariableCostSum",
  719. value: sum,
  720. }];
  721. Element.call(this, "VariableCost", attrs);
  722. }
  723. function VariableCostItem(item) {
  724. const attrs = [{
  725. name: "VariableCostNo",
  726. value: item.code,
  727. },{
  728. name: "Consumption",
  729. value: item.consumption,
  730. }]
  731. Element.call(this, "VariableCostItem", attrs);
  732. }
  733. function FixedCost(sum) {
  734. const attrs = [{
  735. name: "FixedCostSum",
  736. value: sum,
  737. }, {
  738. name: "FixedRate",
  739. value: 1,
  740. }];
  741. Element.call(this, "FixedCost", attrs);
  742. }
  743. function FixedCostItem(item) {
  744. const attrs = [{
  745. name: "FixedCostNo",
  746. value: ratioCodeMap[item.code],
  747. },{
  748. name: "Sum",
  749. value: item.consumption,
  750. }]
  751. Element.call(this, "FixedCostItem", attrs);
  752. }
  753. }
  754. let Mps = new emptyElement("Mps");
  755. let Materials = new emptyElement("Materials");
  756. let Mechs = new emptyElement("Mechs");
  757. let gljKeyMap = {};
  758. let temMechs = [];
  759. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  760. for (let g of pgljData.gljList) {
  761. let type = g.type + "";
  762. gljKeyMap[gljUtil.getIndex(g)] = g;
  763. type = type.charAt(0);
  764. if (type == "1") {
  765. Mps.children.push(new Mp(g));
  766. } else if (type == "2" || type == 5) {
  767. Materials.children.push(new Material(g));
  768. } else if (type == "3") {
  769. temMechs.push(g);
  770. }
  771. }
  772. for (let t of temMechs) {
  773. Mechs.children.push(new Mech(t,gljKeyMap));
  774. }
  775. }
  776. this.children.push(Mps);
  777. this.children.push(Materials);
  778. this.children.push(Mechs);
  779. }
  780. function EprjInfo(tenderProject) {
  781. let bills = tenderProject.Bills.datas;
  782. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  783. let totalItem = null;
  784. let proItem = null; //暂列金额项
  785. let safeItem = null;
  786. for (let b of bills) {
  787. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  788. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  789. if(b.code == "102-3" && b.name=="安全生产费") safeItem = b;
  790. }
  791. const attrs = [{
  792. name: "Name",
  793. value: tenderProject.projectInfo.name,
  794. },
  795. {
  796. name: "Sums",
  797. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  798. },
  799. ];
  800. //输出控制价、投标文件时,取调价后的标段总造价。
  801. //输出招标文件时,取0
  802. if (isBidInvitation) attrs[1].value = 0;
  803. Element.call(this, "EprjInfo", attrs);
  804. this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,feature));
  805. this.children.push(new MakeInfo(tenderProject));
  806. this.children.push(new Params(tenderProject));
  807. this.children.push(new getBillsItems(tenderProject));
  808. this.children.push(new getIndexs(tenderProject));
  809. let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
  810. if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
  811. }
  812. function getBidEvaluationMainMaterial(tenderProject) {
  813. let bidMaterials = [];
  814. let i = 1;
  815. for (let b of tenderProject.bidMaterialData) {
  816. bidMaterials.push(new BidEvaluationMainMaterial(b, i));
  817. i++
  818. }
  819. return bidMaterials;
  820. function BidEvaluationMainMaterial(b, index) {
  821. const attrs = [{
  822. name: "Code",
  823. value: index,
  824. },
  825. {
  826. name: "Number",
  827. value: b.code
  828. },
  829. {
  830. name: "Name",
  831. value: b.name
  832. },
  833. {
  834. name: "Specification",
  835. value: b.specs
  836. },
  837. {
  838. name: "Unit",
  839. value: b.unit
  840. },
  841. {
  842. name: "Price",
  843. value: b.tenderPrice,
  844. type: TYPE.DECIMAL
  845. },
  846. {
  847. name: "LimitedPrice",
  848. value: b.tenderPrice,
  849. type: TYPE.DECIMAL
  850. },
  851. {
  852. name: "Quantity",
  853. value: 0//b.quantity
  854. },
  855. {
  856. name: "Total",
  857. value: 0//b.totalPrice
  858. },
  859. {
  860. name: "Remark",
  861. value: b.remark
  862. }
  863. ];
  864. if (isBidSubmission || isControl) {
  865. attrs[7].value = b.quantity;
  866. attrs[8].value = b.totalPrice;
  867. }
  868. Element.call(this, "BidEvaluationMainMaterial", attrs);
  869. }
  870. }
  871. function getIndexs(tenderProject) {
  872. let Indexs = new emptyElement('Indexs');
  873. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  874. for (let f of feature) {
  875. if (f.code) Indexs.children.push(new IndexItem(f))
  876. }
  877. return Indexs;
  878. function IndexItem(fea) {
  879. const attrs = [{
  880. name: "Code",
  881. value: fea.code,
  882. },
  883. {
  884. name: "Name",
  885. value: fea.dispName,
  886. },
  887. {
  888. name: "Unit",
  889. value: fea.unit,
  890. },
  891. {
  892. name: "Value",
  893. value: fea.value,
  894. },
  895. {
  896. name: "Remark",
  897. value: fea.remark,
  898. }
  899. ]
  900. Element.call(this, "IndexItem", attrs);
  901. }
  902. }
  903. function getBillsItems(tenderProject) {
  904. let items = new emptyElement("Items");
  905. let rootNodes = tenderProject.mainTree.roots;
  906. for (let r of rootNodes) {
  907. setItem(r, -1, items.children);
  908. }
  909. return items;
  910. function setItem(bNode, level, list) {
  911. if (bNode.sourceType == ModuleNames.ration) return;
  912. let item = new bill(bNode, level);
  913. if (bNode.children && bNode.children.length > 0) {
  914. level += 1;
  915. for (let c of bNode.children) {
  916. setItem(c, level, item.children);
  917. }
  918. }
  919. list.push(item);
  920. function getCalcType(node) {
  921. /*
  922. 判断是否父项:
  923. 是父项,则取1;
  924. 是叶子项,则判断其下有无套定额/量价/工料机:
  925. 有则取1;
  926. 无则判断有无基数计算:
  927. 有则取2;
  928. 无则取3 */
  929. if (node.children && node.children.length > 0) {
  930. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  931. } else {
  932. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  933. }
  934. }
  935. function getItemType(node) {
  936. //100~900章部分,叶子清单输出1,父项输出为0;
  937. if (projectObj.project.Bills.isBelongOneToSeven(node)) {
  938. if (node.children && node.children.length > 0) {
  939. return node.children[0].sourceType == ModuleNames.ration?1:0
  940. }
  941. return 1 //叶子清单输出1
  942. } else {
  943. //非100~900章部分,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
  944. return gljUtil.isNotEmpty(node.data.quantity)?1:0
  945. }
  946. }
  947. function bill(bNode, level) {
  948. let data = bNode.data;
  949. let CostKind = 3;
  950. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  951. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  952. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  953. let CalcType = getCalcType(bNode);
  954. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  955. let ProvisionalType = "";
  956. if (data.specialProvisional == "材料") ProvisionalType = 0;
  957. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  958. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  959. //MpRatio
  960. let MpRatio = "";
  961. let MaterialRatio = "";
  962. let MechRatio = "";
  963. if (data.quantityCoe) {
  964. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  965. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  966. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  967. }
  968. let fail = billNameChecking(bNode,tenderProject.projectInfo.name,fixedFlag)
  969. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  970. const attrs = [{
  971. name: "ListCode",
  972. value: data.code,
  973. },
  974. {
  975. name: "ListName",
  976. value: data.name,
  977. fail:fail
  978. },
  979. {
  980. name: "Unit",
  981. value: data.unit,
  982. },
  983. {
  984. name: "Num",
  985. value: data.quantity,
  986. type: TYPE.DECIMAL,
  987. toFix:3
  988. },
  989. {
  990. name: "QtyFormula",
  991. value: data.calcBase //data.calcBase ? cbParser.toFExpr(data.calcBase, tenderProject.mainTree.items) : "",
  992. },
  993. {
  994. name: "Price",
  995. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  996. type: TYPE.DECIMAL,
  997. toFix:2
  998. },
  999. {
  1000. name: "Rate",
  1001. value: 100,
  1002. },
  1003. {
  1004. name: "Sum",
  1005. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1006. type: TYPE.DECIMAL,
  1007. toFix:2
  1008. },
  1009. {
  1010. name: "ChapterKind",
  1011. value: level,
  1012. },
  1013. {
  1014. name: "CostKind",
  1015. value: CostKind,
  1016. },
  1017. {
  1018. name: "CalcType",
  1019. value: CalcType,
  1020. },
  1021. {
  1022. name: "ProvisionalType",
  1023. value: ProvisionalType,
  1024. mustHasValue:true
  1025. },
  1026. {
  1027. name: "MeterRules",
  1028. value: "",
  1029. },
  1030. {
  1031. name: "Content",
  1032. value: data.jobContentText,
  1033. },
  1034. {
  1035. name: "Remarks",
  1036. value: data.remark,
  1037. },
  1038. /* {
  1039. name: "MpRatio",
  1040. value: MpRatio,
  1041. },
  1042. {
  1043. name: "MaterialRatio",
  1044. value: MaterialRatio,
  1045. },
  1046. {
  1047. name: "MechRatio",
  1048. value: MechRatio,
  1049. },
  1050. {
  1051. name: "AdjustedPrice",
  1052. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1053. },
  1054. {
  1055. name: "AdjustedSums",
  1056. value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1057. }, */
  1058. {
  1059. name: "ItemType",
  1060. value: getItemType(bNode),
  1061. },
  1062. /* {
  1063. name: "FomulaCode",
  1064. value: ""
  1065. }, */
  1066. ];
  1067. //投标、招标控制价时。取单价。
  1068. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1069. if (isBidSubmission || isControl || CostKind==1 ||CostKind==2) {
  1070. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1071. attrs[7].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1072. }
  1073. Element.call(this, "Item", attrs);
  1074. let cc = CostComposition(bNode);
  1075. if (cc) this.children.push(cc);
  1076. this.children.push(CostStructure(data))
  1077. function CostComposition(bNode) {
  1078. if (isBidInvitation) return null;
  1079. let CostComposition = new emptyElement('CostComposition');
  1080. let Norms = [];
  1081. let Costs = [];
  1082. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1083. for (let r of bNode.children) {
  1084. if (r.data.type == rationType.ration) {
  1085. Norms.push(new Ration(r.data));
  1086. } else {
  1087. Costs.push(new Cost(r.data));
  1088. }
  1089. }
  1090. }
  1091. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1092. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1093. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1094. return CostComposition.children.length > 0 ? CostComposition : null;
  1095. function Formula(bills) {
  1096. const attrs = [{
  1097. name: "Name",
  1098. value: bills.name
  1099. },
  1100. {
  1101. name: "Formulas",
  1102. value: bills.calcBase
  1103. },
  1104. {
  1105. name: "Ratio",
  1106. value: 1
  1107. },
  1108. {
  1109. name: "Sum",
  1110. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1111. type:TYPE.DECIMAL
  1112. },
  1113. {
  1114. name: "Remarks",
  1115. value: bills.remark
  1116. }
  1117. ]
  1118. Element.call(this, "Formula", attrs);
  1119. // 1.Name
  1120. // 名称/描述。取清单的名称。
  1121. // 2.Formulas
  1122. // 计算式。读取计算基数的文本。
  1123. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1124. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1125. // 3.Ratio
  1126. // 系数。输出为1,非必填。
  1127. // 4.Sum
  1128. // 取金额。
  1129. // 5.Remarks
  1130. }
  1131. function Cost(item) {
  1132. let BasePrice = 0;
  1133. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1134. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1135. } else {
  1136. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1137. }
  1138. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1139. let CostTypeNo = '';
  1140. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1141. const attrs = [{
  1142. name: "Code",
  1143. value: item.code,
  1144. }, {
  1145. name: 'Name',
  1146. value: item.name
  1147. }, {
  1148. name: 'Spec',
  1149. value: item.specs
  1150. }, {
  1151. name: 'Unit',
  1152. value: item.unit
  1153. }, {
  1154. name: 'Num',
  1155. value: item.tenderQuantity
  1156. }, {
  1157. name: 'BasePrice',
  1158. value: BasePrice
  1159. }, {
  1160. name: 'Price',
  1161. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1162. }, {
  1163. name: 'IsEquipment',
  1164. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1165. }, {
  1166. name: 'CostTypeNo',
  1167. value: CostTypeNo
  1168. }, {
  1169. name: 'ProfitRate',
  1170. value: getFeeRate(item.programID, 'profit', tenderProject)
  1171. },
  1172. {
  1173. name: 'TaxRate',
  1174. value: getFeeRate(item.programID, 'tax', tenderProject)
  1175. },
  1176. {
  1177. name: 'MpRatio',
  1178. value: item.subType == gljType.LABOUR ? 100 : 0
  1179. },
  1180. {
  1181. name: 'MaterialRatio',
  1182. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1183. },
  1184. {
  1185. name: 'MechRatio',
  1186. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1187. }
  1188. ]
  1189. Element.call(this, "Cost", attrs);
  1190. this.children.push(CostStructure(item));
  1191. }
  1192. function Ration(ration) {
  1193. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1194. let CostTypeNo = '';
  1195. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1196. const attrs = [{
  1197. name: "NormLibNo",
  1198. value: 'YSDE-000000-2018-86',
  1199. }, {
  1200. name: 'DisplayCode',
  1201. value: ration.code
  1202. }, {
  1203. name: 'Name',
  1204. value: ration.name
  1205. }, {
  1206. name: 'Unit',
  1207. value: ration.unit
  1208. }, {
  1209. name: 'Num',
  1210. value: ration.tenderQuantity
  1211. },
  1212. {
  1213. name: 'CostTypeNo',
  1214. value: CostTypeNo
  1215. },
  1216. {
  1217. name: 'ProfitRate',
  1218. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1219. },
  1220. {
  1221. name: 'TaxRate',
  1222. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1223. },
  1224. {
  1225. name: 'FabricationCost',
  1226. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1227. },
  1228. {
  1229. name: 'AdjustStatus',
  1230. value: ration.adjustState
  1231. }
  1232. ]
  1233. Element.call(this, "Norm", attrs);
  1234. this.children.push(CostStructure(ration));
  1235. this.children.push(Consume(ration));
  1236. }
  1237. }
  1238. function Consume(ration) {
  1239. let consume = new emptyElement('Consume');
  1240. for (let rg of ration.rationGLJList) {
  1241. consume.children.push(new ConsumeItem(rg));
  1242. }
  1243. return consume;
  1244. function ConsumeItem(rg) {
  1245. const attrs = [{
  1246. name: "Code",
  1247. value: rg.code,
  1248. }, {
  1249. name: "Consumption",
  1250. value: rg.tenderQuantity
  1251. }];
  1252. Element.call(this, "ConsumeItem", attrs);
  1253. }
  1254. }
  1255. function CostStructure(item) {
  1256. let CostStructure = new emptyElement('CostStructure');
  1257. for (let f of cpFeeTypes) {
  1258. if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
  1259. }
  1260. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
  1261. function CostItem(item,type) {
  1262. const attrs = [{
  1263. name: "ItemNo",
  1264. value: itemFeeMap[type],
  1265. }, {
  1266. name: 'Sum',
  1267. value: 0 //fee.tenderTotalFee
  1268. }]
  1269. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1270. Element.call(this, "CostItem", attrs);
  1271. }
  1272. return CostStructure;
  1273. }
  1274. }
  1275. }
  1276. }
  1277. function Params(tenderProject) {
  1278. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1279. let featrueMap = {};
  1280. let baseMap = {};
  1281. for (let f of feature) {
  1282. featrueMap[f.key] = f;
  1283. }
  1284. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1285. dispName: "基本信息",
  1286. });
  1287. for (let i of baseInfo.items) {
  1288. let key = i.key;
  1289. //if (i.dispName == "编制日期") key = "编制时间";
  1290. baseMap[key] = i;
  1291. }
  1292. let BuildType = "";
  1293. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1294. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1295. let Terrain = "";
  1296. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1297. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1298. let DesignSpeed = featrueMap["designSpeed"].value;
  1299. let Structure = "";
  1300. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1301. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1302. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1303. let RoadGrade = "";
  1304. if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1305. const attrs = [{
  1306. name: "PrjArea",
  1307. value: baseMap["location"] ? baseMap["location"].value : ""
  1308. },
  1309. {
  1310. name: "StartPileNo",
  1311. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1312. mustHasValue: true
  1313. },
  1314. {
  1315. name: "EndPileNo",
  1316. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1317. mustHasValue: true
  1318. },
  1319. {
  1320. name: "BuildType",
  1321. value: BuildType,
  1322. },
  1323. {
  1324. name: "Terrain",
  1325. value: Terrain,
  1326. mustHasValue: true
  1327. },
  1328. {
  1329. name: "RoadGrade",
  1330. value: RoadGrade,
  1331. mustHasValue: true
  1332. },
  1333. {
  1334. name: "DesignSpeed",
  1335. value: DesignSpeed,
  1336. mustHasValue: true
  1337. },
  1338. {
  1339. name: "Structure",
  1340. value: Structure,
  1341. mustHasValue: true
  1342. },
  1343. {
  1344. name: "SubgradeWidth",
  1345. value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
  1346. mustHasValue: true
  1347. },
  1348. {
  1349. name: "RoadLength",
  1350. value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
  1351. mustHasValue: true
  1352. },
  1353. {
  1354. name: "BridgeLength",
  1355. value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
  1356. mustHasValue: true
  1357. },
  1358. {
  1359. name: "TunnelLength",
  1360. value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
  1361. mustHasValue: true
  1362. },
  1363. {
  1364. name: "BriTunRate",
  1365. value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
  1366. mustHasValue: true
  1367. },
  1368. {
  1369. name: "InterchangeNum",
  1370. value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
  1371. mustHasValue: true
  1372. },
  1373. {
  1374. name: "StubLengths",
  1375. value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
  1376. mustHasValue: true
  1377. },
  1378. {
  1379. name: "LaneLength",
  1380. value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
  1381. mustHasValue: true
  1382. },
  1383. ];
  1384. Element.call(this, "Params", attrs);
  1385. }
  1386. function SummaryOfCost(totalItem, proItem,safeItem,feature) {
  1387. let attrs = [{
  1388. name: "TenderSumLimit",
  1389. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1390. },
  1391. {
  1392. name: "BidTotal",
  1393. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1394. },
  1395. {
  1396. name: "BillTotal",
  1397. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1398. },
  1399. {
  1400. name: "CostForHSE",
  1401. value: safeItem&&safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1402. },
  1403. {
  1404. name: "ProvisionalSums",
  1405. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1406. },
  1407. {
  1408. name: "Appraisal",
  1409. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1410. },
  1411. ];
  1412. if (isBidInvitation) {
  1413. attrs.splice(0, 3) //招标
  1414. }
  1415. //if (isControl) attrs.splice(1, 5); //控制价
  1416. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1417. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1418. if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1419. }
  1420. Element.call(this, "SummaryOfCost", attrs);
  1421. }
  1422. function MakeInfo(tenderProject) {
  1423. let property = tenderProject.property;
  1424. let baseMap = {};
  1425. let baseInfo = _.find(property.basicInformation, {
  1426. dispName: "基本信息",
  1427. });
  1428. for (let i of baseInfo.items) {
  1429. let key = i.key;
  1430. //if (i.dispName == "编制日期") key = "编制时间";
  1431. baseMap[key] = i;
  1432. }
  1433. //mustHasValue
  1434. const attrs = [{
  1435. name: "ValuationModel",
  1436. value: property.taxType,
  1437. },
  1438. {
  1439. name: "Manage",
  1440. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1441. },
  1442. {
  1443. name: "Designer",
  1444. value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
  1445. mustHasValue:true
  1446. },
  1447. {
  1448. name: "Compile",
  1449. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1450. },
  1451. {
  1452. name: "CompileApprover",
  1453. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1454. },
  1455. {
  1456. name: "CompileCertNo",
  1457. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
  1458. mustHasValue:true
  1459. },
  1460. {
  1461. name: "CompileDate",
  1462. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : "",
  1463. mustHasValue:true
  1464. },
  1465. {
  1466. name: "Review",
  1467. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
  1468. mustHasValue:true
  1469. },
  1470. {
  1471. name: "ReviewApprover",
  1472. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
  1473. mustHasValue:true
  1474. },
  1475. {
  1476. name: "ReviewCertNo",
  1477. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
  1478. mustHasValue:true
  1479. },
  1480. {
  1481. name: "ReviewDate",
  1482. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : "",
  1483. mustHasValue:true
  1484. },
  1485. {
  1486. name: "Examine",
  1487. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1488. mustHasValue:true
  1489. },
  1490. {
  1491. name: "ExamineApprover",
  1492. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1493. mustHasValue:true
  1494. },
  1495. {
  1496. name: "ExamineCertNo",
  1497. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1498. mustHasValue:true
  1499. },
  1500. {
  1501. name: "ExamineDate",
  1502. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1503. mustHasValue:true
  1504. },
  1505. {
  1506. name: "CompileExplain",
  1507. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1508. mustHasValue:true
  1509. },
  1510. {
  1511. name: "ExamineExplain",
  1512. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1513. mustHasValue:true
  1514. },
  1515. {
  1516. name: "ProjectExplain",
  1517. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  1518. mustHasValue:true
  1519. },
  1520. ];
  1521. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  1522. attrs.splice(11, 7);
  1523. attrs.splice(7, 1);
  1524. }
  1525. Element.call(this, "MakeInfo", attrs);
  1526. }
  1527. let data = new CprjInfo(projectData.name);
  1528. data.children.push(new SystemInfo(projectData));
  1529. data.children.push(new CostBasis());
  1530. let seriNo = 1;
  1531. let Rates = [];
  1532. let Practs = [];
  1533. let EprjInfos = [];
  1534. for (let c of projectData.children) {
  1535. let tenderProject = tenderDetailMap[c.ID];
  1536. let feeRataDatas = tenderProject.FeeRate.datas;
  1537. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1538. Practs.push(new Pract(tenderProject, seriNo));
  1539. EprjInfos.push(new EprjInfo(tenderProject));
  1540. seriNo++;
  1541. }
  1542. data.children.push(...Rates,...Practs,...EprjInfos);
  1543. return [{
  1544. data: data,
  1545. exportKind: exportKind,
  1546. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1547. }, ];
  1548. }
  1549. return {
  1550. entry,
  1551. };
  1552. })();