exportStdInterface_gd18.js 117 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622
  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.values(ConstructionType),
  453. value: ConstructionType[_util.getValueByKey(basicInformation, 'constructionType')]
  454. },
  455. // 文件类型
  456. {
  457. name: 'FileKind', dName: '文件类型', type: _type.INT, required: true,
  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.values(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, 'scale')
  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. { name: 'MakeDate', dName: '文件生成时间', type: _type.DATE_TIME, required: true, value: makeDate }
  541. ];
  542. _base.Element.call(this, 'SystemInfo', attrs);
  543. }
  544. // 工程信息
  545. function ConstructionInfo() {
  546. _base.Element.call(this, 'ConstructionInfo', []);
  547. }
  548. // 费用精度
  549. function Option() {
  550. const attrs = [
  551. // 工料机消耗量、含量、用量类小数精度
  552. { name: 'ResPrecision', type: _type.INT, required: true, value: Decimal.GLJ },
  553. // 工程量、数量类小数精度
  554. { name: 'QuantityPrecision', type: _type.INT, required: true, value: Decimal.QUANTITY },
  555. // 金额、合价、费用类小数精度
  556. { name: 'CostPrecision', type: _type.INT, required: true, value: Decimal.Fee },
  557. // 费率、指数、比例(%)类小数精度
  558. { name: 'RatePrecision', type: _type.INT, required: true, value: Decimal.RATE }
  559. ];
  560. _base.Element.call(this, 'Option', attrs);
  561. }
  562. // 估(概、预、结)算信息
  563. // 有内容的属性才输出
  564. function ProjectInfo(basicInformation, summaryInfo) {
  565. const attrs = [
  566. // 设计单位
  567. { name: 'Designer', mustHasValue: true, value: _util.getValueByKey(basicInformation, 'designUnits') },
  568. // 承包单位
  569. { name: 'Contractor', mustHasValue: true, value: _util.getValueByKey(basicInformation, 'constructionUnits') },
  570. // 编制单位
  571. {
  572. name: 'CompileCompany', dName: '编制单位', required: true,
  573. value: _util.getValueByKey(basicInformation, 'establishUnit') || '无'
  574. },
  575. // 编制单位法定代表人或其授权人
  576. { name: 'Authorizer', mustHasValue: true, value: _util.getValueByKey(basicInformation, 'authorizer') },
  577. // 工程总价(元)
  578. {
  579. name: 'Total', dName: '工程总价', type: _type.DECIMAL, required: true,
  580. value: summaryInfo.engineeringCost
  581. }
  582. ];
  583. _base.Element.call(this, 'ProjectInfo', attrs);
  584. }
  585. // 招标信息 工程量清单、招标控制价时输出
  586. // 有内容的属性才输出
  587. function TendereeInfo(basicInformation, summaryInfo) {
  588. const attrs = [
  589. // 招标人
  590. {
  591. name: 'TendereeName', dName: '招标人', required: true,
  592. value: _util.getValueByKey(basicInformation, 'tendereeName')
  593. },
  594. // 招标单位法定代表人或其授权人
  595. {
  596. name: 'TenderAuthorizer', mustHasValue: true,
  597. value: _util.getValueByKey(basicInformation, 'tenderAuthorizer')
  598. },
  599. // 招标单位编制人
  600. {
  601. name: 'TenderCompiler', mustHasValue: true,
  602. value: _util.getValueByKey(basicInformation, 'tenderCompiler')
  603. },
  604. // 招标单位编制人资格证书编号
  605. {
  606. name: 'TenderCompilerCertNo', mustHasValue: true,
  607. value: _util.getValueByKey(basicInformation, 'tenderCompilerCertNo')
  608. },
  609. // 招标单位编制时间
  610. {
  611. name: 'TenderCompileDate', mustHasValue: true,
  612. value: _util.getValueByKey(basicInformation, 'tenderCompileDate')
  613. },
  614. // 招标单位审核人
  615. {
  616. name: 'TenderExaminer', mustHasValue: true,
  617. value: _util.getValueByKey(basicInformation, 'tenderExaminer')
  618. },
  619. // 招标单位审核人资格证书编号
  620. {
  621. name: 'TenderExaminerCertNo', mustHasValue: true,
  622. value: _util.getValueByKey(basicInformation, 'tenderExaminerCertNo')
  623. },
  624. // 招标单位审核时间
  625. {
  626. name: 'TenderExamineDate', mustHasValue: true,
  627. value: _util.getValueByKey(basicInformation, 'tenderExamineDate')
  628. },
  629. // 招标单位审定人
  630. {
  631. name: 'TenderApprover', mustHasValue: true,
  632. value: _util.getValueByKey(basicInformation, 'tenderApprover')
  633. },
  634. // 招标单位审定人资格证书编号
  635. {
  636. name: 'TenderApproverCertNo', mustHasValue: true,
  637. value: _util.getValueByKey(basicInformation, 'tenderApproverCertNo')
  638. },
  639. // 招标单位审定时间
  640. {
  641. name: 'TenderApproveDate', mustHasValue: true,
  642. value: _util.getValueByKey(basicInformation, 'tenderApproveDate')
  643. },
  644. // 招标代理 不得为空,如无招标代理,则应填写“无”。
  645. {
  646. name: 'Proxy', dName: '招标代理',
  647. value: _util.getValueByKey(basicInformation, 'proxy') || '无', required: true
  648. },
  649. // 招标代理资质证书编号
  650. {
  651. name: 'ProxyCertNo', mustHasValue: true,
  652. value: _util.getValueByKey(basicInformation, 'proxyCertNo')
  653. },
  654. // 招标代理法定代表人或其授权人
  655. {
  656. name: 'ProxyAuthorizer', mustHasValue: true,
  657. value: _util.getValueByKey(basicInformation, 'proxyAuthorizer')
  658. },
  659. // 招标代理编制人员
  660. {
  661. name: 'ProxyCompiler', mustHasValue: true,
  662. value: _util.getValueByKey(basicInformation, 'proxyCompiler')
  663. },
  664. // 招标代理编制人员资格证书编号
  665. {
  666. name: 'ProxyCompilerCertNo', mustHasValue: true,
  667. value: _util.getValueByKey(basicInformation, 'proxyCompilerCertNo')
  668. },
  669. // 招标代理编制时间
  670. {
  671. name: 'ProxyCompileDate', mustHasValue: true,
  672. value: _util.getValueByKey(basicInformation, 'proxyCompileDate')
  673. },
  674. // 招标代理审核人
  675. {
  676. name: 'ProxyExaminer', mustHasValue: true,
  677. value: _util.getValueByKey(basicInformation, 'proxyExaminer')
  678. },
  679. // 招标代理审核人资格证书编号
  680. {
  681. name: 'ProxyExaminerCertNo', mustHasValue: true,
  682. value: _util.getValueByKey(basicInformation, 'proxyExaminerCertNo')
  683. },
  684. // 招标代理审核时间
  685. {
  686. name: 'ProxyExamineDate', mustHasValue: true,
  687. value: _util.getValueByKey(basicInformation, 'proxyExamineDate')
  688. },
  689. // 招标代理审定人
  690. {
  691. name: 'ProxyApprover', mustHasValue: true,
  692. value: _util.getValueByKey(basicInformation, 'proxyApprover')
  693. },
  694. // 招标代理审定人资格证书编号
  695. {
  696. name: 'ProxyApproverCertNo', mustHasValue: true,
  697. value: _util.getValueByKey(basicInformation, 'proxyApproverCertNo')
  698. },
  699. // 招标代理审定时间
  700. {
  701. name: 'ProxyApproveDate', mustHasValue: true,
  702. value: _util.getValueByKey(basicInformation, 'proxyApproveDate')
  703. },
  704. // 造价咨询 、Consultant(造价咨询):不得为空,如无则应填写“无”。
  705. {
  706. name: 'Consultant', dName: '造价咨询', required: true,
  707. value: _util.getValueByKey(basicInformation, 'consultant') || '无'
  708. },
  709. // 造价咨询资质证书编号
  710. {
  711. name: 'ConsultantCertNo', mustHasValue: true,
  712. value: _util.getValueByKey(basicInformation, 'consultantCertNo')
  713. },
  714. // 造价咨询法定代表人或其授权人
  715. {
  716. name: 'ConsultantAuthorizer', mustHasValue: true,
  717. value: _util.getValueByKey(basicInformation, 'consultantAuthorizer')
  718. },
  719. // 造价咨询编制人
  720. {
  721. name: 'ConsultantCompiler', mustHasValue: true,
  722. value: _util.getValueByKey(basicInformation, 'consultantCompiler')
  723. },
  724. // 造价咨询编制人资格证书
  725. {
  726. name: 'ConsultantCompilerCertNo', mustHasValue: true,
  727. value: _util.getValueByKey(basicInformation, 'consultantCompilerCertNo')
  728. },
  729. // 造价咨询编制时间
  730. {
  731. name: 'ConsultantCompileDate', mustHasValue: true,
  732. value: _util.getValueByKey(basicInformation, 'consultantCompileDate')
  733. },
  734. // 造价咨询审核人
  735. {
  736. name: 'ConsultantExaminer', mustHasValue: true,
  737. value: _util.getValueByKey(basicInformation, 'consultantExaminer')
  738. },
  739. // 造价咨询审核人资格证书编号
  740. {
  741. name: 'ConsultantExaminerCertNo', mustHasValue: true,
  742. value: _util.getValueByKey(basicInformation, 'consultantExaminerCertNo')
  743. },
  744. // 造价咨询审核时间
  745. {
  746. name: 'ConsultantExamineDate', mustHasValue: true,
  747. value: _util.getValueByKey(basicInformation, 'consultantExamineDate')
  748. },
  749. // 造价咨询审定人
  750. {
  751. name: 'ConsultantApprover', mustHasValue: true,
  752. value: _util.getValueByKey(basicInformation, 'consultantApprover')
  753. },
  754. // 造价咨询审定人资格证书编号
  755. {
  756. name: 'ConsultantApproverCertNo', mustHasValue: true,
  757. value: _util.getValueByKey(basicInformation, 'consultantApproverCertNo')
  758. },
  759. // 造价咨询审定时间
  760. {
  761. name: 'ConsultantApproveDate', mustHasValue: true,
  762. value: _util.getValueByKey(basicInformation, 'consultantApproveDate')
  763. },
  764. // 招标控制价(元)
  765. {
  766. name: 'TenderSumLimit', dName: '招标控制价', type: _type.DECIMAL, required: true,
  767. value: summaryInfo.engineeringCost
  768. }
  769. ];
  770. _base.Element.call(this, 'TendereeInfo', attrs);
  771. }
  772. // 投标信息
  773. function BidderInfo(basicInformation, summaryInfo) {
  774. const attrs = [
  775. // 投标人
  776. {
  777. name: 'BidName', dName: '投标人', required: true,
  778. value: _util.getValueByKey(basicInformation, 'bidName') || '无'
  779. },
  780. // 投标单位法定代表人或其授权人
  781. {
  782. name: 'BidAuthorizer', mustHasValue: true,
  783. value: _util.getValueByKey(basicInformation, 'bidAuthorizer')
  784. },
  785. // 投标总价(元)
  786. {
  787. name: 'BidAuthorizer', dName: '投标总价', type: _type.DECIMAL, required: true,
  788. value: summaryInfo.engineeringCost
  789. },
  790. // 投标单位编制人
  791. {
  792. name: 'BidCompiler', mustHasValue: true,
  793. value: _util.getValueByKey(basicInformation, 'bidCompiler')
  794. },
  795. // 投标单位编制人资格证书编号
  796. {
  797. name: 'BidCompilerCertNo', mustHasValue: true,
  798. value: _util.getValueByKey(basicInformation, 'bidCompilerCertNo')
  799. },
  800. // 投标单位编制时间
  801. {
  802. name: 'BidCompileDate', mustHasValue: true,
  803. value: _util.getValueByKey(basicInformation, 'bidCompileDate')
  804. },
  805. // 投标单位审核人
  806. {
  807. name: 'BidExaminer', mustHasValue: true,
  808. value: _util.getValueByKey(basicInformation, 'bidExaminer')
  809. },
  810. // 投标单位审核人资格证书编号
  811. {
  812. name: 'BidExaminerCertNo', mustHasValue: true,
  813. value: _util.getValueByKey(basicInformation, 'bidExaminerCertNo')
  814. },
  815. // 投标单位审核时间
  816. {
  817. name: 'BidExamineDate', mustHasValue: true,
  818. value: _util.getValueByKey(basicInformation, 'bidExamineDate')
  819. },
  820. // 投标单位审定人
  821. {
  822. name: 'BidApprover', mustHasValue: true,
  823. value: _util.getValueByKey(basicInformation, 'bidApprover')
  824. },
  825. // 投标单位审定人资格证书
  826. {
  827. name: 'BidApproverCertNo', mustHasValue: true,
  828. value: _util.getValueByKey(basicInformation, 'bidApproverCertNo')
  829. },
  830. // 投标单位审定时间
  831. {
  832. name: 'BidApproveDate', mustHasValue: true,
  833. value: _util.getValueByKey(basicInformation, 'bidApproveDate')
  834. }
  835. ];
  836. _base.Element.call(this, 'BidderInfo', attrs);
  837. }
  838. // 费用汇总
  839. function SummaryOfCost(summaryInfo) {
  840. const attrs = [
  841. // 工程造价(元)
  842. {
  843. name: 'Total', type: _type.DECIMAL,
  844. value: summaryInfo.engineeringCost
  845. },
  846. // 建筑工程费
  847. {
  848. name: 'Construction', type: _type.DECIMAL,
  849. value: '0'
  850. },
  851. // 安装工程费
  852. {
  853. name: 'Installation', type: _type.DECIMAL,
  854. value: '0',
  855. },
  856. // 分部分项工程费
  857. {
  858. name: 'DivisionalAndElementalWorks', type: _type.DECIMAL,
  859. value: summaryInfo.subEngineering
  860. },
  861. // 措施项目费
  862. {
  863. name: 'Preliminaries', type: _type.DECIMAL,
  864. value: summaryInfo.measure
  865. },
  866. // 绿色施工安全防护措施费
  867. {
  868. name: 'CostForHSE', type: _type.DECIMAL,
  869. value: summaryInfo.greenMeasureFee
  870. },
  871. // 其他措施费
  872. {
  873. name: 'OtherPreliminaries', type: _type.DECIMAL,
  874. value: summaryInfo.otherPreliminaries
  875. },
  876. // 其他项目费
  877. {
  878. name: 'SundryCosts', type: _type.DECIMAL,
  879. value: summaryInfo.other
  880. },
  881. // 暂列金额
  882. {
  883. name: 'ProvisionalSums', type: _type.DECIMAL,
  884. value: summaryInfo.provisional
  885. },
  886. // 暂估价材料
  887. {
  888. name: 'ProvisionalMaterial', type: _type.DECIMAL,
  889. value: summaryInfo.materialProvisional
  890. },
  891. // 专业工程暂估价
  892. {
  893. name: 'SpecialtyProvisionalPrice', type: _type.DECIMAL,
  894. value: summaryInfo.engineeringEstimate
  895. },
  896. // 计日工费用
  897. {
  898. name: 'DayWorkRate', type: _type.DECIMAL,
  899. value: summaryInfo.daywork
  900. },
  901. // 总承包服务费
  902. {
  903. name: 'MainContractorAttendance', type: _type.DECIMAL,
  904. value: summaryInfo.turnKeyContract
  905. },
  906. // 索赔费用
  907. {
  908. name: 'ClaimForLossAndExpenses', type: _type.DECIMAL,
  909. value: summaryInfo.claim
  910. },
  911. // 现场签证费用
  912. {
  913. name: 'SiteInstruction', type: _type.DECIMAL,
  914. value: summaryInfo.visa
  915. },
  916. // 规费
  917. {
  918. name: 'StatutoryFees', type: _type.DECIMAL,
  919. value: '0'
  920. },
  921. // 税金
  922. {
  923. name: 'Tax', type: _type.DECIMAL,
  924. value: summaryInfo.tax
  925. },
  926. // 人工费
  927. {
  928. name: 'Labor', type: _type.DECIMAL,
  929. value: summaryInfo.labour
  930. },
  931. // 材料费
  932. {
  933. name: 'Material', type: _type.DECIMAL,
  934. value: summaryInfo.material
  935. },
  936. // 设备费
  937. {
  938. name: 'Equipment', type: _type.DECIMAL,
  939. value: summaryInfo.equipment
  940. },
  941. // 主材设备费
  942. {
  943. name: 'MainMaterialEquipment', type: _type.DECIMAL,
  944. value: scMathUtil.roundForObj(summaryInfo.mainMaterial + summaryInfo.equipment, Decimal.FEE)
  945. },
  946. // 主材费
  947. {
  948. name: 'MainMaterial', type: _type.DECIMAL,
  949. value: summaryInfo.mainMaterial
  950. },
  951. // 机械费
  952. {
  953. name: 'Machine', type: _type.DECIMAL,
  954. value: summaryInfo.machine
  955. },
  956. // 管理费
  957. {
  958. name: 'Overhead', type: _type.DECIMAL,
  959. value: summaryInfo.overhead
  960. },
  961. // 利润
  962. {
  963. name: 'Profit', type: _type.DECIMAL,
  964. value: summaryInfo.profit
  965. },
  966. ];
  967. _base.Element.call(this, 'SummaryOfCost', attrs);
  968. }
  969. // 建筑安装工程费
  970. function ProjectInstallationWorkCost(projectData, summaryInfo) {
  971. const basicInformation = projectData.property.basicInformation;
  972. const attrs = [
  973. // 工程编号
  974. {
  975. name: 'Number',
  976. value: ''
  977. },
  978. // 工程名称
  979. {
  980. name: 'Name', required: true,
  981. value: projectData.name
  982. },
  983. // 金额 (元)
  984. {
  985. name: 'Total', type: _type.DECIMAL,
  986. value: summaryInfo.engineeringCost
  987. },
  988. // 建设规模
  989. {
  990. name: 'Scale', type: _type.DECIMAL, required: true,
  991. value: _util.getValueByKey(basicInformation, 'projectScale')
  992. },
  993. // 建设规模单位
  994. {
  995. name: 'Unit', required: true,
  996. value: _util.getValueByKey(basicInformation, 'todo')
  997. },
  998. // 占总投资比例(%)
  999. {
  1000. name: 'Ratios', type: _type.DECIMAL,
  1001. value: '0.00'
  1002. },
  1003. ];
  1004. _base.Element.call(this, 'ProjectInstallationWorkCost', attrs);
  1005. }
  1006. // 单项工程
  1007. function SectionWorks({ name, total, rate }) {
  1008. const attrs = [
  1009. // 工程编号
  1010. {
  1011. name: 'Number',
  1012. value: ''
  1013. },
  1014. // 工程名称
  1015. {
  1016. name: 'Name', required: true,
  1017. value: name
  1018. },
  1019. // 金额
  1020. {
  1021. name: 'Total', type: _type.DECIMAL,
  1022. value: total
  1023. },
  1024. // 建设规模 单项工程没有填写的地方,输出“0”
  1025. {
  1026. name: 'Scale', dName: '建设规模', type: _type.DECIMAL, required: true,
  1027. value: '0'
  1028. },
  1029. // 建设规模单位 单项工程没有填写的地方,输出和"m2"
  1030. {
  1031. name: 'Unit', dName: '建设规模单位', required: true,
  1032. value: 'm2'
  1033. },
  1034. // 占总投资比例(%)
  1035. {
  1036. name: 'Ratios', type: _type.DECIMAL,
  1037. value: rate
  1038. },
  1039. // 费用代号
  1040. {
  1041. name: 'Code', type: _type.DECIMAL,
  1042. value: ''
  1043. },
  1044. ];
  1045. _base.Element.call(this, 'SectionWorks', attrs);
  1046. }
  1047. // 单位工程
  1048. function UnitWorks(projectData, tenderData, summaryInfo) {
  1049. const basicInformation = projectData.property.basicInformation;
  1050. const projectFeature = tenderData.property.projectFeature;
  1051. const attrs = [
  1052. // 工程编号
  1053. {
  1054. name: 'Number', required: true,
  1055. value: ''
  1056. },
  1057. // 工程名称
  1058. {
  1059. name: 'Name', required: true,
  1060. value: tenderData.name
  1061. },
  1062. // 标段 取建设项目名称
  1063. {
  1064. name: 'Segment',
  1065. value: projectData.name
  1066. },
  1067. // 工程类别
  1068. {
  1069. name: 'ProjectCategory', required: true,
  1070. value: _util.getValueByKey(basicInformation, 'projectCategory')
  1071. },
  1072. // 工程类型
  1073. {
  1074. name: 'ProjectType', required: true,
  1075. value: getProjectType(projectData)
  1076. },
  1077. // 计价模式
  1078. {
  1079. name: 'ValuationModel', type: _type.INT, required: true,
  1080. value: VALUATION_MODEL.bill
  1081. },
  1082. // 计税模式
  1083. {
  1084. name: 'TaxModel', type: _type.INT, required: true,
  1085. value: tenderData.property.taxType
  1086. },
  1087. // 地区类别 取建设项目-基本信息-地区类别
  1088. {
  1089. name: 'AreaKind', type: _type.INT, required: true,
  1090. value: _util.getValueByKey(basicInformation, 'regionalCategories')
  1091. },
  1092. // 金额
  1093. {
  1094. name: 'Total', type: _type.DECIMAL,
  1095. value: summaryInfo.engineeringCost
  1096. },
  1097. // 专业类别
  1098. {
  1099. name: 'Specialty', type: _type.INT,
  1100. value: Specialty[tenderData.property.engineeringName]
  1101. },
  1102. // 工程用途
  1103. {
  1104. name: 'Purposes',
  1105. value: ''
  1106. },
  1107. //建设(编制)范围
  1108. {
  1109. name: 'RangeOfCompilation',
  1110. value: ''
  1111. },
  1112. // 建设规模 取单位工程-工程特征-建设规模
  1113. {
  1114. name: 'Scale', type: _type.DECIMAL, required: true,
  1115. value: _util.getValueByKey(projectFeature, 'buildScale')
  1116. },
  1117. // 建设规模单位
  1118. {
  1119. name: 'Unit', required: true,
  1120. value: 'todo'
  1121. },
  1122. // 占总投资比例(%)
  1123. {
  1124. name: 'Ratios', type: _type.DECIMAL,
  1125. value: src.summaryInfo.rate
  1126. },
  1127. // 清单数据库,没有则填写 “无”
  1128. {
  1129. name: 'BillDataBase', required: true,
  1130. value: '工程量清单规范(2013广东)',
  1131. },
  1132. // 定额数据库,没有则填写 “无”,后续获取详细数据(getTenderDetail)的时候填上
  1133. {
  1134. name: 'NormDataBase', required: true,
  1135. value: '无'
  1136. },
  1137. // 人工材料设备价格文件,没有则填写 “无”
  1138. {
  1139. name: 'ResInfoPricingFile', required: true,
  1140. value: '无'
  1141. },
  1142. // 总说明
  1143. {
  1144. name: 'Explains',
  1145. value: tenderData.property.compilationIllustrationProject
  1146. },
  1147. // 导出XML文件名,工程编号+工程名称.xml, 暂时取“名称.xml”,用户设置完工程编号后修改此值
  1148. {
  1149. name: 'FileName',
  1150. value: `${tenderData.name}.xml`
  1151. },
  1152. // 备注
  1153. {
  1154. name: 'Remark',
  1155. value: ''
  1156. },
  1157. ];
  1158. _base.Element.call(this, 'UnitWorks', attrs);
  1159. }
  1160. // 工程特征信息 AttrInfo, 补充信息AddiInfo
  1161. function Info(eleName) {
  1162. _base.Element.call(this, eleName, []);
  1163. }
  1164. // 工程特征信息明细 AttrInfoItem, 补充信息明细AddiInfoItem
  1165. function InfoItem(eleName, attr) {
  1166. const attrs = [
  1167. {
  1168. name: 'Name', required: true,
  1169. value: attr.dispName,
  1170. },
  1171. { name: 'Value', value: attr.value },
  1172. ];
  1173. if (attr.code) {
  1174. attrs.push({ name: 'Code', value: attr.code });
  1175. }
  1176. if (attr.remark) {
  1177. attrs.push({ name: 'Remark', value: attr.remark });
  1178. }
  1179. _base.Element.call(this, eleName, attrs);
  1180. }
  1181. // 单位工程费用汇总
  1182. function UnitWorksSummary() {
  1183. _base.Element.call(this, 'UnitWorksSummary', []);
  1184. }
  1185. // 单位工程费用汇总标题
  1186. function UnitWorksSummaryGroup(bills) {
  1187. const attrs = [
  1188. // 费用编号
  1189. { name: 'Number', value: bills.code },
  1190. // 费用名称
  1191. {
  1192. name: 'Name', required: true,
  1193. value: bills.name
  1194. },
  1195. // 单位
  1196. { name: 'Unit', value: bills.unit },
  1197. // 工程量
  1198. {
  1199. name: 'Quantity', type: _type.DECIMAL,
  1200. value: bills.quantity
  1201. },
  1202. // 金额
  1203. {
  1204. name: 'Total', type: _type.DECIMAL,
  1205. value: _util.getFee(bills.fees, 'common.totalFee')
  1206. },
  1207. // 技术经济指标(元) 取综合单价
  1208. {
  1209. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1210. value: _util.getFee(bills.fees, 'common.unitFee')
  1211. },
  1212. //章节类型
  1213. {
  1214. name: 'ChapterKind', type: _type.INT, required: true,
  1215. value: '4'
  1216. },
  1217. // 费用代号
  1218. {
  1219. name: 'Code', type: _type.INT, required: true,
  1220. value: getFeeCode(bills)
  1221. },
  1222. // 汇总类型
  1223. {
  1224. name: 'Kind', type: _type.INT, required: true,
  1225. value: '1'
  1226. },
  1227. // 备注
  1228. { name: 'Remark', value: bills.remark }
  1229. ];
  1230. _base.Element.call(this, 'UnitWorksSummaryGroup', attrs);
  1231. }
  1232. // 单位工程费汇总明细
  1233. function UnitWorksSummaryItem(node) {
  1234. const bills = node.data;
  1235. const attrs = [
  1236. { name: 'Number', value: bills.code },
  1237. {
  1238. name: 'Name', required: true,
  1239. value: bills.name
  1240. },
  1241. { name: 'Unit', value: bills.unit },
  1242. {
  1243. name: 'Quantity', type: _type.DECIMAL,
  1244. value: bills.quantity
  1245. },
  1246. // 计算基数:可由费用代号、数字、四则运算符号、小括号组成
  1247. {
  1248. name: 'QtyFormula', type: _type.DECIMAL,
  1249. value: getQtyFormula(node)
  1250. },
  1251. // 费率
  1252. {
  1253. name: 'Rate', type: _type.DECIMAL,
  1254. value: commonUtil.isDef(bills.feeRate) ? bills.feeRate : '100'
  1255. },
  1256. {
  1257. name: 'Total', type: _type.DECIMAL,
  1258. value: _util.getFee(bills.fees, 'common.totalFee')
  1259. },
  1260. // 技术经济指标(元)
  1261. {
  1262. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1263. value: _util.getFee(bills.fees, 'common.unitFee')
  1264. },
  1265. //章节类型
  1266. {
  1267. name: 'ChapterKind', type: _type.INT, required: true,
  1268. value: '4'
  1269. },
  1270. // 费用代号
  1271. {
  1272. name: 'Code', type: _type.INT, required: true,
  1273. value: getFeeCode(bills)
  1274. },
  1275. // 汇总类型
  1276. {
  1277. name: 'Kind', type: _type.INT, required: true,
  1278. value: '1'
  1279. },
  1280. // 备注
  1281. { name: 'Remark', value: bills.remark }
  1282. ];
  1283. _base.Element.call(this, 'UnitWorksSummaryItem', attrs);
  1284. }
  1285. // 分部分项工程
  1286. function DivisionalAndElementalWorks() {
  1287. _base.Element.call(this, 'DivisionalAndElementalWorks', []);
  1288. }
  1289. // 措施项目
  1290. function Preliminaries() {
  1291. _base.Element.call(this, 'Preliminaries', []);
  1292. }
  1293. // 合计费用
  1294. function SummaryOfBasicCost(items, bills) {
  1295. // 省略了一些
  1296. const mainMaterial = _util.getFee(bills.fees, 'mainMaterial.totalFee');
  1297. const equipment = _util.getFee(bills.fees, 'equipment.totalFee');
  1298. const mainMaterialEquipment = scMathUtil.roundForObj(mainMaterial + equipment, Decimal.FEE); // 主材设备费 = 主材 + 设备 (设备不输出)
  1299. const attrs = [
  1300. // 人工费
  1301. {
  1302. name: 'Labor', type: _type.DECIMAL,
  1303. value: _util.getFee(bills.fees, 'labour.totalFee')
  1304. },
  1305. // 材料费
  1306. {
  1307. name: 'Material', type: _type.DECIMAL,
  1308. value: _util.getFee(bills.fees, 'material.totalFee')
  1309. },
  1310. // 主材费
  1311. {
  1312. name: 'MainMaterial', type: _type.DECIMAL,
  1313. value: mainMaterial
  1314. },
  1315. // 主材设备费
  1316. {
  1317. name: 'MainMaterialEquipment', type: _type.DECIMAL,
  1318. value: mainMaterialEquipment
  1319. },
  1320. // 暂估价
  1321. {
  1322. name: 'Appraisal', type: _type.DECIMAL,
  1323. value: _util.getFeeByFlag(items, fixedFlag.ESTIMATE, 'common.totalFee')
  1324. },
  1325. // 机械费
  1326. {
  1327. name: 'Machine', type: _type.DECIMAL,
  1328. value: _util.getFee(bills.fees, 'machine.totalFee')
  1329. },
  1330. // 管理费
  1331. {
  1332. name: 'Overhead', type: _type.DECIMAL,
  1333. value: _util.getFee(bills.fees, 'manage.totalFee')
  1334. },
  1335. // 利润
  1336. {
  1337. name: 'Profit', type: _type.DECIMAL,
  1338. value: _util.getFee(bills.fees, 'profit.totalFee')
  1339. },
  1340. // 分部分项工程费
  1341. {
  1342. name: 'DivisionalAndElementalWorks', type: _type.DECIMAL,
  1343. value: _util.getFeeByFlag(items, fixedFlag.SUB_ENGINERRING, 'common.totalFee')
  1344. },
  1345. // 措施项目费
  1346. {
  1347. name: 'Preliminaries', type: _type.DECIMAL,
  1348. value: _util.getFeeByFlag(items, fixedFlag.MEASURE, 'common.totalFee')
  1349. },
  1350. // 绿色施工安全防护措施费
  1351. {
  1352. name: 'CostForHSE', type: _type.DECIMAL,
  1353. value: _util.getFeeByFlag(items, fixedFlag.GREEN_MEASURE_FEE, 'common.totalFee')
  1354. },
  1355. // 其他项目费
  1356. {
  1357. name: 'SundryCosts', type: _type.DECIMAL,
  1358. value: _util.getFeeByFlag(items, fixedFlag.OTHER_MEASURE_FEE, 'common.totalFee')
  1359. },
  1360. // 暂列金额
  1361. {
  1362. name: 'ProvisionalSums', type: _type.DECIMAL,
  1363. value: _util.getFeeByFlag(items, fixedFlag.PROVISIONAL, 'common.totalFee')
  1364. },
  1365. // 规费
  1366. {
  1367. name: 'StatutoryFees', type: _type.DECIMAL,
  1368. value: '0'
  1369. },
  1370. // 税金
  1371. {
  1372. name: 'Tax', type: _type.DECIMAL,
  1373. value: _util.getFeeByFlag(items, fixedFlag.TAX, 'common.totalFee')
  1374. },
  1375. ];
  1376. _base.Element.call(this, 'SummaryOfBasicCost', attrs);
  1377. }
  1378. // 分部工程
  1379. function DivisionalWorks(bills) {
  1380. const attrs = [
  1381. // 编码
  1382. { name: 'Number', value: bills.code },
  1383. // 名称
  1384. {
  1385. name: 'Name', required: true,
  1386. value: bills.name
  1387. },
  1388. // 特征
  1389. { name: 'Attr', value: '' },
  1390. // 单位
  1391. { name: 'Unit', value: bills.unit },
  1392. // 工程量
  1393. {
  1394. name: 'Quantity', type: _type.DECIMAL,
  1395. value: bills.quantity
  1396. },
  1397. // 综合合价
  1398. {
  1399. name: 'Total', type: _type.DECIMAL,
  1400. value: _util.getFee(bills.fees, 'common.totalFee')
  1401. },
  1402. // 综合单价
  1403. {
  1404. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1405. value: _util.getFee(bills.fees, 'common.unitFee')
  1406. },
  1407. // 章节类型
  1408. {
  1409. name: 'ChapterKind', type: _type.INT, required: true,
  1410. value: '4'
  1411. },
  1412. // 费用字典,拼音首字母
  1413. { name: 'Code', value: getFeeCode(bills) },
  1414. // 备注
  1415. { name: 'Remark', value: bills.remark }
  1416. ];
  1417. _base.Element.call(this, 'DivisionalWorks', attrs);
  1418. }
  1419. // 清单项目
  1420. function WorkElement(node, kind, specialty) {
  1421. const bills = node.data;
  1422. const attrs = [
  1423. // 项目编码
  1424. { name: 'Number', required: true, value: bills.code || '' },
  1425. // 项目名称
  1426. { name: 'Name', required: true, value: bills.name },
  1427. // 项目特征
  1428. { name: 'Attr', value: bills.itemCharacterText },
  1429. // 工作内容
  1430. { name: 'WorkContent', value: bills.jocContentText },
  1431. // 计量单位
  1432. { name: 'Unit', required: true, value: bills.unit },
  1433. // 工程量
  1434. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1435. // 计算基数
  1436. { name: 'QtyFormula', type: _type.DECIMAL, value: getQtyFormula(node) },
  1437. // 单价(元)
  1438. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1439. // 设备单价(元)指清单项目所采用设备的综合单价
  1440. { name: 'EquipmentPrice', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'equipment.unitFee') },
  1441. // 最低限价(元)
  1442. //{ name: 'PriceLow', type: _type.DECIMAL, value: 'todo' },
  1443. // 最高限价(元)
  1444. { name: 'PriceHigh', type: _type.DECIMAL, value: bills.maxPrice },
  1445. // 费率(%)
  1446. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1447. // 合价(元)
  1448. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1449. // 主要清单
  1450. { name: 'Total', type: _type.BOOL, value: !!bills.mainBills },
  1451. // 子目类型
  1452. { name: 'Kind', type: _type.INT, required: true, value: kind },
  1453. // 取费类型
  1454. { name: 'CalculationKind', type: _type.INT, required: true, value: '1' },
  1455. // 费用归属
  1456. { name: 'CostKind', type: _type.INT, required: true, value: '1' },
  1457. // 计算方式
  1458. { name: 'CalcType', type: _type.INT, required: true, value: '1' },
  1459. // 专业类型
  1460. { name: 'Specialty', type: _type.INT, value: specialty },
  1461. // 清单标识
  1462. { name: 'ListingIdentity', value: 'GB50500-2013 1 GD' },
  1463. // 费用代号
  1464. { name: 'Code', value: getFeeCode(bills) },
  1465. // 备注
  1466. { name: 'Remark', value: bills.remark }
  1467. ];
  1468. _base.Element.call(this, 'WorkElement', attrs);
  1469. }
  1470. // 工程量计算表
  1471. function ExpressElement(quantityDetail) {
  1472. const attrs = [
  1473. // 序号
  1474. { name: 'OrderNumber', required: true, value: quantityDetail.name },
  1475. // 工程量计算式
  1476. { name: 'Express', required: true, value: quantityDetail.regex },
  1477. // 工程量
  1478. { name: 'Quantity', required: true, value: quantityDetail.result },
  1479. // 汇总类型
  1480. { name: 'Kind', type: _type.INT, required: true, value: SummationKindMap[quantityDetail.isSummation] },
  1481. ];
  1482. _base.Element.call(this, 'ExpressElement', attrs);
  1483. }
  1484. // 工序内容
  1485. function WorkContent(contentText, fee) {
  1486. const attrs = [
  1487. // 定额工作内容
  1488. { name: 'Name', required: true, value: contentText },
  1489. // 取此工作内容下定额子目/量价/定额同级人材机的综合合价之和
  1490. { name: 'Total', type: _type.DECIMAL, value: fee },
  1491. { name: 'Remark', value: '' }
  1492. ];
  1493. _base.Element.call(this, 'WorkContent', attrs);
  1494. }
  1495. // 定额子目
  1496. function Norm(ration, libCode, kind, specialty) {
  1497. const attrs = [
  1498. // 定额编码
  1499. { name: 'Number', required: true, value: ration.code },
  1500. { name: 'Name', required: true, value: ration.name },
  1501. { name: 'Unit', required: true, value: ration.unit },
  1502. { name: 'Quantity', type: _type.DECIMAL, value: ration.quantity },
  1503. // 单价
  1504. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(ration.fees, 'common.unitFee') },
  1505. // 合价
  1506. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(src.fees, 'common.totalFee') },
  1507. // 是否定额
  1508. { name: 'IsNorm', type: _type.Bool, required: true, value: 'true' },
  1509. // 子目类型
  1510. { name: 'Kind', type: _type.INT, required: true, value: kind },
  1511. // 取费类型
  1512. { name: 'CalculationKind', type: _type.INT, required: true, value: '1' },
  1513. // 费用归属
  1514. { name: 'CostKind', type: _type.INT, required: true, value: '1' },
  1515. // 降效类型
  1516. {
  1517. name: 'EfficiencyKind', type: _type.INT,
  1518. value: ration.type === rationType.overHeight ? EfficiencyKind.BASE_REDUCTION : EfficiencyKind.NOT_BASE_REDUCTION
  1519. },
  1520. // 子目增加费类型itemIncrease
  1521. {
  1522. name: 'IncFeeKind', type: _type.INT,
  1523. value: ration.type === rationType.overHeight ? IncFeeKind.SUB_BASE : IncFeeKind.NOT_SUB_BASE
  1524. },
  1525. // 换算说明
  1526. { name: 'Conversion', value: ration.adjustState },
  1527. // 专业类别
  1528. { name: 'Specialty', type: _type.INT, value: specialty },
  1529. //定额标识(定额库编码)
  1530. { name: 'NormIdentity', value: libCode },
  1531. // 册 定额书没有分册填写0,有分册的按册号填写
  1532. { name: 'Volume', type: _type.INT, value: getVolume(ration.code) },
  1533. // 章
  1534. { name: 'Chapter', type: _type.INT, value: getChapter(ration.code) },
  1535. { name: 'Remark', value: ration.remark }
  1536. ];
  1537. _base.Element.call(this, 'Norm', attrs);
  1538. }
  1539. // 子目管理费
  1540. function ManageFees(calcTemplate, calcItems) {
  1541. const calcItems = (calcTemplate || {}).calcItems;
  1542. const manageItem = (calcItems || []).find(item => item.name === '管理费');
  1543. const fee1 = manageItem ? manageItem.unitFee : '0';
  1544. const rate = manageItem && commonUtil.isDef(manageItem.feeRate) ? manageItem.feeRate : '100';
  1545. const attrs = [
  1546. // 一类地区管理费 输出定额计算程序的管理费单价
  1547. { name: 'Fee1', type: _type.DECIMAL, required: true, value: fee1 },
  1548. // 二类地区管理费
  1549. { name: 'Fee2', type: _type.DECIMAL, required: true, value: '0' },
  1550. // 三类地区管理费
  1551. { name: 'Fee3', type: _type.DECIMAL, required: true, value: '0' },
  1552. // 四类地区管理费
  1553. { name: 'Fee4', type: _type.DECIMAL, required: true, value: '0' },
  1554. // 管理费换算比例
  1555. { name: 'Rate', type: _type.DECIMAL, required: true, value: rate },
  1556. ];
  1557. _base.Element.call(this, 'ManageFees', attrs);
  1558. }
  1559. // 工料机含量明细
  1560. function LabourMaterialsEquipmentsMachinesElement(glj) {
  1561. const attrs = [
  1562. // 工料机编码
  1563. { name: 'Number', value: glj.code },
  1564. // 消耗量
  1565. { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
  1566. // 不计价材料
  1567. { name: 'NOCost', typ: _type.BOOL, value: 'false' },
  1568. // 备注
  1569. { name: 'Remark', value: '' }
  1570. ];
  1571. _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesElement', attrs);
  1572. }
  1573. //子目单价计算
  1574. function UnitPriceCalculationOfItem(calcItem) {
  1575. const feeRate = commonUtil.isDef(calcItem.feeRate) ? calcItem.feeRate : '100';
  1576. const attrs = [
  1577. // 费用名称
  1578. { name: 'Name', required: true, value: calcItem.name },
  1579. // 计算基数
  1580. { name: 'QtyFormula', value: CalculationQtyMap[calcItem.name] },
  1581. // 费率
  1582. { name: 'Rate', type: _type.DECIMAL, value: feeRate },
  1583. // 金额
  1584. { name: 'Total', type: _type.DECIMAL, value: calcItem.totalFee },
  1585. // 费用代号
  1586. { name: 'Code', value: CalculationCodeMap[calcItem.name] },
  1587. // 备注
  1588. { name: 'Remark', value: '' },
  1589. ];
  1590. _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesElement', attrs);
  1591. }
  1592. // 其他项目
  1593. function Sundry() {
  1594. _base.Element.call(this, 'Sundry', []);
  1595. }
  1596. // 其他项目汇总子目
  1597. function SundryItem(eleName, bills) {
  1598. const attrs = [
  1599. // 名称
  1600. { name: 'Name', required: true, value: bills.name },
  1601. // 金额
  1602. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1603. // 费用代号
  1604. { name: 'Code', required: true, value: getFeeCode(bills) },
  1605. // 备注
  1606. { name: 'Remark', value: bills.remark }
  1607. ];
  1608. _base.Element.call(this, eleName, attrs);
  1609. }
  1610. // 其他项目费标题
  1611. function SundryCostsGroup(node) {
  1612. const bills = node.data;
  1613. const attrs = [
  1614. // 名称
  1615. { name: 'Name', required: true, value: bills.name },
  1616. // 金额
  1617. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1618. // 费用代号
  1619. { name: 'Code', required: true, value: getFeeCode(bills) },
  1620. // 汇总类型
  1621. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1622. // 备注
  1623. { name: 'Remark', value: bills.remark }
  1624. ];
  1625. _base.Element.call(this, 'SundryCostsGroup', attrs);
  1626. }
  1627. // 其他项目费明细
  1628. function SundryCostsItem(node) {
  1629. const bills = node.data;
  1630. const attrs = [
  1631. // 名称
  1632. { name: 'Name', required: true, value: bills.name },
  1633. // 单位
  1634. { name: 'Unit', value: bills.unit },
  1635. // 工程量
  1636. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1637. // 计算基数
  1638. { name: 'QtyFormula', value: getQtyFormula(node) },
  1639. // 单价
  1640. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1641. // 费率
  1642. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1643. // 金额
  1644. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1645. // 费用代号
  1646. { name: 'Code', required: true, value: getFeeCode(bills) },
  1647. // 汇总类型
  1648. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1649. // 备注
  1650. { name: 'Remark', value: bills.remark }
  1651. ];
  1652. _base.Element.call(this, 'SundryCostsItem', attrs);
  1653. }
  1654. // 暂列金额标题
  1655. function ProvisionalSumsGroup(node) {
  1656. const bills = node.data;
  1657. const attrs = [
  1658. // 名称
  1659. { name: 'Name', required: true, value: bills.name },
  1660. // 金额
  1661. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1662. // 汇总类型
  1663. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1664. // 备注
  1665. { name: 'Remark', value: bills.remark }
  1666. ];
  1667. _base.Element.call(this, 'ProvisionalSumsGroup', attrs);
  1668. }
  1669. // 暂列金额明细
  1670. function ProvisionalSumsItem(node) {
  1671. const bills = node.data;
  1672. const attrs = [
  1673. // 名称
  1674. { name: 'Name', required: true, value: bills.name },
  1675. // 单位
  1676. { name: 'Unit', value: bills.unit },
  1677. // 工程量
  1678. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1679. // 计算基数
  1680. { name: 'QtyFormula', value: getQtyFormula(node) },
  1681. // 单价
  1682. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1683. // 费率
  1684. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1685. // 金额
  1686. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1687. // 汇总类型
  1688. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1689. // 备注
  1690. { name: 'Remark', value: bills.remark }
  1691. ];
  1692. _base.Element.call(this, 'ProvisionalSumsItem', attrs);
  1693. }
  1694. // 材料设备暂估价明细
  1695. // 读取单位工程-其他项目费的材料暂估价的组成数据,业务上这个清单是使用清单基数计算得来,所以此部分读取整个单位工程下打勾暂估的材料
  1696. function ProvisionalMaterialEquipmentItem(glj, price) {
  1697. const attrs = [
  1698. // 编码
  1699. { name: 'Number', value: glj.code },
  1700. // 名称
  1701. { name: 'Name', required: true, value: glj.name },
  1702. // 型号规格
  1703. { name: 'Specification', value: glj.specs },
  1704. // 单位
  1705. { name: 'Unit', required: true, value: bills.unit },
  1706. // 工程量(总消耗量)
  1707. { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
  1708. // 单价 取市场价
  1709. { name: 'Price', type: _type.DECIMAL, value: price.marketPrice },
  1710. // 金额 round(总消耗量*市场价,2)
  1711. { name: 'Total', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.quantity * price.marketPrice, 2) },
  1712. // 备注
  1713. { name: 'Remark', value: glj.remark }
  1714. ];
  1715. _base.Element.call(this, 'ProvisionalMaterialEquipmentItem', attrs);
  1716. }
  1717. // 专业工程暂估价标题
  1718. function SpecialtyProvisionalPriceGroup(node) {
  1719. const bills = node.data;
  1720. const attrs = [
  1721. // 名称
  1722. { name: 'Name', required: true, value: bills.name },
  1723. // 工程内容
  1724. { name: 'Content', value: bills.engineeringContent },
  1725. // 金额
  1726. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1727. // 汇总类型
  1728. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1729. // 备注
  1730. { name: 'Remark', value: bills.remark }
  1731. ];
  1732. _base.Element.call(this, 'SpecialtyProvisionalPriceGroup', attrs);
  1733. }
  1734. // 专业工程暂估价明细
  1735. function SpecialtyProvisionalPriceItem(node) {
  1736. const bills = node.data;
  1737. const attrs = [
  1738. // 名称
  1739. { name: 'Name', required: true, value: bills.name },
  1740. // 工程内容
  1741. { name: 'Content', value: bills.engineeringContent },
  1742. // 单位
  1743. { name: 'Unit', value: bills.unit },
  1744. // 工程量
  1745. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1746. // 计算基数
  1747. { name: 'QtyFormula', value: getQtyFormula(node) },
  1748. // 单价
  1749. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1750. // 费率
  1751. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1752. // 金额
  1753. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1754. // 汇总类型
  1755. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1756. // 备注
  1757. { name: 'Remark', value: bills.remark }
  1758. ];
  1759. _base.Element.call(this, 'SpecialtyProvisionalPriceItem', attrs);
  1760. }
  1761. // 计日工标题
  1762. function DayWorkRateGroup(node) {
  1763. const bills = node.data;
  1764. const attrs = [
  1765. // 名称
  1766. { name: 'Name', required: true, value: bills.name },
  1767. // 金额
  1768. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1769. // 费用代号
  1770. { name: 'Code', value: getFeeCode(bills) },
  1771. // 备注
  1772. { name: 'Remark', value: bills.remark }
  1773. ];
  1774. _base.Element.call(this, 'DayWorkRateGroup', attrs);
  1775. }
  1776. // 计日工明细
  1777. function DayWorkRateItem(node) {
  1778. const bills = node.data;
  1779. const attrs = [
  1780. // 编码
  1781. { name: 'Number', value: bills.code },
  1782. // 名称
  1783. { name: 'Name', required: true, value: bills.name },
  1784. // 型号规格
  1785. { name: 'Specification', value: '' },
  1786. // 单位
  1787. { name: 'Unit', required: true, value: bills.unit },
  1788. // 工程量
  1789. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1790. // 单价
  1791. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1792. // 金额
  1793. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1794. // 备注
  1795. { name: 'Remark', value: bills.remark }
  1796. ];
  1797. _base.Element.call(this, 'DayWorkRateItem', attrs);
  1798. }
  1799. // 总承包服务费标题
  1800. function MainContractorAttendanceGroup(node) {
  1801. const bills = node.data;
  1802. const attrs = [
  1803. // 名称
  1804. { name: 'Name', required: true, value: bills.name },
  1805. // 金额
  1806. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1807. // 汇总类型
  1808. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1809. // 备注
  1810. { name: 'Remark', value: bills.remark }
  1811. ];
  1812. _base.Element.call(this, 'MainContractorAttendanceGroup', attrs);
  1813. }
  1814. // 总承包服务费明细
  1815. function MainContractorAttendanceItem(node) {
  1816. const bills = node.data;
  1817. const attrs = [
  1818. // 名称
  1819. { name: 'Name', required: true, value: bills.name },
  1820. // 项目价值
  1821. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1822. // 服务内容
  1823. { name: 'Content', value: bills.serviceContent },
  1824. // 计算基数
  1825. { name: 'QtyFormula', value: getQtyFormula(node) },
  1826. // 费率
  1827. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1828. // 金额
  1829. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1830. // 汇总类型
  1831. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1832. // 备注
  1833. { name: 'Remark', value: bills.remark }
  1834. ];
  1835. _base.Element.call(this, 'MainContractorAttendanceItem', attrs);
  1836. }
  1837. // 索赔、签证费用标题
  1838. function ClaimVisaCostGroup(eleName, node) {
  1839. const bills = node.data;
  1840. const attrs = [
  1841. // 名称
  1842. { name: 'Name', required: true, value: bills.name },
  1843. // 金额
  1844. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1845. // 汇总类型
  1846. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.YES },
  1847. // 备注
  1848. { name: 'Remark', value: bills.remark }
  1849. ];
  1850. _base.Element.call(this, eleName, attrs);
  1851. }
  1852. // 索赔费用明细
  1853. function ClaimVisaCostItem(eleName, node) {
  1854. const bills = node.data;
  1855. const attrs = [
  1856. // 名称
  1857. { name: 'Name', required: true, value: bills.name },
  1858. // 单位
  1859. { name: 'Unit', value: bills.unit },
  1860. // 数量
  1861. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1862. // 计算基数
  1863. { name: 'QtyFormula', value: getQtyFormula(node) },
  1864. // 单价
  1865. { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
  1866. // 费率
  1867. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1868. // 金额
  1869. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1870. // 依据
  1871. { name: 'Reason', value: '' },
  1872. // 汇总类型
  1873. { name: 'Kind', type: _type.INT, required: true, value: SummrayKind.NO },
  1874. // 备注
  1875. { name: 'Remark', value: bills.remark }
  1876. ];
  1877. _base.Element.call(this, eleName, attrs);
  1878. }
  1879. // 规费
  1880. function StatutoryFees() {
  1881. const attrs = [
  1882. { name: 'Name', required: true, value: '规费' },
  1883. { name: 'Code', required: true, value: 'GF' }
  1884. ];
  1885. _base.Element.call(this, 'StatutoryFees', attrs);
  1886. }
  1887. // 税金
  1888. function Tax(eleName, node) {
  1889. const bills = node.data;
  1890. const attrs = [
  1891. // 名称
  1892. { name: 'Name', required: true, value: bills.name },
  1893. // 计算基数说明
  1894. { name: 'CalBasis', value: getCalBasis(node) },
  1895. // 计算基数
  1896. { name: 'QtyFormula', value: getQtyFormula(node) },
  1897. // 费率
  1898. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1899. // 金额
  1900. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1901. // 费用代号
  1902. { name: 'Code', value: getFeeCode(bills) },
  1903. // 备注
  1904. { name: 'Remark', value: bills.remark }
  1905. ];
  1906. _base.Element.call(this, eleName, attrs);
  1907. }
  1908. // 人材机汇总
  1909. function LabourMaterialsEquipmentsMachinesSummary(glj, price, infoData, coeData) {
  1910. const attrs = [
  1911. // 编码
  1912. { name: 'Number', required: true, value: glj.code },
  1913. // 名称
  1914. { name: 'Name', required: true, value: glj.name },
  1915. // 规格型号
  1916. { name: 'Specification', value: glj.specs },
  1917. // 单位
  1918. { name: 'Unit', required: true, value: glj.unit },
  1919. // 数量(总消耗量)
  1920. { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
  1921. // 风险系数 从承包人主要材料设备-造价信息差额调整法读取,取不到则输出"0"
  1922. { name: 'ProviderExp', type: _type.DECIMAL, value: infoData && infoData.riskCoe || '0' },
  1923. // 基准单价 从承包人主要材料设备-造价信息差额调整法读取,取不到则输出"0"
  1924. { name: 'ProviderBase', type: _type.DECIMAL, value: infoData && infoData.standardPrice || '0' },
  1925. // 除税定额价(定额价)
  1926. { name: 'NoTaxOrgPrice', type: _type.DECIMAL, value: price.basePrice },
  1927. // 除税编制价(市场价)
  1928. { name: 'NoTaxPrice', type: _type.DECIMAL, value: price.marketPrice },
  1929. // 含税定额价 不存在这个字段,输出"0"
  1930. { name: 'TaxOrgPrice', type: _type.DECIMAL, value: '0' },
  1931. // 含税编制价 暂时取市场价
  1932. { name: 'TaxPrice', type: _type.DECIMAL, value: price.marketPrice },
  1933. // 引进部分
  1934. { name: 'ForeignCurrency', type: _type.DECIMAL, value: '0' },
  1935. // 折合人民币
  1936. { name: 'ConvertedIntoRMB', type: _type.DECIMAL, value: '0' },
  1937. // 除税定额价合价 取Round(定额价*总消耗量,2)
  1938. { name: 'NoTaxOrgTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.basePrice * glj.quantity, 2) },
  1939. // 除税编制价合价(元) 取Round(不含税市场价*总消耗量,2)
  1940. { name: 'NoTaxTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.marketPrice * glj.quantity, 2) },
  1941. // 含税定额价合价
  1942. { name: 'TaxOrgTotal', type: _type.DECIMAL, value: '0' },
  1943. // 含税编制价合价 取Round(含税市场价*总消耗量,2) (暂时用市场价)
  1944. { name: 'TaxTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.marketPrice * glj.quantity, 2) },
  1945. // 变值权重 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
  1946. { name: 'Weight', type: _type.DECIMAL, value: coeData && coeData.varWeight || '0' },
  1947. // 基本价格指数 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
  1948. { name: 'BasicPrice', type: _type.DECIMAL, value: coeData && coeData.FO || '0' },
  1949. // 现行价格指数 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
  1950. { name: 'CurrentPrice', type: _type.DECIMAL, value: coeData && coeData.FI || '0' },
  1951. // 工料机类型
  1952. { name: 'Kind', type: _type.INT, value: getGLJKind(glj.type) },
  1953. // 工料机归属
  1954. { name: 'Class', value: '' },
  1955. // 扩展属性
  1956. { name: 'ExtKind', type: _type.INT, value: 1 },
  1957. // 商品砼 如果工料机类型是“商品混凝土”、“商品砂浆”、“商品配合比”(软件中没有),则取“true”;否则取“false”
  1958. { name: 'Concrete', type: _type.BOOL, value: [205, 206].includes(glj.type) },
  1959. // 主要材料
  1960. { name: 'MainMaterial', type: _type.BOOL, value: !!glj.is_main_material },
  1961. // 是否暂估价材料
  1962. { name: 'ProvisionalMaterial', type: _type.BOOL, value: !!glj.is_evaluate },
  1963. // 供料方式
  1964. { name: 'Provider', type: _type.INT, value: Provider[glj.supply] },
  1965. // 价格来源
  1966. { name: 'PriceSource', value: '' },
  1967. // 交货方式
  1968. { name: 'Delivery', value: glj.delivery },
  1969. // 送达地点
  1970. { name: 'Location', value: glj.delivery_address },
  1971. // 产地
  1972. { name: 'ProducingArea', value: glj.originPlace },
  1973. // 供应商
  1974. { name: 'Supplier', value: glj.vender },
  1975. // 质量要求
  1976. { name: 'Character', value: glj.qualityGrace },
  1977. // 备注
  1978. { name: 'Remark', value: glj.remark }
  1979. ];
  1980. _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesSummary', attrs);
  1981. }
  1982. // 评标主要材料
  1983. function BidEvaluationMainMaterial(glj) {
  1984. const attrs = [
  1985. // 序号
  1986. { name: 'Code', required: true, value: glj.seq },
  1987. // 编码
  1988. { name: 'Number', value: glj.code },
  1989. // 名称
  1990. { name: 'Name', required: true, value: glj.name },
  1991. // 规格型号
  1992. { name: 'Specification', value: glj.specs },
  1993. // 单位
  1994. { name: 'Unit', required: true, value: glj.unit },
  1995. // 市场价
  1996. { name: 'Price', type: _type.DECIMAL, value: glj.marketPrice },
  1997. // 最高限价
  1998. { name: 'LimitedPrice', type: _type.DECIMAL, value: '0' },
  1999. // 总消耗量
  2000. { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
  2001. // 金额 Round(市场价*总消耗量,2)
  2002. { name: 'Total', type: _type.DECIMAL, value: scMathUtil.roundForObj(glj.marketPrice * glj.quantity, 2) },
  2003. // 交货方式
  2004. { name: 'Delivery', type: _type.DECIMAL, value: glj.delivery },
  2005. // 送达地点
  2006. { name: 'DeliPlace', value: glj.delivery_address },
  2007. // 产地
  2008. { name: 'ProducingArea', value: glj.originPlace },
  2009. // 供应商
  2010. { name: 'Supplier', value: glj.vender },
  2011. // 质量要求
  2012. { name: 'Character', value: glj.qualityGrace },
  2013. // 备注
  2014. { name: 'Remark', value: glj.remark }
  2015. ];
  2016. _base.Element.call(this, 'BidEvaluationMainMaterial', attrs);
  2017. }
  2018. // 建设项目节点
  2019. let constructionProjectEle = null;
  2020. /*
  2021. * 加载数据,分两种数据类型
  2022. * 1.建设项目
  2023. * 2.建设项目下单位工程
  2024. * @param {Object}项目数据
  2025. * @return {Array}
  2026. * */
  2027. async function loadData(projectData) {
  2028. // 标记自检提示的开始(一次性多出多个文件类型,会导出多次)
  2029. _failList.push(_config.HINT_START);
  2030. // 提取出的数据
  2031. const extractData = [];
  2032. // 建设项目部分
  2033. constructionProjectEle = await loadConstructionProject(projectData);
  2034. extractData.push({
  2035. data: constructionProjectEle,
  2036. dataType: DATA_TYPE.project,
  2037. exportKind,
  2038. fileName: 'Project.xml'
  2039. });
  2040. // 单位工程部分
  2041. // 提取出单位工程级别的项目数据
  2042. const tenderData = projectData.children.reduce((acc, cur) => {
  2043. if (Array.isArray(cur.children)) {
  2044. acc.push(...cur.children)
  2045. }
  2046. return acc;
  2047. }, []);
  2048. // 获取单位工程详细结构
  2049. const isPlainTender = false;
  2050. const tenders = await loadTenders(projectData.summaryInfo, tenderData, isPlainTender);
  2051. tenders.forEach(tender => {
  2052. // 单位工程文件名为@_单位工程编码_单位工程名称.xml
  2053. // 因为单位工程编码后续用户可能会改变,这里暂时将fileName设置成单位工程名称.xml
  2054. const name = tender.attrs.find(attr => attr.name === 'Name');
  2055. extractData.push({
  2056. data: tender,
  2057. dataType: DATA_TYPE.tender,
  2058. exportKind,
  2059. fileName: `${name}.xml`
  2060. })
  2061. });
  2062. return extractData;
  2063. }
  2064. /*
  2065. * 加载建设项目
  2066. * @param {Object}项目数据
  2067. * @return {Array}
  2068. * */
  2069. async function loadConstructionProject(projectData) {
  2070. const summaryInfo = projectData.summaryInfo[projectData.ID];
  2071. // 建设项目
  2072. const constructionProject = new ConstructionProject(projectData);
  2073. // 系统信息
  2074. const systemInfo = new SystemInfo({
  2075. // 软件相关信息进行base64编码
  2076. ID1: Base64.encode(projectData.softInfo),
  2077. ID2: _util.generateHardwareId(),
  2078. makeDate: moment(Date.now()).format('YYYY-MM-DDTHH:mm:ss'),
  2079. });
  2080. // 工程信息
  2081. const constructionInfo = loadConstructionInfo(projectData);
  2082. // 费用汇总
  2083. const summaryCost = new SummaryOfCost(summaryInfo);
  2084. // 建筑安装工程费
  2085. const projectInstall = new ProjectInstallationWorkCost(projectData, summaryInfo);
  2086. // 单项工程
  2087. const sectionalWorks = await loadEngineering(summaryInfo, projectData.children);
  2088. projectInstall.children.push(...sectionalWorks);
  2089. constructionProject.children.push(
  2090. systemInfo,
  2091. constructionInfo,
  2092. summaryCost,
  2093. projectInstall
  2094. );
  2095. return constructionProject;
  2096. }
  2097. // 加载工程信息相关元素
  2098. function loadConstructionInfo(projectData) {
  2099. const basicInformation = projectData.property.basicInformation;
  2100. const summaryInfo = projectData.summaryInfo[projectData.ID];
  2101. // 工程信息
  2102. const constructionInfo = new ConstructionInfo();
  2103. // 费用精度
  2104. const option = new Option();
  2105. // 估(概、预、结)算信息
  2106. const projectInfo = new ProjectInfo(basicInformation, summaryInfo);
  2107. let exportInfo;
  2108. if (exportKind === _config.EXPORT_KIND.Tender) {
  2109. // 投标文件输出招标、投标信息
  2110. exportInfo = [
  2111. new TendereeInfo(basicInformation, summaryInfo),
  2112. new BidderInfo(basicInformation, summaryInfo)
  2113. ];
  2114. } else {
  2115. // 招标或控制价文件只输出招标信息
  2116. exportInfo = [new TendereeInfo(basicInformation, summaryInfo)];
  2117. }
  2118. constructionInfo.children.push(option, projectInfo, ...exportInfo);
  2119. return constructionInfo;
  2120. }
  2121. /*
  2122. * 加载所有单项工程元素
  2123. * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
  2124. * {Array}engineeringData 所有单项工程项目数据
  2125. * @return {Array}
  2126. * */
  2127. async function loadEngineering(summaryInfoMap, engineeringData) {
  2128. const isPlainTender = true;
  2129. const engineeringTasks = engineeringData.map(async engData => {
  2130. const summaryInfo = summaryInfoMap[engData.ID];
  2131. // 单项工程
  2132. const sectionalWork = new SectionWorks({
  2133. name: engData.name,
  2134. total: summaryInfo.engineeringCost,
  2135. rate: summaryInfo.rate,
  2136. });
  2137. // 费用汇总
  2138. const summaryCost = new SummaryOfCost(summaryInfo);
  2139. // 简单结构的单位工程
  2140. const tenders = await loadTenders(summaryInfoMap, engData.children, isPlainTender);
  2141. sectionalWork.push(summaryCost, ...tenders);
  2142. return sectionalWork;
  2143. });
  2144. return await Promise.all(engineeringTasks);
  2145. }
  2146. /*
  2147. * 加载所有单位工程元素
  2148. * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
  2149. * {Array}tenderData 所有单项工程项目数据
  2150. * {Boolean}isPlain 是否简单结构(简单结构只含有UnitWorks,其下不含子元素)
  2151. * @return {Array}
  2152. * */
  2153. let tenderDetail = null;
  2154. async function loadTenders(summaryInfoMap, tenderData, isPlain) {
  2155. const tenderTasks = tenderData.map(async tData => {
  2156. const summaryInfo = summaryInfoMap[tData.ID];
  2157. // 单位工程
  2158. const unitWork = new UnitWorks(projectData, tData, summaryInfo);
  2159. // 简单结构,不需要继续添加子元素
  2160. if (isPlain) {
  2161. return unitWork;
  2162. }
  2163. // 不是简单结构,继续添加各种子元素
  2164. // 需要请求项目详细数据的时候,间隔一段时间再初始单位工程数据,减少服务器压力
  2165. const tenderDetailMap = _cache.getItem('tenderDetailMap');
  2166. if (!tenderDetailMap[tData.ID]) {
  2167. await _util.setTimeoutSync(() => { }, _config.TIMEOUT_TIME);
  2168. }
  2169. // 方便用户看错误来自哪个单位工程
  2170. _failList.push(`<span style="font-weight: bold">单位工程“${tData.name}”下:</span>`);
  2171. const orgLen = _failList.length;
  2172. // 先计算人材机总消耗量,以供后面需要
  2173. gljUtil.calcProjectGLJQuantity(tenderDetail.projectGLJ.datas,
  2174. tenderDetail.ration_glj.datas, tenderDetail.Ration.datas, tenderDetail.Bills.datas, Decimal.GLJ, _, scMathUtil);
  2175. // 工程特征信息
  2176. const attrInfo = loadAttrInfo(tData.property.projectFeature);
  2177. // 基本信息
  2178. const addiInfo = loadAddiInfo(projectData.property.basicInformation);
  2179. // 费用汇总
  2180. const summaryOfCost = new SummaryOfCost(summaryInfo);
  2181. // 获取单位工程详细数据
  2182. tenderDetail = await _util.getTenderDetail(tData.ID, userID);
  2183. // 单位工程费用汇总
  2184. const unitWorksSummary = loadUnitWorksSummary(tenderDetail);
  2185. // 分部分项工程
  2186. const divisionalElements = loadDivisionalAndElementalWorks();
  2187. // 措施项目
  2188. const preliminaries = loadPreliminaries();
  2189. // 其他项目
  2190. const sundry = loadSundry();
  2191. // 规费
  2192. const statutoryFees = new StatutoryFees();
  2193. // 税金
  2194. const tax = loadTax();
  2195. // 人材机汇总
  2196. const gljSummary = loadGLJSummary();
  2197. // 评标材料
  2198. const bidEvaluations = loadBidEvaluation();
  2199. // 人材机汇总和评标材料需要汇总到建设项目
  2200. const projectInstallationWorkCost = constructionProjectEle.children.find(ele => ele.name === 'ProjectInstallationWorkCost');
  2201. projectInstallationWorkCost.children.push(...gljSummary, ...bidEvaluations);
  2202. unitWork.children.push(
  2203. attrInfo,
  2204. addiInfo,
  2205. summaryOfCost,
  2206. unitWorksSummary,
  2207. divisionalElements,
  2208. preliminaries,
  2209. sundry,
  2210. statutoryFees,
  2211. tax,
  2212. ...gljSummary,
  2213. ...bidEvaluations
  2214. );
  2215. // 只有方便用户看错误来自哪个单位工程的提示,说明该单位工程没有报错
  2216. if (_failList.length === orgLen) {
  2217. _failList.pop();
  2218. }
  2219. });
  2220. return await Promise.all(tenderTasks);
  2221. }
  2222. // 加载工程特征信息
  2223. // attrList 单位工程的工程特征,来自property.projectFeature
  2224. function loadAttrInfo(attrList) {
  2225. const attrInfo = new Info('AttrInfo');
  2226. // 有值的才输出
  2227. attrInfo.children = attrList
  2228. .filter(attr => commonUtil.isDef(attr.value))
  2229. .map(attr => new InfoItem('AttrInfoItem', attr));
  2230. return attrInfo;
  2231. }
  2232. // 加载补充信息(基本信息所有条目)
  2233. function loadAddiInfo(infoList) {
  2234. const addiInfo = new Info('AddiInfo');
  2235. addiInfo.children = infoList.map(rootInfoItem => {
  2236. const rootInfo = new InfoItem('AddiInfoItem', rootInfoItem);
  2237. rootInfo.children = rootInfoItem.items.map(infoItem => new InfoItem('AddiInfoItem', infoItem));
  2238. return rootInfo;
  2239. });
  2240. }
  2241. // 加载单位工程费用汇总
  2242. // tenderDetail 单位工程详细数据
  2243. function loadUnitWorksSummary() {
  2244. const unitWorksSummary = new UnitWorksSummary();
  2245. // 读取单位工程中的固定类别为“分部分项工程”、“措施项目”、“其他项目”的大项费用
  2246. // 分部分项
  2247. const fbfx = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.SUB_ENGINERRING);
  2248. const fbfxGroup = new UnitWorksSummaryGroup(fbfx.data);
  2249. // 分部分项工程的子项,取项目名称的首字母拼接
  2250. const fbfxChildren = fbfx.children.map(node => new UnitWorksSummaryItem(node));
  2251. fbfxGroup.children.push(...fbfxChildren);
  2252. // 措施项目
  2253. const csxm = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.MEASURE);
  2254. const csxmGroup = new UnitWorksSummaryGroup(csxm.data);
  2255. // 措施项目的子项,“绿色施工安全防护措施费”、“其他措施费”
  2256. const csxmChildren = csxm.getPosterity()
  2257. .filter(node => [fixedFlag.GREEN_MEASURE_FEE, fixedFlag.OTHER_MEASURE_FEE].includes(node.getFlag()))
  2258. .map(node => new UnitWorksSummaryItem(node));
  2259. csxmGroup.children.push(...csxmChildren);
  2260. // 其他项目
  2261. const other = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.OTHER);
  2262. const otherGroup = new UnitWorksSummaryGroup(other.data);
  2263. // 其他项目子项,暂列金额;暂估价;材料(工程设备)暂估价;专业工程暂估价;计日工;总承包服务费;预算包干费;工程优质费;概算幅度差;索赔费用;现场签证费用;其他费用
  2264. const otherChildrenFlags = [
  2265. fixedFlag.PROVISIONAL,
  2266. fixedFlag.ESTIMATE,
  2267. fixedFlag.MATERIAL_PROVISIONAL,
  2268. fixedFlag.ENGINEERING_ESITIMATE,
  2269. fixedFlag.DAYWORK,
  2270. fixedFlag.TURN_KEY_CONTRACT,
  2271. fixedFlag.BUDGET_INCLUDE_WORK_FEE,
  2272. fixedFlag.PROJECT_HIGH_QUALITY_FEE,
  2273. fixedFlag.BUDGET_ESTIMATE_DIFF,
  2274. fixedFlag.CLAIM,
  2275. fixedFlag.VISA,
  2276. fixedFlag.OTHER_FEE
  2277. ];
  2278. const otherChildren = other.getPosterity()
  2279. .filter(node => otherChildrenFlags.includes(node.getFlag()))
  2280. .map(node => new UnitWorksSummaryItem(node));
  2281. otherGroup.chilren.push(...otherChildren);
  2282. // 除固定类别为“分部分项工程”、“措施项目”、“其他项目”以外的大项费用,通常无子项,所以显示到Item中。(即使造价书有子项,也显示到Item中,不再列出其子项数据)
  2283. const flags = [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE, fixedFlag.OTEHER];
  2284. const otherRoots = tenderDetail.mainTree.roots
  2285. .filter(node => !flags.includes(node.getFlag()))
  2286. .map(node => new UnitWorksSummaryItem(node));
  2287. unitWorksSummary.children.push(fbfxGroup, csxmGroup, otherGroup, ...otherRoots);
  2288. return unitWorksSummary;
  2289. }
  2290. // 加载分部分项工程
  2291. function loadDivisionalAndElementalWorks() {
  2292. const division = new DivisionalAndElementalWorks();
  2293. const subEngineering = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.SUB_ENGINERRING);
  2294. // 合计费用
  2295. const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, subEngineering.data);
  2296. // 分部、分项
  2297. const fbfx = loadFBFX(subEngineering.children, BillsKind.FBFX);
  2298. division.children.push(summaryCost, ...fbfx);
  2299. return division;
  2300. }
  2301. // 加载措施项目
  2302. function loadPreliminaries() {
  2303. const preliminaries = new Preliminaries();
  2304. const measure = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.MEASURE);
  2305. // 合计费用
  2306. const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, measure.data);
  2307. // 分部、分项
  2308. const fbfx = loadFBFX(measure.children, BillsKind.MEASURE);
  2309. preliminaries.children.push(summaryCost, ...fbfx);
  2310. return preliminaries;
  2311. }
  2312. // 加载分部分项清单,这部分是分部分项工程和措施项目共用的
  2313. function loadFBFX(nodes, kind) {
  2314. return nodes.map(node => {
  2315. let ele;
  2316. // 有子清单的是分部
  2317. if (node.source.children.length) {
  2318. ele = new DivisionalWorks(node.data);
  2319. // 递归获取子元素
  2320. ele.children = loadFBFX(node.source.children);
  2321. } else { // 无子清单的是分项
  2322. ele = loadBills(node.data, kind, specialty);
  2323. }
  2324. return ele;
  2325. });
  2326. }
  2327. // 加载清单
  2328. function loadBills(node, kind) {
  2329. const specialty = Specialty[tenderDetail.property.engineeringName]; // 工程专业
  2330. const workElement = new WorkElement(node, kind, specialty);
  2331. // 合计费用
  2332. const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, node.data);
  2333. workElement.children.push(summaryCost);
  2334. // 工程量计算表
  2335. const expressElement = loadQuantityExpressions(tenderDetail.quantity_detail.datas, true, node.data.ID);
  2336. workElement.children.push(...expressElement);
  2337. // 相同工作内容的定额进行分组
  2338. const workMap = _.groupBy(node.children, node => node.data.jobContentText || '');
  2339. const workContents = Object.entries(workMap).map(([contentText, rationNodes]) => {
  2340. const workContent = new WorkContent(contentText, _util.getAggregateFee(rationNodes));
  2341. workContent.children = rationNodes.map(node => loadRation(node, kind, specialty));
  2342. });
  2343. workElement.children.push(...workContents);
  2344. return workElement
  2345. }
  2346. // 加载工程量计算表
  2347. function loadQuantityExpressions(quantityDetails, isBills, ID) {
  2348. if (quantityDetails.length) {
  2349. return [];
  2350. }
  2351. quantityDetails.sort((a, b) => a.seq - b.seq);
  2352. const key = isBills ? 'billID' : 'rationID';
  2353. return quantityDetails
  2354. .filter(quantityDetail => quantityDetail[key] === ID)
  2355. .map(quantityDetail => new ExpressElement(quantityDetail));
  2356. }
  2357. // 获取定额的定额库编码
  2358. function getLibCode(ration, rationLibs) {
  2359. const theLib = rationLibs.find(lib => lib.id === ration.libID);
  2360. return theLib ? theLib.libCode : '';
  2361. }
  2362. // 加载定额
  2363. function loadRation(node, kind, specialty) {
  2364. // 定额
  2365. const libCode = getLibCode(node.data, tenderDetail.projectInfo.engineeringInfo.ration_lib);
  2366. const norm = new Norm(node.data, libCode, kind, specialty);
  2367. // 工程量计算表
  2368. const expressElement = loadQuantityExpressions(tenderDetail.quantity_detail.datas, false, node.data.ID);
  2369. if (expressElement.length) {
  2370. norm.children.push(...expressElement);
  2371. }
  2372. // 触发计算程序计算,否则定额calcTemplate数据必为空
  2373. calcProgramObj.refreshCalcProgram(node, 4);
  2374. // 子目管理费
  2375. const manageFees = new ManageFees(node.data.calcTemplate);
  2376. norm.children.push(manageFees);
  2377. // 定额人材机含量明细
  2378. let rationGLJs = tenderDetail.ration_glj.datas.filter(rGLJ => rGLJ.rationID === node.data.ID);
  2379. rationGLJs = gljUtil.sortRationGLJ(rationGLJs); // 定额人材机排序
  2380. const rationGLJElements = rationGLJs
  2381. .filter(rGLJ => {
  2382. // 总消耗量为0的,不输出
  2383. const totalQuantity = gljUtil.getTotalQuantity(rGLJ, node.data, Decimal.GLJ, Decimal.QUANTITY);
  2384. const parsedTotalQuantity = parseFloat(totalQuantity);
  2385. return parsedTotalQuantity;
  2386. })
  2387. .map(rGLJ => new LabourMaterialsEquipmentsMachinesElement(rGLJ));
  2388. norm.children.push(...rationGLJElements);
  2389. // 子目单价计算(定额计算程序)
  2390. if (node.data.calcTemplate) {
  2391. const unitPriceCalculationOfItems = node.data.calcTemplate.calcItems.map(item => new UnitPriceCalculationOfItem(item));
  2392. norm.children.push(...unitPriceCalculationOfItems);
  2393. }
  2394. return norm;
  2395. }
  2396. // 递归加载标题和子目
  2397. function loadGroupAndItems(nodes, groupFactory, itemFactory) {
  2398. return nodes.map(node => {
  2399. let ele;
  2400. // 有子清单的是标题
  2401. if (node.source.children.length) {
  2402. ele = groupFactory(node);
  2403. // 递归获取子元素
  2404. ele.children = loadGroupAndItems(node.source.children, groupFactory, itemFactory);
  2405. } else { // 无子清单的是分项
  2406. ele = itemFactory(node);
  2407. }
  2408. return ele;
  2409. });
  2410. }
  2411. // 加载其他项目
  2412. function loadSundry() {
  2413. // 加载材料设备暂估价明细
  2414. // 业务上这个清单是使用清单基数计算得来,所以此部分读取整个单位工程下打勾暂估的材料。is_evaluate = 1
  2415. function loadProvisionalMaterialDetail() {
  2416. return gljList
  2417. .filter(glj => glj.is_evaluate)
  2418. .map(glj => {
  2419. const price = gljUtil.getGLJPrice(glj, tenderDetail.projectGLJ.datas, // 价格信息
  2420. tenderDetail.projectInfo.property.calcOptions, tenderDetail.labourCoe.datas, tenderDetail.projectInfo.property.decimal, false, _, scMathUtil);
  2421. return new ProvisionalMaterialEquipmentItem(glj, price);
  2422. });
  2423. }
  2424. const sundry = new Sundry();
  2425. // 其他项目费
  2426. const other = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.OTEHER);
  2427. const sundryCosts = new SundryItem('SundryCosts', other.data);
  2428. sundryCosts.children = loadGroupAndItems(
  2429. other.children,
  2430. (node) => new SundryCostsGroup(node),
  2431. (node) => new SundryCostsItem(node)
  2432. );
  2433. // 暂列金额
  2434. const provisional = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.PROVISIONAL);
  2435. const provisionalSums = new SundryItem('ProvisionalSums', provisional.data);
  2436. provisionalSums.children = loadGroupAndItems(
  2437. provisional.children,
  2438. (node) => new ProvisionalSumsGroup(node),
  2439. (node) => new ProvisionalSumsItem(node)
  2440. );
  2441. // 材料设备暂估价
  2442. const provisionalMaterial = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.MATERIAL_PROVISIONAL);
  2443. const provisionalMaterialEle = new SundryItem('ProvisionalMaterialEquipment', provisionalMaterial.data);
  2444. provisionalMaterialEle.children = loadProvisionalMaterialDetail();
  2445. // 专业工程暂估价
  2446. const specialtyProvisionalNode = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.ENGINEERING_ESITIMATE);
  2447. const specialtyProvisional = new SundryItem('SpecialtyProvisionalPrice', specialtyProvisionalNode.data);
  2448. specialtyProvisional.children = loadGroupAndItems(
  2449. specialtyProvisionalNode.children,
  2450. (node) => new SpecialtyProvisionalPriceGroup(node),
  2451. (node) => new SpecialtyProvisionalPriceItem(node)
  2452. );
  2453. // 计日工
  2454. const daywork = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.DAYWORK);
  2455. const dayworkRate = new SundryItem('DayWorkRate', daywork.data);
  2456. // 计日工最多只能有两层子项
  2457. const isValidDepth = _util.validDepth(2, daywork);
  2458. if (!isValidDepth) {
  2459. _failList.push('计日工子项超过两层')
  2460. } else {
  2461. dayworkRate.children = loadGroupAndItems(
  2462. daywork.children,
  2463. (node) => new DayWorkRateGroup(node),
  2464. (node) => new DayWorkRateItem(node)
  2465. );
  2466. }
  2467. // 总承包服务费
  2468. const turnKeyContract = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.TURN_KEY_CONTRACT);
  2469. const mainContractorAttendance = new SundryItem('MainContractorAttendance', turnKeyContract.data);
  2470. mainContractorAttendance.children = loadGroupAndItems(
  2471. turnKeyContract.children,
  2472. (node) => new MainContractorAttendanceGroup(node),
  2473. (node) => new MainContractorAttendanceItem(node)
  2474. );
  2475. // 索赔费用
  2476. const claim = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.CLAIM);
  2477. const claimsCost = new SundryItem('ClaimsCost', claim.data);
  2478. claimsCost.children = loadGroupAndItems(
  2479. claim.children,
  2480. (node) => new ClaimVisaCostGroup('ClaimsCostGroup', node),
  2481. (node) => new ClaimVisaCostItem('ClaimsCostItem', node)
  2482. );
  2483. // 签证费用
  2484. const visa = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.VISA);
  2485. const siteInstructionCost = new SundryItem('SiteInstructionCost', visa.data);
  2486. siteInstructionCost.children = loadGroupAndItems(
  2487. visa.children,
  2488. (node) => new ClaimVisaCostGroup('SiteInstructionCostGroup', node),
  2489. (node) => new ClaimVisaCostItem('SiteInstructionCostItem', node)
  2490. );
  2491. sundry.children.push(sundryCosts, provisionalSums, specialtyProvisional, dayworkRate, mainContractorAttendance, claimsCost, siteInstructionCost);
  2492. return sundry;
  2493. }
  2494. // 加载税金
  2495. function loadTax() {
  2496. const tax = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.TAX);
  2497. const taxEle = new Tax('Tax', tax);
  2498. // 加载税金子项,若无税金子项,税金本身也作为子项
  2499. const taxChildren = tax.source.children.length ? tax.source.children : [tax];
  2500. taxEle.children = taxChildren.map(taxItem => new Tax('TaxItem', taxItem));
  2501. return tax;
  2502. }
  2503. // 加载人材机汇总
  2504. function loadGLJSummary() {
  2505. // 所有人材机
  2506. const gljList = gljUtil.sortRationGLJ(tenderDetail.projectGLJ.datas.gljList); // 汇总排序
  2507. const contractorList = tenderDetail.contractor_list.datas;
  2508. const decimalObj = tenderDetail.projectInfo.property.decimal;
  2509. // 总承包人造价信息差额调整法数据
  2510. const infoDatas = materialAdjustObj.getPirceInfoDatas(gljList, contractorList, decimalObj)
  2511. // 总承包人价格指数调整法数据
  2512. const engineeringCostNode = tenderDetail.Bills.tree.roots.find(node => node.getFlag() === fixedFlag.ENGINEERINGCOST);
  2513. const ecTotalFee = _util.getFee(engineeringCostNode.data.fees, 'common.totalFee');
  2514. const coeDatas = materialAdjustObj.getPriceCoeDatas(gljList, contractorList, ecTotalFee, decimalObj);
  2515. return gljList.map(glj => {
  2516. // 人材机
  2517. const price = gljUtil.getGLJPrice(glj, tenderDetail.projectGLJ.datas, // 价格信息
  2518. tenderDetail.projectInfo.property.calcOptions, tenderDetail.labourCoe.datas, tenderDetail.projectInfo.property.decimal, false, _, scMathUtil);
  2519. // 人材机对应的造价信息差额数据
  2520. const infoData = infoDatas.find(item => item.projectGLJID === glj.id);
  2521. // 人材机对应的价格指数数据
  2522. const coeData = coeDatas.find(item => item.projectGLJID === glj.id);
  2523. const gljEle = new LabourMaterialsEquipmentsMachinesSummary(glj, price, infoData, coeData);
  2524. // 人材机组成物
  2525. const connectKey = gljUtil.getIndex(glj, gljKeyArray);
  2526. const ratios = tenderDetail.projectGLJ.datas.mixRatioMap[connectKey] || [];
  2527. gljEle.children = ratios.map(ratio => new LabourMaterialsEquipmentsMachinesElement(ratio));
  2528. return gljEle;
  2529. });
  2530. }
  2531. // 加载评标材料
  2532. function loadBidEvaluation() {
  2533. const gljList = tenderDetail.projectGLJ.datas.gljList;
  2534. const bidEvaluationSrc = tenderDetail.projectObj.project.bid_evaluation_list.datas;
  2535. const decimalObj = tenderDetail.projectInfo.property.decimal;
  2536. const bidEvaluationList = configMaterialObj.getBidMaterialDatas(gljList, bidEvaluationSrc, decimalObj);
  2537. return bidEvaluationList.map(glj => {
  2538. const projectGLJ = gljList.find(pGLJ => pGLJ.id === glj.projectGLJID);
  2539. if (projectGLJ) {
  2540. glj.delivery = projectGLJ.delivery;
  2541. glj.delivery_address = projectGLJ.delivery_address;
  2542. glj.originPlace = projectGLJ.originPlace;
  2543. glj.vender = projectGLJ.vender;
  2544. glj.qualityGrace = projectGLJ.qualityGrace;
  2545. }
  2546. return new BidEvaluationMainMaterial(glj);
  2547. });
  2548. }
  2549. }
  2550. /*
  2551. * 重置工程编号,广东18 3.0的接口,导出时的文件会用到这个编号
  2552. * 因此重置工程编号后,还需要重置文件名数据
  2553. * @param {Array}codes 工程编号
  2554. * {Array}extractData 提取的数据
  2555. * @return {void}
  2556. * */
  2557. function resetContentCode(codes, extractData) {
  2558. // 提取到的数据分两种类型:
  2559. // 1.根元素为建设项目:需要修改建设项目下的单位工程元素的编码和文件名
  2560. // 2.根元素为单位工程:需要修改单位工程的编码和文件名
  2561. // 获取建设项目数据下的单位工程元素
  2562. const ExtractProjects = extractData.filter(data => data.dataType === DATA_TYPE.project);
  2563. const tenders = ExtractProjects.map(extractP => {
  2564. // 建设项目元素下建筑安装工程费元素
  2565. const projectInstallations = _util.getElementFromSrc(extractP.data, 'ProjectInstallationWorkCost');
  2566. // 建筑安装工程费元素下单项工程元素
  2567. const sectionalWorks = projectInstallations.reduce((acc, cur) => {
  2568. const sections = _util.getElementFromSrc(cur, 'SectionalWorks');
  2569. acc.push(...sections);
  2570. }, []);
  2571. // 单项工程元素下单位工程元素
  2572. return sectionalWorks.reduce((acc, cur) => {
  2573. const tenders = _util.getElementFromSrc(cur, 'UnitWorks');
  2574. acc.push(...tenders);
  2575. }, []);
  2576. });
  2577. // 重置编号
  2578. let idx = 0;
  2579. for (let tender of tenders) {
  2580. let codeItem = tender.attrs.find(attr => attr.name === '编号');
  2581. codeItem.value = codes[idx++];
  2582. }
  2583. }
  2584. })();