guangxi_common.js 66 KB

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