guangxi_common.js 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148
  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. "清单第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,
  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 _getDayworkMapStrByBillType(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. default:
  1274. break;
  1275. }
  1276. break;
  1277. }
  1278. }
  1279. }
  1280. return rst;
  1281. }
  1282. function bill(bNode, level) {
  1283. let data = bNode.data;
  1284. let CostKind = 3;
  1285. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  1286. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  1287. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  1288. let CalcType = getCalcType(bNode);
  1289. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  1290. let ProvisionalType = "";
  1291. if (data.specialProvisional == "材料暂估") ProvisionalType = 0;
  1292. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  1293. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  1294. //MpRatio
  1295. let MpRatio = "";
  1296. let MaterialRatio = "";
  1297. let MechRatio = "";
  1298. if (data.quantityCoe) {
  1299. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  1300. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  1301. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  1302. }
  1303. let fail = null;
  1304. // if (!isBidSubmission) {
  1305. fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag);
  1306. // }
  1307. // 投标的不去判断
  1308. // let fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag)
  1309. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  1310. let ListCode = "";
  1311. if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name][0];
  1312. if (data.code && data.code != "") ListCode = data.code;
  1313. let formulaCode = "";
  1314. if (ListCodeMap[data.name]) {
  1315. formulaCode = ListCodeMap[data.name][1];
  1316. } else {
  1317. formulaCode = _getDayworkMapStrByBillType(data)[1];
  1318. }
  1319. let perKeyId = '';
  1320. if (data.ParentID != -1) {
  1321. const parent = bNode.tree.findNode(bNode.data.ParentID)
  1322. if (parent) {
  1323. perKeyId = parent.data.keyIDData?.item || parent.data.ID;
  1324. }
  1325. }
  1326. const attrs = [{
  1327. name: "ListCode",
  1328. value: ListCode,
  1329. },
  1330. {
  1331. name: "ListName",
  1332. value: data.name,
  1333. fail: fail
  1334. },
  1335. {
  1336. name: "Unit",
  1337. value: data.unit,
  1338. },
  1339. {
  1340. name: "Num",
  1341. value: data.quantity,
  1342. type: TYPE.DECIMAL,
  1343. toFix: _getDecimal(data.unit)
  1344. },
  1345. // {
  1346. // name: "QtyFormula",
  1347. // value: _getStrValueByExportKind(data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : ""),
  1348. // type: TYPE.DECIMAL,
  1349. // toFix:2
  1350. // },
  1351. {
  1352. name: "Price",
  1353. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1354. type: TYPE.DECIMAL,
  1355. toFix: 2
  1356. },
  1357. {
  1358. name: "Sum",
  1359. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1360. type: TYPE.DECIMAL,
  1361. toFix: 2
  1362. },
  1363. {
  1364. name: "ProvisionalType",
  1365. value: ProvisionalType,
  1366. mustHasValue: true
  1367. },
  1368. {
  1369. name: "MeterRules",
  1370. value: "",
  1371. },
  1372. {
  1373. name: "Content",
  1374. value: data.jobContentText,
  1375. },
  1376. {
  1377. name: "Remarks",
  1378. value: data.remark,
  1379. },
  1380. {
  1381. name: "ItemType",
  1382. value: getItemType(bNode),
  1383. },
  1384. {
  1385. name: "FormulaCode",
  1386. value: formulaCode
  1387. },
  1388. {
  1389. name: "KeyId",
  1390. value: data.keyIDData?.item || data.ID
  1391. },
  1392. {
  1393. name: "PerKeyId",
  1394. value: perKeyId
  1395. }
  1396. ];
  1397. //投标、招标控制价时。取单价。
  1398. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1399. if (isBidSubmission || isControl || CostKind == 1 || CostKind == 2) {
  1400. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1401. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1402. //暂列金额 数量为0的时候,单价输出0
  1403. if (CostKind == 2 && !gljUtil.isNotEmpty(data.quantity)) attrs[4].value = 0
  1404. }
  1405. // 计日工合计下的劳务、材料、机械Item节点单价及合价(Price, Sum)也要输出
  1406. if (bNode.children && bNode.children.length === 0 && _getFee(bNode) > 0) { //先检测是否有费用
  1407. // 再检测是否计日工合计清单下
  1408. if (_chkIfJRGHJ(bNode, ['计日工合计'])) {
  1409. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1410. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1411. }
  1412. }
  1413. // 清单的专项暂定有选择了专业工程的清单Item节点单价及合价(Price, Sum)也要输出
  1414. if (ProvisionalType === 2) {
  1415. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1416. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1417. }
  1418. //特殊清单
  1419. if (isBidInvitation) {
  1420. // 招标工程量清单 读计日工和已包含在清单合计中的材料、工程设备、专业工程暂估价合计。
  1421. const specialBills = ['计日工合计', '已包含在清单合计中的材料、工程设备、专业工程暂估价合计'];
  1422. if (bNode.children && bNode.children.length > 0 && _chkIfJRGHJ(bNode, specialBills)) {
  1423. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1424. }
  1425. if (bNode.data.name === '投标报价') {
  1426. let rootNodes = tenderProject.mainTree.roots;
  1427. let ttlSum = 0;
  1428. for (let r of rootNodes) {
  1429. if (specialBills.includes(r.data.name)) {
  1430. ttlSum += _getFee(r);
  1431. }
  1432. }
  1433. attrs[5].value = '' + ttlSum;
  1434. }
  1435. }
  1436. // 导出招标时 清单100章Price、Sum不用输出
  1437. if (isBidInvitation && _isChapter100(bNode)) {
  1438. attrs[4].value = 0;
  1439. attrs[5].value = 0;
  1440. }
  1441. Element.call(this, "Item", attrs);
  1442. let cc = CostComposition(bNode);
  1443. if (cc) this.children.push(cc);
  1444. this.children.push(CostStructure(data))
  1445. // function _chkIfHas
  1446. function _chkIfJRGHJ(bNode, exArr = []) {
  1447. //检测是否在指定清单的子目录下(如:计日工合计等)
  1448. let rst = false;
  1449. let pNode = bNode;
  1450. while (pNode !== null && pNode !== undefined) {
  1451. if ((typeof pNode.data.name === 'string') && exArr.includes(pNode.data.name)) {
  1452. rst = true;
  1453. break;
  1454. }
  1455. pNode = pNode.parent;
  1456. }
  1457. return rst;
  1458. }
  1459. function _getFee(bNode, key = 'common', valueKey = 'tenderTotalFee') {
  1460. let rstSum = 0;
  1461. if (bNode) {
  1462. let dtlB = (bNode.data) ? bNode.data : bNode;
  1463. if (dtlB.fees) {
  1464. for (let fee of dtlB.fees) {
  1465. if (fee.fieldName === key) {
  1466. rstSum = parseFloat(fee[valueKey]);
  1467. if (isNaN(rstSum)) rstSum = 0;
  1468. break;
  1469. }
  1470. }
  1471. }
  1472. }
  1473. return rstSum;
  1474. }
  1475. function _chkIfNeedCostComposition(bNode) {
  1476. let rst = isBidInvitation && !(ProvisionalType === 0 || ProvisionalType === 1);
  1477. if (rst) {
  1478. //计日工合计下的劳务、材料、机械 有费用也要输出
  1479. if (bNode.children && bNode.children.length === 0 && _getFee(bNode) > 0) { //先检测是否有费用
  1480. // 再检测是否计日工合计清单下
  1481. rst = !_chkIfJRGHJ(bNode, ['计日工合计']);
  1482. }
  1483. }
  1484. return rst;
  1485. }
  1486. function CostComposition(bNode) {
  1487. if (_chkIfNeedCostComposition(bNode)) return null;
  1488. let CostComposition = new emptyElement('CostComposition');
  1489. CostComposition.attrs = [{
  1490. name: "KeyId",
  1491. value: bNode.data.keyIDData?.costComposition || uuid.v1()
  1492. }];
  1493. let Norms = [];
  1494. let Costs = [];
  1495. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1496. for (let r of bNode.children) {
  1497. if (r.data.type == rationType.ration) {
  1498. if (isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
  1499. Norms.push(new Ration(r.data));
  1500. } else {
  1501. Costs.push(new Cost(r.data));
  1502. }
  1503. }
  1504. }
  1505. if (Costs.length === 0 && _chkIfJRGHJ(bNode, ['计日工合计'])) {
  1506. Costs.push(new Cost(bNode.data));
  1507. for (let idx = 0; idx < Costs[Costs.length - 1].attrs.length; idx++) {
  1508. if (Costs[Costs.length - 1].attrs[idx].name === 'Num') {
  1509. Costs[Costs.length - 1].attrs[idx].value = '' + bNode.data.quantity;
  1510. } else if (Costs[Costs.length - 1].attrs[idx].name === 'BasePrice') {
  1511. Costs[Costs.length - 1].attrs[idx].value = '' + _getFee(bNode, 'common', 'tenderUnitFee');
  1512. }
  1513. }
  1514. }
  1515. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1516. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1517. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1518. return (CostComposition.children.length > 0) ? CostComposition : null;
  1519. //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
  1520. function isEmptyRation(ration) {
  1521. return !gljUtil.isNotEmpty(ration.code) && !gljUtil.isNotEmpty(ration.name) && !gljUtil.isNotEmpty(ration.unit) && (!gljUtil.isNotEmpty(ration.quantity) || ration.quantity == 0)
  1522. }
  1523. function Formula(bills) {
  1524. const attrs = [{
  1525. name: "Name",
  1526. value: bills.name
  1527. },
  1528. {
  1529. name: "Formulas",
  1530. value: bills.calcBase
  1531. },
  1532. {
  1533. name: "Ratio",
  1534. value: 1
  1535. },
  1536. {
  1537. name: "Sum",
  1538. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1539. type: TYPE.DECIMAL
  1540. },
  1541. {
  1542. name: "Remarks",
  1543. value: bills.remark
  1544. },
  1545. {
  1546. name: "KeyId",
  1547. value: bills.keyIDData?.formula || uuid.v1()
  1548. }
  1549. ]
  1550. Element.call(this, "Formula", attrs);
  1551. // 1.Name
  1552. // 名称/描述。取清单的名称。
  1553. // 2.Formulas
  1554. // 计算式。读取计算基数的文本。
  1555. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1556. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1557. // 3.Ratio
  1558. // 系数。输出为1,非必填。
  1559. // 4.Sum
  1560. // 取金额。
  1561. // 5.Remarks
  1562. }
  1563. function Cost(item) {
  1564. let BasePrice = 0;
  1565. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1566. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1567. } else {
  1568. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1569. }
  1570. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1571. let CostTypeNo = '';
  1572. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1573. const attrs = [{
  1574. name: "Code",
  1575. value: item.code,
  1576. }, {
  1577. name: 'Name',
  1578. value: item.name
  1579. }, {
  1580. name: 'Spec',
  1581. value: item.specs
  1582. }, {
  1583. name: 'Unit',
  1584. value: item.unit
  1585. }, {
  1586. name: 'Num',
  1587. value: item.tenderQuantity
  1588. }, {
  1589. name: 'BasePrice',
  1590. value: BasePrice
  1591. }, {
  1592. name: 'Price',
  1593. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1594. }, {
  1595. name: 'IsEquipment',
  1596. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1597. }, {
  1598. name: 'CostTypeNo',
  1599. value: CostTypeNo
  1600. }, {
  1601. name: 'ProfitRate',
  1602. value: getFeeRate(item.programID, 'profit', tenderProject)
  1603. },
  1604. {
  1605. name: 'TaxRate',
  1606. value: getFeeRate(item.programID, 'tax', tenderProject)
  1607. },
  1608. {
  1609. name: 'MpRatio',
  1610. value: item.subType == gljType.LABOUR ? 100 : 0
  1611. },
  1612. {
  1613. name: 'MaterialRatio',
  1614. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1615. },
  1616. {
  1617. name: 'MechRatio',
  1618. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1619. },
  1620. {
  1621. name: "KeyId",
  1622. value: uuid.v1()
  1623. }
  1624. ]
  1625. Element.call(this, "Cost", attrs);
  1626. this.children.push(CostStructure(item));
  1627. }
  1628. function Ration(ration) {
  1629. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1630. let CostTypeNo = '';
  1631. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1632. const attrs = [{
  1633. name: "NormLibNo",
  1634. value: 'YSDE-000000-2018-86',
  1635. }, {
  1636. name: 'DisplayCode',
  1637. value: ration.code
  1638. }, {
  1639. name: 'Name',
  1640. value: ration.name
  1641. }, {
  1642. name: 'Unit',
  1643. value: ration.unit
  1644. }, {
  1645. name: 'Num',
  1646. value: ration.tenderQuantity
  1647. },
  1648. {
  1649. name: 'CostTypeNo',
  1650. value: CostTypeNo
  1651. },
  1652. {
  1653. name: 'ProfitRate',
  1654. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1655. },
  1656. {
  1657. name: 'TaxRate',
  1658. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1659. },
  1660. {
  1661. name: 'FabricationCost',
  1662. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1663. },
  1664. {
  1665. name: 'AdjustStatus',
  1666. value: ration.adjustState
  1667. },
  1668. {
  1669. name: "KeyId",
  1670. value: uuid.v1()
  1671. }
  1672. ]
  1673. Element.call(this, "Norm", attrs);
  1674. this.children.push(CostStructure(ration));
  1675. this.children.push(Consume(ration));
  1676. }
  1677. }
  1678. function Consume(ration) {
  1679. let consume = new emptyElement('Consume');
  1680. consume.attrs = [{
  1681. name: "KeyId",
  1682. value: uuid.v1()
  1683. }];
  1684. for (let rg of ration.rationGLJList) {
  1685. consume.children.push(new ConsumeItem(rg));
  1686. }
  1687. return consume;
  1688. function ConsumeItem(rg) {
  1689. const attrs = [{
  1690. name: "Code",
  1691. value: rg.code,
  1692. }, {
  1693. name: "Consumption",
  1694. value: rg.tenderQuantity
  1695. }, {
  1696. name: "KeyId",
  1697. value: uuid.v1()
  1698. }];
  1699. Element.call(this, "ConsumeItem", attrs);
  1700. }
  1701. }
  1702. function CostStructure(item) {
  1703. let CostStructure = new emptyElement('CostStructure');
  1704. CostStructure.attrs = [{
  1705. name: "KeyId",
  1706. value: item.keyIDData?.costStructure || uuid.v1()
  1707. }];
  1708. for (let f of cpFeeTypes) {
  1709. if (itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item, f.type))
  1710. }
  1711. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({}, ""))
  1712. function CostItem(item, type) {
  1713. const attrs = [{
  1714. name: "ItemNo",
  1715. value: itemFeeMap[type],
  1716. }, {
  1717. name: 'Sum',
  1718. value: 0 //fee.tenderTotalFee
  1719. }, {
  1720. name: "KeyId",
  1721. value: uuid.v1()
  1722. }
  1723. ]
  1724. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1725. Element.call(this, "CostItem", attrs);
  1726. }
  1727. return CostStructure;
  1728. }
  1729. }
  1730. }
  1731. }
  1732. function Params(tenderProject) {
  1733. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1734. let featrueMap = {};
  1735. debugger;
  1736. let baseMap = {};
  1737. for (let f of feature) {
  1738. featrueMap[f.key] = f;
  1739. }
  1740. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1741. dispName: "基本信息",
  1742. });
  1743. for (let i of baseInfo.items) {
  1744. let key = i.key;
  1745. //if (i.dispName == "编制日期") key = "编制时间";
  1746. baseMap[key] = i;
  1747. }
  1748. let BuildType = "";
  1749. if (baseMap["natureConstruction"]) {
  1750. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1751. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1752. }
  1753. let Terrain = "";
  1754. if (baseMap["terrainCategory"]) {
  1755. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1756. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1757. }
  1758. let DesignSpeed = parseFloat(featrueMap["designSpeed"].value);
  1759. if (isNaN(DesignSpeed)) DesignSpeed = 0;
  1760. let Structure = 0;
  1761. if (featrueMap["pavementStructure"]) {
  1762. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1763. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1764. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1765. }
  1766. let RoadGrade = "";
  1767. if (baseMap["roadGrade"] && RoadGradeMap[baseMap["roadGrade"].value]) {
  1768. RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1769. }
  1770. const attrs = [{
  1771. name: "PrjArea",
  1772. value: baseMap["location"] ? baseMap["location"].value : ""
  1773. },
  1774. {
  1775. name: "StartPileNo",
  1776. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1777. mustHasValue: true
  1778. },
  1779. {
  1780. name: "EndPileNo",
  1781. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1782. mustHasValue: true
  1783. },
  1784. {
  1785. name: "BuildType",
  1786. value: BuildType,
  1787. },
  1788. {
  1789. name: "Terrain",
  1790. value: Terrain,
  1791. mustHasValue: true
  1792. },
  1793. {
  1794. name: "RoadGrade",
  1795. value: RoadGrade,
  1796. mustHasValue: true
  1797. },
  1798. {
  1799. name: "DesignSpeed",
  1800. value: DesignSpeed
  1801. },
  1802. {
  1803. name: "Structure",
  1804. value: Structure
  1805. },
  1806. {
  1807. name: "SubgradeWidth",
  1808. value: featrueMap["subgradeWidth"] ? _getZeroValueIfNotValid(featrueMap["subgradeWidth"].value) : 0
  1809. },
  1810. {
  1811. name: "RoadLength",
  1812. value: featrueMap["roadLength"] ? _getZeroValueIfNotValid(featrueMap["roadLength"].value) : 0
  1813. },
  1814. {
  1815. name: "BridgeLength",
  1816. value: featrueMap["bridgeLength"] ? _getZeroValueIfNotValid(featrueMap["bridgeLength"].value) : 0
  1817. },
  1818. {
  1819. name: "TunnelLength",
  1820. value: featrueMap["tunnelLength"] ? _getZeroValueIfNotValid(featrueMap["tunnelLength"].value) : 0
  1821. },
  1822. {
  1823. name: "BriTunRate",
  1824. value: featrueMap["briTunRate"] ? _getZeroValueIfNotValid(featrueMap["briTunRate"].value) : 0
  1825. },
  1826. {
  1827. name: "InterchangeNum",
  1828. value: featrueMap["interchangeNum"] ? _getZeroValueIfNotValid(featrueMap["interchangeNum"].value) : 0
  1829. },
  1830. {
  1831. name: "RisingRate",
  1832. value: 0,
  1833. mustHasValue: true
  1834. },
  1835. {
  1836. name: "RisingYears",
  1837. value: 0,
  1838. mustHasValue: true
  1839. },
  1840. {
  1841. name: "RateNo",
  1842. value: uuid.v1()
  1843. },
  1844. {
  1845. name: "PractNo",
  1846. value: uuid.v1()
  1847. },
  1848. {
  1849. name: "StubLengths",
  1850. value: featrueMap["stubLengths"] ? _getZeroValueIfNotValid(featrueMap["stubLengths"].value) : 0
  1851. },
  1852. {
  1853. name: "LaneLength",
  1854. value: featrueMap["laneLength"] ? _getZeroValueIfNotValid(featrueMap["laneLength"].value) : 0
  1855. },
  1856. {
  1857. name: "KeyId",
  1858. value: projectData.keyIDData.params || uuid.v1()
  1859. }
  1860. ];
  1861. Element.call(this, "Params", attrs);
  1862. }
  1863. function SummaryOfCost(totalItem, proItem, safeItem, oneToSevenItem, feature) {
  1864. let attrs = [{
  1865. name: "TenderSumLimit",
  1866. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1867. type: TYPE.DECIMAL,
  1868. toFix: 2,
  1869. },
  1870. {
  1871. name: "BidTotal",
  1872. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1873. type: TYPE.DECIMAL,
  1874. toFix: 2,
  1875. },
  1876. {
  1877. name: "BillTotal",
  1878. value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
  1879. type: TYPE.DECIMAL,
  1880. toFix: 2,
  1881. },
  1882. {
  1883. name: "CostForHSE",
  1884. value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1885. type: TYPE.DECIMAL,
  1886. toFix: 2,
  1887. },
  1888. {
  1889. name: "ProvisionalSums",
  1890. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1891. type: TYPE.DECIMAL,
  1892. toFix: 2,
  1893. },
  1894. {
  1895. name: "Appraisal",
  1896. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1897. type: TYPE.DECIMAL,
  1898. toFix: 2,
  1899. },
  1900. ];
  1901. if (isBidInvitation) {
  1902. attrs.splice(0, 3) //招标
  1903. }
  1904. //if (isControl) attrs.splice(1, 5); //控制价
  1905. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1906. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1907. if (tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1908. }
  1909. Element.call(this, "SummaryOfCost", attrs);
  1910. }
  1911. function MakeInfo(tenderProject) {
  1912. let property = tenderProject.property;
  1913. let baseMap = {};
  1914. let baseInfo = _.find(property.basicInformation, {
  1915. dispName: "基本信息",
  1916. });
  1917. for (let i of baseInfo.items) {
  1918. let key = i.key;
  1919. //if (i.dispName == "编制日期") key = "编制时间";
  1920. baseMap[key] = i;
  1921. }
  1922. //mustHasValue
  1923. const attrs = [
  1924. // {
  1925. // name: "ValuationModel",
  1926. // value: property.taxType,
  1927. // },
  1928. {
  1929. name: "Manage",
  1930. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1931. },
  1932. {
  1933. name: "Designer",
  1934. value: baseMap["designUnit"] ? baseMap["designUnit"].value : ""
  1935. },
  1936. {
  1937. name: "Compile",
  1938. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1939. },
  1940. {
  1941. name: "CompileApprover",
  1942. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1943. },
  1944. {
  1945. name: "CompileCertNo",
  1946. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : ""
  1947. },
  1948. {
  1949. name: "CompileDate",
  1950. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : ""
  1951. },
  1952. {
  1953. name: "Review",
  1954. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : ""
  1955. },
  1956. {
  1957. name: "ReviewApprover",
  1958. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : ""
  1959. },
  1960. {
  1961. name: "ReviewCertNo",
  1962. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : ""
  1963. },
  1964. {
  1965. name: "ReviewDate",
  1966. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : ""
  1967. },
  1968. {
  1969. name: "Examine",
  1970. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1971. mustHasValue: true
  1972. },
  1973. {
  1974. name: "ExamineApprover",
  1975. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1976. mustHasValue: true
  1977. },
  1978. {
  1979. name: "ExamineCertNo",
  1980. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1981. mustHasValue: true
  1982. },
  1983. {
  1984. name: "ExamineDate",
  1985. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1986. mustHasValue: true
  1987. },
  1988. {
  1989. name: "CompileExplain",
  1990. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1991. mustHasValue: true
  1992. },
  1993. {
  1994. name: "ExamineExplain",
  1995. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1996. mustHasValue: true
  1997. },
  1998. {
  1999. name: "ProjectExplain",
  2000. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  2001. mustHasValue: true
  2002. },
  2003. {
  2004. name: "KeyId",
  2005. value: projectData.keyIDData.makeInfo || uuid.v1()
  2006. }
  2007. ];
  2008. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  2009. // attrs.splice(11, 7);
  2010. // attrs.splice(7, 1);
  2011. }
  2012. Element.call(this, "MakeInfo", attrs);
  2013. }
  2014. let data = new CprjInfo(projectData.name);
  2015. data.children.push(new SystemInfo(projectData));
  2016. data.children.push(new CostBasis());
  2017. let seriNo = 1;
  2018. let Rates = [];
  2019. let Practs = [];
  2020. let EprjInfos = [];
  2021. let Indexs = [];
  2022. for (let c of projectData.children) {
  2023. let tenderProject = tenderDetailMap[c.ID];
  2024. let feeRataDatas = tenderProject.FeeRate.datas;
  2025. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  2026. Practs.push(new Pract(tenderProject, seriNo));
  2027. EprjInfos.push(new EprjInfo(tenderProject));
  2028. if (seriNo === 1) Indexs.push(new getIndexs(tenderProject));
  2029. seriNo++;
  2030. }
  2031. data.children.push(...Rates, ...Practs, ...EprjInfos, ...Indexs);
  2032. return [{
  2033. data: data,
  2034. exportKind: exportKind,
  2035. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  2036. },];
  2037. }
  2038. return {
  2039. entry,
  2040. };
  2041. })();