guangxi_common.js 65 KB

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