exportStandardInterface.js 121 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Zhong
  6. * @date 2019/3/15
  7. * @version
  8. */
  9. /*
  10. * 数据标准接口
  11. * 导出符合标准接口要求的xml
  12. * */
  13. const XMLStandard = (function () {
  14. //费用类别:固定行ID对应
  15. const FEE_TYPE = {
  16. [fixedFlag.SUB_ENGINERRING]: '1100',
  17. [fixedFlag.MEASURE]: '1200',
  18. [fixedFlag.CONSTRUCTION_ORGANIZATION]: '120201',
  19. [fixedFlag.ORGANIZATION]: '120201',
  20. [fixedFlag.SAFETY_CONSTRUCTION]: '1204',
  21. [fixedFlag.PROJECT_COMPLETE_ARCH_FEE]: '10041',
  22. [fixedFlag.HOUSE_QUALITY_ACCEPT_FEE]: '1206',
  23. [fixedFlag.OTHER]: '1300',
  24. [fixedFlag.CHARGE]: '800',
  25. [fixedFlag.TAX]: '900',
  26. [fixedFlag.ADDED_VALUE_TAX]: '9001',
  27. [fixedFlag.ADDITIONAL_TAX]: '9002',
  28. [fixedFlag.ENVIRONMENTAL_PROTECTION_TAX]: '9003',
  29. [fixedFlag.ENGINEERINGCOST]: '1',
  30. 0: '1800', //其他未定义的大项费用
  31. };
  32. //文件类型
  33. const FILE_KIND = {
  34. '1': '投标',
  35. '2': '招标',
  36. '3': '控制价'
  37. };
  38. //固定类别-基数映射
  39. const FlagCalcBaseMap = {
  40. [fixedFlag.SUB_ENGINERRING]: 'FBFXHJ',
  41. [fixedFlag.MEASURE]: 'CSXMHJ',
  42. [fixedFlag.CONSTRUCTION_TECH]: 'JSCSF',
  43. [fixedFlag.CONSTRUCTION_ORGANIZATION]: 'ZZCSF',
  44. [fixedFlag.Other]: 'QTXMHJ',
  45. [fixedFlag.CHARGE]: 'GF',
  46. [fixedFlag.TAX]: 'SJ',
  47. [fixedFlag.PROVISIONAL]: 'ZLJE',
  48. [fixedFlag.ENGINEERING_ESITIMATE]: 'ZYZGJ',
  49. [fixedFlag.DAYWORK]: 'JRG',
  50. [fixedFlag.TURN_KEY_CONTRACT]: 'ZCBFWF',
  51. [fixedFlag.CLAIM_VISA]: 'SPQZ',
  52. '{分部分项工程费}': fixedFlag.SUB_ENGINERRING,
  53. '{措施项目费}': fixedFlag.MEASURE,
  54. '{组织措施项目费}': fixedFlag.CONSTRUCTION_ORGANIZATION,
  55. '{技术措施项目费}': fixedFlag.CONSTRUCTION_TECH,
  56. '{安全文明施工专项费}': fixedFlag.SAFETY_CONSTRUCTION,
  57. '{其他项目费}': fixedFlag.OTHER,
  58. '{规费}': fixedFlag.CHARGE,
  59. '{税金}': fixedFlag.TAX,
  60. '{增值税}': fixedFlag.ADDED_VALUE_TAX,
  61. };
  62. //计算基础表达式映射
  63. const CalcBaseMap = {
  64. '{分部分项工程费}': 'FBFXHJ',
  65. '{措施项目费}': 'CSXMHJ',
  66. '{组织措施项目费}': 'ZZCSF',
  67. '{其他项目费}': 'QTXMHJ',
  68. '{规费}': 'GF',
  69. '{税金}': 'SJ',
  70. '{分部分项定额人工费}': 'RGF',
  71. '{分部分项定额材料费}': 'CLF',
  72. '{分部分项定额施工机具使用费}': 'JXF',
  73. '{分部分项主材费}': 'ZCF',
  74. '{分部分项人工工日}': 'GR',
  75. '{技术措施项目费}': 'JSCSF',
  76. '{技术措施项目定额人工费}': 'JSCS_RGF',
  77. '{技术措施项目定额材料费}': 'JSCS_CLF',
  78. '{技术措施项目定额施工机具使用费}': 'JSCS_JXF',
  79. '{技术措施项目主材费}': 'JSCS_ZCF',
  80. '{技术措施项目人工工日}': 'JSCS_GR',
  81. '{建筑面积}': 'JZMJ',
  82. '{人材机价差}': 'RCJJC',
  83. '{人工价差}': 'RGJC',
  84. '{材料价差}': 'CLJC',
  85. '{施工机具使用费价差}': 'JXJC',
  86. '{甲供人工费}': 'JGRGF',
  87. '{甲供材料费}': 'JGCLF',
  88. '{甲供施工机具使用费}': 'JGJXF',
  89. '{甲供主材费}': 'JGZCF',
  90. '{甲供设备费}': 'JGSBF',
  91. '{分包费}': 'FBF',
  92. '{分包定额人工费}': 'FBRGF',
  93. '{分包定额材料费}': 'FBCLF',
  94. '{分包定额机械费}': 'FBJXF',
  95. '{分包主材费}': 'FBZCF',
  96. '{分包设备费}': 'FBSBF',
  97. '{分包人工工日}': 'FBGR'
  98. };
  99. //计算基础说明映射
  100. const CalcStateMap = {
  101. 'FBFXHJ': '分部分项工程费',
  102. 'CSXMHJ': '措施项目费',
  103. 'ZZCSF': '组织措施项目费',
  104. 'QTXMHJ': '其他项目费',
  105. 'GF': '规费',
  106. 'SJ': '税金',
  107. 'RGF': '分部分项定额人工费',
  108. 'CLF': '分部分项定额材料费',
  109. 'JXF': '分部分项定额施工机具使用费',
  110. 'ZCF': '分部分项主材费',
  111. 'GR': '分部分项人工工日',
  112. 'JSCSF': '技术措施项目费',
  113. 'JSCS_RGF': '技术措施项目定额人工费',
  114. 'JSCS_CLF': '技术措施项目定额材料费',
  115. 'JSCS_JXF': '技术措施项目定额施工机具使用费',
  116. 'JSCS_ZCF': '技术措施项目主材费',
  117. 'JSCS_GR': '技术措施项目人工工日',
  118. 'JZMJ': '建筑面积',
  119. 'RCJJC': '人材机价差',
  120. 'RGJC': '人工价差',
  121. 'CLJC': '材料价差',
  122. 'JXJC': '施工机具使用费价差',
  123. 'JGRGF': '甲供人工费',
  124. 'JGCLF': '甲供材料费',
  125. 'JGJXF': '甲供施工机具使用费',
  126. 'JGZCF': '甲供主材费',
  127. 'JGSBF': '甲供设备费',
  128. 'FBF': '分包费',
  129. 'FBRGF': '分包定额人工费',
  130. 'FBCLF': '分包定额材料费',
  131. 'FBJXF': '分包定额机械费',
  132. 'FBZCF': '分包主材费',
  133. 'FBSBF': '分包设备费',
  134. 'FBGR': '分包人工工日',
  135. };
  136. // 通用设置和工具
  137. let _base = XML_EXPORT_BASE,
  138. _config = _base.CONFIG,
  139. _util = _base.UTIL,
  140. _cache = _base.CACHE;
  141. return function (userID, granularity, exportKind) {
  142. let _failList = _cache.getItem('failList');
  143. //默认导出建设项目
  144. if (!granularity || ![1, 2, 3].includes(granularity)) {
  145. granularity = _config.GRANULARITY.PROJECT;
  146. }
  147. //默认导出投标文件
  148. if (!exportKind || ![1, 2, 3].includes(exportKind)) {
  149. exportKind = _config.EXPORT_KIND.Tender;
  150. }
  151. this.originalDatas = []; //转换后的数据(xml化前的数据结构)
  152. //建设项目定义
  153. //source:来源数据
  154. function Project(source) {
  155. let attrs = [
  156. {name: '项目编号', value: _util.getValueByKey(source.basicInformation, 'projNum'), required: true, minLen: 1, maxLen: 255,
  157. whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  158. {name: '项目名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  159. {name: '建设单位', value: _util.getValueByKey(source.basicInformation, 'constructionUnit'), required: true},
  160. {name: '标准版本号', value: '3.2.2', required: true},
  161. {name: '标准名称', value: '重庆造价软件数据交换标准(清单计价)', required: true,},
  162. {name: '文件类型', value: source.fileKind, required: true, enumeration: ['招标', '投标', '控制价', '结算', '其他']},
  163. {name: '计税方法', value: source.taxType, required: true, enumeration: ['营业税', '一般计税法', '简易计税法']},
  164. ];
  165. //唯一约束
  166. this.constraints = {
  167. engCode: [], //单项工程编号
  168. tenderCode: [], //单位工程编号
  169. };
  170. XML_EXPORT_BASE.Element.call(this, '标段', attrs);
  171. }
  172. //项目信息定义
  173. function ProjectInfo(source) {
  174. let attrs = [
  175. {name: '工程规模', value: _util.getValueByKey(source.basicInformation, 'projectScale'), required: true},
  176. {name: '工程所在地', value: _util.getValueByKey(source.basicInformation, 'projLocation'), required: true},
  177. {name: '工程地址', value: _util.getValueByKey(source.basicInformation, 'projAddress'), required: true},
  178. {name: '施工单位', value: _util.getValueByKey(source.basicInformation, 'buildingUnit')},
  179. {name: '编制单位', value: _util.getValueByKey(source.basicInformation, 'establishUnit'), required: true},
  180. {name: '审核单位', value: _util.getValueByKey(source.basicInformation, 'auditUnit')},
  181. {name: '编制人', value: _util.getValueByKey(source.basicInformation, 'establishUnitAuthor'), required: true},
  182. {name: '审核人', value: _util.getValueByKey(source.basicInformation, 'auditUnitAuditor')},
  183. {name: '开工日期', value: _util.getValueByKey(source.basicInformation, 'commencementDate'), type: _config.TYPE.DATE},
  184. {name: '竣工日期', value: _util.getValueByKey(source.basicInformation, 'completionDate'), type: _config.TYPE.DATE},
  185. {name: '编制日期', value: _util.getValueByKey(source.basicInformation, 'essentialEstablishDate'), type: _config.TYPE.DATE, required: true},
  186. {name: '审核日期', value: _util.getValueByKey(source.basicInformation, 'auditDate'), type: _config.TYPE.DATE},
  187. {name: '材料价格期', value: _util.getValueByKey(source.basicInformation, 'materialPricePeriod'), required: true},
  188. {name: '合同价类型', value: _util.getValueByKey(source.basicInformation, 'contractPriceType')},
  189. ];
  190. XML_EXPORT_BASE.Element.call(this, '项目信息', attrs);
  191. }
  192. //招标信息定义
  193. function BiddingInfo(source) {
  194. //控制总价: 如果文件类型是“控制价”,则导出建设项目的工程造价;如果是“招标”、“投标”,则取0
  195. let attrs = [
  196. {name: '招标代理机构', value: _util.getValueByKey(source.basicInformation, 'agency')},
  197. {name: '造价工程师', value: _util.getValueByKey(source.basicInformation, 'tenderingCostEngineer'), required: true},
  198. {name: '造价工程师注册证号', value: _util.getValueByKey(source.basicInformation, 'tenderingRegistrationCertificateNumber'), required: true},
  199. {name: '招标工期', value: _util.getValueByKey(source.basicInformation, 'tenderingPeriod'), required: true, type: _config.TYPE.INT},
  200. {name: '控制总价', value: exportKind === _config.EXPORT_KIND.Control ? source.summaryInfo.engineeringCost : '0',
  201. required: true, type: _config.TYPE.NUM2},
  202. ];
  203. XML_EXPORT_BASE.Element.call(this, '招标信息', attrs);
  204. }
  205. //投标信息定义
  206. function BidInfo(source) {
  207. let attrs = [
  208. {name: '投标人', value: _util.getValueByKey(source.basicInformation, 'bidder'), required: true},
  209. {name: '造价工程师', value: _util.getValueByKey(source.basicInformation, 'bidCostEngineer'), required: true},
  210. {name: '造价工程师注册证号', value: _util.getValueByKey(source.basicInformation, 'bidRegistrationCertificateNumber'), required: true},
  211. {name: '项目经理', value: _util.getValueByKey(source.basicInformation, 'projectManager')},
  212. {name: '投标工期', value: _util.getValueByKey(source.basicInformation, 'bidPeriod')},
  213. {name: '投标保证金', value: _util.getValueByKey(source.basicInformation, 'biddingMargin'), type: _config.TYPE.NUM2},
  214. {name: '质量承诺', value: _util.getValueByKey(source.basicInformation, 'qualityCommitment')},
  215. {name: '担保类型', value: _util.getValueByKey(source.basicInformation, 'guaranteeType'), enumeration: ['支票', '现金', '电汇', '汇票']},
  216. {name: '投标总价', value: source.summaryInfo.engineeringCost, required: true, type: _config.TYPE.NUM2},
  217. ];
  218. XML_EXPORT_BASE.Element.call(this, '投标信息', attrs);
  219. }
  220. //编制说明定义
  221. function CompilationIllustration(source) {
  222. let attrs = [
  223. {name: '内容', value: source.compilationIllustration, required: true},
  224. ];
  225. XML_EXPORT_BASE.Element.call(this, '编制说明', attrs);
  226. }
  227. //系统信息定义
  228. function SystemInfo(source) {
  229. let attrs = [
  230. {name: 'ID1', value: source.softInfo, required: true},
  231. {name: 'ID2', value: '', required: true},
  232. {name: '生成时间', value: source.generatedTime, type: _config.TYPE.DATE_TIME, required: true},
  233. ];
  234. XML_EXPORT_BASE.Element.call(this, '系统信息', attrs);
  235. }
  236. //费用构成定义
  237. function FeeFrom(summaryInfo) {
  238. let attrs = [
  239. {name: '工程费合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.engineeringCost : '0', required: true, type: _config.TYPE.NUM2},
  240. {name: '分部分项清单合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.subEngineering : '0', required: true, type: _config.TYPE.NUM2},
  241. {name: '措施项目清单合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.measure : '0', required: true, type: _config.TYPE.NUM2},
  242. {name: '安全文明施工专项费', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.safetyConstruction : '0', required: true, type: _config.TYPE.NUM2},
  243. {name: '其他项目清单合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.other : '0', required: true, type: _config.TYPE.NUM2},
  244. {name: '暂列金额合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.provisional : '0', type: _config.TYPE.NUM2},
  245. {name: '材料暂估价合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.materialProvisional : '0', type: _config.TYPE.NUM2},
  246. {name: '专业工程暂估价合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.engineeringEstimate : '0', type: _config.TYPE.NUM2},
  247. {name: '计日工合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.daywork : '0', type: _config.TYPE.NUM2},
  248. {name: '总承包服务费合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.turnKeyContract : '0', type: _config.TYPE.NUM2},
  249. {name: '签证索赔合计', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.claimVisa : '0', type: _config.TYPE.NUM2},
  250. {name: '规费', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.charge : '0', required: true, type: _config.TYPE.NUM2},
  251. {name: '税金', value: exportKind === _config.EXPORT_KIND.Tender ? summaryInfo.tax : '0', required: true, type: _config.TYPE.NUM2},
  252. ];
  253. XML_EXPORT_BASE.Element.call(this, '费用构成', attrs);
  254. }
  255. //单项工程定义
  256. function Engineering(source) {
  257. let attrs = [
  258. {name: '编号', value: '', required: true, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  259. {name: '名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  260. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? source.summaryInfo.engineeringCost : '0', type: _config.TYPE.NUM2},
  261. ];
  262. XML_EXPORT_BASE.Element.call(this, '单项工程', attrs);
  263. }
  264. //单位工程定义
  265. function Tender(source) {
  266. const TAX = {
  267. '1': '一般计税',
  268. '2': '简易计税',
  269. };
  270. let attrs = [
  271. {name: '编号', value: '', required: true, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  272. {name: '名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  273. {name: '专业', value: source.engineeringName, required: true, enumeration: [
  274. '土建工程', '装饰工程', '安装工程', '市政工程', '园林绿化工程',
  275. '仿古建筑工程', '房修工程', '轨道工程', '构筑物工程', '机械(爆破)土石方',
  276. '围墙工程', '幕墙工程', '市政安装工程', '城市轨道交通安装', '人工土石方',
  277. '房屋安装修缮工程', '房屋修缮单拆除'
  278. ]},
  279. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender
  280. ? source.summaryInfo.engineeringCost
  281. : '0', type: _config.TYPE.NUM2},
  282. {name: '定额库编码', value: source.defaultRationLibCode, enumeration: [
  283. 'CQ18TJ', 'CQ18ZS', 'CQ18AZ', 'CQ18SZ', 'CQ18YL', 'CQ18FG', 'CQ18GD', 'CQ18FS',
  284. 'CQ18LS', 'CQ18GZW', 'CQ18BP', 'CQ18ZP'
  285. ]},
  286. {name: '计税方法', value: TAX[source.taxType], required: true, enumeration: ['营业税', '一般计税', '简易计税']},
  287. ];
  288. this.constraints = {
  289. billsCode: [], //清单项目项目编码
  290. formulaMeasureNo: [], //公式计算措施项序号
  291. gljCode: [], //人材机代码
  292. provisionalDetailCode: [], //暂列金额明细编号
  293. engEstimateDetailCode: [], //专业工程暂估明细
  294. turnKeyContractCode: [], //总承包服务费费用项编号
  295. labourDayWorkCode: [], //人工计日工项目编号
  296. materialDayWorkCode: [], //材料计日工项目编号
  297. machineDayWorkCode: [], //机械计日工项目编号
  298. otherItemNo: [], //其他列项序号
  299. feeItemNo: [], //费用项序号
  300. mainBillsCode: [], //主要清单明细项目编码 (标准文件中constraint中没有定义此唯一性,但是主要清单明细的备注那里说明了,这里处理一下)
  301. appraisalDetailCode: [], //评审材料明细代码唯一(标准文件中constraint中没有定义此唯一性,但是评审材料明细的备注里说明了)
  302. };
  303. XML_EXPORT_BASE.Element.call(this, '单位工程', attrs);
  304. }
  305. //工程特征定义
  306. function EngFeature(source) {
  307. let attrs = [
  308. {name: '建筑分类', value: source.feature.buildingClass, required: true},
  309. {name: '工程分类', value: source.feature.projClass, required: true},
  310. {name: '建设规模', value: source.feature.projectScale, required: true},
  311. {name: '工程类别', value: _util.getValueByKey(source.basicInformation, 'projectCategory'), required: true} //取建设项目的工程类别
  312. ];
  313. XML_EXPORT_BASE.Element.call(this, '工程特征', attrs);
  314. }
  315. //特征项定义
  316. function FeatureItem(feature) {
  317. let attrs = [
  318. {name: '编码', value: feature.code},
  319. {name: '名称', value: feature.dispName, required: true},
  320. {name: '内容', value: feature.value, required: true},
  321. ];
  322. XML_EXPORT_BASE.Element.call(this, '特征项', attrs);
  323. }
  324. //工程信息-信息项定义
  325. function InfoItem(info) {
  326. let attrs = [
  327. {name: '编码', value: info.code, required: true},
  328. {name: '内容', value: info.value, required: true},
  329. ];
  330. XML_EXPORT_BASE.Element.call(this, '信息项', attrs);
  331. }
  332. //单位工程费汇总定义
  333. function TenderFeeSummary() {
  334. XML_EXPORT_BASE.Element.call(this, '单位工程费汇总', []);
  335. }
  336. //计价程序费用行定义
  337. function FeeRow(source) {
  338. let attrs = [
  339. {name: '序号', value: source.code},
  340. {name: '行代号', value: source.rowCode, required: true},
  341. {name: '项目名称', value: source.name, required: true},
  342. {name: '计算基础表达式', value: source.calcBase, required: true},
  343. {name: '计算基础说明', value: source.calcBaseState},
  344. {name: '费率', value: exportKind === _config.EXPORT_KIND.Tender ? source.feeRate : '100'},
  345. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', type: _config.TYPE.NUM2},
  346. {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0', type: _config.TYPE.NUM2},
  347. {name: '费用类别', value: source.feeType, type: _config.TYPE.INT, required: true,
  348. enumeration: ['1100', '1200', '1204', '1300', '800', '900', '1800', '1'],
  349. failHint: `第${source.row}行清单-“费用类别”`
  350. },
  351. {name: '备注', value: source.remark},
  352. ];
  353. XML_EXPORT_BASE.Element.call(this, '计价程序费用行', attrs);
  354. }
  355. //分部分项清单
  356. function FBFXBills() {
  357. XML_EXPORT_BASE.Element.call(this, '分部分项清单', []);
  358. }
  359. //清单分部定义
  360. function FBBills(source) {
  361. let attrs = [
  362. {name: '编号', value: source.code, required: true, maxLen: 20,
  363. failHint: `第${source.row}行清单分部-“编码”`},
  364. {name: '名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE,
  365. failHint: `第${source.row}行清单分部-“名称”`},
  366. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', required: true, type: _config.TYPE.NUM2},
  367. {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0', required: true},
  368. {name: '备注', value: source.remark}
  369. ];
  370. XML_EXPORT_BASE.Element.call(this, '清单分部', attrs);
  371. }
  372. //清单项目定义
  373. function FXbills(source) {
  374. let attrs = [
  375. {name: '项目编码', value: source.code, required: true, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE,
  376. failHint: `第${source.row}行清单-“编码”`},
  377. {name: '项目名称', value: source.name, required: true, minLen: 1, maxLen: 500, whiteSpace: _config.WHITE_SPACE.COLLAPSE,
  378. failHint: `第${source.row}行清单-“名称”`},
  379. {name: '单位', value: source.unit, required: true, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE,
  380. failHint: `第${source.row}行清单-“单位”`},
  381. {name: '工程量', value: source.quantity, required: true, type: _config.TYPE.DECIMAL,
  382. failHint: `第${source.row}行清单-“工程量”`},
  383. {name: '综合单价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.unitFee') : '0', required: true,
  384. type: _config.TYPE.DECIMAL},
  385. {name: '综合合价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', required: true,
  386. type: _config.TYPE.NUM2},
  387. {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0', required: true,
  388. type: _config.TYPE.NUM2},
  389. {name: '主要清单标志', value: !!source.mainBills, type: _config.TYPE.BOOL,
  390. failHint: `第${source.row}行清单-“主要清单标志”`},
  391. {name: '暂估清单标志', value: !!source.isEstimate, type: _config.TYPE.BOOL,
  392. failHint: `第${source.row}行清单-“暂估清单标志”`},
  393. {name: '最高限价', value: exportKind === _config.EXPORT_KIND.Control ? source.maxPrice : '0', type: _config.TYPE.NUM2,
  394. failHint: `第${source.row}行清单-“最高限价”`},
  395. {name: '备注', value: source.remark},
  396. ];
  397. XML_EXPORT_BASE.Element.call(this, '清单项目', attrs);
  398. }
  399. //项目特征定义
  400. function ItemCharacter() {
  401. XML_EXPORT_BASE.Element.call(this, '项目特征', []);
  402. }
  403. //特征定义
  404. function Feature(source) {
  405. let attrs = [
  406. {name: '特征名称', value: source.name, required: true},
  407. {name: '特征描述', value: source.value, required: true},
  408. ];
  409. XML_EXPORT_BASE.Element.call(this, '特征', attrs);
  410. }
  411. //工程内容定义
  412. function JobContent() {
  413. XML_EXPORT_BASE.Element.call(this, '工程内容', []);
  414. }
  415. //内容定义
  416. function Content(content) {
  417. let attrs = [
  418. {name: '内容', value: content, required: true}
  419. ];
  420. XML_EXPORT_BASE.Element.call(this, '内容', attrs);
  421. }
  422. //组价内容定义
  423. function PriceContent() {
  424. XML_EXPORT_BASE.Element.call(this, '组价内容', []);
  425. }
  426. //定额子目定义
  427. function Ration(source) {
  428. let attrs = [
  429. {name: '定额编号', value: source.viewCode, required: true, minLen: 1, maxLen: 80, whiteSpace: _config.WHITE_SPACE.COLLAPSE,
  430. failHint: `第${source.row}行定额-“编码”`},
  431. {name: '项目名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE,
  432. failHint: `第${source.row}行定额-“名称”`},
  433. {name: '单位', value: source.unit, required: true, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE,
  434. failHint: `第${source.row}行定额-“单位”`},
  435. {name: '定额库编码', value: source.libCode, required: true},
  436. {name: '原始定额编号', value: source.code, minLen: 1, maxLen: 80, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  437. {name: '子目类型', value: source.subType, required: true, type: _config.TYPE.INT, enumeration: ['0', '1', '2', '3', '4', '5', '6']},
  438. {name: '工程量', value: source.quantity, required: true, type: _config.TYPE.DECIMAL,
  439. failHint: `第${source.row}行定额-“工程量”`},
  440. {name: '工程量计算式', value: source.quantityEXP},
  441. {name: '定额单价', value: _util.getFee(source.fees, 'rationUnitPrice.unitFee'), required: true, type: _config.TYPE.DECIMAL},
  442. {name: '定额合价', value: _util.getFee(source.fees, 'rationUnitPrice.totalFee'), required: true, type: _config.TYPE.NUM2},
  443. {name: '综合单价', value: _util.getFee(source.fees, 'common.unitFee'), required: true, type: _config.TYPE.DECIMAL},
  444. {name: '综合合价', value: _util.getFee(source.fees, 'common.totalFee'), required: true, type: _config.TYPE.NUM2},
  445. {name: '单价构成文件ID', value: source.programID, required: true, type: _config.TYPE.INT},
  446. {name: '分包标志', value: !!source.isSubcontract, type: _config.TYPE.BOOL,
  447. failHint: `第${source.row}行定额-“分包标志”`},
  448. {name: '备注', value: source.remark}
  449. ];
  450. XML_EXPORT_BASE.Element.call(this, '定额子目', attrs);
  451. }
  452. //工料分析定义
  453. function GljAnalyze() {
  454. XML_EXPORT_BASE.Element.call(this, '工料分析', []);
  455. }
  456. //人材机含量定义
  457. function GljContent(source) {
  458. let attrs = [
  459. {name: '人材机代码', value: source.code, required: true, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  460. {name: '消耗量', value: source.quantity, required: true, type: _config.TYPE.DECIMAL},
  461. {name: '数量', value: source.totalQuantity, required: true, type: _config.TYPE.DECIMAL},
  462. {name: '数量计算方式', value: 1, required: true, type: _config.TYPE.INT, enumeration: ['1', '2']},
  463. ];
  464. XML_EXPORT_BASE.Element.call(this, '人材机含量', attrs);
  465. }
  466. //费用组成
  467. function FeeContent(source) {
  468. let attrs = [
  469. {name: '基价人工费单价', value: _util.getFee(source.fees, 'labour.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  470. {name: '基价人工费合价', value: _util.getFee(source.fees, 'labour.totalFee'), type: _config.TYPE.NUM2, required: true},
  471. {name: '定额人工基价调整单价', value: 0, type: _config.TYPE.DECIMAL}, //调整价目前只有08有,默认设置成0
  472. {name: '定额人工基价调整合价', value: 0, type: _config.TYPE.NUM2},
  473. {name: '基价材料费单价', value: _util.getFee(source.fees, 'material.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  474. {name: '基价材料费合价', value: _util.getFee(source.fees, 'material.totalFee'), type: _config.TYPE.NUM2, required: true},
  475. {name: '基价机械费单价', value: _util.getFee(source.fees, 'machine.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  476. {name: '基价机械费合价', value: _util.getFee(source.fees, 'machine.totalFee'), type: _config.TYPE.NUM2, required: true},
  477. {name: '定额机上人工基价调整单价', value: 0, type: _config.TYPE.DECIMAL, required: true},
  478. {name: '定额机上人工基价调整合价', value: 0, type: _config.TYPE.NUM2, required: true},
  479. {name: '未计价材料单价', value: _util.getFee(source.fees, 'unratedMaterial.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  480. {name: '未计价材料合价', value: _util.getFee(source.fees, 'unratedMaterial.totalFee'), type: _config.TYPE.NUM2, required: true},
  481. {name: '人材机价差单价', value: scMathUtil.roundForObj(_util.getFee(source.fees, 'labourDiff.unitFee') +
  482. _util.getFee(source.fees, 'materialDiff.unitFee') + _util.getFee(source.fees, 'machineDiff.unitFee'), 2),
  483. type: _config.TYPE.DECIMAL, required: true}, //人材机价差通过人工、材料、机械价差相加得出
  484. {name: '人材机价差合价', value: scMathUtil.roundForObj(_util.getFee(source.fees, 'labourDiff.totalFee') +
  485. _util.getFee(source.fees, 'materialDiff.totalFee') + _util.getFee(source.fees, 'machineDiff.totalFee'), 2),
  486. type: _config.TYPE.NUM2, required: true},
  487. {name: '暂估材料单价', value: _util.getFee(source.fees, 'estimate.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  488. {name: '暂估材料合价', value: _util.getFee(source.fees, 'estimate.totalFee'), type: _config.TYPE.NUM2, required: true},
  489. {name: '管理费单价', value: _util.getFee(source.fees, 'manage.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  490. {name: '管理费合价', value: _util.getFee(source.fees, 'manage.totalFee'), type: _config.TYPE.NUM2, required: true},
  491. {name: '利润单价', value: _util.getFee(source.fees, 'profit.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  492. {name: '利润合价', value: _util.getFee(source.fees, 'profit.totalFee'), type: _config.TYPE.NUM2, required: true},
  493. {name: '风险单价', value: scMathUtil.roundForObj(_util.getFee(source.fees, 'risk.unitFee') + _util.getFee(source.fees, 'otherRisk.unitFee'), 2),
  494. type: _config.TYPE.DECIMAL, required: true}, //一般风险费单价+其他风险费单价
  495. {name: '风险合价', value: scMathUtil.roundForObj(_util.getFee(source.fees, 'risk.totalFee') + _util.getFee(source.fees, 'otherRisk.totalFee'), 2),
  496. type: _config.TYPE.NUM2, required: true},
  497. {name: '一般风险单价', value: _util.getFee(source.fees, 'risk.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  498. {name: '一般风险合价', value: _util.getFee(source.fees, 'risk.totalFee'), type: _config.TYPE.NUM2, required: true},
  499. {name: '其他风险单价', value: _util.getFee(source.fees, 'otherRisk.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  500. {name: '其他风险合价', value: _util.getFee(source.fees, 'otherRisk.totalFee'), type: _config.TYPE.NUM2, required: true},
  501. ];
  502. XML_EXPORT_BASE.Element.call(this, '费用组成', attrs);
  503. }
  504. //措施项目清单定义
  505. function CSXMBills(source) {
  506. let attrs = [
  507. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  508. type: _config.TYPE.NUM2, required: true},
  509. {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0',
  510. type: _config.TYPE.NUM2, required: true},
  511. ];
  512. XML_EXPORT_BASE.Element.call(this, '措施项目清单', attrs);
  513. }
  514. //组织措施清单定义
  515. function ZZCSBills(source) {
  516. let attrs = [
  517. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  518. type: _config.TYPE.NUM2, required: true},
  519. ];
  520. XML_EXPORT_BASE.Element.call(this, '组织措施清单', attrs);
  521. }
  522. //组织措施分类定义
  523. function ZZCSClass(source) {
  524. let attrs = [
  525. {name: '编码', value: source.code, maxLen: 20, required: true,
  526. failHint: `第${source.row}行组织措施清单-“编码”`},
  527. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  528. failHint: `第${source.row}行组织措施清单-“名称”`},
  529. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  530. type: _config.TYPE.NUM2, required: true},
  531. {name: '备注', value: source.remark}
  532. ];
  533. XML_EXPORT_BASE.Element.call(this, '组织措施分类', attrs);
  534. }
  535. //公式计算措施项
  536. function FormulaCalcMeasure(source) {
  537. let attrs = [
  538. {name: '序号', value: source.code, minLen: 1, maxLen:20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  539. failHint: `第${source.row}行清单-“编码”`},
  540. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  541. failHint: `第${source.row}行清单-“名称”`},
  542. {name: '计算基础表达式', value: source.calcBase, required: true},
  543. {name: '计算基础说明', value: source.calcBaseState},
  544. {name: '费率', value: exportKind === _config.EXPORT_KIND.Tender ? source.feeRate : '100', required: true},
  545. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', required: true},
  546. {name: '暂估价标志', value: !!source.isEstimate, type: _config.TYPE.BOOL},
  547. {name: '备注', value: source.remark},
  548. {name: '费用类别', value: source.feeType, enumeration: ['120201', '1204', '10041', '1206'], required: true,
  549. enumerationHint: ['组织措施费', '安全文明施工专项费', '建设工程竣工档案编制费', '住宅工程质量分户验收费'],
  550. failHint: `第${source.row}行清单-“固定费用类别”`},
  551. ];
  552. XML_EXPORT_BASE.Element.call(this, '公式计算措施项', attrs);
  553. }
  554. //技术措施清单定义
  555. function JSCSBills(source) {
  556. let attrs = [
  557. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  558. type: _config.TYPE.NUM2, required: true},
  559. {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0',
  560. type: _config.TYPE.NUM2, required: true},
  561. ];
  562. XML_EXPORT_BASE.Element.call(this, '技术措施清单', attrs);
  563. }
  564. //技术措施分类
  565. function JSCSClass(source) {
  566. let attrs = [
  567. {name: '编号', value: source.code},
  568. {name: '名称', value: source.name, required: true},
  569. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  570. type: _config.TYPE.NUM2, required: true},
  571. {name: '其中暂估价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'estimate.totalFee') : '0',
  572. type: _config.TYPE.DECIMAL, required: true},
  573. ];
  574. XML_EXPORT_BASE.Element.call(this, '技术措施分类', attrs);
  575. }
  576. //其他项目清单定义
  577. function OtherBills() {
  578. XML_EXPORT_BASE.Element.call(this, '其他项目清单', []);
  579. }
  580. //暂列金额定义
  581. function Provisional(source) {
  582. let attrs = [
  583. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', type: _config.TYPE.NUM2}
  584. ];
  585. XML_EXPORT_BASE.Element.call(this, '暂列金额', attrs);
  586. }
  587. //暂列金额明细定义
  588. function ProvisionalDetail(source) {
  589. let attrs = [
  590. {name: '编号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  591. failHint: `第${source.row}行暂列金额清单-“编码”`},
  592. {name: '项目名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  593. failHint: `第${source.row}行暂列金额清单-“名称”`},
  594. {name: '计量单位', value: source.unit, maxLen: 20, required: true,
  595. failHint: `第${source.row}行暂列金额清单-“单位”`},
  596. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  597. type: _config.TYPE.NUM2, required: true},
  598. {name: '备注', value: source.remark, required: true}
  599. ];
  600. XML_EXPORT_BASE.Element.call(this, '暂列金额明细', attrs);
  601. }
  602. //专业工程暂估价定义
  603. function EngEstimate(source) {
  604. let attrs = [
  605. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0'}
  606. ];
  607. XML_EXPORT_BASE.Element.call(this, '专业工程暂估价', attrs);
  608. }
  609. //专业工程暂估明细定义
  610. function EngEstimateDetail(source) {
  611. let attrs = [
  612. {name: '编号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  613. failHint: `第${source.row}行专业工程暂估清单-“编码”`},
  614. {name: '工程名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  615. failHint: `第${source.row}行专业工程暂估清单-“名称”`},
  616. {name: '工程内容', value: source.engineeringContent, maxLen: 2000, required: true,
  617. failHint: `第${source.row}行专业工程暂估清单-“工程内容”`},
  618. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  619. type: _config.TYPE.NUM2, required: true},
  620. {name: '备注', value: source.remark, required: true}
  621. ];
  622. XML_EXPORT_BASE.Element.call(this, '专业工程暂估明细', attrs);
  623. }
  624. //计日工定义
  625. function DayWork(source) {
  626. let attrs = [
  627. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0'}
  628. ];
  629. XML_EXPORT_BASE.Element.call(this, '计日工', attrs);
  630. }
  631. //人工定义
  632. function Labour() {
  633. XML_EXPORT_BASE.Element.call(this, '人工', []);
  634. }
  635. //材料定义
  636. function Material() {
  637. XML_EXPORT_BASE.Element.call(this, '材料', []);
  638. }
  639. //施工机械定义
  640. function Machine() {
  641. XML_EXPORT_BASE.Element.call(this, '施工机械', []);
  642. }
  643. //计日工项目定义
  644. function DayWorkItem(source) {
  645. let attrs = [
  646. {name: '编号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  647. failHint: `第${source.row}行计日工清单-“编码”`},
  648. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  649. failHint: `第${source.row}行计日工清单-“名称”`},
  650. {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  651. failHint: `第${source.row}行计日工清单-“单位”`},
  652. {name: '数量', value: source.quantity, type: _config.TYPE.DECIMAL, required: true},
  653. {name: '综合单价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.unitFee') : '0',
  654. type: _config.TYPE.DECIMAL, required: true},
  655. {name: '综合合价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  656. type: _config.TYPE.NUM2, required: true},
  657. {name: '备注', value: source.remark}
  658. ];
  659. XML_EXPORT_BASE.Element.call(this, '计日工项目', attrs);
  660. }
  661. //总承包服务费定义
  662. function TurnKeyContract(source) {
  663. let attrs = [
  664. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', type: _config.TYPE.NUM2}
  665. ];
  666. XML_EXPORT_BASE.Element.call(this, '总承包服务费', attrs);
  667. }
  668. //总承包服务费分类定义
  669. function TurnKeyContractClass(source) {
  670. let attrs = [
  671. {name:'编号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE,
  672. failHint: `第${source.row}行承包服务费清单-“编码”`},
  673. {name:'名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  674. failHint: `第${source.row}行承包服务费清单-“名称”`},
  675. {name:'备注', value: source.remark}
  676. ];
  677. XML_EXPORT_BASE.Element.call(this, '总承包服务费分类', attrs);
  678. }
  679. //总承包服务费费用项定义
  680. function TurnKeyContractItem(source) {
  681. let attrs = [
  682. {name: '编号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  683. failHint: `第${source.row}行承包服务费清单-“编码”`},
  684. {name: '工程名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  685. failHint: `第${source.row}行承包服务费清单-“名称”`},
  686. {name: '计算基础', value: exportKind === _config.EXPORT_KIND.Tender ? source.calcBaseValue : '', type: _config.TYPE.DECIMAL, required: true},
  687. {name: '服务内容', value: source.serviceContent, maxLen: 255, required: true,
  688. failHint: `第${source.row}行承包服务费清单-“服务内容”`},
  689. {name: '费率', value: exportKind === _config.EXPORT_KIND.Tender ? source.feeRate : '100', type: _config.TYPE.DECIMAL, required: true},
  690. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', type: _config.TYPE.NUM2, required: true},
  691. {name: '备注', value: source.remark}
  692. ];
  693. XML_EXPORT_BASE.Element.call(this, '总承包服务费费用项', attrs);
  694. }
  695. //签证索赔计价汇总费用项
  696. function ClaimVisaFeeItem(source) {
  697. let attrs = [
  698. {name: '编号', value: source.code, required: true},
  699. {name: '项目名称', value: source.name, required: true},
  700. {name: '计量单位', value: source.unit, required: true},
  701. {name: '数量', value: source.quantity, type: _config.TYPE.DECIMAL, required: true},
  702. {name: '单价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.unitFee') : '0',
  703. type: _config.TYPE.DECIMAL, required: true},
  704. {name: '合价', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0',
  705. type: _config.TYPE.NUM2, required: true},
  706. {name: '依据', value: source.claimVisa, required: true},
  707. ];
  708. XML_EXPORT_BASE.Element.call(this, '签证索赔计价汇总费用项', attrs);
  709. }
  710. //其他定义
  711. function Other(source) {
  712. let attrs = [
  713. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? source.commonTotalFee : '0', type: _config.TYPE.NUM2}
  714. ];
  715. XML_EXPORT_BASE.Element.call(this, '其他', attrs);
  716. }
  717. //其他列项定义
  718. function OtherItem(source) {
  719. let attrs = [
  720. {name: '序号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  721. failHint: `第${source.row}行清单-“编码”`},
  722. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  723. failHint: `第${source.row}行清单-“名称”`},
  724. {name: '计算基础', value: exportKind === _config.EXPORT_KIND.Tender ? source.calcBase : '', maxLen: 255,
  725. failHint: `第${source.row}行清单-“计算基础”`},
  726. {name: '费率', value: exportKind === _config.EXPORT_KIND.Tender ? source.feeRate : '100', type: _config.TYPE.DECIMAL},
  727. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? source.commonTotalFee : '0', type: _config.TYPE.NUM2, required: true},
  728. {name: '不计入合价标志', value: source.notSummray, type: _config.TYPE.BOOL},
  729. {name: '招标人标志', value: false, type: _config.TYPE.BOOL},
  730. {name: '备注', value: source.remark, maxLen: 255}
  731. ];
  732. XML_EXPORT_BASE.Element.call(this, '其他列项', attrs);
  733. }
  734. //规费和税金清单定义
  735. function ChargeTaxBills() {
  736. XML_EXPORT_BASE.Element.call(this, '规费和税金清单', []);
  737. }
  738. //费用项定义
  739. function FeeItem(source) {
  740. let attrs = [
  741. {name: '序号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  742. failHint: `第${source.row}行清单-“编号”`},
  743. {name: '行代号', value: source.rowCode, maxLen: 20, required: true},
  744. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  745. failHint: `第${source.row}行清单-“名称”`},
  746. {name: '计算基础表达式', value: exportKind === _config.EXPORT_KIND.Tender ? source.calcBase : '', maxLen: 255, required: true,
  747. failHint: `第${source.row}行清单-“计算基础表达式”`},
  748. {name: '计算基础说明', value: exportKind === _config.EXPORT_KIND.Tender ? source.calcBaseState : '', maxLen: 255},
  749. {name: '费率', value: exportKind === _config.EXPORT_KIND.Tender ? source.feeRate : '100', type: _config.TYPE.DECIMAL, required: true},
  750. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(source.fees, 'common.totalFee') : '0', type: _config.TYPE.NUM2, required: true},
  751. {name: '费用类别', value: source.feeType, enumeration: ['800', '900', '9001', '9002', '9003'], required: true,
  752. enumerationHint: ['规费', '税金', '增值税', '附加税', '环境保护税'],
  753. failHint: `第${source.row}行清单-“固定费用类别”`},
  754. {name: '备注', value: source.remark, maxLen: 255}
  755. ];
  756. XML_EXPORT_BASE.Element.call(this, '费用项', attrs);
  757. }
  758. //承包人材料差额法表
  759. function DifferentiaGlj() {
  760. XML_EXPORT_BASE.Element.call(this, '承包人材料差额法表', []);
  761. }
  762. //承包人材料差额法明细
  763. //如果是“控制价”、“招标”,则不导出;
  764. //如果是“投标”,且采用了信息价差额法,则导出;如果采用了指数法,则导出,但数量、风险系数、基准单价、投标单价,都取0。
  765. function DifferentiaGljDetail(adjustType, source) {
  766. let attrs = [
  767. {name: '关联材料号', value: getGljCode(source.id), minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  768. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  769. {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  770. {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  771. {name: '数量', value: adjustType === _config.ADJUST_TYPE.info ? source.quantity : '0', type: _config.TYPE.DECIMAL, required: true},
  772. {name: '风险系数', value: adjustType === _config.ADJUST_TYPE.info ? source.riskCoe : '0', type: _config.TYPE.DECIMAL, require: true},
  773. {name: '基准单价', value: source.standardPrice, type: _config.TYPE.DECIMAL, require: true},
  774. {name: '投标单价', value: adjustType === _config.ADJUST_TYPE.info ? source.marketPrice : '0', type: _config.TYPE.DECIMAL},
  775. {name: '确认单价', value: '0', type: _config.TYPE.DECIMAL},
  776. {name: '备注', value: source.remark, maxLen: 255,
  777. failHint: `承包人材料${source.code}-“备注”`},
  778. ];
  779. XML_EXPORT_BASE.Element.call(this, '承包人材料差额法明细', attrs);
  780. }
  781. //承包人材料指数法表
  782. function ExponentialGlj(fixedWeight) {
  783. let attrs = [
  784. {name: '定值权重A', value: fixedWeight, required: true, type: _config.TYPE.DECIMAL}
  785. ];
  786. XML_EXPORT_BASE.Element.call(this, '承包人材料指数法表', attrs);
  787. }
  788. //承包人材料指数法明细
  789. //如果是“控制价”、“招标”,则不导出;
  790. //如果是“投标”,且采用了指数法,则导出;如果采用了信息价差额法,则导出,但定值权重A取1,变值权重B、基本价格指数、现行价格指数取0。
  791. function ExponentialGljDetail(adjustType, source) {
  792. let attrs = [
  793. {name: '关联材料号', value: getGljCode(source.id), minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  794. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  795. {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  796. {name: '变值权重B', value: adjustType === _config.ADJUST_TYPE.coe ? source.varWeight : '0', type: _config.TYPE.DECIMAL, required: true},
  797. {name: '基本价格指数', value: adjustType === _config.ADJUST_TYPE.coe ? source.FO : '0', type: _config.TYPE.DECIMAL, require: true},
  798. {name: '现行价格指数', value: adjustType === _config.ADJUST_TYPE.coe ? source.FI : '0', type: _config.TYPE.DECIMAL, require: true},
  799. {name: '备注', value: source.remark, maxLen: 255,
  800. failHint: `承包人材料${source.code}-“备注”`},
  801. ];
  802. XML_EXPORT_BASE.Element.call(this, '承包人材料指数法明细', attrs);
  803. }
  804. //人材机汇总定义
  805. function GljSummary() {
  806. XML_EXPORT_BASE.Element.call(this, '人材机汇总', []);
  807. }
  808. //人材机定义
  809. function Glj(source) {
  810. let attrs = [
  811. {name: '代码', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  812. failHint: `人材机${source.orgCode}-“编码”`},
  813. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  814. failHint: `人材机${source.orgCode}-“名称”`},
  815. {name: '规格', value: source.specs, maxLen: 255,
  816. failHint: `人材机${source.orgCode}-“规格”`},
  817. {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true,
  818. failHint: `人材机${source.orgCode}-“单位”`},
  819. {name: '原始代码', value: source.orgCode, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  820. {name: '费用类别', value: source.feeType, enumeration: ['1', '2', '3', '4'], required: true},
  821. {name: '配比类别', value: source.ratioType, type: _config.TYPE.INT},
  822. {name: '主要材料类别', value: source.mainMaterialType, type: _config.TYPE.INT},
  823. {name: '主要材料单位系数', value: source.materialCoe, type: _config.TYPE.DECIMAL},
  824. {name: '材料耗用类型', value: 0, type: _config.TYPE.INT, required: true},
  825. {name: '供应方式', value: source.supply, type: _config.TYPE.INT, enumeration: ['1', '2']},
  826. {name: '暂估材料标志', value: source.is_evaluate, type: _config.TYPE.BOOL},
  827. {name: '不计税设备标志', value: source.no_tax_eqp, type: _config.TYPE.BOOL, required: true},
  828. {name: '单价不从明细汇总标志', value: source.notFromDetail, type: _config.TYPE.BOOL},
  829. {name: '定额价', value: source.basePrice, type: _config.TYPE.DECIMAL, required: true},
  830. {name: '定额价调整', value: source.adjPrice, type: _config.TYPE.DECIMAL, required: true},
  831. {name: '市场价', value: source.marketPrice, type: _config.TYPE.DECIMAL, required: true},
  832. {name: '数量', value: source.quantity, type: _config.TYPE.DECIMAL, required: true},
  833. {name: '产地', value: source.originPlace, maxLen: 255,
  834. failHint: `人材机${source.orgCode}-“产地”`},
  835. {name: '厂家', value: source.vender, maxLen: 255,
  836. failHint: `人材机${source.orgCode}-“厂家”`},
  837. {name: '质量等级', value: source.qualityGrace, maxLen: 255,
  838. failHint: `人材机${source.orgCode}-“质量等级”`},
  839. {name: '品牌', value: source.brand, maxLen: 255,
  840. failHint: `人材机${source.orgCode}-“品牌”`},
  841. {name: '备注', value: source.remark, maxLen: 255,
  842. failHint: `人材机${source.orgCode}-“备注”`},
  843. ];
  844. XML_EXPORT_BASE.Element.call(this, '人材机', attrs);
  845. }
  846. //人材机配比定义
  847. function GljRatio(source) {
  848. let attrs = [
  849. {name: '明细材料代码', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  850. {name: '数量', value: source.quantity, type: _config.TYPE.DECIMAL, required: true}
  851. ];
  852. XML_EXPORT_BASE.Element.call(this, '人材机配比', attrs);
  853. }
  854. //评标材料表定义
  855. function EvalBidMaterial() {
  856. XML_EXPORT_BASE.Element.call(this, '评标材料表', []);
  857. }
  858. //暂估价材料表定义
  859. function EvalEstimateMaterial() {
  860. XML_EXPORT_BASE.Element.call(this, '暂估价材料表', []);
  861. }
  862. //材料明细定义
  863. function MaterialDetail(source) {
  864. let attrs = [
  865. {name: '序号', value: source.serialNo, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  866. {name: '关联材料号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  867. {name: '材料名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  868. {name: '规格型号', value: source.specs, maxLen: 255},
  869. {name: '计量单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  870. {name: '数量', value: source.quantity, type: _config.TYPE.DECIMAL},
  871. {name: '单价', value: source.marketPrice, type: _config.TYPE.DECIMAL},
  872. {name: '合价', value: source.totalPrice, type: _config.TYPE.NUM2},
  873. {name: '产地', value: source.originPlace, maxLen: 255},
  874. {name: '厂家', value: source.vender, maxLen: 255},
  875. {name: '品牌', value: source.brand, maxLen: 255},
  876. {name: '质量等级', value: source.qualityGrace, maxLen: 255},
  877. {name: '备注', value: source.remark, maxLen: 255},
  878. ];
  879. XML_EXPORT_BASE.Element.call(this, '材料明细', attrs);
  880. }
  881. //清单综合单价计算程序定义
  882. function CalcProgram() {
  883. XML_EXPORT_BASE.Element.call(this, '清单综合单价计算程序', []);
  884. }
  885. //综合单价计算程序文件定义
  886. function CalcProgramFile(source) {
  887. let attrs = [
  888. {name: 'ID', value: source.ID, type: _config.TYPE.INT, required: true},
  889. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true}
  890. ];
  891. XML_EXPORT_BASE.Element.call(this, '综合单价计算程序文件', attrs);
  892. }
  893. //综合单价计算程序费用项定义
  894. function CalcProgramFeeItem(source) {
  895. let attrs = [
  896. {name: '序号', value: source.serialNo, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
  897. {name: '行代号', value: source.rowCode, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  898. {name: '项目名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  899. {name: '计算基础表达式', value: source.calcBase, maxLen: 255, required: true},
  900. {name: '计算基础说明', value: source.statement, maxLen: 255},
  901. {name: '费率', value: source.feeRate, type: _config.TYPE.DECIMAL},
  902. {name: '费用类别', value: source.feeType, type: _config.TYPE.INT, required: true},
  903. {name: '备注', value: source.remark, maxLen: 255},
  904. ];
  905. XML_EXPORT_BASE.Element.call(this, '综合单价计算程序费用项', attrs);
  906. }
  907. //主要清单汇总定义
  908. function MainBillsSummary() {
  909. XML_EXPORT_BASE.Element.call(this, '主要清单汇总', []);
  910. }
  911. //主要清单明细定义
  912. function MainBillsItem(source) {
  913. let attrs = [
  914. {name: '项目编码', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  915. {name: '项目名称', value: source.name, minLen: 1, maxLen: 500, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  916. {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  917. {name: '工程量', value: source.quantity, type: _config.TYPE.DECIMAL, required: true},
  918. {name: '综合单价', value: _util.getFee(source.fees, 'common.unitFee'), type: _config.TYPE.DECIMAL, required: true},
  919. {name: '综合合价', value: _util.getFee(source.fees, 'common.totalFee'), type: _config.TYPE.NUM2, required: true},
  920. {name: '其中暂估价', value: _util.getFee(source.fees, 'estimate.totalFee'), type: _config.TYPE.DECIMAL},
  921. {name: '备注', value: source.remark, maxLen: 255},
  922. ];
  923. XML_EXPORT_BASE.Element.call(this, '主要清单明细', attrs);
  924. }
  925. //评审材料汇总定义
  926. function AppraisalSummary(){
  927. XML_EXPORT_BASE.Element.call(this, '评审材料汇总', []);
  928. }
  929. //评审材料明细定义
  930. function AppraisalDetail(source) {
  931. let attrs = [
  932. {name: '代码', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  933. {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  934. {name: '规格', value: source.specs, maxLen: 255},
  935. {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
  936. {name: '市场价', value: source.marketPrice, type: _config.TYPE.DECIMAL, required: true}
  937. ];
  938. XML_EXPORT_BASE.Element.call(this, '评审材料明细', attrs);
  939. }
  940. //目前的数据
  941. let curProjectEle = null, //建设项目节点
  942. curTenderEle = null; //单位工程节点
  943. //获取需要导出的项目数据
  944. //@param {Number}tenderID(当前界面的单位工程ID,后台根据这个单位工程,去找其建设项目下所有数据)
  945. //@return {Object}(eleObj)
  946. async function loadProject(tenderID) {
  947. //拉取标段数据:建设项目、单项工程、单位工程数据
  948. let projectsData = await _util.getProjectByGranularity(granularity, tenderID, userID);
  949. if (!projectsData) {
  950. throw '获取项目数据错误';
  951. }
  952. //单项工程、单位工程按照树结构数据进行排序
  953. projectsData.children = _util.sortByNext(projectsData.children);
  954. for (let engData of projectsData.children) {
  955. engData.children = _util.sortByNext(engData.children);
  956. }
  957. //标段
  958. let project = new Project({
  959. basicInformation: projectsData.property.basicInformation,
  960. name: projectsData.name,
  961. fileKind: FILE_KIND[exportKind],
  962. taxType: projectsData.property.taxType ? _config.TAX_TYPE[projectsData.property.taxType] : ''
  963. });
  964. curProjectEle = project;
  965. //项目信息
  966. let projectInfo = new ProjectInfo({basicInformation: projectsData.property.basicInformation});
  967. project.children.push(projectInfo);
  968. //招标信息
  969. let biddingInfo = new BiddingInfo({basicInformation: projectsData.property.basicInformation, summaryInfo: projectsData.summaryInfo[projectsData.ID]});
  970. projectInfo.children.push(biddingInfo);
  971. //投标信息 导出类型为投标时,才导出
  972. if (exportKind === _config.EXPORT_KIND.Tender) {
  973. let bidInfo = new BidInfo({basicInformation: projectsData.property.basicInformation, summaryInfo: projectsData.summaryInfo[projectsData.ID]});
  974. projectInfo.children.push(bidInfo);
  975. }
  976. //编制说明
  977. let compilationIll = new CompilationIllustration({compilationIllustration: projectsData.property.compilationIllustration});
  978. project.children.push(compilationIll);
  979. //系统信息
  980. let generatedTime = moment(Date.now()).format('YYYY-MM-DDTHH:mm:ss'),
  981. sysInfoSource = {softInfo: projectsData.softInfo, generatedTime},
  982. sysInfo = new SystemInfo(sysInfoSource);
  983. project.children.push(sysInfo);
  984. //费用构成
  985. let feeForm = new FeeFrom(projectsData.summaryInfo[projectsData.ID]);
  986. project.children.push(feeForm);
  987. //主要清单汇总 主要清单明细在loadTender中设置
  988. let mainBillsSummaryEle = new MainBillsSummary();
  989. project.children.unshift(mainBillsSummaryEle); //必须要排在loadTender前,这样才能添加到明细数据
  990. //评审材料汇总 评审材料明细在loadTender中设置
  991. let appraisalSummary = new AppraisalSummary();
  992. project.children.unshift(appraisalSummary);
  993. //单项工程
  994. for (let eng of projectsData.children) {
  995. let engElement = await loadEngineering(projectsData.summaryInfo, eng);
  996. project.children.push(engElement);
  997. }
  998. //主要清单汇总、评审材料汇总 排在后面
  999. project.children = [...project.children.slice(2), mainBillsSummaryEle, appraisalSummary];
  1000. return project;
  1001. }
  1002. //单位工程内的人材机ID: 用于代码映射关系 //单位工程级别,C+数组下标 <==> gljID
  1003. let tenderGljs = [];
  1004. //获取人材机代码,eg: C0, C1....
  1005. function getGljCode(gljID) {
  1006. let idx = tenderGljs.findIndex(ID => ID === gljID);
  1007. if (~idx) {
  1008. return `C${idx}`;
  1009. }
  1010. tenderGljs.push(gljID);
  1011. return `C${tenderGljs.length - 1}`;
  1012. }
  1013. /*
  1014. * 加载单项工程数据
  1015. * @param {Object}summaryInfo(项目汇总信息映射) {Object}engData(单项工程数据)
  1016. * */
  1017. async function loadEngineering(summaryInfo, engData) {
  1018. let source = {summaryInfo: summaryInfo[engData.ID], name: engData.name};
  1019. let engineering = new Engineering(source);
  1020. //费用构成
  1021. let feeForm = new FeeFrom(summaryInfo[engData.ID]);
  1022. engineering.children.push(feeForm);
  1023. //分批次获取单位工程
  1024. let tenderDetailMap = _cache.getItem('tenderDetailMap');
  1025. for (let tenderData of engData.children) {
  1026. //需要请求项目详细数据的时候,间隔一段时间再初始单位工程数据,减少服务器压力
  1027. if (!tenderDetailMap[tenderData.ID]) {
  1028. await _util.setTimeoutSync(() => {}, _config.TIMEOUT_TIME);
  1029. }
  1030. //方便用户看错误来自哪个单位工程
  1031. _failList.push(`<span style="font-weight: bold">单位工程“${tenderData.name}”下:</span>`);
  1032. let orgLen = _failList.length;
  1033. let tender = await loadTender(summaryInfo, tenderData);
  1034. if (_failList.length === orgLen) { //只有上方的提示,说明该单位工程没有报错
  1035. _failList.pop();
  1036. }
  1037. tenderGljs = []; //清空单位工程内所有的人材机(ID)
  1038. engineering.children.push(tender);
  1039. }
  1040. return engineering;
  1041. }
  1042. /*
  1043. * 加载单位工程数据
  1044. * @param {Object}summaryInfo(项目汇总信息映射) {Object}tenderData(单位工程数据)
  1045. * @return {Object}
  1046. * */
  1047. async function loadTender(summaryInfo, tenderData) {
  1048. //获取单位工程详细数据
  1049. let tenderDetail = await _util.getTenderDetail(tenderData.ID, userID);
  1050. //设置定额库编码
  1051. tenderDetail.rationLibMap = {};
  1052. let defaultLib = null;
  1053. if (tenderDetail.projectInfo.engineeringInfo && Array.isArray(tenderDetail.projectInfo.engineeringInfo.ration_lib)) {
  1054. defaultLib = tenderDetail.projectInfo.engineeringInfo.ration_lib.find(data => data.isDefault);
  1055. for (let lib of tenderDetail.projectInfo.engineeringInfo.ration_lib) {
  1056. tenderDetail.rationLibMap[lib.id] = lib;
  1057. }
  1058. }
  1059. //初始化项目人材机代号(人材机生成的代号要由排序后的项目人材机从C0开始生成),定额下的人材机含量提前使用到了这个代码,所以需要先初始化
  1060. let allGljs = gljUtil.sortRationGLJ(tenderDetail.projectGLJ.datas.gljList); //人材机汇总排序
  1061. tenderGljs = allGljs.map(glj => glj.id);
  1062. //单位工程
  1063. let tenderSource = {
  1064. name: tenderData.name,
  1065. engineeringName: tenderData.property.engineeringName,
  1066. summaryInfo: summaryInfo[tenderData.ID],
  1067. defaultRationLibCode: defaultLib.libCode,
  1068. taxType: tenderData.property.taxType
  1069. };
  1070. let tender = curTenderEle = new Tender(tenderSource);
  1071. //工程特征
  1072. let featureObj = _util.arrayToObj(tenderData.property.projectFeature);
  1073. let engFeature = new EngFeature({feature:featureObj, basicInformation: tenderDetail.projectInfo.property.basicInformation});
  1074. tender.children.push(engFeature);
  1075. //特征项:每一项工程特征
  1076. for (let data of tenderData.property.projectFeature) {
  1077. let featureItem = new FeatureItem(data);
  1078. engFeature.children.push(featureItem);
  1079. }
  1080. //工程信息 : 筛选设置了编码的基本信息数据
  1081. let constructInfo = new XML_EXPORT_BASE.Element('工程信息', []);
  1082. tenderDetail.projectInfo.property.basicInformation.forEach(pItem => {
  1083. pItem.items.forEach(info => {
  1084. if (info.code) {
  1085. constructInfo.children.push(new InfoItem(info));
  1086. }
  1087. });
  1088. });
  1089. if (constructInfo.children.length) {
  1090. tender.children.push(constructInfo)
  1091. }
  1092. //单位工程费汇总
  1093. tender.children.push(loadDXFY(tenderDetail));
  1094. //分部分项清单
  1095. tender.children.push(loadFBFX(tenderDetail));
  1096. //措施项目清单
  1097. tender.children.push(loadCSXM(tenderDetail));
  1098. //其他项目清单
  1099. let other = loadOtherBills(tenderDetail);
  1100. if (other) {
  1101. tender.children.push(other);
  1102. }
  1103. //规费和税金清单
  1104. let chargeTax = loadChargeTax(tenderDetail);
  1105. tender.children.push(chargeTax);
  1106. //建设项目下评审材料汇总设置评审材料明细
  1107. let curAppraisalSummary = curProjectEle.children.find(ele => ele.name === '评审材料汇总');
  1108. //人材机汇总相关
  1109. let gljSumarryInfo = loadGlj(curAppraisalSummary, tenderDetail);
  1110. if (gljSumarryInfo) {
  1111. //投标导出承包人材料相关
  1112. if (exportKind === _config.EXPORT_KIND.Tender) {
  1113. let adjustType = tenderData.property.gljAdjustType || _config.ADJUST_TYPE.info;
  1114. //承包人材料差额法表
  1115. let diffGljs = materialAdjustObj.getPirceInfoDatas(tenderDetail.projectGLJ.datas.gljList);
  1116. if (diffGljs.length) {
  1117. let diffP = new DifferentiaGlj();
  1118. diffGljs.forEach(data => diffP.children.push(new DifferentiaGljDetail(adjustType, data)));
  1119. tender.children.push(diffP);
  1120. }
  1121. //承包人材料指数法表
  1122. let engineeringCostNode = tenderDetail.Bills.tree.roots.find(node => node.getFlag() === fixedFlag.ENGINEERINGCOST);
  1123. if (engineeringCostNode) {
  1124. let ecTotalFee = _util.getFee(engineeringCostNode.data.fees, 'common.totalFee');
  1125. let exponentialGljs = materialAdjustObj.getPriceCoeDatas(tenderDetail.projectGLJ.datas.gljList, ecTotalFee);
  1126. if (exponentialGljs.length) {
  1127. // 变值权重B累加
  1128. let totalVarWeight = exponentialGljs.reduce((acc, cur) => acc += cur.varWeight || 0, 0);
  1129. // 如果采用指数法,定值权重A = 1 - 变值权重B累加。如果不是指数法,取1
  1130. let fixedWeight = adjustType === _config.ADJUST_TYPE.coe ? 1 - totalVarWeight : '1';
  1131. let exP = new ExponentialGlj(fixedWeight);
  1132. exponentialGljs.forEach(data => {
  1133. exP.children.push(new ExponentialGljDetail(adjustType, data));
  1134. });
  1135. tender.children.push(exP);
  1136. }
  1137. }
  1138. }
  1139. let {gljSummary, evalBidMaterial, evalEstimateMaterial} = gljSumarryInfo;
  1140. //投标导出人材机汇总
  1141. if (exportKind === _config.EXPORT_KIND.Tender) {
  1142. tender.children.push(gljSummary);
  1143. }
  1144. //评标材料表
  1145. if (evalBidMaterial && evalBidMaterial.children.length) {
  1146. tender.children.push(evalBidMaterial);
  1147. }
  1148. //暂估价材料表
  1149. if (evalEstimateMaterial && evalEstimateMaterial.children.length) {
  1150. tender.children.push(evalEstimateMaterial);
  1151. }
  1152. }
  1153. //清单综合单价计算程序
  1154. let calcProgram = loadCalcProgram(tenderDetail);
  1155. if (calcProgram) {
  1156. tender.children.push(calcProgram);
  1157. }
  1158. //给建设项目下主要清单汇总设置主要清单明细
  1159. let curMainBillsSummary = curProjectEle.children.find(ele => ele.name === '主要清单汇总');
  1160. if (curMainBillsSummary) {
  1161. loadMainBillsItems(curMainBillsSummary, tenderDetail);
  1162. }
  1163. return tender;
  1164. }
  1165. /*
  1166. * 加载计算程序费用行
  1167. * @param {Object}detail(单位工程的详细数据,清单定额等等)
  1168. * @return {Object}
  1169. * */
  1170. function loadDXFY(detail) {
  1171. //单位工程费汇总
  1172. let tenderFeeSummary = new TenderFeeSummary();
  1173. //计价程序费用行,筛选大项费用
  1174. let feeNodes = detail.Bills.tree.roots;
  1175. for (let node of feeNodes) {
  1176. let mainTreeNode = detail.mainTree.getNodeByID(node.data.ID),
  1177. serialNo = mainTreeNode ? mainTreeNode.serialNo() + 1 : 1;
  1178. let flag = node.getFlag() || 0;
  1179. let source = {
  1180. row: serialNo,
  1181. code: node.data.code,
  1182. rowCode: `F${serialNo}`,
  1183. name: node.data.name,
  1184. calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
  1185. feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
  1186. fees: node.data.fees,
  1187. feeType: FEE_TYPE[flag] || FEE_TYPE['0'],
  1188. remark: node.data.remark
  1189. };
  1190. source.calcBaseState = _util.transformCalcBaseState(detail, source.calcBase, CalcStateMap);
  1191. let feeRow = new FeeRow(source);
  1192. tenderFeeSummary.children.push(feeRow);
  1193. }
  1194. return tenderFeeSummary;
  1195. }
  1196. /*
  1197. * 加载清单项目
  1198. * @param {Object}node(清单树节点) {Object}detail
  1199. * */
  1200. function loadBills(node, detail) {// allRation, allRationGlj, decimal,
  1201. let allRation = detail.Ration.datas,
  1202. allRationGlj = detail.ration_glj.datas,
  1203. decimal = detail.projectInfo.property.decimal;
  1204. let source = {
  1205. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1206. code: node.data.code,
  1207. name: node.data.name,
  1208. unit: node.data.unit,
  1209. quantity: node.data.quantity,
  1210. fees: node.data.fees,
  1211. mainBills: node.data.mainBills,
  1212. isEstimate: node.data.isEstimate,
  1213. remark: node.data.remark
  1214. };
  1215. let bills = new FXbills(source);
  1216. //清单项目项目编码要在单位工程中唯一
  1217. _util.checkUnique(curTenderEle.constraints.billsCode, source.code, `第${source.row}行`,`“清单项目编码${source.code}”`);
  1218. //加载特征及内容
  1219. function loadFeatureContent() {
  1220. let job = [],
  1221. feature = [];
  1222. let jobText = node.data.jobContentText || '';
  1223. let featureText = node.data.itemCharacterText || '';
  1224. let jobSplit = jobText.split(/[\r,\n]/g),
  1225. featureSplit = featureText.split(/[\r,\n]/g);
  1226. //将特征和内容分类,通过[项目特征][工作内容]区分。若没有,则不区分:工作内容列全部数据为工作内容,项目特征列全部数据为项目特征
  1227. //@param {Array}data(splitdata) {String}field(job、feature)
  1228. function classifyData(data, field) {
  1229. let rst = {
  1230. job: [],
  1231. feature: []
  1232. };
  1233. let featureIndex = data.findIndex(x => x === '[项目特征]');
  1234. if (featureIndex < 0) {
  1235. rst[field] = data;
  1236. return rst;
  1237. }
  1238. let jobIndex = data.findIndex(x => x === '[工作内容]');
  1239. if (jobIndex < 0) { //有[项目特征],没有[工作内容],则其数据全为项目特征数据
  1240. rst.feature = data;
  1241. return rst;
  1242. }
  1243. //有[项目特征],有[工作内容],进行数据分类
  1244. rst.feature = data.slice(featureIndex, jobIndex);
  1245. rst.job = data.slice(jobIndex);
  1246. return rst;
  1247. }
  1248. let classifiedJob = classifyData(jobSplit, 'job');
  1249. job = job.concat(classifiedJob.job);
  1250. feature = feature.concat(classifiedJob.feature);
  1251. let classifiedFeature = classifyData(featureSplit, 'feature');
  1252. job = job.concat(classifiedFeature.job);
  1253. feature = feature.concat(classifiedFeature.feature);
  1254. job = job.filter(x => x && !['[项目特征]', '[工作内容]'].includes(x));
  1255. feature = feature.filter(x => x && !['[项目特征]', '[工作内容]'].includes(x));
  1256. //创建项目特征节点
  1257. if (feature.length > 0) {
  1258. let itemChac = new ItemCharacter();
  1259. let reg = /(.{0,}):(.{0,})/;
  1260. for (let f of feature) {
  1261. let source = {name: '', value: ''};
  1262. let execRst = reg.exec(f);
  1263. if (execRst) {
  1264. source.name = execRst[1].replace(/^\d+\.{1}/, '').trim(); //去除开头(1.)序号,首位空格
  1265. source.value = execRst[2].trim();
  1266. }
  1267. let featureEle = new Feature(source);
  1268. //let featureEle = new Feature({name: f.trim(), value: ''});
  1269. itemChac.children.push(featureEle);
  1270. }
  1271. bills.children.push(itemChac);
  1272. }
  1273. //创建工作内容节点
  1274. if (job.length > 0) {
  1275. let jobContent = new JobContent();
  1276. for (let j of job) {
  1277. let data = j.replace(/^\d+\.{1}/, '').trim();
  1278. let content = new Content(data);
  1279. //let content = new Content(j.trim());
  1280. jobContent.children.push(content);
  1281. }
  1282. bills.children.push(jobContent);
  1283. }
  1284. }
  1285. loadFeatureContent();
  1286. //解析工程量计算式
  1287. function parseQuantityExp(rationData) {
  1288. if (rationData.quantityEXP === 'QDL') { //取清单工程量
  1289. return node.data.quantity;
  1290. } else if (rationData.quantityEXP === 'GCLMXHJ') { //从明细汇总成数值
  1291. let referDetail = detail.quantity_detail.datas.filter(data => data.rationID === rationData.ID && data.isSummation);
  1292. if (referDetail.length === 0) {
  1293. return '';
  1294. }
  1295. let rst = 0;
  1296. for (let d of referDetail) {
  1297. rst = scMathUtil.roundForObj(rst + d.result, detail.projectInfo.property.decimal.process);
  1298. }
  1299. return scMathUtil.roundForObj(rst, detail.projectInfo.property.decimal.ration.quantity);
  1300. } else {
  1301. return rationData.quantityEXP;
  1302. }
  1303. }
  1304. /*
  1305. * 加载定额子目
  1306. * @param {Array}rationData(清单项目下定额数据) {Array}rationGljData(定额的人材机数据) {Object}decimal(项目小数位数)
  1307. * @return {Object}
  1308. * */
  1309. function loadRation(rationData, rationGljData) {
  1310. let viewCode = rationData.code;
  1311. if (rationData.prefix) {
  1312. viewCode = rationData.prefix + viewCode;
  1313. }
  1314. if (rationData.adjustState) {
  1315. viewCode += '换';
  1316. }
  1317. //子目类型 补充定额为“1”,标准定额无换算为“0”,标准定额有换算为“2”,安装费用,即自动生成的安装子目,为“3”,子目级人材机,即量价、与定额同级的人材机 其他待完善……
  1318. let subType;
  1319. if (rationData.type === rationType.ration && rationData.from === 'cpt') {
  1320. subType = '1';
  1321. } else if (rationData.type === rationType.ration && !rationData.adjustState) {
  1322. subType = '0';
  1323. } else if (rationData.type === rationType.ration && rationData.adjustState) {
  1324. subType = '2';
  1325. } else if (rationData.type === rationType.install) {
  1326. subType = '3';
  1327. } else if (rationData.type === rationType.volumePrice) {
  1328. subType = '6';
  1329. }
  1330. let rNode = detail.mainTree.nodes[detail.mainTree.prefix + rationData.ID];
  1331. let rationSource = {
  1332. row: rNode ? rNode.serialNo() + 1 : -1,
  1333. viewCode: viewCode,
  1334. name: rationData.name,
  1335. unit: rationData.unit,
  1336. libCode: '',
  1337. code: rationData.code,
  1338. subType: subType,
  1339. quantity: rationData.quantity,
  1340. quantityEXP: parseQuantityExp(rationData),
  1341. fees: rationData.fees,
  1342. isSubcontract: rationData.isSubcontract,
  1343. programID: rationData.programID,
  1344. remark: rationData.remark
  1345. };
  1346. if (rationData.from === 'std' && _util.isDef(rationData.libID)) { //来自标准库,设置定额库编码
  1347. rationSource.libCode = detail.rationLibMap[rationData.libID].libCode;
  1348. }
  1349. let ration = new Ration(rationSource);
  1350. //创建工料分析
  1351. let gljAnalyze = new GljAnalyze();
  1352. ration.children.push(gljAnalyze);
  1353. //定额人材机排序
  1354. rationGljData = gljUtil.sortRationGLJ(rationGljData);
  1355. for (let rGlj of rationGljData) {
  1356. let gljSource = {
  1357. //code: rGlj.code,
  1358. code: getGljCode(rGlj.projectGLJID),
  1359. quantity: rGlj.quantity,
  1360. totalQuantity: gljUtil.getTotalQuantity(rGlj, rationData, decimal.glj.quantity, decimal.ration.quantity)
  1361. };
  1362. let gljContent = new GljContent(gljSource);
  1363. gljAnalyze.children.push(gljContent);
  1364. }
  1365. //创建费用组成
  1366. let feeContent = new FeeContent({fees: rationData.fees});
  1367. ration.children.push(feeContent);
  1368. return ration;
  1369. }
  1370. //投标加载组价内容、费用组成
  1371. if (exportKind === _config.EXPORT_KIND.Tender) {
  1372. let rationData = allRation.filter(x => x.billsItemID === node.data.ID);
  1373. if (rationData.length > 0) {
  1374. let priceContent = new PriceContent();
  1375. bills.children.push(priceContent);
  1376. //加载定额子目
  1377. rationData.sort((x, y) => x.serialNo - y.serialNo); //定额排序
  1378. for (let rData of rationData) {
  1379. let rationGlj = allRationGlj.filter(x => x.rationID === rData.ID);
  1380. priceContent.children.push(loadRation(rData, rationGlj));
  1381. }
  1382. }
  1383. //清单费用组成
  1384. let feeContent = new FeeContent({fees: node.data.fees});
  1385. bills.children.push(feeContent);
  1386. }
  1387. return bills;
  1388. }
  1389. /*
  1390. * 加载分部分项清单
  1391. * @param {Object}detail
  1392. * @return {Object || NULL}
  1393. * */
  1394. function loadFBFX(detail) {
  1395. let fbfxBills = new FBFXBills();
  1396. let subEngNode = detail.Bills.tree.roots.find((node) => node.getFlag() === fixedFlag.SUB_ENGINERRING);
  1397. if (!subEngNode) {
  1398. _failList.push('不存在分部分项清单');
  1399. return fbfxBills;
  1400. }
  1401. //是否有清单分类,分部分项下,清单分类和清单项目不可同层存在,如果有了清单分类,则提示其他清单项目:
  1402. //清单xx行应是清单分类,其下必须有清单项目
  1403. let hasBillsClass = subEngNode.children && subEngNode.children.some(node => node.children && node.children.length);
  1404. for (let node of subEngNode.children) {
  1405. if (node.data.type === billType.FB) {
  1406. //创建清单分部节点
  1407. let fbSource = {
  1408. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1409. code: node.data.code,
  1410. name: node.data.name,
  1411. fees: node.data.fees,
  1412. remark: node.data.remark
  1413. };
  1414. if (node.children.length === 0) {
  1415. _failList.push(`第${fbSource.row}行清单分部下至少要有一条清单项目。`);
  1416. }
  1417. let fbBills = new FBBills(fbSource);
  1418. fbfxBills.children.push(fbBills);
  1419. //创建清单项目节点
  1420. for (let subNode of node.children) {
  1421. //detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1422. let fx = loadBills(subNode, detail);
  1423. fbBills.children.push(fx);
  1424. }
  1425. } else {
  1426. //第一层有了分部,不能有分项
  1427. if (hasBillsClass) {
  1428. let row = detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1;
  1429. _failList.push(`第${row}行清单应是清单分部,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
  1430. }
  1431. let fxBills = loadBills(node, detail);
  1432. fbfxBills.children.push(fxBills);
  1433. }
  1434. }
  1435. return fbfxBills;
  1436. }
  1437. /*
  1438. * 加载措施项目清单
  1439. * @param {Object}detail
  1440. * @return {Object}
  1441. * */
  1442. function loadCSXM(detail) {
  1443. let measureNode = detail.Bills.tree.roots.find((node) => node.getFlag() === fixedFlag.MEASURE);
  1444. if (!measureNode) {
  1445. _failList.push('不存在措施项目清单');
  1446. return new XML_EXPORT_BASE.Element('措施项目清单', []);
  1447. }
  1448. let csxmBills = new CSXMBills({fees: measureNode.data.fees});
  1449. //加载组织措施清单
  1450. let zzcsNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.CONSTRUCTION_ORGANIZATION);
  1451. if (zzcsNode) {
  1452. let zzcsBills = new ZZCSBills({fees: zzcsNode.data.fees});
  1453. csxmBills.children.push(zzcsBills);
  1454. loadZZCS(zzcsBills, zzcsNode.children);
  1455. }
  1456. //加载技术措施清单
  1457. let jscsNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.CONSTRUCTION_TECH);
  1458. let maxDepth = 2; //技术措施清单最多深度是2层:技术措施分类-清单项目
  1459. if (jscsNode) {
  1460. let jscsBills = new JSCSBills({fees: jscsNode.data.fees});
  1461. csxmBills.children.push(jscsBills);
  1462. let isValidDepth = _util.validDepth(maxDepth, jscsNode);
  1463. if (!isValidDepth) {
  1464. _failList.push('技术措施清单子项超过两层');
  1465. } else {
  1466. loadJSCS(jscsBills, jscsNode.children);
  1467. }
  1468. }
  1469. return csxmBills;
  1470. function loadZZCS(parent, nodes) {
  1471. let hasBillsClass = nodes && nodes.some(node => node.children && node.children.length);
  1472. //组织措施分类和公式计算措施项不能出现在同层中
  1473. for (let node of nodes) {
  1474. if (node.children.length > 0) { //组织措施分类
  1475. let classSource = {
  1476. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1477. code: node.data.code,
  1478. name: node.data.name,
  1479. fees: node.data.fees,
  1480. remark: node.data.remark
  1481. };
  1482. let zzcsClass = new ZZCSClass(classSource);
  1483. parent.children.push(zzcsClass);
  1484. loadZZCS(zzcsClass, node.children);
  1485. } else { //公式计算措施项
  1486. let source = {
  1487. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1488. code: node.data.code,
  1489. name: node.data.name,
  1490. calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
  1491. feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
  1492. fees: node.data.fees,
  1493. remark: node.data.remark,
  1494. feeType: FEE_TYPE[node.getFlag()] || FEE_TYPE['0']
  1495. };
  1496. source.calcBaseState = _util.transformCalcBaseState(detail, source.calcBase, CalcStateMap);
  1497. if (hasBillsClass) {
  1498. _failList.push(`第${source.row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
  1499. }
  1500. let formula = new FormulaCalcMeasure(source);
  1501. parent.children.push(formula);
  1502. }
  1503. }
  1504. if (parent instanceof ZZCSClass) { //组织措施分类下的只能有一个组织措施分类
  1505. let filters = parent.children.filter(data => data instanceof ZZCSClass);
  1506. if (filters.length) {
  1507. _failList.push('组织措施分类下只能有一个组织措施分类');
  1508. }
  1509. }
  1510. }
  1511. function loadJSCS(parent, nodes) {
  1512. let hasBillsClass = nodes && nodes.some(node => node.children && node.children.length);
  1513. for (let node of nodes) {
  1514. if (node.children.length > 0) { //技术措施分类
  1515. let classSource = {
  1516. code: node.data.code,
  1517. name: node.data.name,
  1518. fees: node.data.fees
  1519. };
  1520. let jscsClass = new JSCSClass(classSource);
  1521. parent.children.push(jscsClass);
  1522. loadJSCS(jscsClass, node.children);
  1523. } else { //清单项目
  1524. if (hasBillsClass) {
  1525. let row = detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1;
  1526. _failList.push(`第${row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
  1527. }
  1528. parent.children.push(loadBills(node, detail));
  1529. }
  1530. }
  1531. }
  1532. }
  1533. /*
  1534. * 加载其他项目清单,要出现此节点,需要遵循标准条件(至少含有一条相关明细)
  1535. * @param {Object}detail
  1536. * @return {Object || Null}
  1537. * */
  1538. function loadOtherBills(detail) {
  1539. let otherNode = detail.Bills.tree.roots.find(node => node.getFlag() === fixedFlag.OTHER);
  1540. if (otherNode.children.length === 0) {
  1541. return null;
  1542. }
  1543. //其他项目清单元素
  1544. let otherEle = new OtherBills();
  1545. //添加暂列金额元素
  1546. let provisionalNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.PROVISIONAL);
  1547. if (provisionalNode && provisionalNode.children.length > 0) {
  1548. otherEle.children.push(loadProvisional(provisionalNode));
  1549. }
  1550. //添加专业工程暂估价元素
  1551. let engEstimateNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.ENGINEERING_ESITIMATE);
  1552. if (engEstimateNode && engEstimateNode.children.length > 0) {
  1553. otherEle.children.push(loadEngEstimate(engEstimateNode));
  1554. }
  1555. //添加计日工元素
  1556. let dayWorkNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.DAYWORK);
  1557. let dayWorkEle = new DayWork({fees: dayWorkNode.data.fees});
  1558. if (dayWorkNode && dayWorkNode.children.length > 0) {
  1559. //要显示计日工元素,人工、材料、施工机械,最少有一条含有子项(计日工项目)
  1560. let filterNodes = dayWorkNode.children.filter(node => [fixedFlag.LABOUR, fixedFlag.MATERIAL, fixedFlag.MACHINE].includes(node.getFlag()));
  1561. for (let fNode of filterNodes) {
  1562. let ele,
  1563. constraints;
  1564. let flag = fNode.getFlag();
  1565. if (flag === fixedFlag.LABOUR) {
  1566. ele = new Labour();
  1567. constraints = curTenderEle.constraints.labourDayWorkCode;
  1568. } else if (flag === fixedFlag.MATERIAL) {
  1569. ele = new Material();
  1570. constraints = curTenderEle.constraints.materialDayWorkCode;
  1571. } else if (flag === fixedFlag.MACHINE) {
  1572. ele = new Machine();
  1573. constraints = curTenderEle.constraints.machineDayWorkCode;
  1574. }
  1575. if (fNode.children.length > 0) {
  1576. let isValidDepth = _util.validDepth(1, fNode);
  1577. if (!isValidDepth) {
  1578. _failList.push(`计日工${ele.name}子项超过一层`);
  1579. } else {
  1580. for (let itemNode of fNode.children) {
  1581. ele.children.push(loadDayWorkItem(itemNode, constraints, `${ele.name}计日工项目编号`));
  1582. }
  1583. dayWorkEle.children.push(ele);
  1584. }
  1585. }
  1586. }
  1587. //如果计日工下有计日工项目,则显示计日工元素
  1588. if (dayWorkEle.children.length > 0) {
  1589. otherEle.children.push(dayWorkEle);
  1590. }
  1591. }
  1592. //添加总承包服务费元素
  1593. let tkcNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.TURN_KEY_CONTRACT);
  1594. if (tkcNode && tkcNode.children.length > 0) { //必须要有子项才显示总承包服务费元素
  1595. let isValidDepth = _util.validDepth(2, tkcNode); //最多2层子项:总承包服务费分类-总承包服务费费用项
  1596. if (!isValidDepth) {
  1597. _failList.push('总承包服务费子项超过两层');
  1598. } else {
  1599. let tkcEle = new TurnKeyContract({fees: tkcNode.data.fees});
  1600. otherEle.children.push(tkcEle);
  1601. loadService(tkcEle, tkcNode.children);
  1602. }
  1603. }
  1604. //添加索赔计价汇总元素
  1605. let claimNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.CLAIM);
  1606. if (claimNode && claimNode.children.length > 0) { //必须要有子项才能显示索赔计价汇总元素
  1607. let claimEle = new XML_EXPORT_BASE.Element('索赔计价汇总', [
  1608. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(claimNode.data.fees, 'common.totalFee') : '0'}]);
  1609. for (let n of claimNode.children) {
  1610. claimEle.children.push(new ClaimVisaFeeItem(n.data));
  1611. }
  1612. otherEle.children.push(claimEle);
  1613. }
  1614. //添加现场签证计价汇总元素
  1615. let visaNode = detail.Bills.tree.items.find(node => node.getFlag() === fixedFlag.VISA);
  1616. if (visaNode && visaNode.children.length > 0) { //必须要有子项才能显示现场签证计价汇总元素
  1617. let visaEle = new XML_EXPORT_BASE.Element('现场签证计价汇总', [
  1618. {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? _util.getFee(visaNode.data.fees, 'common.totalFee') : '0'}
  1619. ]);
  1620. for (let n of visaNode.children) {
  1621. visaEle.children.push(new ClaimVisaFeeItem(n.data));
  1622. }
  1623. otherEle.children.push(visaEle);
  1624. }
  1625. //添加其他元素
  1626. let posetriy = otherNode.getPosterity();
  1627. let subOtherEle = loadOthers(posetriy);
  1628. if (subOtherEle) {
  1629. otherEle.children.push(subOtherEle);
  1630. }
  1631. //必须有有效子项,才能显示其他项目清单元素
  1632. return otherEle.children.length > 0 ? otherEle : null;
  1633. //加载暂列金额
  1634. function loadProvisional(node) {
  1635. let provisionalEle = new Provisional({fees: node.data.fees});
  1636. //暂列金额最多只有一层子节点
  1637. let isValidDepth = _util.validDepth(1, node);
  1638. if (!isValidDepth) {
  1639. _failList.push('暂列金额子项超过一层');
  1640. } else { //加载暂列金额明细
  1641. for (let n of node.children) {
  1642. let pDetailSource = {
  1643. row: detail.mainTree.nodes[detail.mainTree.prefix + n.data.ID].serialNo() + 1,
  1644. code: n.data.code,
  1645. name: n.data.name,
  1646. unit: n.data.unit,
  1647. fees: n.data.fees,
  1648. remark: n.data.remark
  1649. },
  1650. pDetailEle = new ProvisionalDetail(pDetailSource);
  1651. //暂列金额明细编号在单位工程中唯一
  1652. _util.checkUnique(curTenderEle.constraints.provisionalDetailCode, pDetailSource.code,
  1653. `第${pDetailSource.row}行`, `暂列金额明细编码${pDetailSource.code}`);
  1654. provisionalEle.children.push(pDetailEle);
  1655. }
  1656. }
  1657. return provisionalEle;
  1658. }
  1659. //加载专业工程暂估价
  1660. function loadEngEstimate(node) {
  1661. let engEstimateEle = new EngEstimate({fees: node.data.fees});
  1662. //专业工程暂估价最多只有一层子节点
  1663. let isValidDepth = _util.validDepth(1, node);
  1664. if (!isValidDepth) {
  1665. _failList.push('专业工程暂估价子项超过一层');
  1666. } else { //加载专业工程暂估明细
  1667. for (let n of node.children) {
  1668. let eDetailSource = {
  1669. row: detail.mainTree.nodes[detail.mainTree.prefix + n.data.ID].serialNo() + 1,
  1670. code: n.data.code,
  1671. name: n.data.name,
  1672. engineeringContent: n.data.engineeringContent,
  1673. fees: n.data.fees,
  1674. remark: n.data.remark
  1675. },
  1676. eDetailEle = new EngEstimateDetail(eDetailSource);
  1677. //暂列金额明细编号在单位工程中唯一
  1678. _util.checkUnique(curTenderEle.constraints.engEstimateDetailCode, eDetailSource.code,
  1679. `第${eDetailSource.row}行`, `专业工程暂估明细编码${eDetailSource.code}`);
  1680. engEstimateEle.children.push(eDetailEle);
  1681. }
  1682. }
  1683. return engEstimateEle;
  1684. }
  1685. //加载计日工项目
  1686. function loadDayWorkItem(node, constraints, hint) {
  1687. let source = {
  1688. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1689. code: node.data.code,
  1690. name: node.data.name,
  1691. unit: node.data.unit,
  1692. quantity: node.data.quantity,
  1693. fees: node.data.fees,
  1694. remark: node.data.remark
  1695. };
  1696. _util.checkUnique(constraints, source.code, `第${source.row}行`, `计日工项目编码${source.code}`);
  1697. return new DayWorkItem(source);
  1698. }
  1699. //加载服务费项
  1700. function loadService(parent, nodes) {
  1701. let hasBillsClass = nodes && nodes.some(node => node.children && node.children.length);
  1702. for (let node of nodes) {
  1703. if (node.children.length > 0) { //总承包服务费分类
  1704. let classSource = {
  1705. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1706. code: node.data.code,
  1707. name: node.data.name,
  1708. remark: node.data.remark
  1709. };
  1710. let tkcClass = new TurnKeyContractClass(classSource);
  1711. parent.children.push(tkcClass);
  1712. loadService(tkcClass, node.children);
  1713. } else { //总承包服务费费用项
  1714. let source = {
  1715. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1716. code: node.data.code,
  1717. name: node.data.name,
  1718. serviceContent: node.data.serviceContent,
  1719. calcBaseValue: node.data.calcBase,
  1720. feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
  1721. fees: node.data.fees,
  1722. remark: node.data.remark
  1723. };
  1724. if (hasBillsClass) {
  1725. _failList.push(`第${source.row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
  1726. }
  1727. parent.children.push(new TurnKeyContractItem(source));
  1728. }
  1729. }
  1730. }
  1731. //加载其他列项,不符合上述情况的,其他所有清单子项
  1732. function loadOthers(nodes) {
  1733. //排除项
  1734. let exclusionFlags = [
  1735. fixedFlag.PROVISIONAL,
  1736. fixedFlag.ENGINEERING_ESITIMATE,
  1737. fixedFlag.LABOUR,
  1738. fixedFlag.MATERIAL,
  1739. fixedFlag.MACHINE,
  1740. fixedFlag.TURN_KEY_CONTRACT,
  1741. fixedFlag.CLAIM,
  1742. fixedFlag.VISA
  1743. ];
  1744. //生成其他列项
  1745. let otherItems = [],
  1746. summaryFee = 0;
  1747. for (let node of nodes) {
  1748. let belongFlag = node.belongToFlag();
  1749. if (node.children.length > 0 || (belongFlag && exclusionFlags.includes(belongFlag))) {
  1750. continue;
  1751. }
  1752. //汇总其他列项金额
  1753. let totalFee = _util.getFee(node.data.fees, 'common.totalFee');
  1754. summaryFee = scMathUtil.roundForObj(summaryFee + totalFee, detail.projectInfo.property.decimal.bills.totalPrice);
  1755. let otherItemSource = {
  1756. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1757. code: node.data.code,
  1758. name: node.data.name,
  1759. calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
  1760. feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
  1761. commonTotalFee: totalFee,
  1762. notSummary: belongFlag && belongFlag === fixedFlag.MATERIAL_PROVISIONAL, //不计入合价,只有材料(工程设备)暂估价固定节点
  1763. remark: node.data.remark
  1764. };
  1765. let otherItemEle = new OtherItem(otherItemSource);
  1766. otherItems.push(otherItemEle);
  1767. _util.checkUnique(curTenderEle.constraints.otherItemNo, otherItemSource.code,
  1768. `第${otherItemSource.row}行`, `清单编码${otherItemSource.code}`);
  1769. }
  1770. let otherEle = new Other({commonTotalFee: summaryFee});
  1771. for (let ele of otherItems) {
  1772. otherEle.children.push(ele);
  1773. }
  1774. return otherEle.children.length > 0 ? otherEle : null; //有其他列项才能显示其他元素
  1775. }
  1776. }
  1777. /*
  1778. * 加载规费和税金清单,固定显示:规费、规费子项、税金、增值税、附加税、环境保护税这几个清单
  1779. * @param {Object}detail
  1780. * @return {Object}
  1781. * */
  1782. function loadChargeTax(detail) {
  1783. let chargeTaxEle = new ChargeTaxBills();
  1784. let filterFlags = [
  1785. fixedFlag.CHARGE,
  1786. fixedFlag.TAX,
  1787. fixedFlag.ADDED_VALUE_TAX,
  1788. fixedFlag.ADDITIONAL_TAX,
  1789. fixedFlag.ENVIRONMENTAL_PROTECTION_TAX
  1790. ];
  1791. let filterNodes = detail.Bills.tree.items.filter(node => filterFlags.includes(node.getFlag()));
  1792. // 规费子项
  1793. let chargeNode = filterNodes.find(node => node.getFlag() === fixedFlag.CHARGE);
  1794. if (chargeNode) {
  1795. filterNodes.splice(filterNodes.indexOf(chargeNode) + 1, 0, ...chargeNode.children);
  1796. }
  1797. for (let node of filterNodes) {
  1798. let mainTreeNode = detail.mainTree.getNodeByID(node.data.ID),
  1799. serialNo = mainTreeNode ? mainTreeNode.serialNo() + 1 : 1;
  1800. // 规费和规费子项费用类别相同
  1801. let feeType = node === chargeNode || node.parent === chargeNode
  1802. ? FEE_TYPE[chargeNode.getFlag()]
  1803. : FEE_TYPE[node.getFlag()] || FEE_TYPE['0'];
  1804. let source = {
  1805. row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
  1806. code: node.data.code,
  1807. rowCode: `F${serialNo}`,
  1808. name: node.data.name,
  1809. calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
  1810. feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
  1811. fees: node.data.fees,
  1812. feeType: feeType,
  1813. remark: node.data.remark
  1814. };
  1815. source.calcBaseState = _util.transformCalcBaseState(detail, source.calcBase, CalcStateMap);
  1816. //序号唯一
  1817. _util.checkUnique(curTenderEle.constraints.feeItemNo, source.code,
  1818. `第${source.row}行`, `清单编码${source.code}`);
  1819. chargeTaxEle.children.push(new FeeItem(source));
  1820. }
  1821. return chargeTaxEle;
  1822. }
  1823. /*
  1824. * 加载主要清单明细
  1825. * @param {Obejct}parent(设置到的父项:主要清单汇总元素) {Object}detail
  1826. * @return {void}
  1827. * */
  1828. function loadMainBillsItems(parent, detail) {
  1829. let mainBills = detail.Bills.datas.filter(data => {
  1830. let billsNode = detail.Bills.tree.nodes[`${detail.Bills.tree.prefix}${data.ID}`];
  1831. return data.mainBills && billsNode && billsNode.children.length === 0;
  1832. });
  1833. for (let bills of mainBills) {
  1834. let source = {
  1835. code: bills.code,
  1836. name: bills.name,
  1837. unit: bills.unit,
  1838. quantity: bills.quantity,
  1839. fees: bills.fees,
  1840. remark: bills.remark
  1841. };
  1842. let mainBillsItemEle = new MainBillsItem(source);
  1843. //主要清单明细项目编码唯一
  1844. _util.checkUnique(curTenderEle.constraints.mainBillsCode, source.code, '主要清单明细项目编码');
  1845. parent.children.push(mainBillsItemEle);
  1846. }
  1847. }
  1848. /*
  1849. * 加载人材机汇总相关:人材机汇总、评标、暂估
  1850. * @param {Object}appraisalSummary(建设项目下的评审材料汇总) {Object}detail
  1851. * @return {Object}
  1852. * */
  1853. function loadGlj(appraisalSummary, detail) {
  1854. let gljList = detail.projectGLJ.datas.gljList;
  1855. let evalBidSeq = 1, //评标序号
  1856. evalEstSeq = 1; //暂估序号
  1857. if (gljList.length > 0) {
  1858. //创建人材机汇总节点
  1859. let gljSummary = new GljSummary();
  1860. //创建评标材料表节点
  1861. let evalBidMaterial = new EvalBidMaterial();
  1862. //创建暂估价材料表节点
  1863. let evalEstimateMaterial = new EvalEstimateMaterial();
  1864. //人材机节点
  1865. let allGljs = gljUtil.sortRationGLJ(gljList); //人材机汇总排序
  1866. //计算总消耗量
  1867. gljUtil.calcProjectGLJQuantity(detail.projectGLJ.datas,
  1868. detail.ration_glj.datas, detail.Ration.datas, detail.Bills.datas, detail.projectInfo.property.decimal.glj.quantity, _, scMathUtil);
  1869. //类型-配比类别映射
  1870. let ratioMapping = {
  1871. '202': '1', //为“混凝土”时,取“1”;
  1872. '205': '2', //为“商品混凝土”时,取“2”;
  1873. '203': '3', //为“砂浆”时,取“3”;
  1874. '206': '4', //为“商品砂浆”时,取“4”;
  1875. '204': '5' //为“配合比”时,取“5”
  1876. };
  1877. //三材类别-主要材料类别映射 三材类型:钢材1、钢筋2、木材3、水泥4、商品砼5、商品砂浆6
  1878. let mainMaterialMapping = {
  1879. '1': '100', //为“钢材”、“钢筋”时,取“100”;
  1880. '2': '100',
  1881. '4': '200', //为“水泥”时,取“200”;
  1882. '3': '300', //为“木材”时,取“300”;
  1883. '5': '400', //为“商品砼”、商品砂浆”时,取“400”。
  1884. '6': '400'
  1885. };
  1886. for (let glj of allGljs) {
  1887. let price = gljUtil.getGLJPrice(glj, detail.projectGLJ.datas,
  1888. detail.projectInfo.property.calcOptions, detail.labourCoe.datas, detail.projectInfo.property.decimal, false, _, scMathUtil);
  1889. //调整价
  1890. /*let adjPrice = gljUtil.getAdjustPrice(glj, detail.projectGLJ.datas,
  1891. detail.projectInfo.property.calcOptions, detail.labourCoe.datas, detail.projectInfo.property.decimal, false, _, scMathUtil);*/
  1892. let adjPrice = 0;
  1893. //获取人材机费用类别: 1=人工费 2=材料费 3=机械费 4=未计价费
  1894. let feeType = String(glj.type)[0];
  1895. if (feeType && !['1', '2', '3'].includes(feeType)) {
  1896. feeType = '4';
  1897. }
  1898. let gljSource = {
  1899. //code: glj.code,
  1900. code: getGljCode(glj.id),
  1901. name: glj.name,
  1902. specs: glj.specs,
  1903. unit: glj.unit,
  1904. orgCode: glj.code, //不取原始编码了,直接取编码
  1905. feeType: feeType,
  1906. ratioType: ratioMapping[glj.type],
  1907. mainMaterialType: mainMaterialMapping[glj.materialType],
  1908. materialCoe: glj.materialCoe,
  1909. supply: glj.supply === 2 ? 2 : 1, //供货方式为“完全甲供”,取“2”;否则取“1”。
  1910. is_evaluate: !!glj.is_evaluate,
  1911. no_tax_eqp: !!glj.no_tax_eqp,
  1912. notFromDetail: !glj.ratio_data.length, //单价不从明细汇总标志,如果有配比组成,取“false”;否则取“true”。
  1913. basePrice: price.basePrice,
  1914. adjPrice: adjPrice,
  1915. marketPrice: price.marketPrice,
  1916. quantity: glj.quantity,
  1917. originPlace: glj.originPlace,
  1918. vender: glj.vender,
  1919. qualityGrace: glj.qualityGrace,
  1920. brand: glj.brand,
  1921. remark: glj.remark
  1922. };
  1923. let gljEle = new Glj(gljSource);
  1924. //人材机代码唯一
  1925. _util.checkUnique(curTenderEle.constraints.gljCode, gljSource.code, '人材机代码', gljSource.orgCode);
  1926. //人材机配比
  1927. let connectKey = gljUtil.getIndex(glj, gljKeyArray),
  1928. ratioData = detail.projectGLJ.datas.mixRatioMap[connectKey];
  1929. if (ratioData && Array.isArray(ratioData)) {
  1930. for (let ratio of ratioData) {
  1931. let pGLJ = detail.projectGLJ.datas.gljList.find(d => d.original_code === ratio.code);
  1932. if (pGLJ) {
  1933. let gljRatio = new GljRatio({code: getGljCode(pGLJ.id), quantity: ratio.consumption});
  1934. gljEle.children.push(gljRatio);
  1935. }
  1936. }
  1937. }
  1938. gljSummary.children.push(gljEle);
  1939. gljSource.totalPrice = scMathUtil.roundForObj(gljSource.quantity * gljSource.marketPrice,
  1940. detail.projectInfo.property.decimal.bills.totalPrice);
  1941. //评标和暂估材料表下的材料明细中的人材机代码,要求单位工程内唯一,由于人材机汇总也有这个限制,所以这里不再处理
  1942. if (glj.is_eval_material) { //评标
  1943. gljSource.serialNo = evalBidSeq++;
  1944. evalBidMaterial.children.push(new MaterialDetail(gljSource));
  1945. //给建设项目下的评审材料汇总设置明细数据,这里需要检测代码(编号)唯一性,因为是汇总所有单位工程的,要求所有单位工程内评审材料代码唯一
  1946. appraisalSummary.children.push(new AppraisalDetail(gljSource));
  1947. _util.checkUnique(curTenderEle.constraints.appraisalDetailCode, gljSource.code, '评审材料明细代码', gljSource.orgCode);
  1948. }
  1949. if (glj.is_evaluate) { //暂估
  1950. gljSource.serialNo = evalEstSeq++;
  1951. evalEstimateMaterial.children.push(new MaterialDetail(gljSource));
  1952. }
  1953. }
  1954. return {gljSummary, evalBidMaterial, evalEstimateMaterial};
  1955. }
  1956. }
  1957. /*
  1958. * 加载清单综合单价计算程序
  1959. * */
  1960. function loadCalcProgram(detail) {
  1961. let calcProgram = detail.calcProgram;
  1962. if (!calcProgram) {
  1963. return null;
  1964. }
  1965. let calcProramTemplates = calcProgram.templates;
  1966. if (!Array.isArray(calcProramTemplates) || calcProramTemplates.length === 0) {
  1967. return null;
  1968. }
  1969. //创建清单综合单价计算程序
  1970. let calcProgramEle = new CalcProgram();
  1971. //创建综合单价计算程序文件
  1972. for (let calcFile of calcProramTemplates) {
  1973. let calcFileEle = new CalcProgramFile({ID: calcFile.ID, name: calcFile.name});
  1974. //创建计算程序费用项
  1975. for (let calcItem of calcFile.calcItems) {
  1976. let idx = calcFile.calcItems.indexOf(calcItem);
  1977. //如果是有[]的基数则转换为其简称,如“[定额人工费]”对应的检查是"RGF"
  1978. let calcBase = calcItem.dispExpr.replace(/\[[\u4e00-\u9fa5]+\]/g, str => rationBaseShort[str] ? rationBaseShort[str] : '');
  1979. let feeType = calcProgram.feeTypes.find(data => data.type === calcItem.fieldName);
  1980. feeType = feeType ? feeType.code : '1800';
  1981. let source = {
  1982. serialNo: idx + 1,
  1983. rowCode: `F${idx + 1}`,
  1984. name: calcItem.name,
  1985. calcBase: calcBase,
  1986. statement: calcItem.statement,
  1987. feeRate: _util.hasValue(calcItem.feeRate) ? calcItem.feeRate : 100,
  1988. feeType: feeType,
  1989. remark: calcItem.memo
  1990. };
  1991. let calcItemEle = new CalcProgramFeeItem(source);
  1992. calcFileEle.children.push(calcItemEle);
  1993. }
  1994. if (calcFileEle.children.length > 0) { //计算程序文件必须有费用项
  1995. calcProgramEle.children.push(calcFileEle);
  1996. }
  1997. }
  1998. return calcProgramEle.children.length > 0 ? calcProgramEle : null;
  1999. }
  2000. /*
  2001. * 转换导出数据
  2002. * @param {Number}tenderID(当前界面的单位工程ID,后台根据这个单位工程,根据导出粒度去找其建设项目下相关数据)
  2003. * @param {Number}curExportKind(导出的文件类型:1-投标 2-招标 3-控制价)
  2004. * @return {void}
  2005. * */
  2006. this.transformData = async function (tenderID, curExportKind) {
  2007. if (curExportKind) {
  2008. exportKind = parseInt(curExportKind);
  2009. }
  2010. let eleData = await loadProject(tenderID);
  2011. if (!eleData) {
  2012. return;
  2013. }
  2014. console.log(eleData);
  2015. this.originalDatas.push({data: eleData, fileName: `重庆标准交换数据(${FILE_KIND[exportKind]}).QTF`});
  2016. };
  2017. }
  2018. })();