guangxi_common.js 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155
  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': 'SGJXSYF',
  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. "清单第100章总则": true,
  113. "清单第200章路基": true,
  114. "清单第300章路面": true,
  115. "清单第400章桥梁、涵洞": true,
  116. "清单第500章隧道": true,
  117. "清单第600章安全设施及预埋管线": true,
  118. "清单第700章绿化及环境保护设施": true,
  119. // "清单第800章机电工程": true,
  120. // "清单第900章附属区房建工程":true,
  121. "清单第900章机电工程": true, // 临时改
  122. }
  123. const ListCodeMap = {
  124. "第100章至700章清单合计": ["1", "A"],
  125. "清单 第100章 总则": ["一", "A1"],
  126. "清单 第200章 路基": ["二", "A2"],
  127. "清单 第300章 路面": ["三", "A3"],
  128. "清单 第400章 桥梁、涵洞": ["四", "A4"],
  129. "清单 第500章 隧道": ["五", "A5"],
  130. "清单 第600章 安全设施及预埋管线": ["六", "A6"],
  131. "清单 第700章 绿化及环境保护设施": ["七", "A7"],
  132. // "清单 第800章 机电工程": ["八", "A8"],
  133. // "清单 第900章 附属区房建工程": ["九", "A9"],
  134. "已包含在清单合计中的材料、工程设备、专业工程暂估价合计": ["8", "B"],
  135. "清单合计减去材料、工程设备、专业工程暂估价合计": ["9", "C"],
  136. "计日工合计": ["10", "D"],
  137. "劳务": ["10.1", "D1"],
  138. "材料": ["10.2", "D2"],
  139. "机械": ["10.3", "D3"],
  140. "暂列金额(不含计日工总额)": ["11", "E"],
  141. "投标报价": ["12", "Total"]
  142. }
  143. const ratioCodeMap = {
  144. "01ZJF": "0",
  145. "02JXF": "1",
  146. "03WHF": "2",
  147. "04ACFZF": "3"
  148. }
  149. const reg1 = new RegExp('\n', 'g'), reg2 = new RegExp('\r', 'g'),
  150. reg3 = new RegExp(' ', 'g'), reg4 = new RegExp('\t', 'g'),
  151. reg5 = new RegExp('(', 'g'), reg6 = new RegExp(')', 'g')
  152. ;
  153. function getBasePrice(projectGLJID, tenderProject) {
  154. let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
  155. id: projectGLJID
  156. })
  157. return glj ? gljUtil.getBasePrice(glj, null, null, null, decimalObj, false, _, scMathUtil) : 0;
  158. }
  159. function getFeeRate(programID, fieldName, tenderProject) {
  160. let rate = 0;
  161. let template = tenderProject.calcProgram.compiledTemplates;
  162. if (template[programID]) {
  163. let item = _.find(template[programID].calcItems, {
  164. fieldName: fieldName
  165. })
  166. if (item) rate = item.feeRate;
  167. }
  168. return rate;
  169. }
  170. function _billStrFilter(billStr) {
  171. let rst = billStr || '';
  172. if (typeof billStr === 'string') {
  173. rst = billStr.replace(reg1, '').replace(reg2, '').replace(reg3, '').replace(reg4, '').replace(reg5, '(').replace(reg6, ')');
  174. }
  175. return rst;
  176. }
  177. function billNameChecking(bNode, projectName, fixedFlag) {
  178. let data = bNode.data;
  179. let fail = null;
  180. let pass = true;
  181. if (data.flagsIndex && data.flagsIndex.fixed) {
  182. let flag = data.flagsIndex.fixed.flag;
  183. switch (flag) {
  184. case fixedFlag.ONE_SEVEN_BILLS:
  185. pass = data.name == "第100章至700章清单" || data.name == "第100章至700章清单合计";
  186. break;
  187. case fixedFlag.PROVISIONAL_TOTAL:
  188. pass = data.name == "已包含在清单合计中的材料、工程设备、专业工程暂估价合计";
  189. break;
  190. case fixedFlag.BILLS_TOTAL_WT_PROV:
  191. pass = data.name == "清单合计减去材料、工程设备、专业工程暂估价合计";
  192. break;
  193. case fixedFlag.DAYWORK_LABOR:
  194. pass = data.name == "计日工合计";
  195. break;
  196. /*
  197. case fixedFlag.LABOUR_SERVICE:
  198. pass = data.name == "劳务";
  199. break;
  200. case fixedFlag.MATERIAL:
  201. pass = data.name == "材料";
  202. break;
  203. case fixedFlag.CONSTRUCTION_MACHINE:
  204. pass = data.name == "机械";
  205. break;
  206. //*/
  207. case fixedFlag.PROVISIONAL:
  208. pass = data.name == "暂列金额(不含计日工总额)";
  209. break;
  210. case fixedFlag.TOTAL_COST:
  211. pass = data.name == "投标报价";
  212. break;
  213. case fixedFlag.ONE_HUNDRED_BILLS:
  214. // pass = data.name == "清单 第100章 总则";
  215. pass = _billStrFilter(data.name) == "清单第100章总则";
  216. break;
  217. }
  218. } else {
  219. if (bNode.parent) {
  220. const pdata = bNode.parent.data;
  221. if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
  222. if (!sectionNameMap[_billStrFilter(data.name)]) pass = false
  223. }
  224. }
  225. }
  226. pass = true; // 新要求,不检查清单名称了 (这个检测随时变化)
  227. if (pass == false) fail = { hint: `清单:"${data.name ? data.name : ""}",名字不符合规范!`, type: projectName }
  228. return fail;
  229. }
  230. /**
  231. *
  232. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  233. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  234. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  235. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  236. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  237. */
  238. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  239. const {
  240. CONFIG: {
  241. TYPE
  242. },
  243. UTIL,
  244. Element
  245. } = INTERFACE_EXPORT_BASE;
  246. const {
  247. EXPORT_KIND: {
  248. BID_INVITATION,
  249. BID_SUBMISSION,
  250. CONTROL
  251. },
  252. fixedFlag,
  253. } = window.commonConstants;
  254. let cprjType = {
  255. 1: "QDYS", // 招标
  256. 2: "QDYS", // 投标
  257. 3: "QDYS", // 控制价
  258. };
  259. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  260. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  261. const isControl = exportKind === CONTROL; // 是否是控制价
  262. function emptyElement(name) {
  263. this.name = name;
  264. this.attrs = [];
  265. this.children = [];
  266. }
  267. if (projectData.keyIDData === null || projectData.keyIDData === undefined) {
  268. projectData.keyIDData = {};
  269. }
  270. // 建设项目根节点信息
  271. function CprjInfo(projectName) {
  272. let baseInfo = _.find(projectData.property.basicInformation, {
  273. dispName: "基本信息",
  274. });
  275. let zbr = _.find(baseInfo.items, { "key": "tendereeName" });
  276. let Zbdljg = _.find(baseInfo.items, { "key": "proxy" });
  277. let Shijian = _.find(baseInfo.items, { "key": "compileDate" });
  278. let Zbbh = _.find(baseInfo.items, { "key": "projNum" });
  279. const attrs = [{
  280. name: "CprjName",
  281. value: projectName,
  282. },
  283. {
  284. name: "CprjType",
  285. value: cprjType[exportKind],
  286. },
  287. {
  288. name: "Zbbh",
  289. value: Zbbh ? Zbbh.value : ""
  290. },
  291. {
  292. name: "Zbr",
  293. value: zbr ? zbr.value : ""
  294. },
  295. {
  296. name: "Zbdljg",
  297. value: Zbdljg ? Zbdljg.value : ""
  298. },
  299. {
  300. name: "ShiJian",
  301. value: Shijian ? Shijian.value : ""
  302. },
  303. {
  304. name: "KeyId",
  305. value: projectData.keyIDData.cprjInfo || uuid.v1()
  306. }
  307. ];
  308. Element.call(this, "CprjInfo", attrs);
  309. }
  310. // 项目基本信息
  311. function SystemInfo(projectData) {
  312. let baseInfo = _.find(projectData.property.basicInformation, {
  313. dispName: "基本信息",
  314. });
  315. //“招标工程量清单”、“招标控制价”时,输出该字段,为导出该文件的当前时间
  316. let makeData = {
  317. value: UTIL.getNowFormatTime(true)
  318. }
  319. //投标的时候取基本信息的makeData字段
  320. if (isBidSubmission) makeData = _.find(baseInfo.items, { "key": "makeDate" });
  321. let hardID = UTIL.generateHardwareId();
  322. let [cpuId, diskId, macId] = hardID.split(";");
  323. const attrs = [{
  324. name: "Name",
  325. value: "广西公路工程造价文件数据交换标准化规定",
  326. },
  327. {
  328. name: "Version",
  329. value: "1.0",
  330. },
  331. {
  332. name: "SoftwareName",
  333. value: "纵横公路云造价",
  334. },
  335. {
  336. name: "SoftwareVer",
  337. value: "V" + VERSION,
  338. },
  339. {
  340. name: "SoftwareCompany",
  341. value: "珠海纵横创新软件有限公司",
  342. },
  343. {
  344. name: "MakeDate",
  345. value: makeData ? makeData.value : "",
  346. },
  347. {
  348. name: "SoftwareNumber",
  349. // value: window.btoa(userID),
  350. value: $('#certifyInputForGX')[0].value
  351. },
  352. {
  353. name: "HardNumber",
  354. value: window.btoa(diskId),
  355. },
  356. {
  357. name: "MacAddress",
  358. value: window.btoa(macId),
  359. },
  360. {
  361. name: "KeyId",
  362. value: projectData.keyIDData.systemInfo || uuid.v1()
  363. }
  364. ];
  365. // if (isBidSubmission)
  366. // attrs.splice(6, 0, {
  367. // name: "BidderVer",
  368. // value: UTIL.getNowFormatTime(true),
  369. // });
  370. Element.call(this, "SystemInfo", attrs);
  371. }
  372. //造价依据
  373. function CostBasis() {
  374. // ItemStandardNo="GYSFX-000000-2018-86"
  375. const attrs = [{
  376. name: "MakeRuleNo",
  377. value: "GYSBB-000000-2018-86",
  378. },
  379. {
  380. name: "MakeRuleName",
  381. value: "公路工程建设项目概算预算编制办法",
  382. },
  383. {
  384. name: "ItemStandardNo",
  385. value: "GYSFX-000000-2018-86",
  386. },
  387. {
  388. name: "KeyId",
  389. value: projectData.keyIDData.costBasis || uuid.v1()
  390. }
  391. ];
  392. Element.call(this, "CostBasis", attrs);
  393. //定额库信息
  394. //to do 改成实际的值
  395. function NormLib() {
  396. const attrs = [{
  397. name: "NormLibNo",
  398. value: "YSDE-000000-2018-86",
  399. },
  400. {
  401. name: "NormLibName",
  402. value: "部颁公路工程预算定额(2018)",
  403. },
  404. {
  405. name: "Type",
  406. value: "ZDEK",
  407. },
  408. {
  409. name: "KeyId",
  410. value: uuid.v1()
  411. },
  412. ];
  413. Element.call(this, "NormLib", attrs);
  414. }
  415. this.children.push(new NormLib());
  416. }
  417. function Rate(tenderProject, feeRateInfo, seirNo) {
  418. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  419. const attrs = [{
  420. name: "RateNo",
  421. value: seirNo,
  422. },
  423. {
  424. name: "Name",
  425. value: feeRateInfo.name,
  426. },
  427. {
  428. name: "RateLibNo",
  429. value: feeLibNoMap[feeRateInfo.libID],
  430. },
  431. {
  432. name: "KeyId",
  433. value: projectData.keyIDData.rate || uuid.v1()
  434. }
  435. ];
  436. Element.call(this, "Rate", attrs);
  437. let RateParams = new emptyElement("RateParams");
  438. RateParams.attrs = [{
  439. name: "KeyId",
  440. value: projectData.keyIDData.rateParams || uuid.v1()
  441. }];
  442. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  443. for (let s of subRates) {
  444. let sname = s.name.replace("(%)", "");
  445. sname = sname.replace("(%)", "");
  446. if (feeRateMap[sname]) {
  447. let value = "";
  448. if (s.editable) {
  449. let sel = _.find(s.optionList, {
  450. selected: true,
  451. });
  452. if (sel) {
  453. value = sel.name;
  454. } else if (gljUtil.isDef(s.value)) {
  455. value = s.value;
  456. }
  457. } else {
  458. value = _.findIndex(s.optionList, {
  459. selected: true,
  460. });
  461. if (value == -1) value = 0;
  462. }
  463. /* if (sname == '利润') tenderProject.ProfitRate = value;
  464. if (sname == '税金') tenderProject.TaxRate = value; */
  465. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  466. }
  467. }
  468. this.children.push(RateParams);
  469. function RateParam(RateTypeNo, RateParamNo) {
  470. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  471. const attrs = [{
  472. name: "RateTypeNo",
  473. value: RateTypeNo,
  474. },
  475. {
  476. name: "RateParamNo",
  477. value: RateParamNo,
  478. },
  479. {
  480. name: "Ratio",
  481. value: "100",
  482. },
  483. {
  484. name: "KeyId",
  485. value: uuid.v1()
  486. }
  487. ];
  488. Element.call(this, "RateParam", attrs);
  489. }
  490. let RateValues = new emptyElement("RateValues");
  491. RateValues.attrs = [{
  492. name: "KeyId",
  493. value: projectData.keyIDData.rateValues || uuid.v1()
  494. }];
  495. function RateValue(CostTypeNo, RateTypeNo, value) {
  496. const attrs = [{
  497. name: "CostTypeNo",
  498. value: CostTypeNo,
  499. },
  500. {
  501. name: "RateTypeNo",
  502. value: RateTypeNo,
  503. },
  504. {
  505. name: "RateValue",
  506. value: value,
  507. },
  508. {
  509. name: "KeyId",
  510. value: uuid.v1()
  511. }
  512. ];
  513. Element.call(this, "RateValue", attrs);
  514. }
  515. let prefix = "";
  516. for (let r of feeRateInfo.rates) {
  517. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  518. if (feeRateMap[r.name] && r.ParentID) {
  519. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  520. }
  521. }
  522. this.children.push(RateValues);
  523. }
  524. function Pract(tpdata, seriNo) {
  525. let pgljData = tpdata.projectGLJ.datas;
  526. let decimalObj = tpdata.property.decimal;
  527. let ccsObj = $("#vvTax")[0];
  528. const attrs = [{
  529. name: "PractNo",
  530. value: seriNo,
  531. },
  532. {
  533. name: "Name",
  534. value: pgljData.constData.usedUnitPriceInfo.name,
  535. },
  536. {
  537. name: "TaxLibNo",
  538. value: ccsObj.options[ccsObj.selectedIndex].text //读取车船税标准名称
  539. },
  540. {
  541. name: "PriceFileNo",
  542. value: "JGXX"
  543. },
  544. {
  545. name: "KeyId",
  546. value: projectData.keyIDData.pract || uuid.v1()
  547. }
  548. ];
  549. Element.call(this, "Pract", attrs);
  550. let Param = {
  551. name: "Param",
  552. attrs: [{
  553. name: "TaxLibNo",
  554. value: "CCSBZ-440000-2019-544",
  555. },
  556. {
  557. name: "AuxRate",
  558. value: pgljData.constData.assistProductionFeeRate,
  559. },
  560. ],
  561. children: [],
  562. };
  563. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  564. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  565. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  566. for (let e of elecDatas) {
  567. let Electro = {
  568. name: "Electro",
  569. attrs: [{
  570. name: "Code",
  571. value: e.code,
  572. },
  573. {
  574. name: "Price",
  575. value: e.electPrice,
  576. },
  577. {
  578. name: "Ratio",
  579. value: e.coe,
  580. },
  581. ],
  582. children: [],
  583. };
  584. Param.children.push(Electro);
  585. }
  586. }
  587. // this.children.push(Param);
  588. function Mp(g) {
  589. const attrs = [{
  590. name: "Code",
  591. value: g.code,
  592. },
  593. {
  594. name: "PractName",
  595. value: g.name,
  596. },
  597. {
  598. name: "Spec",
  599. value: g.specs,
  600. },
  601. {
  602. name: "Unit",
  603. value: g.unit,
  604. },
  605. {
  606. name: "BudgetPrice",
  607. value: g.priceInfo.tenderPrice,
  608. },
  609. {
  610. name: "NormPrice",
  611. value: g.priceInfo.basePrice,
  612. },
  613. {
  614. name: "IsAdd",
  615. value: g.unit_price.is_add,
  616. },
  617. {
  618. name: "Num",
  619. value: (g.quantity) ? g.quantity : 0,
  620. },
  621. {
  622. name: "BudgetSum",
  623. value: scMathUtil.roundForObj(g.quantity * g.unit_price.market_price, tpdata.property.decimal.bills.unitPrice), //项目的人工费(人工预算价*人工数量)
  624. },
  625. {
  626. name: "NormSum",
  627. value: scMathUtil.roundForObj(g.quantity * g.unit_price.base_price, tpdata.property.decimal.bills.unitPrice), //项目的定额人工费(人工定额价*人工数量)
  628. },
  629. {
  630. name: "KeyId",
  631. value: uuid.v1()
  632. },
  633. ];
  634. Element.call(this, "Mp", attrs);
  635. }
  636. function Material(g) {
  637. const attrs = [{
  638. name: "Code",
  639. value: g.code,
  640. },
  641. {
  642. name: "PractName",
  643. value: g.name,
  644. },
  645. {
  646. name: "Spec",
  647. value: g.specs,
  648. },
  649. {
  650. name: "Unit",
  651. value: g.unit,
  652. },
  653. {
  654. name: "BudgetPrice",
  655. value: g.priceInfo.tenderPrice,
  656. },
  657. {
  658. name: "NormPrice",
  659. value: g.priceInfo.basePrice,
  660. },
  661. {
  662. name: "IsAdd",
  663. value: g.unit_price.is_add,
  664. },
  665. {
  666. name: "OrgPrice",
  667. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  668. },
  669. {
  670. name: "TransFee",
  671. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  672. },
  673. {
  674. name: "GwRate",
  675. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  676. },
  677. {
  678. name: "OffSiteLf",
  679. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  680. },
  681. {
  682. name: "OnSiteLf",
  683. value: 0,
  684. },
  685. {
  686. name: "LoadLf",
  687. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  688. },
  689. {
  690. name: "StoreRate",
  691. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  692. },
  693. {
  694. name: "PackageRecycleFee",
  695. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  696. },
  697. {
  698. name: "Num",
  699. value: (g.quantity) ? g.quantity : 0,
  700. },
  701. {
  702. name: "BudgetSum",
  703. value: scMathUtil.roundForObj(g.quantity * g.unit_price.market_price, tpdata.property.decimal.bills.unitPrice), //项目的材料费(材料预算价*材料数量)
  704. },
  705. {
  706. name: "NormSum",
  707. value: scMathUtil.roundForObj(g.quantity * g.unit_price.base_price, tpdata.property.decimal.bills.unitPrice), //项目的定额材料费(材料定额价*材料数量)
  708. },
  709. {
  710. name: "KeyId",
  711. value: uuid.v1()
  712. },
  713. ];
  714. Element.call(this, "Material", attrs);
  715. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  716. // let index = gljUtil.getIndex(g);
  717. // let orList = [];
  718. // for (let o of pgljData.originalList) {
  719. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  720. // }
  721. // if (orList.length > 0) this.children = orList;
  722. // }
  723. // function CostStructure(r) {
  724. // //待获取
  725. // this.name = "CostStructure";
  726. // this.attrs = [];
  727. // this.children = [];
  728. // }
  729. // function Consume(r, o) {
  730. // this.name = "Consume";
  731. // this.attrs = [{
  732. // name: "KeyId",
  733. // value: uuid.v1()
  734. // }];
  735. // this.children = [];
  736. // for (let g of o.ration_gljs) {
  737. // if (g.rationID == r.ID) {
  738. // let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  739. // this.children.push(new ConsumeItem(g, r_quantity));
  740. // }
  741. // }
  742. // }
  743. // function ConsumeItem(g, ration_quantity) {
  744. // let costType = parseInt(g.type);
  745. // if (costType < 100) {
  746. // costType = 1;
  747. // } else if (costType >= 300) {
  748. // costType = 3;
  749. // } else {
  750. // //判断主材
  751. // for (let pglj of pgljData.gljList) {
  752. // if (pglj.glj_id === g.GLJID) {
  753. // if (pglj.is_main_material == 1) {
  754. // costType = 3;
  755. // } else {
  756. // costType = 2;
  757. // }
  758. // break;
  759. // }
  760. // }
  761. // }
  762. // const attrs = [{
  763. // name: "Code", //待获取
  764. // value: g.code,
  765. // },
  766. // {
  767. // name: "Consumption",
  768. // value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  769. // },
  770. // {
  771. // name: "CostType",
  772. // value: costType,
  773. // },
  774. // {
  775. // name: "KeyId",
  776. // value: uuid.v1()
  777. // },
  778. // ];
  779. // Element.call(this, "ConsumeItem", attrs);
  780. // }
  781. // function Norm(r, o) {
  782. // const attrs = [{
  783. // name: "NormLibNo", //待获取
  784. // value: "",
  785. // },
  786. // {
  787. // name: "DisplayCode",
  788. // value: r.code,
  789. // },
  790. // {
  791. // name: "Name",
  792. // value: r.name,
  793. // },
  794. // {
  795. // name: "Unit",
  796. // value: r.unit,
  797. // },
  798. // {
  799. // name: "Num",
  800. // value: r.quantity || 0,
  801. // },
  802. // {
  803. // name: "CostTypeNo",
  804. // value: "", //待获取
  805. // },
  806. // {
  807. // name: "FabricationCost", //待获取
  808. // value: "",
  809. // },
  810. // {
  811. // name: "AdjustStatus",
  812. // value: "",
  813. // },
  814. // ];
  815. // Element.call(this, "Norm", attrs);
  816. // this.children.push(new CostStructure(r));
  817. // this.children.push(new Consume(r, o));
  818. // }
  819. // function SelfCollect(o) {
  820. // const attrs = [{
  821. // name: "OtherCost",
  822. // value: 0,
  823. // },];
  824. // Element.call(this, "SelfCollect", attrs);
  825. // for (let r of o.rations) {
  826. // this.children.push(new Norm(r, o));
  827. // }
  828. // }
  829. // function OrgPrices(o) {
  830. // const attrs = [{
  831. // name: "OrgPricevalue",
  832. // value: o.supplyPrice,
  833. // },
  834. // {
  835. // name: "Ratio",
  836. // value: o.coe,
  837. // },
  838. // ];
  839. // Element.call(this, "OrgPrices", attrs);
  840. // if (!o.rations) return;
  841. // this.children.push(new SelfCollect(o));
  842. // }
  843. }
  844. function Mech(g, gljKeyMap) {
  845. const attrs = [{
  846. name: "Code",
  847. value: g.code,
  848. },
  849. {
  850. name: "PractName",
  851. value: g.name,
  852. },
  853. {
  854. name: "Spec",
  855. value: g.specs,
  856. },
  857. {
  858. name: "Unit",
  859. value: g.unit,
  860. },
  861. {
  862. name: "BudgetPrice",
  863. value: g.priceInfo.tenderPrice,
  864. },
  865. {
  866. name: "NormPrice",
  867. value: g.priceInfo.basePrice,
  868. },
  869. {
  870. name: "IsAdd",
  871. value: g.unit_price.is_add,
  872. },
  873. {
  874. name: "Num",
  875. value: (g.quantity) ? g.quantity : 0,
  876. },
  877. {
  878. name: "BudgetSum",
  879. value: scMathUtil.roundForObj(g.quantity * g.unit_price.market_price, tpdata.property.decimal.bills.unitPrice), //项目的机械费(机械预算价*机械数量)
  880. },
  881. {
  882. name: "NormSum",
  883. value: scMathUtil.roundForObj(g.quantity * g.unit_price.base_price, tpdata.property.decimal.bills.unitPrice), //项目的定额机械费(机械定额价*机械数量)
  884. },
  885. {
  886. name: "KeyId",
  887. value: uuid.v1()
  888. },
  889. ];
  890. Element.call(this, "Mech", attrs);
  891. let FixedCostItems = [];
  892. let fcsum = 0;
  893. let VariableCostItems = [];
  894. let vcsum = 0;
  895. if (g.ratio_data && g.ratio_data.length > 0) {
  896. for (let ratio of g.ratio_data) {
  897. let rIndex = gljUtil.getIndex(ratio);
  898. let rglj = gljKeyMap[rIndex];
  899. let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
  900. if (FixedCostMap[ratio.name]) {
  901. FixedCostItems.push(new FixedCostItem(ratio));
  902. fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
  903. } else {
  904. VariableCostItems.push(new VariableCostItem(ratio));
  905. vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
  906. }
  907. }
  908. }
  909. if (FixedCostItems.length > 0) {
  910. let fc = new FixedCost(fcsum);
  911. fc.children = FixedCostItems;
  912. this.children.push(fc);
  913. }
  914. if (VariableCostItems.length > 0) {
  915. let vc = new VariableCost(vcsum);
  916. vc.children = VariableCostItems;
  917. this.children.push(vc);
  918. }
  919. function VariableCost(sum) {
  920. const attrs = [{
  921. name: "VariableCostSum",
  922. value: sum,
  923. }, {
  924. name: "KeyId",
  925. value: uuid.v1()
  926. }];
  927. Element.call(this, "VariableCost", attrs);
  928. }
  929. function VariableCostItem(item) {
  930. const attrs = [{
  931. name: "VariableCostNo",
  932. value: item.code,
  933. }, {
  934. name: "Consumption",
  935. value: item.consumption,
  936. }, {
  937. name: "KeyId",
  938. value: uuid.v1()
  939. }]
  940. Element.call(this, "VariableCostItem", attrs);
  941. }
  942. function FixedCost(sum) {
  943. const attrs = [{
  944. name: "FixedCostSum",
  945. value: sum,
  946. }, {
  947. name: "FixedRate",
  948. value: 1,
  949. }, {
  950. name: "KeyId",
  951. value: uuid.v1()
  952. }];
  953. Element.call(this, "FixedCost", attrs);
  954. }
  955. function FixedCostItem(item) {
  956. const attrs = [{
  957. name: "FixedCostNo",
  958. value: ratioCodeMap[item.code],
  959. }, {
  960. name: "Sum",
  961. value: item.consumption,
  962. }, {
  963. name: "KeyId",
  964. value: uuid.v1()
  965. }]
  966. Element.call(this, "FixedCostItem", attrs);
  967. }
  968. }
  969. let Mps = new emptyElement("Mps");
  970. Mps.attrs = [{
  971. name: "KeyId",
  972. value: projectData.keyIDData.mps || uuid.v1()
  973. }];
  974. let Materials = new emptyElement("Materials");
  975. Materials.attrs = [{
  976. name: "KeyId",
  977. value: projectData.keyIDData.materials || uuid.v1()
  978. }];
  979. let Mechs = new emptyElement("Mechs");
  980. Mechs.attrs = [{
  981. name: "KeyId",
  982. value: projectData.keyIDData.mechs || uuid.v1()
  983. }];
  984. let gljKeyMap = {};
  985. let temMechs = [];
  986. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  987. for (let g of pgljData.gljList) {
  988. if (!g.quantity) {
  989. continue;
  990. }
  991. let type = g.type + "";
  992. gljKeyMap[gljUtil.getIndex(g)] = g;
  993. type = type.charAt(0);
  994. if (type == "1") {
  995. Mps.children.push(new Mp(g));
  996. } else if (type == "2" || type == 5) {
  997. Materials.children.push(new Material(g));
  998. } else if (type == "3") {
  999. temMechs.push(g);
  1000. }
  1001. }
  1002. for (let t of temMechs) {
  1003. Mechs.children.push(new Mech(t, gljKeyMap));
  1004. }
  1005. }
  1006. this.children.push(Mps);
  1007. this.children.push(Materials);
  1008. this.children.push(Mechs);
  1009. }
  1010. function EprjInfo(tenderProject) {
  1011. let bills = tenderProject.Bills.datas;
  1012. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1013. let totalItem = null;
  1014. let proItem = null; //暂列金额项
  1015. let safeItem = null;
  1016. let oneToSevenItem = null;
  1017. for (let b of bills) {
  1018. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  1019. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  1020. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) oneToSevenItem = b;
  1021. if (b.code == "102-3" && b.name == "安全生产费") safeItem = b;
  1022. }
  1023. const attrs = [{
  1024. name: "Name",
  1025. value: tenderProject.projectInfo.name,
  1026. },
  1027. {
  1028. name: "Sums",
  1029. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1030. },
  1031. {
  1032. name: "KeyId",
  1033. value: projectData.keyIDData.eprjInfo || uuid.v1()
  1034. }
  1035. ];
  1036. //输出控制价、投标文件时,取调价后的标段总造价。
  1037. //输出招标文件时,取0
  1038. if (isBidInvitation) attrs[1].value = 0;
  1039. Element.call(this, "EprjInfo", attrs);
  1040. // this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature));
  1041. this.children.push(new MakeInfo(tenderProject));
  1042. this.children.push(new Params(tenderProject));
  1043. this.children.push(new getBillsItems(tenderProject));
  1044. // this.children.push(new getIndexs(tenderProject));
  1045. // let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
  1046. // if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
  1047. }
  1048. function _getZeroValueIfNotValid(orgVal) {
  1049. let rst = orgVal;
  1050. if (orgVal === undefined || orgVal === null || orgVal === "") {
  1051. rst = 0;
  1052. }
  1053. return rst;
  1054. }
  1055. function _getNumValueByExportKind(orgSum) {
  1056. let rst = orgSum;
  1057. // const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  1058. // const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  1059. // const isControl = exportKind === CONTROL; // 是否是控制价
  1060. //根据导出类型(上面3个),输出实际合计或price
  1061. if (isBidInvitation) {
  1062. rst = 0;
  1063. }
  1064. return rst;
  1065. }
  1066. function _getStrValueByExportKind(orgStr) {
  1067. let rst = orgStr;
  1068. if (isBidInvitation) {
  1069. rst = '';
  1070. }
  1071. return rst;
  1072. }
  1073. function getBidEvaluationMainMaterial(tenderProject) {
  1074. let bidMaterials = [];
  1075. let i = 1;
  1076. for (let b of tenderProject.bidMaterialData) {
  1077. bidMaterials.push(new BidEvaluationMainMaterial(b, i));
  1078. i++
  1079. }
  1080. return bidMaterials;
  1081. function BidEvaluationMainMaterial(b, index) {
  1082. const attrs = [{
  1083. name: "Code",
  1084. value: b.seq,
  1085. },
  1086. {
  1087. name: "Number",
  1088. value: b.code
  1089. },
  1090. {
  1091. name: "Name",
  1092. value: b.name
  1093. },
  1094. {
  1095. name: "Specification",
  1096. value: b.specs
  1097. },
  1098. {
  1099. name: "Unit",
  1100. value: b.unit
  1101. },
  1102. {
  1103. name: "Price",
  1104. value: b.marketPrice || '0',
  1105. type: TYPE.DECIMAL
  1106. },
  1107. {
  1108. name: "LimitedPrice",
  1109. value: b.marketPrice || '0',
  1110. type: TYPE.DECIMAL
  1111. },
  1112. {
  1113. name: "Quantity",
  1114. value: 0,//b.quantity
  1115. type: TYPE.DECIMAL
  1116. },
  1117. {
  1118. name: "Total",
  1119. value: 0//b.totalPrice
  1120. },
  1121. {
  1122. name: "Remark",
  1123. value: b.remark
  1124. }
  1125. ];
  1126. if (isBidSubmission || isControl) {
  1127. attrs[7].value = b.quantity;
  1128. attrs[8].value = b.totalPrice;
  1129. }
  1130. Element.call(this, "BidEvaluationMainMaterial", attrs);
  1131. }
  1132. }
  1133. function getIndexs(tenderProject) {
  1134. let Indexs = new emptyElement('Indexs');
  1135. Indexs.attrs = [{
  1136. name: "KeyId",
  1137. value: projectData.keyIDData.indexs || uuid.v1()
  1138. // value: uuid.v1()
  1139. }];
  1140. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1141. for (let f of feature) {
  1142. if (f.code) Indexs.children.push(new IndexItem(f))
  1143. }
  1144. return Indexs;
  1145. function IndexItem(fea) {
  1146. const attrs = [{
  1147. name: "Code",
  1148. value: fea.code,
  1149. },
  1150. {
  1151. name: "Name",
  1152. value: fea.dispName,
  1153. },
  1154. {
  1155. name: "Unit",
  1156. value: fea.unit,
  1157. },
  1158. {
  1159. name: "Value",
  1160. value: fea.value,
  1161. },
  1162. {
  1163. name: "Remark",
  1164. value: fea.remark,
  1165. },
  1166. {
  1167. name: "KeyId",
  1168. value: uuid.v1()
  1169. }
  1170. ]
  1171. Element.call(this, "IndexItem", attrs);
  1172. }
  1173. }
  1174. function getBillsItems(tenderProject) {
  1175. let items = new emptyElement("Items");
  1176. items.attrs = [{
  1177. name: "KeyId",
  1178. value: projectData.keyIDData.items || uuid.v1()
  1179. }];
  1180. let rootNodes = tenderProject.mainTree.roots;
  1181. for (let r of rootNodes) {
  1182. setItem(r, -1, items.children);
  1183. }
  1184. return items;
  1185. function setItem(bNode, level, list) {
  1186. if (bNode.sourceType == ModuleNames.ration) return;
  1187. let item = new bill(bNode, level);
  1188. if (bNode.children && bNode.children.length > 0) {
  1189. level += 1;
  1190. for (let c of bNode.children) {
  1191. setItem(c, level, item.children);
  1192. }
  1193. }
  1194. list.push(item);
  1195. function getCalcType(node) {
  1196. /*
  1197. 判断是否父项:
  1198. 是父项,则取1;
  1199. 是叶子项,则判断其下有无套定额/量价/工料机:
  1200. 有则取1;
  1201. 无则判断有无基数计算:
  1202. 有则取2;
  1203. 无则取3 */
  1204. if (node.children && node.children.length > 0) {
  1205. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  1206. } else {
  1207. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  1208. }
  1209. }
  1210. function getItemType(node) {
  1211. let Bills = projectObj.project.Bills;
  1212. //是100~900章部分、或是计日工部分,叶子清单输出1,父项输出0;
  1213. if (Bills.isBelongOneToSeven(node) || Bills.isBelongDayWork(node)) {
  1214. if (node.children && node.children.length > 0) {
  1215. return node.children[0].sourceType == ModuleNames.ration ? 1 : 0
  1216. }
  1217. return 1 //叶子清单输出1
  1218. } else {
  1219. return 0;
  1220. /* //非100~900章部分,
  1221. // 是暂列金额,判断暂列金额的金额等于0,则输出为0;暂列金额的金额不等于0,则输出为1;
  1222. if (node.data.name && node.data.name.indexOf("暂列金额") != -1) {
  1223. let sum = node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : "";
  1224. return gljUtil.isNotEmpty(sum) ? 1 : 0
  1225. } else { //非暂列金额,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
  1226. return gljUtil.isNotEmpty(node.data.quantity) ? 1 : 0
  1227. } */
  1228. }
  1229. }
  1230. function _getDecimal(unit) {
  1231. let rst = 3;
  1232. if (tenderProject.property.billsQuantityDecimal) {
  1233. for (let bdec of tenderProject.property.billsQuantityDecimal) {
  1234. if (bdec.unit === '其他未列单位') {
  1235. rst = bdec.decimal;
  1236. if (unit === null || unit === undefined || unit === '') {
  1237. break;
  1238. }
  1239. }
  1240. if (bdec.unit === unit) {
  1241. rst = bdec.decimal;
  1242. break;
  1243. }
  1244. }
  1245. }
  1246. return rst;
  1247. }
  1248. function _isChapter100(bNode) {
  1249. let rst = false;
  1250. if (bNode) {
  1251. rst = _billStrFilter(bNode.data.name) == "清单第100章总则";
  1252. if (!rst && bNode.parent) {
  1253. rst = _isChapter100(bNode.parent);
  1254. }
  1255. }
  1256. return rst;
  1257. }
  1258. function _getMapStrByBillFlag(billData) {
  1259. let rst = ['', ''];
  1260. if (billData && billData.flags && billData.flags.length > 0) {
  1261. for (let idx = 0; idx < billData.flags.length; idx++) {
  1262. if (billData.flags[idx].fieldName === 'fixed') {
  1263. switch(billData.flags[idx].flag) {
  1264. case 23:
  1265. rst = ["10.1", "D1"]; // 劳务
  1266. break;
  1267. case 24:
  1268. rst = ["10.2", "D2"]; // 材料
  1269. break;
  1270. case 25:
  1271. rst = ["10.3", "D3"]; // 机械
  1272. break;
  1273. case 19:
  1274. rst = ["1", "A"]; // 第100章至700章清单
  1275. break;
  1276. case 26:
  1277. rst = ["11", "E"]; // 暂列金额 fixedFlag.PROVISIONAL
  1278. break;
  1279. default:
  1280. break;
  1281. }
  1282. break;
  1283. }
  1284. }
  1285. }
  1286. return rst;
  1287. }
  1288. function bill(bNode, level) {
  1289. let data = bNode.data;
  1290. let CostKind = 3;
  1291. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  1292. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  1293. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  1294. let CalcType = getCalcType(bNode);
  1295. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  1296. let ProvisionalType = "";
  1297. if (data.specialProvisional == "材料暂估") ProvisionalType = 0;
  1298. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  1299. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  1300. //MpRatio
  1301. let MpRatio = "";
  1302. let MaterialRatio = "";
  1303. let MechRatio = "";
  1304. if (data.quantityCoe) {
  1305. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  1306. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  1307. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  1308. }
  1309. let fail = null;
  1310. // if (!isBidSubmission) {
  1311. fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag);
  1312. // }
  1313. // 投标的不去判断
  1314. // let fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag)
  1315. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  1316. let ListCode = "";
  1317. if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name][0];
  1318. if (data.code && data.code != "") ListCode = data.code;
  1319. let formulaCode = "";
  1320. // ListCodeFlagMap
  1321. if (ListCodeMap[data.name]) {
  1322. formulaCode = ListCodeMap[data.name][1];
  1323. } else {
  1324. formulaCode = _getMapStrByBillFlag(data)[1];
  1325. }
  1326. let perKeyId = '';
  1327. if (data.ParentID != -1) {
  1328. const parent = bNode.tree.findNode(bNode.data.ParentID)
  1329. if (parent) {
  1330. perKeyId = parent.data.keyIDData?.item || parent.data.ID;
  1331. }
  1332. }
  1333. const attrs = [{
  1334. name: "ListCode",
  1335. value: ListCode,
  1336. },
  1337. {
  1338. name: "ListName",
  1339. value: data.name,
  1340. fail: fail
  1341. },
  1342. {
  1343. name: "Unit",
  1344. value: data.unit,
  1345. },
  1346. {
  1347. name: "Num",
  1348. value: data.quantity || 0,
  1349. type: TYPE.DECIMAL,
  1350. toFix: _getDecimal(data.unit)
  1351. },
  1352. // {
  1353. // name: "QtyFormula",
  1354. // value: _getStrValueByExportKind(data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : ""),
  1355. // type: TYPE.DECIMAL,
  1356. // toFix:2
  1357. // },
  1358. {
  1359. name: "Price",
  1360. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1361. type: TYPE.DECIMAL,
  1362. toFix: 2
  1363. },
  1364. {
  1365. name: "Sum",
  1366. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1367. type: TYPE.DECIMAL,
  1368. toFix: 2
  1369. },
  1370. {
  1371. name: "ProvisionalType",
  1372. value: ProvisionalType,
  1373. mustHasValue: true
  1374. },
  1375. {
  1376. name: "MeterRules",
  1377. value: "",
  1378. },
  1379. {
  1380. name: "Content",
  1381. value: data.jobContentText,
  1382. },
  1383. {
  1384. name: "Remarks",
  1385. value: data.remark,
  1386. },
  1387. {
  1388. name: "ItemType",
  1389. value: getItemType(bNode),
  1390. },
  1391. {
  1392. name: "FormulaCode",
  1393. value: formulaCode
  1394. },
  1395. {
  1396. name: "KeyId",
  1397. value: data.keyIDData?.item || data.ID
  1398. },
  1399. {
  1400. name: "PerKeyId",
  1401. value: perKeyId
  1402. }
  1403. ];
  1404. //投标、招标控制价时。取单价。
  1405. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1406. if (isBidSubmission || isControl || CostKind == 1 || CostKind == 2) {
  1407. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1408. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1409. //暂列金额 数量为0的时候,单价输出0
  1410. if (CostKind == 2 && !gljUtil.isNotEmpty(data.quantity)) attrs[4].value = 0
  1411. }
  1412. // 计日工合计下的劳务、材料、机械Item节点单价及合价(Price, Sum)也要输出
  1413. if (bNode.children && bNode.children.length === 0 && _getFee(bNode) > 0) { //先检测是否有费用
  1414. // 再检测是否计日工合计清单下
  1415. if (_chkIfJRGHJ(bNode, ['计日工合计'])) {
  1416. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1417. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1418. }
  1419. }
  1420. // 清单的专项暂定有选择了专业工程的清单Item节点单价及合价(Price, Sum)也要输出
  1421. if (ProvisionalType === 2) {
  1422. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1423. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1424. }
  1425. //特殊清单
  1426. if (isBidInvitation) {
  1427. // 招标工程量清单 读计日工和已包含在清单合计中的材料、工程设备、专业工程暂估价合计。
  1428. const specialBills = ['计日工合计', '已包含在清单合计中的材料、工程设备、专业工程暂估价合计'];
  1429. if (bNode.children && bNode.children.length > 0 && _chkIfJRGHJ(bNode, specialBills)) {
  1430. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1431. }
  1432. if (bNode.data.name === '投标报价') {
  1433. let rootNodes = tenderProject.mainTree.roots;
  1434. let ttlSum = 0;
  1435. for (let r of rootNodes) {
  1436. if (specialBills.includes(r.data.name)) {
  1437. ttlSum += _getFee(r);
  1438. }
  1439. }
  1440. attrs[5].value = '' + ttlSum;
  1441. }
  1442. }
  1443. // 导出招标时 清单100章Price、Sum不用输出
  1444. if (isBidInvitation && _isChapter100(bNode)) {
  1445. attrs[4].value = 0;
  1446. attrs[5].value = 0;
  1447. }
  1448. Element.call(this, "Item", attrs);
  1449. let cc = CostComposition(bNode);
  1450. if (cc) this.children.push(cc);
  1451. this.children.push(CostStructure(data))
  1452. // function _chkIfHas
  1453. function _chkIfJRGHJ(bNode, exArr = []) {
  1454. //检测是否在指定清单的子目录下(如:计日工合计等)
  1455. let rst = false;
  1456. let pNode = bNode;
  1457. while (pNode !== null && pNode !== undefined) {
  1458. if ((typeof pNode.data.name === 'string') && exArr.includes(pNode.data.name)) {
  1459. rst = true;
  1460. break;
  1461. }
  1462. pNode = pNode.parent;
  1463. }
  1464. return rst;
  1465. }
  1466. function _getFee(bNode, key = 'common', valueKey = 'tenderTotalFee') {
  1467. let rstSum = 0;
  1468. if (bNode) {
  1469. let dtlB = (bNode.data) ? bNode.data : bNode;
  1470. if (dtlB.fees) {
  1471. for (let fee of dtlB.fees) {
  1472. if (fee.fieldName === key) {
  1473. rstSum = parseFloat(fee[valueKey]);
  1474. if (isNaN(rstSum)) rstSum = 0;
  1475. break;
  1476. }
  1477. }
  1478. }
  1479. }
  1480. return rstSum;
  1481. }
  1482. function _chkIfNeedCostComposition(bNode) {
  1483. let rst = isBidInvitation && !(ProvisionalType === 0 || ProvisionalType === 1);
  1484. if (rst) {
  1485. //计日工合计下的劳务、材料、机械 有费用也要输出
  1486. if (bNode.children && bNode.children.length === 0 && _getFee(bNode) > 0) { //先检测是否有费用
  1487. // 再检测是否计日工合计清单下
  1488. rst = !_chkIfJRGHJ(bNode, ['计日工合计']);
  1489. }
  1490. }
  1491. return rst;
  1492. }
  1493. function CostComposition(bNode) {
  1494. if (_chkIfNeedCostComposition(bNode)) return null;
  1495. let CostComposition = new emptyElement('CostComposition');
  1496. CostComposition.attrs = [{
  1497. name: "KeyId",
  1498. value: bNode.data.keyIDData?.costComposition || uuid.v1()
  1499. }];
  1500. let Norms = [];
  1501. let Costs = [];
  1502. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1503. for (let r of bNode.children) {
  1504. if (r.data.type == rationType.ration) {
  1505. if (isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
  1506. Norms.push(new Ration(r.data));
  1507. } else {
  1508. Costs.push(new Cost(r.data));
  1509. }
  1510. }
  1511. }
  1512. if (Costs.length === 0 && _chkIfJRGHJ(bNode, ['计日工合计'])) {
  1513. Costs.push(new Cost(bNode.data));
  1514. for (let idx = 0; idx < Costs[Costs.length - 1].attrs.length; idx++) {
  1515. if (Costs[Costs.length - 1].attrs[idx].name === 'Num') {
  1516. Costs[Costs.length - 1].attrs[idx].value = '' + (bNode.data.quantity || 0);
  1517. } else if (Costs[Costs.length - 1].attrs[idx].name === 'BasePrice') {
  1518. Costs[Costs.length - 1].attrs[idx].value = '' + _getFee(bNode, 'common', 'tenderUnitFee');
  1519. }
  1520. }
  1521. }
  1522. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1523. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1524. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1525. return (CostComposition.children.length > 0) ? CostComposition : null;
  1526. //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
  1527. function isEmptyRation(ration) {
  1528. return !gljUtil.isNotEmpty(ration.code) && !gljUtil.isNotEmpty(ration.name) && !gljUtil.isNotEmpty(ration.unit) && (!gljUtil.isNotEmpty(ration.quantity) || ration.quantity == 0)
  1529. }
  1530. function Formula(bills) {
  1531. const attrs = [{
  1532. name: "Name",
  1533. value: bills.name
  1534. },
  1535. {
  1536. name: "Formulas",
  1537. value: bills.calcBase
  1538. },
  1539. {
  1540. name: "Ratio",
  1541. value: 1
  1542. },
  1543. {
  1544. name: "Sum",
  1545. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1546. type: TYPE.DECIMAL
  1547. },
  1548. {
  1549. name: "Remarks",
  1550. value: bills.remark
  1551. },
  1552. {
  1553. name: "KeyId",
  1554. value: bills.keyIDData?.formula || uuid.v1()
  1555. }
  1556. ]
  1557. Element.call(this, "Formula", attrs);
  1558. // 1.Name
  1559. // 名称/描述。取清单的名称。
  1560. // 2.Formulas
  1561. // 计算式。读取计算基数的文本。
  1562. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1563. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1564. // 3.Ratio
  1565. // 系数。输出为1,非必填。
  1566. // 4.Sum
  1567. // 取金额。
  1568. // 5.Remarks
  1569. }
  1570. function Cost(item) {
  1571. let BasePrice = 0;
  1572. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1573. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1574. } else {
  1575. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1576. }
  1577. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1578. let CostTypeNo = '';
  1579. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1580. const attrs = [{
  1581. name: "Code",
  1582. value: item.code,
  1583. }, {
  1584. name: 'Name',
  1585. value: item.name
  1586. }, {
  1587. name: 'Spec',
  1588. value: item.specs
  1589. }, {
  1590. name: 'Unit',
  1591. value: item.unit
  1592. }, {
  1593. name: 'Num',
  1594. value: item.tenderQuantity || ''
  1595. }, {
  1596. name: 'BasePrice',
  1597. value: BasePrice
  1598. }, {
  1599. name: 'Price',
  1600. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1601. }, {
  1602. name: 'IsEquipment',
  1603. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1604. }, {
  1605. name: 'CostTypeNo',
  1606. value: CostTypeNo
  1607. }, {
  1608. name: 'ProfitRate',
  1609. value: getFeeRate(item.programID, 'profit', tenderProject)
  1610. },
  1611. {
  1612. name: 'TaxRate',
  1613. value: getFeeRate(item.programID, 'tax', tenderProject)
  1614. },
  1615. {
  1616. name: 'MpRatio',
  1617. value: item.subType == gljType.LABOUR ? 100 : 0
  1618. },
  1619. {
  1620. name: 'MaterialRatio',
  1621. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1622. },
  1623. {
  1624. name: 'MechRatio',
  1625. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1626. },
  1627. {
  1628. name: "KeyId",
  1629. value: uuid.v1()
  1630. }
  1631. ]
  1632. Element.call(this, "Cost", attrs);
  1633. this.children.push(CostStructure(item));
  1634. }
  1635. function Ration(ration) {
  1636. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1637. let CostTypeNo = '';
  1638. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1639. const attrs = [{
  1640. name: "NormLibNo",
  1641. value: 'YSDE-000000-2018-86',
  1642. }, {
  1643. name: 'DisplayCode',
  1644. value: ration.code
  1645. }, {
  1646. name: 'Name',
  1647. value: ration.name
  1648. }, {
  1649. name: 'Unit',
  1650. value: ration.unit
  1651. }, {
  1652. name: 'Num',
  1653. value: ration.tenderQuantity || 0
  1654. },
  1655. {
  1656. name: 'CostTypeNo',
  1657. value: CostTypeNo
  1658. },
  1659. {
  1660. name: 'ProfitRate',
  1661. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1662. },
  1663. {
  1664. name: 'TaxRate',
  1665. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1666. },
  1667. {
  1668. name: 'FabricationCost',
  1669. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1670. },
  1671. {
  1672. name: 'AdjustStatus',
  1673. value: ration.adjustState
  1674. },
  1675. {
  1676. name: "KeyId",
  1677. value: uuid.v1()
  1678. }
  1679. ]
  1680. Element.call(this, "Norm", attrs);
  1681. this.children.push(CostStructure(ration));
  1682. this.children.push(Consume(ration));
  1683. }
  1684. }
  1685. function Consume(ration) {
  1686. let consume = new emptyElement('Consume');
  1687. consume.attrs = [{
  1688. name: "KeyId",
  1689. value: uuid.v1()
  1690. }];
  1691. for (let rg of ration.rationGLJList) {
  1692. consume.children.push(new ConsumeItem(rg));
  1693. }
  1694. return consume;
  1695. function ConsumeItem(rg) {
  1696. const attrs = [{
  1697. name: "Code",
  1698. value: rg.code,
  1699. }, {
  1700. name: "Consumption",
  1701. value: rg.tenderQuantity || 0
  1702. }, {
  1703. name: "KeyId",
  1704. value: uuid.v1()
  1705. }];
  1706. Element.call(this, "ConsumeItem", attrs);
  1707. }
  1708. }
  1709. function CostStructure(item) {
  1710. let CostStructure = new emptyElement('CostStructure');
  1711. CostStructure.attrs = [{
  1712. name: "KeyId",
  1713. value: item.keyIDData?.costStructure || uuid.v1()
  1714. }];
  1715. for (let f of cpFeeTypes) {
  1716. if (itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item, f.type))
  1717. }
  1718. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({}, ""))
  1719. function CostItem(item, type) {
  1720. const attrs = [{
  1721. name: "ItemNo",
  1722. value: itemFeeMap[type],
  1723. }, {
  1724. name: 'Sum',
  1725. value: 0 //fee.tenderTotalFee
  1726. }, {
  1727. name: "KeyId",
  1728. value: uuid.v1()
  1729. }
  1730. ]
  1731. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1732. Element.call(this, "CostItem", attrs);
  1733. }
  1734. return CostStructure;
  1735. }
  1736. }
  1737. }
  1738. }
  1739. function Params(tenderProject) {
  1740. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1741. let featrueMap = {};
  1742. debugger;
  1743. let baseMap = {};
  1744. for (let f of feature) {
  1745. featrueMap[f.key] = f;
  1746. }
  1747. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1748. dispName: "基本信息",
  1749. });
  1750. for (let i of baseInfo.items) {
  1751. let key = i.key;
  1752. //if (i.dispName == "编制日期") key = "编制时间";
  1753. baseMap[key] = i;
  1754. }
  1755. let BuildType = "";
  1756. if (baseMap["natureConstruction"]) {
  1757. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1758. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1759. }
  1760. let Terrain = "";
  1761. if (baseMap["terrainCategory"]) {
  1762. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1763. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1764. }
  1765. let DesignSpeed = parseFloat(featrueMap["designSpeed"].value);
  1766. if (isNaN(DesignSpeed)) DesignSpeed = 0;
  1767. let Structure = 0;
  1768. if (featrueMap["pavementStructure"]) {
  1769. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1770. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1771. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1772. }
  1773. let RoadGrade = "";
  1774. if (baseMap["roadGrade"] && RoadGradeMap[baseMap["roadGrade"].value]) {
  1775. RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1776. }
  1777. const attrs = [{
  1778. name: "PrjArea",
  1779. value: baseMap["location"] ? baseMap["location"].value : ""
  1780. },
  1781. {
  1782. name: "StartPileNo",
  1783. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1784. mustHasValue: true
  1785. },
  1786. {
  1787. name: "EndPileNo",
  1788. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1789. mustHasValue: true
  1790. },
  1791. {
  1792. name: "BuildType",
  1793. value: BuildType,
  1794. },
  1795. {
  1796. name: "Terrain",
  1797. value: Terrain,
  1798. mustHasValue: true
  1799. },
  1800. {
  1801. name: "RoadGrade",
  1802. value: RoadGrade,
  1803. mustHasValue: true
  1804. },
  1805. {
  1806. name: "DesignSpeed",
  1807. value: DesignSpeed
  1808. },
  1809. {
  1810. name: "Structure",
  1811. value: Structure
  1812. },
  1813. {
  1814. name: "SubgradeWidth",
  1815. value: featrueMap["subgradeWidth"] ? _getZeroValueIfNotValid(featrueMap["subgradeWidth"].value) : 0
  1816. },
  1817. {
  1818. name: "RoadLength",
  1819. value: featrueMap["roadLength"] ? _getZeroValueIfNotValid(featrueMap["roadLength"].value) : 0
  1820. },
  1821. {
  1822. name: "BridgeLength",
  1823. value: featrueMap["bridgeLength"] ? _getZeroValueIfNotValid(featrueMap["bridgeLength"].value) : 0
  1824. },
  1825. {
  1826. name: "TunnelLength",
  1827. value: featrueMap["tunnelLength"] ? _getZeroValueIfNotValid(featrueMap["tunnelLength"].value) : 0
  1828. },
  1829. {
  1830. name: "BriTunRate",
  1831. value: featrueMap["briTunRate"] ? _getZeroValueIfNotValid(featrueMap["briTunRate"].value) : 0
  1832. },
  1833. {
  1834. name: "InterchangeNum",
  1835. value: featrueMap["interchangeNum"] ? _getZeroValueIfNotValid(featrueMap["interchangeNum"].value) : 0
  1836. },
  1837. {
  1838. name: "RisingRate",
  1839. value: 0,
  1840. mustHasValue: true
  1841. },
  1842. {
  1843. name: "RisingYears",
  1844. value: 0,
  1845. mustHasValue: true
  1846. },
  1847. {
  1848. name: "RateNo",
  1849. value: uuid.v1()
  1850. },
  1851. {
  1852. name: "PractNo",
  1853. value: uuid.v1()
  1854. },
  1855. {
  1856. name: "StubLengths",
  1857. value: featrueMap["stubLengths"] ? _getZeroValueIfNotValid(featrueMap["stubLengths"].value) : 0
  1858. },
  1859. {
  1860. name: "LaneLength",
  1861. value: featrueMap["laneLength"] ? _getZeroValueIfNotValid(featrueMap["laneLength"].value) : 0
  1862. },
  1863. {
  1864. name: "KeyId",
  1865. value: projectData.keyIDData.params || uuid.v1()
  1866. }
  1867. ];
  1868. Element.call(this, "Params", attrs);
  1869. }
  1870. function SummaryOfCost(totalItem, proItem, safeItem, oneToSevenItem, feature) {
  1871. let attrs = [{
  1872. name: "TenderSumLimit",
  1873. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1874. type: TYPE.DECIMAL,
  1875. toFix: 2,
  1876. },
  1877. {
  1878. name: "BidTotal",
  1879. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1880. type: TYPE.DECIMAL,
  1881. toFix: 2,
  1882. },
  1883. {
  1884. name: "BillTotal",
  1885. value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
  1886. type: TYPE.DECIMAL,
  1887. toFix: 2,
  1888. },
  1889. {
  1890. name: "CostForHSE",
  1891. value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1892. type: TYPE.DECIMAL,
  1893. toFix: 2,
  1894. },
  1895. {
  1896. name: "ProvisionalSums",
  1897. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1898. type: TYPE.DECIMAL,
  1899. toFix: 2,
  1900. },
  1901. {
  1902. name: "Appraisal",
  1903. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1904. type: TYPE.DECIMAL,
  1905. toFix: 2,
  1906. },
  1907. ];
  1908. if (isBidInvitation) {
  1909. attrs.splice(0, 3) //招标
  1910. }
  1911. //if (isControl) attrs.splice(1, 5); //控制价
  1912. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1913. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1914. if (tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1915. }
  1916. Element.call(this, "SummaryOfCost", attrs);
  1917. }
  1918. function MakeInfo(tenderProject) {
  1919. let property = tenderProject.property;
  1920. let baseMap = {};
  1921. let baseInfo = _.find(property.basicInformation, {
  1922. dispName: "基本信息",
  1923. });
  1924. for (let i of baseInfo.items) {
  1925. let key = i.key;
  1926. //if (i.dispName == "编制日期") key = "编制时间";
  1927. baseMap[key] = i;
  1928. }
  1929. //mustHasValue
  1930. const attrs = [
  1931. // {
  1932. // name: "ValuationModel",
  1933. // value: property.taxType,
  1934. // },
  1935. {
  1936. name: "Manage",
  1937. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1938. },
  1939. {
  1940. name: "Designer",
  1941. value: baseMap["designUnit"] ? baseMap["designUnit"].value : ""
  1942. },
  1943. {
  1944. name: "Compile",
  1945. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1946. },
  1947. {
  1948. name: "CompileApprover",
  1949. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1950. },
  1951. {
  1952. name: "CompileCertNo",
  1953. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : ""
  1954. },
  1955. {
  1956. name: "CompileDate",
  1957. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : ""
  1958. },
  1959. {
  1960. name: "Review",
  1961. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : ""
  1962. },
  1963. {
  1964. name: "ReviewApprover",
  1965. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : ""
  1966. },
  1967. {
  1968. name: "ReviewCertNo",
  1969. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : ""
  1970. },
  1971. {
  1972. name: "ReviewDate",
  1973. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : ""
  1974. },
  1975. {
  1976. name: "Examine",
  1977. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1978. mustHasValue: true
  1979. },
  1980. {
  1981. name: "ExamineApprover",
  1982. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1983. mustHasValue: true
  1984. },
  1985. {
  1986. name: "ExamineCertNo",
  1987. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1988. mustHasValue: true
  1989. },
  1990. {
  1991. name: "ExamineDate",
  1992. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1993. mustHasValue: true
  1994. },
  1995. {
  1996. name: "CompileExplain",
  1997. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1998. mustHasValue: true
  1999. },
  2000. {
  2001. name: "ExamineExplain",
  2002. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  2003. mustHasValue: true
  2004. },
  2005. {
  2006. name: "ProjectExplain",
  2007. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  2008. mustHasValue: true
  2009. },
  2010. {
  2011. name: "KeyId",
  2012. value: projectData.keyIDData.makeInfo || uuid.v1()
  2013. }
  2014. ];
  2015. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  2016. // attrs.splice(11, 7);
  2017. // attrs.splice(7, 1);
  2018. }
  2019. Element.call(this, "MakeInfo", attrs);
  2020. }
  2021. let data = new CprjInfo(projectData.name);
  2022. data.children.push(new SystemInfo(projectData));
  2023. data.children.push(new CostBasis());
  2024. let seriNo = 1;
  2025. let Rates = [];
  2026. let Practs = [];
  2027. let EprjInfos = [];
  2028. let Indexs = [];
  2029. for (let c of projectData.children) {
  2030. let tenderProject = tenderDetailMap[c.ID];
  2031. let feeRataDatas = tenderProject.FeeRate.datas;
  2032. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  2033. Practs.push(new Pract(tenderProject, seriNo));
  2034. EprjInfos.push(new EprjInfo(tenderProject));
  2035. if (seriNo === 1) Indexs.push(new getIndexs(tenderProject));
  2036. seriNo++;
  2037. }
  2038. data.children.push(...Rates, ...Practs, ...EprjInfos, ...Indexs);
  2039. return [{
  2040. data: data,
  2041. exportKind: exportKind,
  2042. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  2043. },];
  2044. }
  2045. return {
  2046. entry,
  2047. };
  2048. })();