exportStdInterface_gd18.js 117 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654
  1. /**
  2. *
  3. *
  4. * @author Zhong
  5. * @date 2019/6/24
  6. * @version
  7. */
  8. /*
  9. * 广东建设工程政府投资项目造价数据标准3.0
  10. * */
  11. const XMLStandard = (function () {
  12. // 广东18的导出文件中,需要把建设项目和单位工程文件分开
  13. // 数据类别,辨别提取的数据,哪份是以建设项目为根元素,哪份以单位工程为根元素
  14. const DATA_TYPE = {
  15. 'project': 1,
  16. 'tender': 2,
  17. };
  18. // 精度
  19. const Decimal = {
  20. // 工料机消耗量、含量、用量类小数精度
  21. GLJ: 4,
  22. // 工程量、数量类小数精度
  23. QUANTITY: 3,
  24. // 金额、合价、费用类小数精度
  25. FEE: 2,
  26. // 费率、指数、比例(%)类小数精度
  27. RATE: 3,
  28. };
  29. // 建设性质
  30. const ConstructionType = {
  31. '新建': '1',
  32. '扩建': '2',
  33. '改建': '3',
  34. '修缮': '4',
  35. '修复': '5',
  36. '维护保养': '6',
  37. '其他': '9',
  38. };
  39. // 造价类型
  40. const CostType = {
  41. '投资估算': '1',
  42. '设计概算': '2',
  43. '施工图预算': '3',
  44. '招标工程量清单': '4',
  45. '招标控制价(最高投标限价)': '5',
  46. '投标报价': '6',
  47. '签约合同价': '7',
  48. '竣工结算价': '8',
  49. };
  50. // 软件中的文件类型与造假类型映射
  51. const FileKind = {
  52. '1': '6', // 投标
  53. '2': '4', // 招标
  54. '3': '5', // 控制价
  55. };
  56. // 计价模式
  57. const ValuationModel = {
  58. 'bill': '1', // 清单计价
  59. 'ration': '2', // 定额计价
  60. };
  61. // 地区类别
  62. const AreaKind = {
  63. '一类地区': '1',
  64. '二类地区': '2',
  65. '三类地区': '3',
  66. '四类地区': '4',
  67. };
  68. // 专业类别
  69. const Specialty = {
  70. '房屋建筑与装饰工程': '1',
  71. '仿古建筑': '2',
  72. '通用安装工程': '3',
  73. '市政工程': '4',
  74. '园林绿化': '5',
  75. '矿山': '6',
  76. '构筑物': '7',
  77. '城市轨道交通工程': '8',
  78. '爆破': '9',
  79. '装饰装修': '10',
  80. '市政交通设施': '11',
  81. '市政养护': '12',
  82. '修缮': '13',
  83. '环卫': '14',
  84. '古建筑': '15',
  85. '节能': '16',
  86. '抗震加固': '17',
  87. '绿色建筑': '18',
  88. '工业建筑': '19',
  89. '地下管廊': '20',
  90. '装配式建筑': '21',
  91. '营造林': '22',
  92. '修复': '23',
  93. '其他': '99',
  94. };
  95. // 需要用固定类别关联的费用字典,用固定类别来映射
  96. // 数据节选自标准pdf文件《《建设工程政府投资项目造价数据标准》信息公开版》,附录C-费用名称与费用代号
  97. // 若映射表中没有映射关系,则费用字典取名称首字母
  98. const FlagFeeCodeMap = {
  99. // 分部分项工程
  100. [fixedFlag.SUB_ENGINERRING]: 'QDF',
  101. // 措施项目
  102. [fixedFlag.MEASURE]: 'CSF',
  103. // 其他项目
  104. [fixedFlag.OTHER]: 'QTF',
  105. // 措施项目的子项
  106. [fixedFlag.GREEN_MEASURE_FEE]: 'AQWMSGF', // 绿色施工安全防护措施费
  107. [fixedFlag.OTHER_MEASURE_FEE]: 'QTCSF', // 其他措施费
  108. // 其他项目的子项
  109. [fixedFlag.PROVISIONAL]: 'ZLF', // 暂列金额
  110. [fixedFlag.ESTIMATE]: 'ZGJ', // 暂估价
  111. [fixedFlag.MATERIAL_PROVISIONAL]: 'ZGC', // 材料(工程设备)暂估价
  112. [fixedFlag.ENGINEERING_ESITIMATE]: 'ZGGC', // 专业工程暂估价
  113. [fixedFlag.DAYWORK]: 'LXF', // 计日工
  114. [fixedFlag.TURN_KEY_CONTRACT]: 'ZCBFWF', // 总承包服务费
  115. [fixedFlag.BUDGET_INCLUDE_WORK_FEE]: 'YSBGF', // 预算包干费
  116. [fixedFlag.PROJECT_HIGH_QUALITY_FEE]: 'GCYZF', // 工程优质费
  117. [fixedFlag.BUDGET_ESTIMATE_DIFF]: 'GSFDC', // 概算幅度差
  118. [fixedFlag.CLAIM]: 'SPFY', // 索赔费用
  119. [fixedFlag.VISA]: 'XCQZFY', // 现场签证
  120. [fixedFlag.OTHER_FEE]: 'QTFY', // 其他费用
  121. // 税金
  122. [fixedFlag.TAX]: 'SJ',
  123. // 工程造价
  124. [fixedFlag.ENGINEERINGCOST]: 'ZZJ',
  125. };
  126. // 需要用计算基数关联的费用字典
  127. const FormulaFeeCodeMap = {
  128. '{分部分项工程费}': 'QDF',
  129. '{分部分项人工费}': 'QRG',
  130. '{分部分项材料费}': 'QCL',
  131. '{分部分项施工机具费}': 'QJX',
  132. '{分部分项主材费}': 'QZCF',
  133. '{分部分项设备费}': 'QSBF',
  134. '{分部分项人工工日}': 'FBFXRGGR', // 标准没有,自增
  135. '{建筑面积}': 'JZMZ', // 自增
  136. '{措施项目费}': 'CSF',
  137. '{其他项目费}': 'QTF',
  138. '{甲供人工费}': 'JGRGF', // 自增
  139. '{甲供材料费}': 'JGC',
  140. '{甲供施工机具费}': 'JGSGJJF', // 自增
  141. '{甲定人工费}': 'JDRGF', // 自增
  142. '{甲定材料费}': 'JDCLF', // 自增
  143. '{甲定施工机具费}': 'JDSGJJF', // 自增
  144. '{甲定主材费}': 'JDZCF', // 自增
  145. '{甲定设备费}': 'JDSBF', // 自增
  146. '{暂估材料费(从子目汇总)}': 'ZGCLFCZMHZ', // 自增
  147. '{税金}': 'SJ',
  148. };
  149. // 费用字典占用列表,普通清单根据首字母获取费用字典时,与下列占用费用字典重复时,需要加上_序号后缀
  150. const feeCodeList = [
  151. 'QDF', 'QRG', 'QCL', 'QJX', 'ZCSB', 'QZCF', 'QSBF', 'QGL', 'QLR', 'QZGJ', 'CSF', 'AQWMSGF', 'AXSJSCSXMF',
  152. 'QTCSF', 'LSSGCSF', 'SGYCWRFZF', 'YGSMGLF', 'DXJXSBJCCJAC', 'GGCSF', 'CSRG', 'CSCL', 'CSJX', 'CSZCSB',
  153. 'CSZCF', 'CSSBF', 'CSGL', 'CSLR', 'CSZGJ', 'QTF', 'ZGJ', 'ZGC', 'ZLF', 'ZGGC', 'ZCBFWF', 'LXF', 'CLBGF',
  154. 'YSBGF', 'SPFY', 'XCQZFY', 'DLF', 'QTFY', 'YLJ', 'GF', 'SJ', 'ZZJ', 'ZJF', 'RGF', 'JXRG', 'CLF', 'JXF',
  155. 'ZCF', 'SBF', 'ZZCSB', 'JC', 'RGJC', 'CLJC', 'JXJC', 'JGC', 'GLF', 'LR', 'DJ', 'HJ', 'YNZTYSYPFFY',
  156. 'JZYWSHBXF', 'GCFY', 'JZAZGCF', 'SBJGQJGZF', 'GCJSQTFY', 'YBF', 'CLGZF', 'JSQDKLX', 'PDLDZJ'
  157. ];
  158. // 计算程序名称-计算基数映射
  159. const CalculationQtyMap = {
  160. '直接费': 'RGF+CLF+JXF+ZCF+SBF+GLF',
  161. '人工费': 'RGF',
  162. '材料费': 'CLF',
  163. '施工机具费': 'JXF',
  164. '主材费': 'ZCF',
  165. '设备费': 'SBF',
  166. '管理费': 'GLF',
  167. '利润': 'LR',
  168. '综合单价': 'RGF+CLF+JXF+ZCF+SBF+GLF+LR',
  169. };
  170. // 计算程序名称-费用代号映射
  171. const CalculationCodeMap = {
  172. '直接费': 'DEZJF',
  173. '人工费': 'RGF',
  174. '材料费': 'CLF',
  175. '施工机具费': 'JXF',
  176. '主材费': 'ZCF',
  177. '设备费': 'SBF',
  178. '管理费': 'GLF',
  179. '利润': 'LR',
  180. '综合单价': 'DJ',
  181. }
  182. // 章节类型
  183. const ChapterKind = {
  184. '章': '1',
  185. '节': '2',
  186. '细目': '3',
  187. '其他': '4',
  188. };
  189. // 汇总类型
  190. const SummrayKind = {
  191. YES: '1', // 汇总
  192. NO: '2', // 不汇总
  193. };
  194. // 工程量计算累加与汇总类型映射
  195. const SummationKindMap = {
  196. '0': SummrayKind.NO,
  197. '1': SummrayKind.YES,
  198. }
  199. // 清单子目类型
  200. const BillsKind = {
  201. FBFX: '1', // 分部分项子目
  202. '模板及支架': '2',
  203. '脚手架': '3',
  204. '现场围挡': '4',
  205. '防尘降噪绿色施工防护': '5',
  206. MEASURE: '6', // 其他措施子目
  207. };
  208. // 取费类型
  209. const CalcKind = {
  210. '地上工程': '1',
  211. '地下明(盖)挖工程': '2',
  212. '地下暗挖工程': '3',
  213. '盾构工程': '4',
  214. '轨道工程': '5',
  215. '通信工程': '6',
  216. '信号工程': '7',
  217. '供电工程': '8',
  218. '智能与控制系统工程': '9',
  219. '机电工程': '10',
  220. '其他': '15',
  221. };
  222. // 费用归属
  223. const CostKind = {
  224. '建筑工程费': '1',
  225. '安装工程费': '2',
  226. '其他': '3',
  227. };
  228. // 计算方式
  229. const CalcType = {
  230. 'quantityMulTotalUnitPrice': '1', // 工程量×综合单价
  231. 'formulaAddFeeRate': '2', // 计算基数×费率
  232. 'quantityMulUnitPrice': '3', // 工程量×单价
  233. };
  234. // 降效类型 建筑装饰工程定额超高降效费用计算标记
  235. const EfficiencyKind = {
  236. BASE_REDUCTION: '1', // 降效基础定额
  237. NOT_BASE_REDUCTION: '2', // 非降效定额
  238. MARKET_PRICE_REDUCTION: '3', // 按市场价计算降效费用定额
  239. RATION_PRICE_REDUCTION: '4', // 按定额价计算降效费用定额
  240. };
  241. // 子目增加费类型 安装工程定额子目增加费的费用计算标记
  242. const IncFeeKind = {
  243. SUB_BASE: '1', // 子目增加费基础定额
  244. NOT_SUB_BASE: '2', // 非子目增加费定额
  245. SUB_CALC: '3', // 子目增加费用计算定额
  246. };
  247. // 工料机类型
  248. const GLJKind = {
  249. };
  250. // 供料方式
  251. const Provider = {
  252. [supplyType.ZXCG]: '1',
  253. [supplyType.BFJG]: '2',
  254. [supplyType.WQJG]: '2',
  255. [supplyType.WQJG]: '3',
  256. }
  257. // 通用设置和工具
  258. const _base = XML_EXPORT_BASE;
  259. const _config = _base.CONFIG;
  260. const _type = _config.TYPE;
  261. const _util = _base.UTIL;
  262. const _cache = _base.CACHE;
  263. // 项目汇总字段
  264. const summaryObj = {
  265. // 取固定清单的综合合价进行汇总
  266. feeFields: [
  267. { k: fixedFlag.ENGINEERINGCOST, v: 'engineeringCost' },
  268. { k: fixedFlag.SUB_ENGINERRING, v: 'subEngineering' },
  269. { k: fixedFlag.MEASURE, v: 'measure' },
  270. { k: fixedFlag.GREEN_MEASURE_FEE, v: 'greenMeasureFee' },
  271. { k: fixedFlag.OTHER_MEASURE_FEE, v: 'otherPreliminaries' },
  272. { k: fixedFlag.OTHER, v: 'other' },
  273. { k: fixedFlag.PROVISIONAL, v: 'provisional' },
  274. { k: fixedFlag.MATERIAL_PROVISIONAL, v: 'materialProvisional' },
  275. { k: fixedFlag.ENGINEERING_ESITIMATE, v: 'engineeringEstimate' },
  276. { k: fixedFlag.DAYWORK, v: 'daywork' },
  277. { k: fixedFlag.TURN_KEY_CONTRACT, v: 'turnKeyContract' },
  278. { k: fixedFlag.CLAIM, v: 'claim' },
  279. { k: fixedFlag.VISA, v: 'visa' },
  280. { k: fixedFlag.TAX, v: 'tax' }
  281. ],
  282. // 取工程造价的一些费用进行汇总,k为汇总到summaryInfo的字段,v为取的工程造价费用字段
  283. engineeringCostFields: [
  284. { k: 'labour', v: 'labour' },
  285. { k: 'material', v: 'material' },
  286. { k: 'equipment', v: 'equipment' },
  287. { k: 'mainMaterial', v: 'mainMaterial' },
  288. { k: 'machine', v: 'machine' },
  289. { k: 'overhead', v: 'manage' },
  290. { k: 'profit', v: 'profit' },
  291. ]
  292. };
  293. // 获取工程类型:枚举单位工程的工程专业+费用标准,用“;”分隔
  294. function getProjectType(projectData) {
  295. // 工程类型 工程专业+费用标准
  296. return projectData.children.reduce((acc, eng) => {
  297. const tenderProjectTypeArr = eng.children.reduce((acc, tender) => {
  298. const engineeringName = tender.property.engineeringName.replace('工程', '');
  299. const feeStandardName = tender.property.feeStandardName;
  300. acc.push(`${engineeringName}${feeStandardName}`);
  301. return acc;
  302. }, []);
  303. acc.push(...tenderProjectTypeArr);
  304. return acc;
  305. }, []).join(';');
  306. }
  307. // 清单名称首字母包含的清单ID eg: 'AABC': ['ID1', 'ID2']
  308. const firstLetterMap = {};
  309. // 对已被占用的费用字典进行占位处理
  310. feeCodeList.forEach(feeCode => firstLetterMap[feeCode] = [null]);
  311. /**
  312. * 获取费用字典
  313. * @param {Object} bills - 清单数据,清单获取费用字典时用
  314. * @param {String} formula - 文本内容,非ID引用基数获取费用字典时用 eg: {分部分项工程费}
  315. * @return {String}
  316. */
  317. function getFeeCode(bills, formula) {
  318. let feeCode;
  319. // 清单获取费用字典,如果根据固定类别找不到对应的费用字典,才用名称首字母获取
  320. if (bills) {
  321. const flag = bills.flagsIndex && bills.flagsIndex.fixed ? bills.flagsIndex.fixed.flag : null;
  322. feeCode = FlagFeeCodeMap[flag];
  323. if (feeCode) {
  324. return feeCode;
  325. }
  326. const name = bills.name || '';
  327. // 出现重名,应以“费用代号_顺序号”规则,顺序号为自然数,从 1 开始
  328. const tempFeeCode = pinyinUtil.getFirstLetter(name);
  329. const sameFeeCodes = firstLetterMap[tempFeeCode] ? firstLetterMap[tempFeeCode] : firstLetterMap[tempFeeCode] = [];
  330. feeCode = sameFeeCodes.includes(bills.ID)
  331. ? `${tempFeeCode}${sameFeeCodes.indexOf(bills.ID) === 0 ? '' : '_' + sameFeeCodes.indexOf(bills.ID)}`
  332. : sameFeeCodes.length
  333. ? `${tempFeeCode}_${sameFeeCodes.length}`
  334. : tempFeeCode;
  335. sameFeeCodeIDs.push(bills.ID);
  336. return feeCode;
  337. } else { // 非ID引用基数获取费用字典
  338. return FormulaFeeCodeMap[formula] || '';
  339. }
  340. }
  341. // 获取转换后的计算基数
  342. // 1.有子项,则取固定清单对应基数
  343. // 2.无子项,有基数,转换为费用字典
  344. function getQtyFormula(node) {
  345. let expr = node.data.calcBase || '';
  346. if (node.children.length) {
  347. return FlagCalcBaseMap[node.getFlag()] || '';
  348. }
  349. if (expr) {
  350. const normalBase = _util.getNormalBase(expr);
  351. const idBase = _util.getIDBase(expr);
  352. //普通基数转费用字典
  353. normalBase.forEach(base => {
  354. const feeCode = getFeeCode(null, base);
  355. expr = expr.replace(new RegExp(base, 'g'), feeCode);
  356. });
  357. //id引用转换为费用字典
  358. idBase.forEach(base => {
  359. const id = base.match(/[^@]+/)[0];
  360. const theNode = node.tree.getNodeByID(id);
  361. const feeCode = getFeeCode(theNode.data);
  362. expr = expr.replace(new RegExp(base, 'g'), feeCode);
  363. });
  364. return expr;
  365. }
  366. }
  367. // 获取计算计算说明
  368. function getCalBasis(node) {
  369. let expr = node.data.calcBase || '';
  370. expr = expr.replace(new RegExp('{', 'g'), '');
  371. expr = expr.replace(new RegExp('}', 'g'), '');
  372. return expr;
  373. }
  374. // 获取定额册 取定额编号开头字母后面、-前面的数字,没有则取0
  375. // 如: A2-1-1 则册为2
  376. function getVolume(code) {
  377. if (!code) {
  378. return '0';
  379. }
  380. const reg = /^[A-Za-z](\d+)(?=-)/;
  381. const rst = reg.exec(code);
  382. return rst ? rst[1] : '0';
  383. }
  384. // 获取定额章 取定额编号第一个-和第二个-之间的数字
  385. // 如: A1-2-3 则章为2
  386. function getChapter(code) {
  387. if (!code) {
  388. return '0';
  389. }
  390. const reg = /^[A-Za-z]\d+-(\d+)(?=-)/;
  391. const rst = reg.exec(code);
  392. return rst ? rst[1] : '0';
  393. }
  394. // 获取人材机类型
  395. function getGLJKind(type) {
  396. // 标准中的定义: 1=人工;2=材料;3=机械;4=主材;5=设备;6=配合比(砂浆、混凝土);7=机械(具)台班;8=定额材料;15=其他。
  397. // 处理人材机类型:2=除了配合比、砂浆、混凝土的材料; 3=除了机械台班的机械
  398. type = +type;
  399. switch (type) {
  400. case 202:
  401. case 203:
  402. case 204:
  403. return '6'; // 配合比、砂浆、混凝土
  404. case 301:
  405. return '7'; // 机械台班
  406. case 6:
  407. case 7:
  408. case 8:
  409. return '15'; // 管理费、利润、一般风险费
  410. }
  411. const rootTypeReg = /\d/;
  412. const rootType = rootTypeReg.exec(type)[0];
  413. return ['1', '2', '3', '4', '5', '6'].includes(rootType) ? rootType : '15';
  414. }
  415. /*
  416. * 提取数据入口
  417. * @param {String}userID 用户ID
  418. * {Number}exportKind 导出类型(投标1、招标2、控制价3
  419. * {Object}projectData 项目数据(项目自身的数据、建设、单项、单位的数据(projects表的数据),不包含详细的清单定额等数据)
  420. * @return {Array} [{data: Object, exportKind: Number, fileName: String}]
  421. * */
  422. async function entry(userID, exportKind, projectData) {
  423. // name为导出的xml节点属性名称 dName为可能需要显示给用户属性时使用的名称,比如自检提示的时候用,这里只有required为true时需要设置dNam
  424. // 错误列表
  425. const _failList = _cache.getItem('failList');
  426. // 建设项目
  427. function ConstructionProject(projectData) {
  428. const basicInformation = projectData.property.basicInformation;
  429. const attrs = [
  430. // 项目编号
  431. {
  432. name: 'Number', dName: '项目编号', required: true,
  433. value: ''
  434. },
  435. // 项目名称
  436. {
  437. name: 'Name', dName: '项目名称', required: true,
  438. value: projectData.name
  439. },
  440. // 工程类别
  441. {
  442. name: 'ProjectCategory', dName: '工程类别', required: true,
  443. value: _util.getValueByKey(basicInformation, 'projectCategory')
  444. },
  445. // 工程类型
  446. {
  447. name: 'ProjectType', dName: '工程类型', required: true,
  448. value: getProjectType(projectData)
  449. },
  450. // 建设性质
  451. {
  452. name: 'ConstructionType', type: _type.INT, enumeration: Object.keys(ConstructionType),
  453. value: ConstructionType[_util.getValueByKey(basicInformation, 'constructionType')]
  454. },
  455. // 文件类型
  456. {
  457. name: 'FileKind', dName: '造价类型', type: _type.INT, required: true, enumeration: Object.keys(CostType),
  458. value: FileKind[exportKind]
  459. },
  460. // 计价模式
  461. {
  462. name: 'ValuationModel', dName: '计价模式', type: _type.INT, required: true,
  463. value: ValuationModel.bill
  464. },
  465. // 计税模式
  466. {
  467. name: 'TaxModel', dName: '计税模式', type: _type.INT, required: true,
  468. value: projectData.property.taxType
  469. },
  470. // 地区类别
  471. {
  472. name: 'AreaKind', dName: '地区类别', type: _type.INT, required: true, enumeration: Object.keys(AreaKind),
  473. value: _util.getValueByKey(basicInformation, 'regionalCategories')
  474. },
  475. // 工程地点
  476. {
  477. name: 'ProjectSite',
  478. value: _util.getValueByKey(basicInformation, 'projLocation')
  479. },
  480. // 建设单位
  481. {
  482. name: 'BuildUnit', dName: '建设单位', required: true,
  483. value: _util.getValueByKey(basicInformation, 'constructingUnits')
  484. },
  485. // 建设单位法定代表人或其授权人
  486. {
  487. name: 'BulidAuthorizer',
  488. value: _util.getValueByKey(basicInformation, 'constructingUnitsPerson')
  489. },
  490. // 数据交换标准名称
  491. {
  492. name: 'StandardName', required: true,
  493. value: '建设工程政府投资项目造价数据标准'
  494. },
  495. // 数据交换标准编号
  496. {
  497. name: 'StandardNumber', required: true,
  498. value: 'DBJ/T XX-XX-2018'
  499. },
  500. // 建设(编制)范围
  501. {
  502. name: 'RangeOfCompilation',
  503. value: _util.getValueByKey(basicInformation, 'rangeOfCompilation')
  504. },
  505. // 建设规模
  506. {
  507. name: 'Scale', dName: '工程规模', type: _type.DECIMAL, required: true,
  508. value: _util.getValueByKey(basicInformation, 'projectScale')
  509. },
  510. // 建设规模单位
  511. {
  512. name: 'Unit', dName: '建设规模单位', required: true,
  513. value: _util.getValueByKey(basicInformation, 'unit')
  514. },
  515. // 技术经济指标(元) 取单方造价
  516. {
  517. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  518. value: summaryInfo.perCost
  519. },
  520. // 总说明 编制说明
  521. {
  522. name: 'Explains',
  523. value: projectData.property.compilationIllustration
  524. }
  525. ];
  526. //唯一约束
  527. this.constraints = {
  528. billsCode: [], //清单项目项目编码(xsd中没体现,通过跟pm沟通得知)
  529. };
  530. _base.Element.call(this, 'ConstructionProject', attrs);
  531. }
  532. // 系统信息
  533. function SystemInfo({ ID1, ID2, makeDate }) {
  534. const attrs = [
  535. // 编制软件信息
  536. { name: 'ID1', value: ID1 },
  537. // 编制机器硬件信息,不输出
  538. { name: 'ID2', value: ID2 },
  539. // 文件生成时间
  540. {
  541. name: 'MakeDate', dName: '文件生成时间', type: _type.DATE_TIME, required: true,
  542. value: makeDate
  543. }
  544. ];
  545. _base.Element.call(this, 'SystemInfo', attrs);
  546. }
  547. // 工程信息
  548. function ConstructionInfo() {
  549. _base.Element.call(this, 'ConstructionInfo', []);
  550. }
  551. // 费用精度
  552. function Option() {
  553. const attrs = [
  554. // 工料机消耗量、含量、用量类小数精度
  555. {
  556. name: 'ResPrecision', type: _type.INT, required: true,
  557. value: Decimal.GLJ
  558. },
  559. // 工程量、数量类小数精度
  560. {
  561. name: 'QuantityPrecision', type: _type.INT, required: true,
  562. value: Decimal.QUANTITY
  563. },
  564. // 金额、合价、费用类小数精度
  565. {
  566. name: 'CostPrecision', type: _type.INT, required: true,
  567. value: Decimal.Fee
  568. },
  569. // 费率、指数、比例(%)类小数精度
  570. {
  571. name: 'RatePrecision', type: _type.INT, required: true,
  572. value: Decimal.RATE
  573. }
  574. ];
  575. _base.Element.call(this, 'Option', attrs);
  576. }
  577. // 估(概、预、结)算信息
  578. function ProjectInfo(basicInformation, summaryInfo) {
  579. const attrs = [
  580. // 设计单位
  581. { name: 'Designer', value: _util.getValueByKey(basicInformation, 'designUnits') },
  582. // 承包单位
  583. { name: 'Contractor', value: _util.getValueByKey(basicInformation, 'constructionUnits') },
  584. // 编制单位
  585. {
  586. name: 'CompileCompany', dName: '编制单位', required: true,
  587. value: _util.getValueByKey(basicInformation, 'establishUnit') || '无'
  588. },
  589. // 编制单位法定代表人或其授权人
  590. { name: 'Authorizer', value: _util.getValueByKey(basicInformation, 'constructingUnitsPerson') },
  591. // 编制人
  592. { name: 'Compiler', value: _util.getValueByKey(basicInformation, 'establishUnitAuthor') },
  593. // 编制人资格证书编号
  594. { name: 'CompilerCertNo', value: _util.getValueByKey(basicInformation, 'establishDate') },
  595. // 编制时间
  596. {
  597. name: 'CompileDate', dName: '编制时间', required: true,
  598. value: 'todo',
  599. },
  600. // 审核人
  601. { name: 'Examiner', value: _util.getValueByKey(basicInformation, 'auditUnitAuditor') },
  602. // 审核人资格证书编号
  603. { name: 'ExaminerCertNo', value: _util.getValueByKey(basicInformation, 'ExaminerCertNo') },
  604. // 审核时间
  605. { name: 'ExamineDate', value: _util.getValueByKey(basicInformation, 'auditDate') },
  606. // 审定人
  607. { name: 'Approver', value: _util.getValueByKey(basicInformation, 'Approver') },
  608. // 审定人资格证书编号
  609. { name: 'ApproverCertNo', value: _util.getValueByKey(basicInformation, 'ApproverCertNo') },
  610. // 审定时间
  611. { name: 'ApproverDate', value: _util.getValueByKey(basicInformation, 'ApproverDate') },
  612. // 工程总价(元)
  613. {
  614. name: 'Total', dName: '工程总价', type: _type.DECIMAL, required: true,
  615. value: summaryInfo.engineeringCost || '0'
  616. }
  617. ];
  618. _base.Element.call(this, 'ProjectInfo', attrs);
  619. }
  620. // 招标信息 工程量清单、招标控制价时输出
  621. function TendereeInfo(basicInformation) {
  622. const attrs = [
  623. // 招标人
  624. {
  625. name: 'TendereeName', dName: '招标人', required: true,
  626. value: _util.getValueByKey(basicInformation, 'bidInviter')
  627. },
  628. // 招标单位法定代表人或其授权人
  629. {
  630. name: 'TenderAuthorizer',
  631. value: _util.getValueByKey(basicInformation, 'tenderRepresentative')
  632. },
  633. // 招标单位编制人
  634. {
  635. name: 'TenderCompiler',
  636. value: _util.getValueByKey(basicInformation, 'TenderCompiler')
  637. },
  638. // 招标单位编制人资格证书编号
  639. {
  640. name: 'TenderCompilerCertNo',
  641. value: _util.getValueByKey(basicInformation, 'TenderCompilerCertNo')
  642. },
  643. // 招标单位编制时间
  644. {
  645. name: 'TenderCompileDate',
  646. value: _util.getValueByKey(basicInformation, 'TenderCompileDate')
  647. },
  648. // 招标单位审核人
  649. {
  650. name: 'TenderExaminer',
  651. value: _util.getValueByKey(basicInformation, 'TenderExaminer')
  652. },
  653. // 招标单位审核人资格证书编号
  654. {
  655. name: 'TenderExaminerCertNo',
  656. value: _util.getValueByKey(basicInformation, 'TenderExaminerCertNo')
  657. },
  658. // 招标单位审核时间
  659. {
  660. name: 'TenderExamineDate',
  661. value: _util.getValueByKey(basicInformation, 'TenderExamineDate')
  662. },
  663. // 招标单位审定人
  664. {
  665. name: 'TenderApprover',
  666. value: _util.getValueByKey(basicInformation, 'TenderApprover')
  667. },
  668. // 招标单位审定人资格证书编号
  669. {
  670. name: 'TenderApproverCertNo',
  671. value: _util.getValueByKey(basicInformation, 'TenderApproverCertNo')
  672. },
  673. // 招标单位审定时间
  674. {
  675. name: 'TenderApproveDate',
  676. value: _util.getValueByKey(basicInformation, 'TenderApproveDate')
  677. },
  678. // 招标代理 不得为空,如无招标代理,则应填写“无”。
  679. {
  680. name: 'Proxy', dName: '招标代理',
  681. value: _util.getValueByKey(basicInformation, 'Proxy'), required: true
  682. },
  683. // 招标代理资质证书编号
  684. {
  685. name: 'ProxyCertNo',
  686. value: _util.getValueByKey(basicInformation, 'ProxyCertNo')
  687. },
  688. // 招标代理法定代表人或其授权人
  689. {
  690. name: 'ProxyAuthorizer',
  691. value: _util.getValueByKey(basicInformation, 'ProxyAuthorizer')
  692. },
  693. // 招标代理编制人员
  694. {
  695. name: 'ProxyCompiler',
  696. value: _util.getValueByKey(basicInformation, 'ProxyCompiler')
  697. },
  698. // 招标代理编制人员资格证书编号
  699. {
  700. name: 'ProxyCompilerCertNo',
  701. value: _util.getValueByKey(basicInformation, 'ProxyCompilerCertNo')
  702. },
  703. // 招标代理编制时间
  704. {
  705. name: 'ProxyCompileDate',
  706. value: _util.getValueByKey(basicInformation, 'ProxyCompileDate')
  707. },
  708. // 招标代理审核人
  709. {
  710. name: 'ProxyExaminer',
  711. value: _util.getValueByKey(basicInformation, 'ProxyExaminer')
  712. },
  713. // 招标代理审核人资格证书编号
  714. {
  715. name: 'ProxyExaminerCertNo',
  716. value: _util.getValueByKey(basicInformation, 'ProxyExaminerCertNo')
  717. },
  718. // 招标代理审核时间
  719. {
  720. name: 'ProxyExamineDate',
  721. value: _util.getValueByKey(basicInformation, 'ProxyExamineDate')
  722. },
  723. // 招标代理审定人
  724. {
  725. name: 'ProxyApprover',
  726. value: _util.getValueByKey(basicInformation, 'ProxyApprover')
  727. },
  728. // 招标代理审定人资格证书编号
  729. {
  730. name: 'ProxyApproverCertNo',
  731. value: _util.getValueByKey(basicInformation, 'ProxyApproverCertNo')
  732. },
  733. // 招标代理审定时间
  734. {
  735. name: 'ProxyApproveDate',
  736. value: _util.getValueByKey(basicInformation, 'ProxyApproveDate')
  737. },
  738. // 造价咨询 、Consultant(造价咨询):不得为空,如无则应填写“无”。
  739. {
  740. name: 'Consultant', dName: '造价咨询', required: true,
  741. value: _util.getValueByKey(basicInformation, 'Consultant')
  742. },
  743. // 造价咨询资质证书编号
  744. {
  745. name: 'ConsultantCertNo',
  746. value: _util.getValueByKey(basicInformation, 'ConsultantCertNo')
  747. },
  748. // 造价咨询法定代表人或其授权人
  749. {
  750. name: 'ConsultantAuthorizer',
  751. value: _util.getValueByKey(basicInformation, 'ConsultantAuthorizer')
  752. },
  753. // 造价咨询编制人
  754. {
  755. name: 'ConsultantCompiler',
  756. value: _util.getValueByKey(basicInformation, 'ConsultantCompiler')
  757. },
  758. // 造价咨询编制人资格证书
  759. {
  760. name: 'ConsultantCompilerCertNo',
  761. value: _util.getValueByKey(basicInformation, 'ConsultantCompilerCertNo')
  762. },
  763. // 造价咨询编制时间
  764. {
  765. name: 'ConsultantCompileDate',
  766. value: _util.getValueByKey(basicInformation, 'ConsultantCompileDate')
  767. },
  768. // 造价咨询审核人
  769. {
  770. name: 'ConsultantExaminer',
  771. value: _util.getValueByKey(basicInformation, 'ConsultantExaminer')
  772. },
  773. // 造价咨询审核人资格证书编号
  774. {
  775. name: 'ConsultantExaminerCertNo',
  776. value: _util.getValueByKey(basicInformation, 'ConsultantExaminerCertNo')
  777. },
  778. // 造价咨询审核时间
  779. {
  780. name: 'ConsultantExamineDate',
  781. value: _util.getValueByKey(basicInformation, 'ConsultantExamineDate')
  782. },
  783. // 造价咨询审定人
  784. {
  785. name: 'ConsultantApprover',
  786. value: _util.getValueByKey(basicInformation, 'ConsultantApprover')
  787. },
  788. // 造价咨询审定人资格证书编号
  789. {
  790. name: 'ConsultantApproverCertNo',
  791. value: _util.getValueByKey(basicInformation, 'ConsultantApproverCertNo')
  792. },
  793. // 造价咨询审定时间
  794. {
  795. name: 'ConsultantApproveDate',
  796. value: _util.getValueByKey(basicInformation, 'ConsultantApproveDate')
  797. },
  798. // 招标控制价(元)
  799. {
  800. name: 'TenderSumLimit', dName: '招标控制价', type: _type.DECIMAL, required: true,
  801. value: 'todo'
  802. }
  803. ];
  804. _base.Element.call(this, 'TendereeInfo', attrs);
  805. }
  806. // 投标信息
  807. function BidderInfo(basicInformation, summaryInfo) {
  808. const attrs = [
  809. // 投标人
  810. {
  811. name: 'BidName', dName: '投标人', required: true,
  812. value: _util.getValueByKey(basicInformation, 'bidName')
  813. },
  814. // 投标单位法定代表人或其授权人
  815. {
  816. name: 'BidAuthorizer',
  817. value: _util.getValueByKey(basicInformation, 'bidAuthorizer')
  818. },
  819. // 投标总价(元)
  820. {
  821. name: 'BidAuthorizer', dName: '投标总价', type: _type.DECIMAL, required: true,
  822. value: summaryInfo.engineeringCost
  823. },
  824. // 投标单位编制人
  825. {
  826. name: 'BidCompiler',
  827. value: _util.getValueByKey(basicInformation, 'bidCompiler')
  828. },
  829. // 投标单位编制人资格证书编号
  830. {
  831. name: 'BidCompilerCertNo',
  832. value: _util.getValueByKey(basicInformation, 'BidCompilerCertNo')
  833. },
  834. // 投标单位编制时间
  835. {
  836. name: 'BidCompileDate',
  837. value: _util.getValueByKey(basicInformation, 'bidCompileDate')
  838. },
  839. // 投标单位审核人
  840. {
  841. name: 'BidExaminer',
  842. value: _util.getValueByKey(basicInformation, 'bidExaminer')
  843. },
  844. // 投标单位审核人资格证书编号
  845. {
  846. name: 'BidExaminerCertNo',
  847. value: _util.getValueByKey(basicInformation, 'bidExaminerCertNo')
  848. },
  849. // 投标单位审核时间
  850. {
  851. name: 'BidExamineDate',
  852. value: _util.getValueByKey(basicInformation, 'bidExamineDate')
  853. },
  854. // 投标单位审定人
  855. {
  856. name: 'BidApprover',
  857. value: _util.getValueByKey(basicInformation, 'bidApprover')
  858. },
  859. // 投标单位审定人资格证书
  860. {
  861. name: 'BidApproverCertNo',
  862. value: _util.getValueByKey(basicInformation, 'bidApproverCertNo')
  863. },
  864. // 投标单位审定时间
  865. {
  866. name: 'BidApproveDate',
  867. value: _util.getValueByKey(basicInformation, 'BidApproveDate')
  868. }
  869. ];
  870. _base.Element.call(this, 'BidderInfo', attrs);
  871. }
  872. // 费用汇总
  873. function SummaryOfCost(summaryInfo) {
  874. const attrs = [
  875. // 工程造价(元)
  876. {
  877. name: 'Total', type: _type.DECIMAL,
  878. value: summaryInfo.engineeringCost
  879. },
  880. // 建筑工程费
  881. {
  882. name: 'Construction', type: _type.DECIMAL,
  883. value: '0'
  884. },
  885. // 安装工程费
  886. {
  887. name: 'Installation', type: _type.DECIMAL,
  888. value: '0',
  889. },
  890. // 分部分项工程费
  891. {
  892. name: 'DivisionalAndElementalWorks', type: _type.DECIMAL,
  893. value: summaryInfo.subEngineering
  894. },
  895. // 措施项目费
  896. {
  897. name: 'Preliminaries', type: _type.DECIMAL,
  898. value: summaryInfo.measure
  899. },
  900. // 绿色施工安全防护措施费
  901. {
  902. name: 'CostForHSE', type: _type.DECIMAL,
  903. value: summaryInfo.greenMeasureFee
  904. },
  905. // 其他措施费
  906. {
  907. name: 'OtherPreliminaries', type: _type.DECIMAL,
  908. value: summaryInfo.otherPreliminaries
  909. },
  910. // 其他项目费
  911. {
  912. name: 'SundryCosts', type: _type.DECIMAL,
  913. value: summaryInfo.other
  914. },
  915. // 暂列金额
  916. {
  917. name: 'ProvisionalSums', type: _type.DECIMAL,
  918. value: summaryInfo.provisional
  919. },
  920. // 暂估价材料
  921. {
  922. name: 'ProvisionalMaterial', type: _type.DECIMAL,
  923. value: summaryInfo.materialProvisional
  924. },
  925. // 专业工程暂估价
  926. {
  927. name: 'SpecialtyProvisionalPrice', type: _type.DECIMAL,
  928. value: summaryInfo.engineeringEstimate
  929. },
  930. // 计日工费用
  931. {
  932. name: 'DayWorkRate', type: _type.DECIMAL,
  933. value: summaryInfo.daywork
  934. },
  935. // 总承包服务费
  936. {
  937. name: 'MainContractorAttendance', type: _type.DECIMAL,
  938. value: summaryInfo.turnKeyContract
  939. },
  940. // 索赔费用
  941. {
  942. name: 'ClaimForLossAndExpenses', type: _type.DECIMAL,
  943. value: summaryInfo.claim
  944. },
  945. // 现场签证费用
  946. {
  947. name: 'SiteInstruction', type: _type.DECIMAL,
  948. value: summaryInfo.visa
  949. },
  950. // 规费
  951. {
  952. name: 'StatutoryFees', type: _type.DECIMAL,
  953. value: '0'
  954. },
  955. // 税金
  956. {
  957. name: 'Tax', type: _type.DECIMAL,
  958. value: summaryInfo.tax
  959. },
  960. // 人工费
  961. {
  962. name: 'Labor', type: _type.DECIMAL,
  963. value: summaryInfo.labour
  964. },
  965. // 材料费
  966. {
  967. name: 'Material', type: _type.DECIMAL,
  968. value: summaryInfo.material
  969. },
  970. // 设备费
  971. {
  972. name: 'Equipment', type: _type.DECIMAL,
  973. value: summaryInfo.equipment
  974. },
  975. // 主材设备费
  976. {
  977. name: 'MainMaterialEquipment', type: _type.DECIMAL,
  978. value: scMathUtil.roundForObj(summaryInfo.mainMaterial + summaryInfo.equipment, Decimal.FEE)
  979. },
  980. // 主材费
  981. {
  982. name: 'MainMaterial', type: _type.DECIMAL,
  983. value: summaryInfo.mainMaterial
  984. },
  985. // 机械费
  986. {
  987. name: 'Machine', type: _type.DECIMAL,
  988. value: summaryInfo.machine
  989. },
  990. // 管理费
  991. {
  992. name: 'Overhead', type: _type.DECIMAL,
  993. value: summaryInfo.overhead
  994. },
  995. // 利润
  996. {
  997. name: 'Profit', type: _type.DECIMAL,
  998. value: summaryInfo.profit
  999. },
  1000. ];
  1001. _base.Element.call(this, 'SummaryOfCost', attrs);
  1002. }
  1003. // 建筑安装工程费
  1004. function ProjectInstallationWorkCost(projectData, summaryInfo) {
  1005. const basicInformation = projectData.property.basicInformation;
  1006. const attrs = [
  1007. // 工程编号
  1008. {
  1009. name: 'Number',
  1010. value: ''
  1011. },
  1012. // 工程名称
  1013. {
  1014. name: 'Name', required: true,
  1015. value: projectData.name
  1016. },
  1017. // 金额 (元)
  1018. {
  1019. name: 'Total', type: _type.DECIMAL,
  1020. value: summaryInfo.engineeringCost
  1021. },
  1022. // 建设规模
  1023. {
  1024. name: 'Scale', type: _type.DECIMAL, required: true,
  1025. value: _util.getValueByKey(basicInformation, 'projectScale')
  1026. },
  1027. // 建设规模单位
  1028. {
  1029. name: 'Unit', required: true,
  1030. value: _util.getValueByKey(basicInformation, 'todo')
  1031. },
  1032. // 占总投资比例(%)
  1033. {
  1034. name: 'Ratios', type: _type.DECIMAL,
  1035. value: '0.00'
  1036. },
  1037. ];
  1038. _base.Element.call(this, 'ProjectInstallationWorkCost', attrs);
  1039. }
  1040. // 单项工程
  1041. function SectionWorks({ name, total, rate }) {
  1042. const attrs = [
  1043. // 工程编号
  1044. {
  1045. name: 'Number',
  1046. value: ''
  1047. },
  1048. // 工程名称
  1049. {
  1050. name: 'Name', required: true,
  1051. value: name
  1052. },
  1053. // 金额
  1054. {
  1055. name: 'Total', type: _type.DECIMAL,
  1056. value: total
  1057. },
  1058. // 建设规模 单项工程没有填写的地方,输出“0”
  1059. {
  1060. name: 'Scale', dName: '建设规模', type: _type.DECIMAL, required: true,
  1061. value: '0'
  1062. },
  1063. // 建设规模单位 单项工程没有填写的地方,输出和"m2"
  1064. {
  1065. name: 'Unit', dName: '建设规模单位', required: true,
  1066. value: 'm2'
  1067. },
  1068. // 占总投资比例(%)
  1069. {
  1070. name: 'Ratios', type: _type.DECIMAL,
  1071. value: rate
  1072. },
  1073. // 费用代号
  1074. {
  1075. name: 'Code', type: _type.DECIMAL,
  1076. value: ''
  1077. },
  1078. ];
  1079. _base.Element.call(this, 'SectionWorks', attrs);
  1080. }
  1081. // 单位工程
  1082. function UnitWorks(projectData, tenderData, summaryInfo) {
  1083. const basicInformation = projectData.property.basicInformation;
  1084. const projectFeature = tenderData.property.projectFeature;
  1085. const attrs = [
  1086. // 工程编号
  1087. {
  1088. name: 'Number', required: true,
  1089. value: ''
  1090. },
  1091. // 工程名称
  1092. {
  1093. name: 'Name', required: true,
  1094. value: tenderData.name
  1095. },
  1096. // 标段 取建设项目名称
  1097. {
  1098. name: 'Segment',
  1099. value: projectData.name
  1100. },
  1101. // 工程类别
  1102. {
  1103. name: 'ProjectCategory', required: true,
  1104. value: _util.getValueByKey(basicInformation, 'projectCategory')
  1105. },
  1106. // 工程类型
  1107. {
  1108. name: 'ProjectType', required: true,
  1109. value: getProjectType(projectData)
  1110. },
  1111. // 计价模式
  1112. {
  1113. name: 'ValuationModel', type: _type.INT, required: true,
  1114. value: VALUATION_MODEL.bill
  1115. },
  1116. // 计税模式
  1117. {
  1118. name: 'TaxModel', type: _type.INT, required: true,
  1119. value: tenderData.property.taxType
  1120. },
  1121. // 地区类别 取建设项目-基本信息-地区类别
  1122. {
  1123. name: 'AreaKind', type: _type.INT, required: true,
  1124. value: _util.getValueByKey(basicInformation, 'regionalCategories')
  1125. },
  1126. // 金额
  1127. {
  1128. name: 'Total', type: _type.DECIMAL,
  1129. value: summaryInfo.engineeringCost
  1130. },
  1131. // 专业类别
  1132. {
  1133. name: 'Specialty', type: _type.INT,
  1134. value: Specialty[tenderData.property.engineeringName]
  1135. },
  1136. // 工程用途
  1137. {
  1138. name: 'Purposes',
  1139. value: ''
  1140. },
  1141. //建设(编制)范围
  1142. {
  1143. name: 'RangeOfCompilation',
  1144. value: ''
  1145. },
  1146. // 建设规模 取单位工程-工程特征-建设规模
  1147. {
  1148. name: 'Scale', type: _type.DECIMAL, required: true,
  1149. value: _util.getValueByKey(projectFeature, 'buildScale')
  1150. },
  1151. // 建设规模单位
  1152. {
  1153. name: 'Unit', required: true,
  1154. value: 'todo'
  1155. },
  1156. // 占总投资比例(%)
  1157. {
  1158. name: 'Ratios', type: _type.DECIMAL,
  1159. value: src.summaryInfo.rate
  1160. },
  1161. // 清单数据库,没有则填写 “无”
  1162. {
  1163. name: 'BillDataBase', required: true,
  1164. value: '工程量清单规范(2013广东)',
  1165. },
  1166. // 定额数据库,没有则填写 “无”,后续获取详细数据(getTenderDetail)的时候填上
  1167. {
  1168. name: 'NormDataBase', required: true,
  1169. value: '无'
  1170. },
  1171. // 人工材料设备价格文件,没有则填写 “无”
  1172. {
  1173. name: 'ResInfoPricingFile', required: true,
  1174. value: '无'
  1175. },
  1176. // 总说明
  1177. {
  1178. name: 'Explains',
  1179. value: tenderData.property.compilationIllustrationProject
  1180. },
  1181. // 导出XML文件名,工程编号+工程名称.xml, 暂时取“名称.xml”,用户设置完工程编号后修改此值
  1182. {
  1183. name: 'FileName',
  1184. value: `${tenderData.name}.xml`
  1185. },
  1186. // 备注
  1187. {
  1188. name: 'Remark',
  1189. value: ''
  1190. },
  1191. ];
  1192. _base.Element.call(this, 'UnitWorks', attrs);
  1193. }
  1194. // 工程特征信息 AttrInfo, 补充信息AddiInfo
  1195. function Info(eleName) {
  1196. _base.Element.call(this, eleName, []);
  1197. }
  1198. // 工程特征信息明细 AttrInfoItem, 补充信息明细AddiInfoItem
  1199. function InfoItem(eleName, attr) {
  1200. const attrs = [
  1201. {
  1202. name: 'Name', required: true,
  1203. value: attr.dispName,
  1204. },
  1205. { name: 'Value', value: attr.value },
  1206. ];
  1207. if (attr.code) {
  1208. attrs.push({ name: 'Code', value: attr.code });
  1209. }
  1210. if (attr.remark) {
  1211. attrs.push({ name: 'Remark', value: attr.remark });
  1212. }
  1213. _base.Element.call(this, eleName, attrs);
  1214. }
  1215. // 单位工程费用汇总
  1216. function UnitWorksSummary() {
  1217. _base.Element.call(this, 'UnitWorksSummary', []);
  1218. }
  1219. // 单位工程费用汇总标题
  1220. function UnitWorksSummaryGroup(bills) {
  1221. const attrs = [
  1222. // 费用编号
  1223. { name: 'Number', value: bills.code },
  1224. // 费用名称
  1225. {
  1226. name: 'Name', required: true,
  1227. value: bills.name
  1228. },
  1229. // 单位
  1230. { name: 'Unit', value: bills.unit },
  1231. // 工程量
  1232. {
  1233. name: 'Quantity', type: _type.DECIMAL,
  1234. value: bills.quantity
  1235. },
  1236. // 金额
  1237. {
  1238. name: 'Total', type: _type.DECIMAL,
  1239. value: _util.getFee(bills.fees, 'common.totalFee')
  1240. },
  1241. // 技术经济指标(元) 取综合单价
  1242. {
  1243. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1244. value: _util.getFee(bills.fees, 'common.unitFee')
  1245. },
  1246. //章节类型
  1247. {
  1248. name: 'ChapterKind', type: _type.INT, required: true,
  1249. value: '4'
  1250. },
  1251. // 费用代号
  1252. {
  1253. name: 'Code', type: _type.INT, required: true,
  1254. value: getFeeCode(bills)
  1255. },
  1256. // 汇总类型
  1257. {
  1258. name: 'Kind', type: _type.INT, required: true,
  1259. value: '1'
  1260. },
  1261. // 备注
  1262. { name: 'Remark', value: bills.remark }
  1263. ];
  1264. _base.Element.call(this, 'UnitWorksSummaryGroup', attrs);
  1265. }
  1266. // 单位工程费汇总明细
  1267. function UnitWorksSummaryItem(node) {
  1268. const bills = node.data;
  1269. const attrs = [
  1270. { name: 'Number', value: bills.code },
  1271. {
  1272. name: 'Name', required: true,
  1273. value: bills.name
  1274. },
  1275. { name: 'Unit', value: bills.unit },
  1276. {
  1277. name: 'Quantity', type: _type.DECIMAL,
  1278. value: bills.quantity
  1279. },
  1280. // 计算基数:可由费用代号、数字、四则运算符号、小括号组成
  1281. {
  1282. name: 'QtyFormula', type: _type.DECIMAL,
  1283. value: getQtyFormula(node)
  1284. },
  1285. // 费率
  1286. {
  1287. name: 'Rate', type: _type.DECIMAL,
  1288. value: commonUtil.isDef(bills.feeRate) ? bills.feeRate : '100'
  1289. },
  1290. {
  1291. name: 'Total', type: _type.DECIMAL,
  1292. value: _util.getFee(bills.fees, 'common.totalFee')
  1293. },
  1294. // 技术经济指标(元)
  1295. {
  1296. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1297. value: _util.getFee(bills.fees, 'common.unitFee')
  1298. },
  1299. //章节类型
  1300. {
  1301. name: 'ChapterKind', type: _type.INT, required: true,
  1302. value: '4'
  1303. },
  1304. // 费用代号
  1305. {
  1306. name: 'Code', type: _type.INT, required: true,
  1307. value: getFeeCode(bills)
  1308. },
  1309. // 汇总类型
  1310. {
  1311. name: 'Kind', type: _type.INT, required: true,
  1312. value: '1'
  1313. },
  1314. // 备注
  1315. { name: 'Remark', value: bills.remark }
  1316. ];
  1317. _base.Element.call(this, 'UnitWorksSummaryItem', attrs);
  1318. }
  1319. // 分部分项工程
  1320. function DivisionalAndElementalWorks() {
  1321. _base.Element.call(this, 'DivisionalAndElementalWorks', []);
  1322. }
  1323. // 措施项目
  1324. function Preliminaries() {
  1325. _base.Element.call(this, 'Preliminaries', []);
  1326. }
  1327. // 合计费用
  1328. function SummaryOfBasicCost(items, bills) {
  1329. // 省略了一些
  1330. const mainMaterial = _util.getFee(bills.fees, 'mainMaterial.totalFee');
  1331. const equipment = _util.getFee(bills.fees, 'equipment.totalFee');
  1332. const mainMaterialEquipment = scMathUtil.roundForObj(mainMaterial + equipment, Decimal.FEE); // 主材设备费 = 主材 + 设备 (设备不输出)
  1333. const attrs = [
  1334. // 人工费
  1335. {
  1336. name: 'Labor', type: _type.DECIMAL,
  1337. value: _util.getFee(bills.fees, 'labour.totalFee')
  1338. },
  1339. // 材料费
  1340. {
  1341. name: 'Material', type: _type.DECIMAL,
  1342. value: _util.getFee(bills.fees, 'material.totalFee')
  1343. },
  1344. // 主材费
  1345. {
  1346. name: 'MainMaterial', type: _type.DECIMAL,
  1347. value: mainMaterial
  1348. },
  1349. // 主材设备费
  1350. {
  1351. name: 'MainMaterialEquipment', type: _type.DECIMAL,
  1352. value: mainMaterialEquipment
  1353. },
  1354. // 暂估价
  1355. {
  1356. name: 'Appraisal', type: _type.DECIMAL,
  1357. value: _util.getFeeByFlag(items, fixedFlag.ESTIMATE, 'common.totalFee')
  1358. },
  1359. // 机械费
  1360. {
  1361. name: 'Machine', type: _type.DECIMAL,
  1362. value: _util.getFee(bills.fees, 'machine.totalFee')
  1363. },
  1364. // 管理费
  1365. {
  1366. name: 'Overhead', type: _type.DECIMAL,
  1367. value: _util.getFee(bills.fees, 'manage.totalFee')
  1368. },
  1369. // 利润
  1370. {
  1371. name: 'Profit', type: _type.DECIMAL,
  1372. value: _util.getFee(bills.fees, 'profit.totalFee')
  1373. },
  1374. // 分部分项工程费
  1375. {
  1376. name: 'DivisionalAndElementalWorks', type: _type.DECIMAL,
  1377. value: _util.getFeeByFlag(items, fixedFlag.SUB_ENGINERRING, 'common.totalFee')
  1378. },
  1379. // 措施项目费
  1380. {
  1381. name: 'Preliminaries', type: _type.DECIMAL,
  1382. value: _util.getFeeByFlag(items, fixedFlag.MEASURE, 'common.totalFee')
  1383. },
  1384. // 绿色施工安全防护措施费
  1385. {
  1386. name: 'CostForHSE', type: _type.DECIMAL,
  1387. value: _util.getFeeByFlag(items, fixedFlag.GREEN_MEASURE_FEE, 'common.totalFee')
  1388. },
  1389. // 其他项目费
  1390. {
  1391. name: 'SundryCosts', type: _type.DECIMAL,
  1392. value: _util.getFeeByFlag(items, fixedFlag.OTHER_MEASURE_FEE, 'common.totalFee')
  1393. },
  1394. // 暂列金额
  1395. {
  1396. name: 'ProvisionalSums', type: _type.DECIMAL,
  1397. value: _util.getFeeByFlag(items, fixedFlag.PROVISIONAL, 'common.totalFee')
  1398. },
  1399. // 规费
  1400. {
  1401. name: 'StatutoryFees', type: _type.DECIMAL,
  1402. value: '0'
  1403. },
  1404. // 税金
  1405. {
  1406. name: 'Tax', type: _type.DECIMAL,
  1407. value: _util.getFeeByFlag(items, fixedFlag.TAX, 'common.totalFee')
  1408. },
  1409. ];
  1410. _base.Element.call(this, 'SummaryOfBasicCost', attrs);
  1411. }
  1412. // 分部工程
  1413. function DivisionalWorks(bills) {
  1414. const attrs = [
  1415. // 编码
  1416. { name: 'Number', value: bills.code },
  1417. // 名称
  1418. {
  1419. name: 'Name', required: true,
  1420. value: bills.name
  1421. },
  1422. // 特征
  1423. { name: 'Attr', value: '' },
  1424. // 单位
  1425. { name: 'Unit', value: bills.unit },
  1426. // 工程量
  1427. {
  1428. name: 'Quantity', type: _type.DECIMAL,
  1429. value: bills.quantity
  1430. },
  1431. // 综合合价
  1432. {
  1433. name: 'Total', type: _type.DECIMAL,
  1434. value: _util.getFee(bills.fees, 'common.totalFee')
  1435. },
  1436. // 综合单价
  1437. {
  1438. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1439. value: _util.getFee(bills.fees, 'common.unitFee')
  1440. },
  1441. // 章节类型
  1442. {
  1443. name: 'ChapterKind', type: _type.INT, required: true,
  1444. value: '4'
  1445. },
  1446. // 费用字典,拼音首字母
  1447. { name: 'Code', value: getFeeCode(bills) },
  1448. // 备注
  1449. { name: 'Remark', value: bills.remark }
  1450. ];
  1451. _base.Element.call(this, 'DivisionalWorks', attrs);
  1452. }
  1453. // 清单项目
  1454. function WorkElement(node, kind, specialty) {
  1455. const bills = node.data;
  1456. const attrs = [
  1457. // 项目编码
  1458. { name: 'Number', required: true, value: bills.code || '' },
  1459. // 项目名称
  1460. { name: 'Name', required: true, value: bills.name },
  1461. // 项目特征
  1462. { name: 'Attr', value: bills.itemCharacterText },
  1463. // 工作内容
  1464. { name: 'WorkContent', value: bills.jocContentText },
  1465. // 计量单位
  1466. { name: 'Unit', required: true, value: bills.unit },
  1467. // 工程量
  1468. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1469. // 计算基数
  1470. { name: 'QtyFormula', type: _type.DECIMAL, value: getQtyFormula(node) },
  1471. // 单价(元)
  1472. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1473. // 设备单价(元)指清单项目所采用设备的综合单价
  1474. { name: 'EquipmentPrice', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'equipment.unitFee') },
  1475. // 最低限价(元)
  1476. //{ name: 'PriceLow', type: _type.DECIMAL, value: 'todo' },
  1477. // 最高限价(元)
  1478. { name: 'PriceHigh', type: _type.DECIMAL, value: bills.maxPrice },
  1479. // 费率(%)
  1480. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1481. // 合价(元)
  1482. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1483. // 主要清单
  1484. { name: 'Total', type: _type.BOOL, value: !!bills.mainBills },
  1485. // 子目类型
  1486. { name: 'Kind', type: _type.INT, required: true, value: kind },
  1487. // 取费类型
  1488. { name: 'CalculationKind', type: _type.INT, required: true, value: '1' },
  1489. // 费用归属
  1490. { name: 'CostKind', type: _type.INT, required: true, value: '1' },
  1491. // 计算方式
  1492. { name: 'CalcType', type: _type.INT, required: true, value: '1' },
  1493. // 专业类型
  1494. { name: 'Specialty', type: _type.INT, value: specialty },
  1495. // 清单标识
  1496. { name: 'ListingIdentity', value: 'GB50500-2013 1 GD' },
  1497. // 费用代号
  1498. { name: 'Code', value: getFeeCode(bills) },
  1499. // 备注
  1500. { name: 'Remark', value: bills.remark }
  1501. ];
  1502. _base.Element.call(this, 'WorkElement', attrs);
  1503. }
  1504. // 工程量计算表
  1505. function ExpressElement(quantityDetail) {
  1506. const attrs = [
  1507. // 序号
  1508. { name: 'OrderNumber', required: true, value: quantityDetail.name },
  1509. // 工程量计算式
  1510. { name: 'Express', required: true, value: quantityDetail.regex },
  1511. // 工程量
  1512. { name: 'Quantity', required: true, value: quantityDetail.result },
  1513. // 汇总类型
  1514. { name: 'Kind', type: _type.INT, required: true, value: SummationKindMap[quantityDetail.isSummation] },
  1515. ];
  1516. _base.Element.call(this, 'ExpressElement', attrs);
  1517. }
  1518. // 工序内容
  1519. function WorkContent(contentText, fee) {
  1520. const attrs = [
  1521. // 定额工作内容
  1522. { name: 'Name', required: true, value: contentText },
  1523. // 取此工作内容下定额子目/量价/定额同级人材机的综合合价之和
  1524. { name: 'Total', type: _type.DECIMAL, value: fee },
  1525. { name: 'Remark', value: '' }
  1526. ];
  1527. _base.Element.call(this, 'WorkContent', attrs);
  1528. }
  1529. // 定额子目
  1530. function Norm(ration, libCode, kind, specialty) {
  1531. const attrs = [
  1532. // 定额编码
  1533. { name: 'Number', required: true, value: ration.code },
  1534. { name: 'Name', required: true, value: ration.name },
  1535. { name: 'Unit', required: true, value: ration.unit },
  1536. { name: 'Quantity', type: _type.DECIMAL, value: ration.quantity },
  1537. // 单价
  1538. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(ration.fees, 'common.unitFee') },
  1539. // 合价
  1540. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(src.fees, 'common.totalFee') },
  1541. // 是否定额
  1542. { name: 'IsNorm', type: _type.Bool, required: true, value: 'true' },
  1543. // 子目类型
  1544. { name: 'Kind', type: _type.INT, required: true, value: kind },
  1545. // 取费类型
  1546. { name: 'CalculationKind', type: _type.INT, required: true, value: '1' },
  1547. // 费用归属
  1548. { name: 'CostKind', type: _type.INT, required: true, value: '1' },
  1549. // 降效类型
  1550. {
  1551. name: 'EfficiencyKind', type: _type.INT,
  1552. value: ration.type === rationType.overHeight ? EfficiencyKind.BASE_REDUCTION : EfficiencyKind.NOT_BASE_REDUCTION
  1553. },
  1554. // 子目增加费类型itemIncrease
  1555. {
  1556. name: 'IncFeeKind', type: _type.INT,
  1557. value: ration.type === rationType.overHeight ? IncFeeKind.SUB_BASE : IncFeeKind.NOT_SUB_BASE
  1558. },
  1559. // 换算说明
  1560. { name: 'Conversion', value: ration.adjustState },
  1561. // 专业类别
  1562. { name: 'Specialty', type: _type.INT, value: specialty },
  1563. //定额标识(定额库编码)
  1564. { name: 'NormIdentity', value: libCode },
  1565. // 册 定额书没有分册填写0,有分册的按册号填写
  1566. { name: 'Volume', type: _type.INT, value: getVolume(ration.code) },
  1567. // 章
  1568. { name: 'Chapter', type: _type.INT, value: getChapter(ration.code) },
  1569. { name: 'Remark', value: ration.remark }
  1570. ];
  1571. _base.Element.call(this, 'Norm', attrs);
  1572. }
  1573. // 子目管理费
  1574. function ManageFees(calcTemplate, calcItems) {
  1575. const calcItems = (calcTemplate || {}).calcItems;
  1576. const manageItem = (calcItems || []).find(item => item.name === '管理费');
  1577. const fee1 = manageItem ? manageItem.unitFee : '0';
  1578. const rate = manageItem && commonUtil.isDef(manageItem.feeRate) ? manageItem.feeRate : '100';
  1579. const attrs = [
  1580. // 一类地区管理费 输出定额计算程序的管理费单价
  1581. { name: 'Fee1', type: _type.DECIMAL, required: true, value: fee1 },
  1582. // 二类地区管理费
  1583. { name: 'Fee2', type: _type.DECIMAL, required: true, value: '0' },
  1584. // 三类地区管理费
  1585. { name: 'Fee3', type: _type.DECIMAL, required: true, value: '0' },
  1586. // 四类地区管理费
  1587. { name: 'Fee4', type: _type.DECIMAL, required: true, value: '0' },
  1588. // 管理费换算比例
  1589. { name: 'Rate', type: _type.DECIMAL, required: true, value: rate },
  1590. ];
  1591. _base.Element.call(this, 'ManageFees', attrs);
  1592. }
  1593. // 工料机含量明细
  1594. function LabourMaterialsEquipmentsMachinesElement(glj) {
  1595. const attrs = [
  1596. // 工料机编码
  1597. { name: 'Number', value: glj.code },
  1598. // 消耗量
  1599. { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
  1600. // 不计价材料
  1601. { name: 'NOCost', typ: _type.BOOL, value: 'false' },
  1602. // 备注
  1603. { name: 'Remark', value: '' }
  1604. ];
  1605. _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesElement', attrs);
  1606. }
  1607. //子目单价计算
  1608. function UnitPriceCalculationOfItem(calcItem) {
  1609. const feeRate = commonUtil.isDef(calcItem.feeRate) ? calcItem.feeRate : '100';
  1610. const attrs = [
  1611. // 费用名称
  1612. { name: 'Name', required: true, value: calcItem.name },
  1613. // 计算基数
  1614. { name: 'QtyFormula', value: CalculationQtyMap[calcItem.name] },
  1615. // 费率
  1616. { name: 'Rate', type: _type.DECIMAL, value: feeRate },
  1617. // 金额
  1618. { name: 'Total', type: _type.DECIMAL, value: calcItem.totalFee },
  1619. // 费用代号
  1620. { name: 'Code', value: CalculationCodeMap[calcItem.name] },
  1621. // 备注
  1622. { name: 'Remark', value: '' },
  1623. ];
  1624. _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesElement', attrs);
  1625. }
  1626. // 其他项目
  1627. function Sundry() {
  1628. _base.Element.call(this, 'Sundry', []);
  1629. }
  1630. // 其他项目汇总子目
  1631. function SundryItem(eleName, bills) {
  1632. const attrs = [
  1633. // 名称
  1634. { name: 'Name', required: true, value: bills.name },
  1635. // 金额
  1636. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1637. // 费用代号
  1638. { name: 'Code', required: true, value: getFeeCode(bills) },
  1639. // 备注
  1640. { name: 'Remark', value: bills.remark }
  1641. ];
  1642. _base.Element.call(this, eleName, attrs);
  1643. }
  1644. // 其他项目费标题
  1645. function SundryCostsGroup(node) {
  1646. const bills = node.data;
  1647. const attrs = [
  1648. // 名称
  1649. { name: 'Name', required: true, value: bills.name },
  1650. // 金额
  1651. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1652. // 费用代号
  1653. { name: 'Code', required: true, value: getFeeCode(bills) },
  1654. // 汇总类型
  1655. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1656. // 备注
  1657. { name: 'Remark', value: bills.remark }
  1658. ];
  1659. _base.Element.call(this, 'SundryCostsGroup', attrs);
  1660. }
  1661. // 其他项目费明细
  1662. function SundryCostsItem(node) {
  1663. const bills = node.data;
  1664. const attrs = [
  1665. // 名称
  1666. { name: 'Name', required: true, value: bills.name },
  1667. // 单位
  1668. { name: 'Unit', value: bills.unit },
  1669. // 工程量
  1670. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1671. // 计算基数
  1672. { name: 'QtyFormula', value: getQtyFormula(node) },
  1673. // 单价
  1674. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1675. // 费率
  1676. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1677. // 金额
  1678. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1679. // 费用代号
  1680. { name: 'Code', required: true, value: getFeeCode(bills) },
  1681. // 汇总类型
  1682. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1683. // 备注
  1684. { name: 'Remark', value: bills.remark }
  1685. ];
  1686. _base.Element.call(this, 'SundryCostsItem', attrs);
  1687. }
  1688. // 暂列金额标题
  1689. function ProvisionalSumsGroup(node) {
  1690. const bills = node.data;
  1691. const attrs = [
  1692. // 名称
  1693. { name: 'Name', required: true, value: bills.name },
  1694. // 金额
  1695. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1696. // 汇总类型
  1697. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1698. // 备注
  1699. { name: 'Remark', value: bills.remark }
  1700. ];
  1701. _base.Element.call(this, 'ProvisionalSumsGroup', attrs);
  1702. }
  1703. // 暂列金额明细
  1704. function ProvisionalSumsItem(node) {
  1705. const bills = node.data;
  1706. const attrs = [
  1707. // 名称
  1708. { name: 'Name', required: true, value: bills.name },
  1709. // 单位
  1710. { name: 'Unit', value: bills.unit },
  1711. // 工程量
  1712. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1713. // 计算基数
  1714. { name: 'QtyFormula', value: getQtyFormula(node) },
  1715. // 单价
  1716. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1717. // 费率
  1718. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1719. // 金额
  1720. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1721. // 汇总类型
  1722. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1723. // 备注
  1724. { name: 'Remark', value: bills.remark }
  1725. ];
  1726. _base.Element.call(this, 'ProvisionalSumsItem', attrs);
  1727. }
  1728. // 材料设备暂估价明细
  1729. // 读取单位工程-其他项目费的材料暂估价的组成数据,业务上这个清单是使用清单基数计算得来,所以此部分读取整个单位工程下打勾暂估的材料
  1730. function ProvisionalMaterialEquipmentItem(glj, price) {
  1731. const attrs = [
  1732. // 编码
  1733. { name: 'Number', value: glj.code },
  1734. // 名称
  1735. { name: 'Name', required: true, value: glj.name },
  1736. // 型号规格
  1737. { name: 'Specification', value: glj.specs },
  1738. // 单位
  1739. { name: 'Unit', required: true, value: bills.unit },
  1740. // 工程量(总消耗量)
  1741. { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
  1742. // 单价 取市场价
  1743. { name: 'Price', type: _type.DECIMAL, value: price.marketPrice },
  1744. // 金额 round(总消耗量*市场价,2)
  1745. { name: 'Total', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.quantity * price.marketPrice, 2) },
  1746. // 备注
  1747. { name: 'Remark', value: glj.remark }
  1748. ];
  1749. _base.Element.call(this, 'ProvisionalMaterialEquipmentItem', attrs);
  1750. }
  1751. // 专业工程暂估价标题
  1752. function SpecialtyProvisionalPriceGroup(node) {
  1753. const bills = node.data;
  1754. const attrs = [
  1755. // 名称
  1756. { name: 'Name', required: true, value: bills.name },
  1757. // 工程内容
  1758. { name: 'Content', value: bills.engineeringContent },
  1759. // 金额
  1760. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1761. // 汇总类型
  1762. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1763. // 备注
  1764. { name: 'Remark', value: bills.remark }
  1765. ];
  1766. _base.Element.call(this, 'SpecialtyProvisionalPriceGroup', attrs);
  1767. }
  1768. // 专业工程暂估价明细
  1769. function SpecialtyProvisionalPriceItem(node) {
  1770. const bills = node.data;
  1771. const attrs = [
  1772. // 名称
  1773. { name: 'Name', required: true, value: bills.name },
  1774. // 工程内容
  1775. { name: 'Content', value: bills.engineeringContent },
  1776. // 单位
  1777. { name: 'Unit', value: bills.unit },
  1778. // 工程量
  1779. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1780. // 计算基数
  1781. { name: 'QtyFormula', value: getQtyFormula(node) },
  1782. // 单价
  1783. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1784. // 费率
  1785. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1786. // 金额
  1787. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1788. // 汇总类型
  1789. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1790. // 备注
  1791. { name: 'Remark', value: bills.remark }
  1792. ];
  1793. _base.Element.call(this, 'SpecialtyProvisionalPriceItem', attrs);
  1794. }
  1795. // 计日工标题
  1796. function DayWorkRateGroup(node) {
  1797. const bills = node.data;
  1798. const attrs = [
  1799. // 名称
  1800. { name: 'Name', required: true, value: bills.name },
  1801. // 金额
  1802. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1803. // 费用代号
  1804. { name: 'Code', value: getFeeCode(bills) },
  1805. // 备注
  1806. { name: 'Remark', value: bills.remark }
  1807. ];
  1808. _base.Element.call(this, 'DayWorkRateGroup', attrs);
  1809. }
  1810. // 计日工明细
  1811. function DayWorkRateItem(node) {
  1812. const bills = node.data;
  1813. const attrs = [
  1814. // 编码
  1815. { name: 'Number', value: bills.code },
  1816. // 名称
  1817. { name: 'Name', required: true, value: bills.name },
  1818. // 型号规格
  1819. { name: 'Specification', value: '' },
  1820. // 单位
  1821. { name: 'Unit', required: true, value: bills.unit },
  1822. // 工程量
  1823. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1824. // 单价
  1825. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1826. // 金额
  1827. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1828. // 备注
  1829. { name: 'Remark', value: bills.remark }
  1830. ];
  1831. _base.Element.call(this, 'DayWorkRateItem', attrs);
  1832. }
  1833. // 总承包服务费标题
  1834. function MainContractorAttendanceGroup(node) {
  1835. const bills = node.data;
  1836. const attrs = [
  1837. // 名称
  1838. { name: 'Name', required: true, value: bills.name },
  1839. // 金额
  1840. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1841. // 汇总类型
  1842. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1843. // 备注
  1844. { name: 'Remark', value: bills.remark }
  1845. ];
  1846. _base.Element.call(this, 'MainContractorAttendanceGroup', attrs);
  1847. }
  1848. // 总承包服务费明细
  1849. function MainContractorAttendanceItem(node) {
  1850. const bills = node.data;
  1851. const attrs = [
  1852. // 名称
  1853. { name: 'Name', required: true, value: bills.name },
  1854. // 项目价值
  1855. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1856. // 服务内容
  1857. { name: 'Content', value: bills.serviceContent },
  1858. // 计算基数
  1859. { name: 'QtyFormula', value: getQtyFormula(node) },
  1860. // 费率
  1861. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1862. // 金额
  1863. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1864. // 汇总类型
  1865. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1866. // 备注
  1867. { name: 'Remark', value: bills.remark }
  1868. ];
  1869. _base.Element.call(this, 'MainContractorAttendanceItem', attrs);
  1870. }
  1871. // 索赔、签证费用标题
  1872. function ClaimVisaCostGroup(eleName, node) {
  1873. const bills = node.data;
  1874. const attrs = [
  1875. // 名称
  1876. { name: 'Name', required: true, value: bills.name },
  1877. // 金额
  1878. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1879. // 汇总类型
  1880. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1881. // 备注
  1882. { name: 'Remark', value: bills.remark }
  1883. ];
  1884. _base.Element.call(this, eleName, attrs);
  1885. }
  1886. // 索赔费用明细
  1887. function ClaimVisaCostItem(eleName, node) {
  1888. const bills = node.data;
  1889. const attrs = [
  1890. // 名称
  1891. { name: 'Name', required: true, value: bills.name },
  1892. // 单位
  1893. { name: 'Unit', value: bills.unit },
  1894. // 数量
  1895. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1896. // 计算基数
  1897. { name: 'QtyFormula', value: getQtyFormula(node) },
  1898. // 单价
  1899. { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
  1900. // 费率
  1901. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1902. // 金额
  1903. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1904. // 依据
  1905. { name: 'Reason', value: '' },
  1906. // 汇总类型
  1907. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1908. // 备注
  1909. { name: 'Remark', value: bills.remark }
  1910. ];
  1911. _base.Element.call(this, eleName, attrs);
  1912. }
  1913. // 规费
  1914. function StatutoryFees() {
  1915. const attrs = [
  1916. { name: 'Name', required: true, value: '规费' },
  1917. { name: 'Code', required: true, value: 'GF' }
  1918. ];
  1919. _base.Element.call(this, 'StatutoryFees', attrs);
  1920. }
  1921. // 税金
  1922. function Tax(eleName, node) {
  1923. const bills = node.data;
  1924. const attrs = [
  1925. // 名称
  1926. { name: 'Name', required: true, value: bills.name },
  1927. // 计算基数说明
  1928. { name: 'CalBasis', value: getCalBasis(node) },
  1929. // 计算基数
  1930. { name: 'QtyFormula', value: getQtyFormula(node) },
  1931. // 费率
  1932. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1933. // 金额
  1934. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1935. // 费用代号
  1936. { name: 'Code', value: getFeeCode(bills) },
  1937. // 备注
  1938. { name: 'Remark', value: bills.remark }
  1939. ];
  1940. _base.Element.call(this, eleName, attrs);
  1941. }
  1942. // 人材机汇总
  1943. function LabourMaterialsEquipmentsMachinesSummary(glj, price, infoData, coeData) {
  1944. const attrs = [
  1945. // 编码
  1946. { name: 'Number', required: true, value: glj.code },
  1947. // 名称
  1948. { name: 'Name', required: true, value: glj.name },
  1949. // 规格型号
  1950. { name: 'Specification', value: glj.specs },
  1951. // 单位
  1952. { name: 'Unit', required: true, value: glj.unit },
  1953. // 数量(总消耗量)
  1954. { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
  1955. // 风险系数 从承包人主要材料设备-造价信息差额调整法读取,取不到则输出"0"
  1956. { name: 'ProviderExp', type: _type.DECIMAL, value: infoData && infoData.riskCoe || '0' },
  1957. // 基准单价 从承包人主要材料设备-造价信息差额调整法读取,取不到则输出"0"
  1958. { name: 'ProviderBase', type: _type.DECIMAL, value: infoData && infoData.standardPrice || '0' },
  1959. // 除税定额价(定额价)
  1960. { name: 'NoTaxOrgPrice', type: _type.DECIMAL, value: price.basePrice },
  1961. // 除税编制价(市场价)
  1962. { name: 'NoTaxPrice', type: _type.DECIMAL, value: price.marketPrice },
  1963. // 含税定额价 不存在这个字段,输出"0"
  1964. { name: 'TaxOrgPrice', type: _type.DECIMAL, value: '0' },
  1965. // 含税编制价 暂时取市场价
  1966. { name: 'TaxPrice', type: _type.DECIMAL, value: price.marketPrice },
  1967. // 引进部分
  1968. { name: 'ForeignCurrency', type: _type.DECIMAL, value: '0' },
  1969. // 折合人民币
  1970. { name: 'ConvertedIntoRMB', type: _type.DECIMAL, value: '0' },
  1971. // 除税定额价合价 取Round(定额价*总消耗量,2)
  1972. { name: 'NoTaxOrgTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.basePrice * glj.quantity, 2) },
  1973. // 除税编制价合价(元) 取Round(不含税市场价*总消耗量,2)
  1974. { name: 'NoTaxTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.marketPrice * glj.quantity, 2) },
  1975. // 含税定额价合价
  1976. { name: 'TaxOrgTotal', type: _type.DECIMAL, value: '0' },
  1977. // 含税编制价合价 取Round(含税市场价*总消耗量,2) (暂时用市场价)
  1978. { name: 'TaxTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.marketPrice * glj.quantity, 2) },
  1979. // 变值权重 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
  1980. { name: 'Weight', type: _type.DECIMAL, value: coeData && coeData.varWeight || '0' },
  1981. // 基本价格指数 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
  1982. { name: 'BasicPrice', type: _type.DECIMAL, value: coeData && coeData.FO || '0' },
  1983. // 现行价格指数 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
  1984. { name: 'CurrentPrice', type: _type.DECIMAL, value: coeData && coeData.FI || '0' },
  1985. // 工料机类型
  1986. { name: 'Kind', type: _type.INT, value: getGLJKind(glj.type) },
  1987. // 工料机归属
  1988. { name: 'Class', value: '' },
  1989. // 扩展属性
  1990. { name: 'ExtKind', type: _type.INT, value: 1 },
  1991. // 商品砼 如果工料机类型是“商品混凝土”、“商品砂浆”、“商品配合比”(软件中没有),则取“true”;否则取“false”
  1992. { name: 'Concrete', type: _type.BOOL, value: [205, 206].includes(glj.type) },
  1993. // 主要材料
  1994. { name: 'MainMaterial', type: _type.BOOL, value: !!glj.is_main_material },
  1995. // 是否暂估价材料
  1996. { name: 'ProvisionalMaterial', type: _type.BOOL, value: !!glj.is_evaluate },
  1997. // 供料方式
  1998. { name: 'Provider', type: _type.INT, value: Provider[glj.supply] },
  1999. // 价格来源
  2000. { name: 'PriceSource', value: '' },
  2001. // 交货方式
  2002. { name: 'Delivery', value: glj.delivery },
  2003. // 送达地点
  2004. { name: 'Location', value: glj.delivery_address },
  2005. // 产地
  2006. { name: 'ProducingArea', value: glj.originPlace },
  2007. // 供应商
  2008. { name: 'Supplier', value: glj.vender },
  2009. // 质量要求
  2010. { name: 'Character', value: glj.qualityGrace },
  2011. // 备注
  2012. { name: 'Remark', value: glj.remark }
  2013. ];
  2014. _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesSummary', attrs);
  2015. }
  2016. // 评标主要材料
  2017. function BidEvaluationMainMaterial(glj) {
  2018. const attrs = [
  2019. // 序号
  2020. { name: 'Code', required: true, value: glj.seq },
  2021. // 编码
  2022. { name: 'Number', value: glj.code },
  2023. // 名称
  2024. { name: 'Name', required: true, value: glj.name },
  2025. // 规格型号
  2026. { name: 'Specification', value: glj.specs },
  2027. // 单位
  2028. { name: 'Unit', required: true, value: glj.unit },
  2029. // 市场价
  2030. { name: 'Price', type: _type.DECIMAL, value: glj.marketPrice },
  2031. // 最高限价
  2032. { name: 'LimitedPrice', type: _type.DECIMAL, value: '0' },
  2033. // 总消耗量
  2034. { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
  2035. // 金额 Round(市场价*总消耗量,2)
  2036. { name: 'Total', type: _type.DECIMAL, value: scMathUtil.roundForObj(glj.marketPrice * glj.quantity, 2) },
  2037. // 交货方式
  2038. { name: 'Delivery', type: _type.DECIMAL, value: glj.delivery },
  2039. // 送达地点
  2040. { name: 'DeliPlace', value: glj.delivery_address },
  2041. // 产地
  2042. { name: 'ProducingArea', value: glj.originPlace },
  2043. // 供应商
  2044. { name: 'Supplier', value: glj.vender },
  2045. // 质量要求
  2046. { name: 'Character', value: glj.qualityGrace },
  2047. // 备注
  2048. { name: 'Remark', value: glj.remark }
  2049. ];
  2050. _base.Element.call(this, 'BidEvaluationMainMaterial', attrs);
  2051. }
  2052. // 建设项目节点
  2053. let constructionProjectEle = null;
  2054. /*
  2055. * 加载数据,分两种数据类型
  2056. * 1.建设项目
  2057. * 2.建设项目下单位工程
  2058. * @param {Object}项目数据
  2059. * @return {Array}
  2060. * */
  2061. async function loadData(projectData) {
  2062. // 标记自检提示的开始(一次性多出多个文件类型,会导出多次)
  2063. _failList.push(_config.HINT_START);
  2064. // 提取出的数据
  2065. const extractData = [];
  2066. // 建设项目部分
  2067. constructionProjectEle = await loadConstructionProject(projectData);
  2068. extractData.push({
  2069. data: constructionProjectEle,
  2070. dataType: DATA_TYPE.project,
  2071. exportKind,
  2072. fileName: 'Project.xml'
  2073. });
  2074. // 单位工程部分
  2075. // 提取出单位工程级别的项目数据
  2076. const tenderData = projectData.children.reduce((acc, cur) => {
  2077. if (Array.isArray(cur.children)) {
  2078. acc.push(...cur.children)
  2079. }
  2080. return acc;
  2081. }, []);
  2082. // 获取单位工程详细结构
  2083. const isPlainTender = false;
  2084. const tenders = await loadTenders(projectData.summaryInfo, tenderData, isPlainTender);
  2085. tenders.forEach(tender => {
  2086. // 单位工程文件名为@_单位工程编码_单位工程名称.xml
  2087. // 因为单位工程编码后续用户可能会改变,这里暂时将fileName设置成单位工程名称.xml
  2088. const name = tender.attrs.find(attr => attr.name === 'Name');
  2089. extractData.push({
  2090. data: tender,
  2091. dataType: DATA_TYPE.tender,
  2092. exportKind,
  2093. fileName: `${name}.xml`
  2094. })
  2095. });
  2096. return extractData;
  2097. }
  2098. /*
  2099. * 加载建设项目
  2100. * @param {Object}项目数据
  2101. * @return {Array}
  2102. * */
  2103. async function loadConstructionProject(projectData) {
  2104. const summaryInfo = projectData.summaryInfo[projectData.ID];
  2105. // 建设项目
  2106. const constructionProject = new ConstructionProject(projectData);
  2107. // 系统信息
  2108. const systemInfo = new SystemInfo({
  2109. // 软件相关信息进行base64编码
  2110. ID1: Base64.encode(projectData.softInfo),
  2111. ID2: _util.generateHardwareId(),
  2112. makeDate: moment(Date.now()).format('YYYY-MM-DDTHH:mm:ss'),
  2113. });
  2114. // 工程信息
  2115. const constructionInfo = loadConstructionInfo(projectData);
  2116. // 费用汇总
  2117. const summaryCost = new SummaryOfCost(summaryInfo);
  2118. // 建筑安装工程费
  2119. const projectInstall = new ProjectInstallationWorkCost(projectData, summaryInfo);
  2120. // 单项工程
  2121. const sectionalWorks = await loadEngineering(summaryInfo, projectData.children);
  2122. projectInstall.children.push(...sectionalWorks);
  2123. constructionProject.children.push(
  2124. systemInfo,
  2125. constructionInfo,
  2126. summaryCost,
  2127. projectInstall
  2128. );
  2129. return constructionProject;
  2130. }
  2131. // 加载工程信息相关元素
  2132. function loadConstructionInfo(projectData) {
  2133. const basicInformation = projectData.property.basicInformation;
  2134. const summaryInfo = projectData.summaryInfo[projectData.ID];
  2135. // 工程信息
  2136. const constructionInfo = new ConstructionInfo();
  2137. // 费用精度
  2138. const option = new Option();
  2139. // 估(概、预、结)算信息
  2140. const projectInfo = new ProjectInfo(basicInformation, summaryInfo);
  2141. let exportInfo;
  2142. if (exportKind === _config.EXPORT_KIND.Bid) {
  2143. // 招标信息
  2144. exportInfo = new TendereeInfo(basicInformation);
  2145. } else if (exportKind === _config.EXPORT_KIND.Tender) {
  2146. // 投标信息
  2147. exportInfo = new BidderInfo(basicInformation, summaryInfo);
  2148. }
  2149. constructionInfo.push(option, projectInfo, exportInfo);
  2150. return constructionInfo;
  2151. }
  2152. /*
  2153. * 加载所有单项工程元素
  2154. * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
  2155. * {Array}engineeringData 所有单项工程项目数据
  2156. * @return {Array}
  2157. * */
  2158. async function loadEngineering(summaryInfoMap, engineeringData) {
  2159. const isPlainTender = true;
  2160. const engineeringTasks = engineeringData.map(async engData => {
  2161. const summaryInfo = summaryInfoMap[engData.ID];
  2162. // 单项工程
  2163. const sectionalWork = new SectionWorks({
  2164. name: engData.name,
  2165. total: summaryInfo.engineeringCost,
  2166. rate: summaryInfo.rate,
  2167. });
  2168. // 费用汇总
  2169. const summaryCost = new SummaryOfCost(summaryInfo);
  2170. // 简单结构的单位工程
  2171. const tenders = await loadTenders(summaryInfoMap, engData.children, isPlainTender);
  2172. sectionalWork.push(summaryCost, ...tenders);
  2173. return sectionalWork;
  2174. });
  2175. return await Promise.all(engineeringTasks);
  2176. }
  2177. /*
  2178. * 加载所有单位工程元素
  2179. * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
  2180. * {Array}tenderData 所有单项工程项目数据
  2181. * {Boolean}isPlain 是否简单结构(简单结构只含有UnitWorks,其下不含子元素)
  2182. * @return {Array}
  2183. * */
  2184. let tenderDetail = null;
  2185. async function loadTenders(summaryInfoMap, tenderData, isPlain) {
  2186. const basicInformation = projectData.property.basicInformation;
  2187. const tenderTasks = tenderData.map(async tData => {
  2188. const summaryInfo = summaryInfoMap[tData.ID];
  2189. // 单位工程
  2190. const unitWork = new UnitWorks(projectData, tData, summaryInfo);
  2191. // 简单结构,不需要继续添加子元素
  2192. if (isPlain) {
  2193. return unitWork;
  2194. }
  2195. // 不是简单结构,继续添加各种子元素
  2196. // 需要请求项目详细数据的时候,间隔一段时间再初始单位工程数据,减少服务器压力
  2197. const tenderDetailMap = _cache.getItem('tenderDetailMap');
  2198. if (!tenderDetailMap[tData.ID]) {
  2199. await _util.setTimeoutSync(() => { }, _config.TIMEOUT_TIME);
  2200. }
  2201. // 方便用户看错误来自哪个单位工程
  2202. _failList.push(`<span style="font-weight: bold">单位工程“${tData.name}”下:</span>`);
  2203. const orgLen = _failList.length;
  2204. // 先计算人材机总消耗量,以供后面需要
  2205. gljUtil.calcProjectGLJQuantity(tenderDetail.projectGLJ.datas,
  2206. tenderDetail.ration_glj.datas, tenderDetail.Ration.datas, tenderDetail.Bills.datas, Decimal.GLJ, _, scMathUtil);
  2207. // 工程特征信息
  2208. const attrInfo = loadAttrInfo(tData.property.projectFeature);
  2209. // 基本信息
  2210. const addiInfo = loadAddiInfo(projectData.property.basicInformation);
  2211. // 费用汇总
  2212. const summaryOfCost = new SummaryOfCost(summaryInfo);
  2213. // 获取单位工程详细数据
  2214. tenderDetail = await _util.getTenderDetail(tData.ID, userID);
  2215. // 单位工程费用汇总
  2216. const unitWorksSummary = loadUnitWorksSummary(tenderDetail);
  2217. // 分部分项工程
  2218. const divisionalElements = loadDivisionalAndElementalWorks();
  2219. // 措施项目
  2220. const preliminaries = loadPreliminaries();
  2221. // 其他项目
  2222. const sundry = loadSundry();
  2223. // 规费
  2224. const statutoryFees = new StatutoryFees();
  2225. // 税金
  2226. const tax = loadTax();
  2227. // 人材机汇总
  2228. const gljSummary = loadGLJSummary();
  2229. // 评标材料
  2230. const bidEvaluations = loadBidEvaluation();
  2231. // 人材机汇总和评标材料需要汇总到建设项目
  2232. const projectInstallationWorkCost = constructionProjectEle.children.find(ele => ele.name === 'ProjectInstallationWorkCost');
  2233. projectInstallationWorkCost.children.push(...gljSummary, ...bidEvaluations);
  2234. unitWork.children.push(
  2235. attrInfo,
  2236. addiInfo,
  2237. summaryOfCost,
  2238. unitWorksSummary,
  2239. divisionalElements,
  2240. preliminaries,
  2241. sundry,
  2242. statutoryFees,
  2243. tax,
  2244. ...gljSummary,
  2245. ...bidEvaluations
  2246. );
  2247. // 只有方便用户看错误来自哪个单位工程的提示,说明该单位工程没有报错
  2248. if (_failList.length === orgLen) {
  2249. _failList.pop();
  2250. }
  2251. });
  2252. return await Promise.all(tenderTasks);
  2253. }
  2254. // 加载工程特征信息
  2255. // attrList 单位工程的工程特征,来自property.projectFeature
  2256. function loadAttrInfo(attrList) {
  2257. const attrInfo = new Info('AttrInfo');
  2258. // 有值的才输出
  2259. attrInfo.children = attrList
  2260. .filter(attr => commonUtil.isDef(attr.value))
  2261. .map(attr => new InfoItem('AttrInfoItem', attr));
  2262. return attrInfo;
  2263. }
  2264. // 加载补充信息(基本信息所有条目)
  2265. function loadAddiInfo(infoList) {
  2266. const addiInfo = new Info('AddiInfo');
  2267. addiInfo.children = infoList.map(rootInfoItem => {
  2268. const rootInfo = new InfoItem('AddiInfoItem', rootInfoItem);
  2269. rootInfo.children = rootInfoItem.items.map(infoItem => new InfoItem('AddiInfoItem', infoItem));
  2270. return rootInfo;
  2271. });
  2272. }
  2273. // 加载单位工程费用汇总
  2274. // tenderDetail 单位工程详细数据
  2275. function loadUnitWorksSummary() {
  2276. const unitWorksSummary = new UnitWorksSummary();
  2277. // 读取单位工程中的固定类别为“分部分项工程”、“措施项目”、“其他项目”的大项费用
  2278. // 分部分项
  2279. const fbfx = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.SUB_ENGINERRING);
  2280. const fbfxGroup = new UnitWorksSummaryGroup(fbfx.data);
  2281. // 分部分项工程的子项,取项目名称的首字母拼接
  2282. const fbfxChildren = fbfx.children.map(node => new UnitWorksSummaryItem(node));
  2283. fbfxGroup.children.push(...fbfxChildren);
  2284. // 措施项目
  2285. const csxm = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.MEASURE);
  2286. const csxmGroup = new UnitWorksSummaryGroup(csxm.data);
  2287. // 措施项目的子项,“绿色施工安全防护措施费”、“其他措施费”
  2288. const csxmChildren = csxm.getPosterity()
  2289. .filter(node => [fixedFlag.GREEN_MEASURE_FEE, fixedFlag.OTHER_MEASURE_FEE].includes(node.getFlag()))
  2290. .map(node => new UnitWorksSummaryItem(node));
  2291. csxmGroup.children.push(...csxmChildren);
  2292. // 其他项目
  2293. const other = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.OTHER);
  2294. const otherGroup = new UnitWorksSummaryGroup(other.data);
  2295. // 其他项目子项,暂列金额;暂估价;材料(工程设备)暂估价;专业工程暂估价;计日工;总承包服务费;预算包干费;工程优质费;概算幅度差;索赔费用;现场签证费用;其他费用
  2296. const otherChildrenFlags = [
  2297. fixedFlag.PROVISIONAL,
  2298. fixedFlag.ESTIMATE,
  2299. fixedFlag.MATERIAL_PROVISIONAL,
  2300. fixedFlag.ENGINEERING_ESITIMATE,
  2301. fixedFlag.DAYWORK,
  2302. fixedFlag.TURN_KEY_CONTRACT,
  2303. fixedFlag.BUDGET_INCLUDE_WORK_FEE,
  2304. fixedFlag.PROJECT_HIGH_QUALITY_FEE,
  2305. fixedFlag.BUDGET_ESTIMATE_DIFF,
  2306. fixedFlag.CLAIM,
  2307. fixedFlag.VISA,
  2308. fixedFlag.OTHER_FEE
  2309. ];
  2310. const otherChildren = other.getPosterity()
  2311. .filter(node => otherChildrenFlags.includes(node.getFlag()))
  2312. .map(node => new UnitWorksSummaryItem(node));
  2313. otherGroup.chilren.push(...otherChildren);
  2314. // 除固定类别为“分部分项工程”、“措施项目”、“其他项目”以外的大项费用,通常无子项,所以显示到Item中。(即使造价书有子项,也显示到Item中,不再列出其子项数据)
  2315. const flags = [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE, fixedFlag.OTEHER];
  2316. const otherRoots = tenderDetail.mainTree.roots
  2317. .filter(node => !flags.includes(node.getFlag()))
  2318. .map(node => new UnitWorksSummaryItem(node));
  2319. unitWorksSummary.children.push(fbfxGroup, csxmGroup, otherGroup, ...otherRoots);
  2320. return unitWorksSummary;
  2321. }
  2322. // 加载分部分项工程
  2323. function loadDivisionalAndElementalWorks() {
  2324. const division = new DivisionalAndElementalWorks();
  2325. const subEngineering = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.SUB_ENGINERRING);
  2326. // 合计费用
  2327. const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, subEngineering.data);
  2328. // 分部、分项
  2329. const fbfx = loadFBFX(subEngineering.children, BillsKind.FBFX);
  2330. division.children.push(summaryCost, ...fbfx);
  2331. return division;
  2332. }
  2333. // 加载措施项目
  2334. function loadPreliminaries() {
  2335. const preliminaries = new Preliminaries();
  2336. const measure = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.MEASURE);
  2337. // 合计费用
  2338. const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, measure.data);
  2339. // 分部、分项
  2340. const fbfx = loadFBFX(measure.children, BillsKind.MEASURE);
  2341. preliminaries.children.push(summaryCost, ...fbfx);
  2342. return preliminaries;
  2343. }
  2344. // 加载分部分项清单,这部分是分部分项工程和措施项目共用的
  2345. function loadFBFX(nodes, kind) {
  2346. return nodes.map(node => {
  2347. let ele;
  2348. // 有子清单的是分部
  2349. if (node.source.children.length) {
  2350. ele = new DivisionalWorks(node.data);
  2351. // 递归获取子元素
  2352. ele.children = loadFBFX(node.source.children);
  2353. } else { // 无子清单的是分项
  2354. ele = loadBills(node.data, kind, specialty);
  2355. }
  2356. return ele;
  2357. });
  2358. }
  2359. // 加载清单
  2360. function loadBills(node, kind) {
  2361. const specialty = Specialty[tenderDetail.property.engineeringName]; // 工程专业
  2362. const workElement = new WorkElement(node, kind, specialty);
  2363. // 合计费用
  2364. const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, node.data);
  2365. workElement.children.push(summaryCost);
  2366. // 工程量计算表
  2367. const expressElement = loadQuantityExpressions(tenderDetail.quantity_detail.datas, true, node.data.ID);
  2368. workElement.children.push(...expressElement);
  2369. // 相同工作内容的定额进行分组
  2370. const workMap = _.groupBy(node.children, node => node.data.jobContentText || '');
  2371. const workContents = Object.entries(workMap).map(([contentText, rationNodes]) => {
  2372. const workContent = new WorkContent(contentText, _util.getAggregateFee(rationNodes));
  2373. workContent.children = rationNodes.map(node => loadRation(node, kind, specialty));
  2374. });
  2375. workElement.children.push(...workContents);
  2376. return workElement
  2377. }
  2378. // 加载工程量计算表
  2379. function loadQuantityExpressions(quantityDetails, isBills, ID) {
  2380. if (quantityDetails.length) {
  2381. return [];
  2382. }
  2383. quantityDetails.sort((a, b) => a.seq - b.seq);
  2384. const key = isBills ? 'billID' : 'rationID';
  2385. return quantityDetails
  2386. .filter(quantityDetail => quantityDetail[key] === ID)
  2387. .map(quantityDetail => new ExpressElement(quantityDetail));
  2388. }
  2389. // 获取定额的定额库编码
  2390. function getLibCode(ration, rationLibs) {
  2391. const theLib = rationLibs.find(lib => lib.id === ration.libID);
  2392. return theLib ? theLib.libCode : '';
  2393. }
  2394. // 加载定额
  2395. function loadRation(node, kind, specialty) {
  2396. // 定额
  2397. const libCode = getLibCode(node.data, tenderDetail.projectInfo.engineeringInfo.ration_lib);
  2398. const norm = new Norm(node.data, libCode, kind, specialty);
  2399. // 工程量计算表
  2400. const expressElement = loadQuantityExpressions(tenderDetail.quantity_detail.datas, false, node.data.ID);
  2401. if (expressElement.length) {
  2402. norm.children.push(...expressElement);
  2403. }
  2404. // 触发计算程序计算,否则定额calcTemplate数据必为空
  2405. calcProgramObj.refreshCalcProgram(node, 4);
  2406. // 子目管理费
  2407. const manageFees = new ManageFees(node.data.calcTemplate);
  2408. norm.children.push(manageFees);
  2409. // 定额人材机含量明细
  2410. let rationGLJs = tenderDetail.ration_glj.datas.filter(rGLJ => rGLJ.rationID === node.data.ID);
  2411. rationGLJs = gljUtil.sortRationGLJ(rationGLJs); // 定额人材机排序
  2412. const rationGLJElements = rationGLJs
  2413. .filter(rGLJ => {
  2414. // 总消耗量为0的,不输出
  2415. const totalQuantity = gljUtil.getTotalQuantity(rGLJ, node.data, Decimal.GLJ, Decimal.QUANTITY);
  2416. const parsedTotalQuantity = parseFloat(totalQuantity);
  2417. return parsedTotalQuantity;
  2418. })
  2419. .map(rGLJ => new LabourMaterialsEquipmentsMachinesElement(rGLJ));
  2420. norm.children.push(...rationGLJElements);
  2421. // 子目单价计算(定额计算程序)
  2422. if (node.data.calcTemplate) {
  2423. const unitPriceCalculationOfItems = node.data.calcTemplate.calcItems.map(item => new UnitPriceCalculationOfItem(item));
  2424. norm.children.push(...unitPriceCalculationOfItems);
  2425. }
  2426. return norm;
  2427. }
  2428. // 递归加载标题和子目
  2429. function loadGroupAndItems(nodes, groupFactory, itemFactory) {
  2430. return nodes.map(node => {
  2431. let ele;
  2432. // 有子清单的是标题
  2433. if (node.source.children.length) {
  2434. ele = groupFactory(node);
  2435. // 递归获取子元素
  2436. ele.children = loadGroupAndItems(node.source.children, groupFactory, itemFactory);
  2437. } else { // 无子清单的是分项
  2438. ele = itemFactory(node);
  2439. }
  2440. return ele;
  2441. });
  2442. }
  2443. // 加载其他项目
  2444. function loadSundry() {
  2445. // 加载材料设备暂估价明细
  2446. // 业务上这个清单是使用清单基数计算得来,所以此部分读取整个单位工程下打勾暂估的材料。is_evaluate = 1
  2447. function loadProvisionalMaterialDetail() {
  2448. return gljList
  2449. .filter(glj => glj.is_evaluate)
  2450. .map(glj => {
  2451. const price = gljUtil.getGLJPrice(glj, tenderDetail.projectGLJ.datas, // 价格信息
  2452. tenderDetail.projectInfo.property.calcOptions, tenderDetail.labourCoe.datas, tenderDetail.projectInfo.property.decimal, false, _, scMathUtil);
  2453. return new ProvisionalMaterialEquipmentItem(glj, price);
  2454. });
  2455. }
  2456. const sundry = new Sundry();
  2457. // 其他项目费
  2458. const other = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.OTEHER);
  2459. const sundryCosts = new SundryItem('SundryCosts', other.data);
  2460. sundryCosts.children = loadGroupAndItems(
  2461. other.children,
  2462. (node) => new SundryCostsGroup(node),
  2463. (node) => new SundryCostsItem(node)
  2464. );
  2465. // 暂列金额
  2466. const provisional = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.PROVISIONAL);
  2467. const provisionalSums = new SundryItem('ProvisionalSums', provisional.data);
  2468. provisionalSums.children = loadGroupAndItems(
  2469. provisional.children,
  2470. (node) => new ProvisionalSumsGroup(node),
  2471. (node) => new ProvisionalSumsItem(node)
  2472. );
  2473. // 材料设备暂估价
  2474. const provisionalMaterial = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.MATERIAL_PROVISIONAL);
  2475. const provisionalMaterialEle = new SundryItem('ProvisionalMaterialEquipment', provisionalMaterial.data);
  2476. provisionalMaterialEle.children = loadProvisionalMaterialDetail();
  2477. // 专业工程暂估价
  2478. const specialtyProvisionalNode = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.ENGINEERING_ESITIMATE);
  2479. const specialtyProvisional = new SundryItem('SpecialtyProvisionalPrice', specialtyProvisionalNode.data);
  2480. specialtyProvisional.children = loadGroupAndItems(
  2481. specialtyProvisionalNode.children,
  2482. (node) => new SpecialtyProvisionalPriceGroup(node),
  2483. (node) => new SpecialtyProvisionalPriceItem(node)
  2484. );
  2485. // 计日工
  2486. const daywork = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.DAYWORK);
  2487. const dayworkRate = new SundryItem('DayWorkRate', daywork.data);
  2488. // 计日工最多只能有两层子项
  2489. const isValidDepth = _util.validDepth(2, daywork);
  2490. if (!isValidDepth) {
  2491. _failList.push('计日工子项超过两层')
  2492. } else {
  2493. dayworkRate.children = loadGroupAndItems(
  2494. daywork.children,
  2495. (node) => new DayWorkRateGroup(node),
  2496. (node) => new DayWorkRateItem(node)
  2497. );
  2498. }
  2499. // 总承包服务费
  2500. const turnKeyContract = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.TURN_KEY_CONTRACT);
  2501. const mainContractorAttendance = new SundryItem('MainContractorAttendance', turnKeyContract.data);
  2502. mainContractorAttendance.children = loadGroupAndItems(
  2503. turnKeyContract.children,
  2504. (node) => new MainContractorAttendanceGroup(node),
  2505. (node) => new MainContractorAttendanceItem(node)
  2506. );
  2507. // 索赔费用
  2508. const claim = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.CLAIM);
  2509. const claimsCost = new SundryItem('ClaimsCost', claim.data);
  2510. claimsCost.children = loadGroupAndItems(
  2511. claim.children,
  2512. (node) => new ClaimVisaCostGroup('ClaimsCostGroup', node),
  2513. (node) => new ClaimVisaCostItem('ClaimsCostItem', node)
  2514. );
  2515. // 签证费用
  2516. const visa = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.VISA);
  2517. const siteInstructionCost = new SundryItem('SiteInstructionCost', visa.data);
  2518. siteInstructionCost.children = loadGroupAndItems(
  2519. visa.children,
  2520. (node) => new ClaimVisaCostGroup('SiteInstructionCostGroup', node),
  2521. (node) => new ClaimVisaCostItem('SiteInstructionCostItem', node)
  2522. );
  2523. sundry.children.push(sundryCosts, provisionalSums, specialtyProvisional, dayworkRate, mainContractorAttendance, claimsCost, siteInstructionCost);
  2524. return sundry;
  2525. }
  2526. // 加载税金
  2527. function loadTax() {
  2528. const tax = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.TAX);
  2529. const taxEle = new Tax('Tax', tax);
  2530. // 加载税金子项,若无税金子项,税金本身也作为子项
  2531. const taxChildren = tax.source.children.length ? tax.source.children : [tax];
  2532. taxEle.children = taxChildren.map(taxItem => new Tax('TaxItem', taxItem));
  2533. return tax;
  2534. }
  2535. // 加载人材机汇总
  2536. function loadGLJSummary() {
  2537. // 所有人材机
  2538. const gljList = gljUtil.sortRationGLJ(tenderDetail.projectGLJ.datas.gljList); // 汇总排序
  2539. const contractorList = tenderDetail.contractor_list.datas;
  2540. const decimalObj = tenderDetail.projectInfo.property.decimal;
  2541. // 总承包人造价信息差额调整法数据
  2542. const infoDatas = materialAdjustObj.getPirceInfoDatas(gljList, contractorList, decimalObj)
  2543. // 总承包人价格指数调整法数据
  2544. const engineeringCostNode = tenderDetail.Bills.tree.roots.find(node => node.getFlag() === fixedFlag.ENGINEERINGCOST);
  2545. const ecTotalFee = _util.getFee(engineeringCostNode.data.fees, 'common.totalFee');
  2546. const coeDatas = materialAdjustObj.getPriceCoeDatas(gljList, contractorList, ecTotalFee, decimalObj);
  2547. return gljList.map(glj => {
  2548. // 人材机
  2549. const price = gljUtil.getGLJPrice(glj, tenderDetail.projectGLJ.datas, // 价格信息
  2550. tenderDetail.projectInfo.property.calcOptions, tenderDetail.labourCoe.datas, tenderDetail.projectInfo.property.decimal, false, _, scMathUtil);
  2551. // 人材机对应的造价信息差额数据
  2552. const infoData = infoDatas.find(item => item.projectGLJID === glj.id);
  2553. // 人材机对应的价格指数数据
  2554. const coeData = coeDatas.find(item => item.projectGLJID === glj.id);
  2555. const gljEle = new LabourMaterialsEquipmentsMachinesSummary(glj, price, infoData, coeData);
  2556. // 人材机组成物
  2557. const connectKey = gljUtil.getIndex(glj, gljKeyArray);
  2558. const ratios = tenderDetail.projectGLJ.datas.mixRatioMap[connectKey] || [];
  2559. gljEle.children = ratios.map(ratio => new LabourMaterialsEquipmentsMachinesElement(ratio));
  2560. return gljEle;
  2561. });
  2562. }
  2563. // 加载评标材料
  2564. function loadBidEvaluation() {
  2565. const gljList = tenderDetail.projectGLJ.datas.gljList;
  2566. const bidEvaluationSrc = tenderDetail.projectObj.project.bid_evaluation_list.datas;
  2567. const decimalObj = tenderDetail.projectInfo.property.decimal;
  2568. const bidEvaluationList = configMaterialObj.getBidMaterialDatas(gljList, bidEvaluationSrc, decimalObj);
  2569. return bidEvaluationList.map(glj => {
  2570. const projectGLJ = gljList.find(pGLJ => pGLJ.id === glj.projectGLJID);
  2571. if (projectGLJ) {
  2572. glj.delivery = projectGLJ.delivery;
  2573. glj.delivery_address = projectGLJ.delivery_address;
  2574. glj.originPlace = projectGLJ.originPlace;
  2575. glj.vender = projectGLJ.vender;
  2576. glj.qualityGrace = projectGLJ.qualityGrace;
  2577. }
  2578. return new BidEvaluationMainMaterial(glj);
  2579. });
  2580. }
  2581. }
  2582. /*
  2583. * 重置工程编号,广东18 3.0的接口,导出时的文件会用到这个编号
  2584. * 因此重置工程编号后,还需要重置文件名数据
  2585. * @param {Array}codes 工程编号
  2586. * {Array}extractData 提取的数据
  2587. * @return {void}
  2588. * */
  2589. function resetContentCode(codes, extractData) {
  2590. // 提取到的数据分两种类型:
  2591. // 1.根元素为建设项目:需要修改建设项目下的单位工程元素的编码和文件名
  2592. // 2.根元素为单位工程:需要修改单位工程的编码和文件名
  2593. // 获取建设项目数据下的单位工程元素
  2594. const ExtractProjects = extractData.filter(data => data.dataType === DATA_TYPE.project);
  2595. const tenders = ExtractProjects.map(extractP => {
  2596. // 建设项目元素下建筑安装工程费元素
  2597. const projectInstallations = _util.getElementFromSrc(extractP.data, 'ProjectInstallationWorkCost');
  2598. // 建筑安装工程费元素下单项工程元素
  2599. const sectionalWorks = projectInstallations.reduce((acc, cur) => {
  2600. const sections = _util.getElementFromSrc(cur, 'SectionalWorks');
  2601. acc.push(...sections);
  2602. }, []);
  2603. // 单项工程元素下单位工程元素
  2604. return sectionalWorks.reduce((acc, cur) => {
  2605. const tenders = _util.getElementFromSrc(cur, 'UnitWorks');
  2606. acc.push(...tenders);
  2607. }, []);
  2608. });
  2609. // 重置编号
  2610. let idx = 0;
  2611. for (let tender of tenders) {
  2612. let codeItem = tender.attrs.find(attr => attr.name === '编号');
  2613. codeItem.value = codes[idx++];
  2614. }
  2615. }
  2616. })();