exportStandardInterface.js 122 KB

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