exportStdInterface_gd18.js 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691
  1. /**
  2. *
  3. *
  4. * @author Zhong
  5. * @date 2019/6/24
  6. * @version
  7. */
  8. /*
  9. * 广东建设工程政府投资项目造价数据标准3.0
  10. * */
  11. const XMLStandard = (function () {
  12. // 广东18的导出文件中,需要把建设项目和单位工程文件分开
  13. // 数据类别,辨别提取的数据,哪份是以建设项目为根元素,哪份以单位工程为根元素
  14. const DATA_TYPE = {
  15. 'project': 1,
  16. 'tender': 2,
  17. };
  18. // 建设性质
  19. const ConstructionType = {
  20. '新建': '1',
  21. '扩建': '2',
  22. '改建': '3',
  23. '修缮': '4',
  24. '修复': '5',
  25. '维护保养': '6',
  26. '其他': '9',
  27. };
  28. // 造价类型
  29. const CostType = {
  30. '投资估算': '1',
  31. '设计概算': '2',
  32. '施工图预算': '3',
  33. '招标工程量清单': '4',
  34. '招标控制价(最高投标限价)': '5',
  35. '投标报价': '6',
  36. '签约合同价': '7',
  37. '竣工结算价': '8',
  38. };
  39. // 软件中的文件类型与造假类型映射
  40. const FileKind = {
  41. '1': '6', // 投标
  42. '2': '4', // 招标
  43. '3': '5', // 控制价
  44. };
  45. // 计价模式
  46. const ValuationModel = {
  47. 'bill': '1', // 清单计价
  48. 'ration': '2', // 定额计价
  49. };
  50. // 地区类别
  51. const AreaKind = {
  52. '一类地区': '1',
  53. '二类地区': '2',
  54. '三类地区': '3',
  55. '四类地区': '4',
  56. };
  57. // 专业类别
  58. const Specialty = {
  59. '房屋建筑与装饰工程': '1',
  60. '仿古建筑': '2',
  61. '通用安装工程': '3',
  62. '市政工程': '4',
  63. '园林绿化': '5',
  64. '矿山': '6',
  65. '构筑物': '7',
  66. '城市轨道交通工程': '8',
  67. '爆破': '9',
  68. '装饰装修': '10',
  69. '市政交通设施': '11',
  70. '市政养护': '12',
  71. '修缮': '13',
  72. '环卫': '14',
  73. '古建筑': '15',
  74. '节能': '16',
  75. '抗震加固': '17',
  76. '绿色建筑': '18',
  77. '工业建筑': '19',
  78. '地下管廊': '20',
  79. '装配式建筑': '21',
  80. '营造林': '22',
  81. '修复': '23',
  82. '其他': '99',
  83. };
  84. // 需要用到的费用字典,用固定类别来映射
  85. // 数据节选自标准pdf文件《《建设工程政府投资项目造价数据标准》信息公开版》,附录C-费用名称与费用代号
  86. // 若映射表中没有映射关系,则费用字典取名称首字母
  87. const FeeCodeMap = {
  88. // 分部分项工程,分部分项工程的子项,取项目名称的首字母拼接
  89. [fixedFlag.SUB_ENGINERRING]: 'QDF',
  90. // 措施项目
  91. [fixedFlag.MEASURE]: 'CSF',
  92. // 其他项目
  93. [fixedFlag.OTHER]: 'QTF',
  94. // 措施项目的子项
  95. [fixedFlag.GREEN_MEASURE_FEE]: 'AQWMSGF', // 绿色施工安全防护措施费
  96. [fixedFlag.OTHER_MEASURE_FEE]: 'QTCSF', // 其他措施费
  97. // 其他项目的子项
  98. [fixedFlag.PROVISIONAL]: 'ZLF', // 暂列金额
  99. [fixedFlag.ESTIMATE]: 'ZGJ', // 暂估价
  100. [fixedFlag.MATERIAL_PROVISIONAL]: 'ZGC', // 材料(工程设备)暂估价
  101. [fixedFlag.ENGINEERING_ESITIMATE]: 'ZGGC', // 专业工程暂估价
  102. [fixedFlag.DAYWORK]: 'LXF', // 计日工
  103. [fixedFlag.TURN_KEY_CONTRACT]: 'ZCBFWF', // 总承包服务费
  104. [fixedFlag.BUDGET_INCLUDE_WORK_FEE]: 'YSBGF', // 预算包干费
  105. [fixedFlag.PROJECT_HIGH_QUALITY_FEE]: 'GCYZF', // 工程优质费
  106. [fixedFlag.BUDGET_ESTIMATE_DIFF]: 'GSFDC', // 概算幅度差
  107. [fixedFlag.CLAIM]: 'SPFY', // 索赔费用
  108. [fixedFlag.VISA]: 'XCQZFY', // 现场签证
  109. [fixedFlag.OTHER_FEE]: 'QTFY', // 其他费用
  110. // 税金
  111. [fixedFlag.TAX]: 'SJ',
  112. // 工程造价
  113. [fixedFlag.ENGINEERINGCOST]: 'ZZJ',
  114. };
  115. // 章节类型
  116. const ChapterKind = {
  117. '章': '1',
  118. '节': '2',
  119. '细目': '3',
  120. '其他': '4',
  121. };
  122. // 汇总类型
  123. const SummrayKind = {
  124. 'summary': '1',
  125. 'notSummary': '2',
  126. };
  127. // 清单子目类型
  128. const BillsKind = {
  129. FBFX: '1',
  130. '模板及支架': '2',
  131. '脚手架': '3',
  132. '现场围挡': '4',
  133. '防尘降噪绿色施工防护': '5',
  134. OTHERS: '6',
  135. };
  136. // 取费类型
  137. const CalcKind = {
  138. '地上工程': '1',
  139. '地下明(盖)挖工程': '2',
  140. '地下暗挖工程': '3',
  141. '盾构工程': '4',
  142. '轨道工程': '5',
  143. '通信工程': '6',
  144. '信号工程': '7',
  145. '供电工程': '8',
  146. '智能与控制系统工程': '9',
  147. '机电工程': '10',
  148. '其他': '15',
  149. };
  150. // 费用归属
  151. const CostKind = {
  152. '建筑工程费': '1',
  153. '安装工程费': '2',
  154. '其他': '3',
  155. };
  156. // 计算方式
  157. const CalcType = {
  158. 'quantityMulTotalUnitPrice': '1', // 工程量×综合单价
  159. 'formulaAddFeeRate': '2', // 计算基数×费率
  160. 'quantityMulUnitPrice': '3', // 工程量×单价
  161. };
  162. // 降效类型 建筑装饰工程定额超高降效费用计算标记
  163. const EfficiencyKind = {
  164. 'baseReduction': '1', // 降效基础定额
  165. 'notReduction': '2', // 非降效定额
  166. 'marketPriceReduction': '3', // 按市场价计算降效费用定额
  167. 'rationPriceReduction': '4', // 按定额价计算降效费用定额
  168. };
  169. // 子目增加费类型 安装工程定额子目增加费的费用计算标记
  170. const IncFeeKind = {
  171. 'subBase': '1', // 子目增加费基础定额
  172. 'notSubBase': '2', // 非子目增加费定额
  173. 'subCalc': '3', // 子目增加费用计算定额
  174. };
  175. // 工料机类型
  176. const GLJKind = {
  177. };
  178. // 供料方式
  179. const Provider = {
  180. }
  181. // 通用设置和工具
  182. const _base = XML_EXPORT_BASE;
  183. const _config = _base.CONFIG;
  184. const _type = _config.TYPE;
  185. const _util = _base.UTIL;
  186. const _cache = _base.CACHE;
  187. /*
  188. * 提取数据入口
  189. * @param {String}userID 用户ID
  190. * {Number}exportKind 导出类型(投标1、招标2、控制价3
  191. * {Object}projectData 项目数据(项目自身的数据、建设、单项、单位的数据(projects表的数据),不包含详细的清单定额等数据)
  192. * @return {Array} [{data: Object, exportKind: Number, fileName: String}]
  193. * */
  194. async function entry(userID, exportKind, projectData) {
  195. // name为导出的xml节点属性名称 dName为可能需要显示给用户属性时使用的名称,比如自检提示的时候用,这里只有required为true时需要设置dName
  196. // 获取工程类型:枚举单位工程的工程专业+费用标准,用“;”分隔
  197. function getProjectType(projectData) {
  198. // 工程类型 工程专业+费用标准
  199. return projectData.children.reduce((acc, eng) => {
  200. const tenderProjectTypeArr = eng.children.reduce((acc, tender) => {
  201. const engineeringName = tender.property.engineeringName.replace('工程', '');
  202. const feeStandardName = tender.property.feeStandardName;
  203. acc.push(`${engineeringName}${feeStandardName}`);
  204. return acc;
  205. }, []);
  206. acc.push(...tenderProjectTypeArr);
  207. return acc;
  208. }, []).join(';');
  209. }
  210. // 获取费用字典
  211. function getFeeCode(data) {
  212. const flag = data.flagsIndex && data.flagsIndex.fixed ? data.flagsIndex.fixed.flag : null;
  213. const name = data.name || '';
  214. return FeeCodeMap[flag] || pinyinUtil.getFirstLetter(name);
  215. }
  216. // 获取定额册 取定额编号开头字母后面、-前面的数字,没有则取0
  217. // 如: A2-1-1 则册为2
  218. function getVolume(code) {
  219. if (!code) {
  220. return '0';
  221. }
  222. const reg = /^[A-Za-z](\d+)(?=-)/;
  223. const rst = reg.exec(code);
  224. return rst ? rst[1] : '0';
  225. }
  226. // 获取定额章 取定额编号第一个-和第二个-之间的数字
  227. // 如: A1-2-3 则章为2
  228. function getChapter(code) {
  229. if (!code) {
  230. return '0';
  231. }
  232. const reg = /^[A-Za-z]\d+-(\d+)(?=-)/;
  233. const rst = reg.exec(code);
  234. return rst ? rst[1] : '0';
  235. }
  236. // 建设项目
  237. function ConstructionProject(projectData) {
  238. const basicInformation = projectData.property.basicInformation;
  239. const attrs = [
  240. // 项目编号
  241. {
  242. name: 'Number', dName: '项目编号', required: true,
  243. value: ''
  244. },
  245. // 项目名称
  246. {
  247. name: 'Name', dName: '项目名称', required: true,
  248. value: projectData.name
  249. },
  250. // 工程类别
  251. {
  252. name: 'ProjectCategory', dName: '工程类别', required: true,
  253. value: _util.getValueByKey(basicInformation, 'projectCategory')
  254. },
  255. // 工程类型
  256. {
  257. name: 'ProjectType', dName: '工程类型', required: true,
  258. value: getProjectType(projectData)
  259. },
  260. // 建设性质
  261. {
  262. name: 'ConstructionType', type: _type.INT, enumeration: Object.keys(ConstructionType),
  263. value: ConstructionType[_util.getValueByKey(basicInformation, 'constructionType')]
  264. },
  265. // 文件类型
  266. {
  267. name: 'FileKind', dName: '造价类型', type: _type.INT, required: true, enumeration: Object.keys(CostType),
  268. value: FileKind[exportKind]
  269. },
  270. // 计价模式
  271. {
  272. name: 'ValuationModel', dName: '计价模式', type: _type.INT, required: true,
  273. value: ValuationModel.bill
  274. },
  275. // 计税模式
  276. {
  277. name: 'TaxModel', dName: '计税模式', type: _type.INT, required: true,
  278. value: projectData.property.taxType
  279. },
  280. // 地区类别
  281. {
  282. name: 'AreaKind', dName: '地区类别', type: _type.INT, required: true, enumeration: Object.keys(AreaKind),
  283. value: _util.getValueByKey(basicInformation, 'regionalCategories')
  284. },
  285. // 工程地点
  286. {
  287. name: 'ProjectSite',
  288. value: _util.getValueByKey(basicInformation, 'projLocation')
  289. },
  290. // 建设单位
  291. {
  292. name: 'BuildUnit', dName: '建设单位', required: true,
  293. value: _util.getValueByKey(basicInformation, 'constructingUnits')
  294. },
  295. // 建设单位法定代表人或其授权人
  296. {
  297. name: 'BulidAuthorizer',
  298. value: _util.getValueByKey(basicInformation, 'constructingUnitsPerson')
  299. },
  300. // 数据交换标准名称
  301. {
  302. name: 'StandardName', required: true,
  303. value: '建设工程政府投资项目造价数据标准'
  304. },
  305. // 数据交换标准编号
  306. {
  307. name: 'StandardNumber', required: true,
  308. value: 'DBJ/T XX-XX-2018'
  309. },
  310. // 建设(编制)范围
  311. {
  312. name: 'RangeOfCompilation',
  313. value: _util.getValueByKey(basicInformation, 'rangeOfCompilation')
  314. },
  315. // 建设规模
  316. {
  317. name: 'Scale', dName: '工程规模', type: _type.DECIMAL, required: true,
  318. value: _util.getValueByKey(basicInformation, 'projectScale')
  319. },
  320. // 建设规模单位
  321. {
  322. name: 'Unit', dName: '建设规模单位', required: true,
  323. value: _util.getValueByKey(basicInformation, 'unit')
  324. },
  325. // 技术经济指标(元) 取单方造价
  326. {
  327. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  328. value: summaryInfo.perCost
  329. },
  330. // 总说明 编制说明
  331. {
  332. name: 'Explains',
  333. value: projectData.property.compilationIllustration
  334. }
  335. ];
  336. //唯一约束
  337. this.constraints = {
  338. billsCode: [], //清单项目项目编码(xsd中没体现,通过跟pm沟通得知)
  339. };
  340. _base.Element.call(this, 'ConstructionProject', attrs);
  341. }
  342. // 系统信息
  343. function SystemInfo({ ID1, ID2, makeDate }) {
  344. const attrs = [
  345. // 编制软件信息
  346. { name: 'ID1', value: ID1 },
  347. // 编制机器硬件信息,不输出
  348. { name: 'ID2', value: ID2 },
  349. // 文件生成时间
  350. {
  351. name: 'MakeDate', dName: '文件生成时间', type: _type.DATE_TIME, required: true,
  352. value: makeDate
  353. }
  354. ];
  355. _base.Element.call(this, 'SystemInfo', attrs);
  356. }
  357. // 工程信息
  358. function ConstructionInfo() {
  359. _base.Element.call(this, 'ConstructionInfo', []);
  360. }
  361. // 费用精度
  362. function Option() {
  363. const attrs = [
  364. // 工料机消耗量、含量、用量类小数精度
  365. {
  366. name: 'ResPrecision', type: _type.INT, required: true,
  367. value: 4
  368. },
  369. // 工程量、数量类小数精度
  370. {
  371. name: 'QuantityPrecision', type: _type.INT, required: true,
  372. value: 3
  373. },
  374. // 金额、合价、费用类小数精度
  375. {
  376. name: 'CostPrecision', type: _type.INT, required: true,
  377. value: 2
  378. },
  379. // 费率、指数、比例(%)类小数精度
  380. {
  381. name: 'RatePrecision', type: _type.INT, required: true,
  382. value: 3
  383. }
  384. ];
  385. _base.Element.call(this, 'Option', attrs);
  386. }
  387. // 估(概、预、结)算信息
  388. function ProjectInfo(basicInformation, summaryInfo) {
  389. const attrs = [
  390. // 设计单位
  391. { name: 'Designer', value: _util.getValueByKey(basicInformation, 'designUnits') },
  392. // 承包单位
  393. { name: 'Contractor', value: _util.getValueByKey(basicInformation, 'constructionUnits') },
  394. // 编制单位
  395. {
  396. name: 'CompileCompany', dName: '编制单位', required: true,
  397. value: _util.getValueByKey(basicInformation, 'establishUnit') || '无'
  398. },
  399. // 编制单位法定代表人或其授权人
  400. { name: 'Authorizer', value: _util.getValueByKey(basicInformation, 'constructingUnitsPerson') },
  401. // 编制人
  402. { name: 'Compiler', value: _util.getValueByKey(basicInformation, 'establishUnitAuthor') },
  403. // 编制人资格证书编号
  404. { name: 'CompilerCertNo', value: _util.getValueByKey(basicInformation, 'establishDate') },
  405. // 编制时间
  406. {
  407. name: 'CompileDate', dName: '编制时间', required: true,
  408. value: 'todo',
  409. },
  410. // 审核人
  411. { name: 'Examiner', value: _util.getValueByKey(basicInformation, 'auditUnitAuditor') },
  412. // 审核人资格证书编号
  413. { name: 'ExaminerCertNo', value: _util.getValueByKey(basicInformation, 'ExaminerCertNo') },
  414. // 审核时间
  415. { name: 'ExamineDate', value: _util.getValueByKey(basicInformation, 'auditDate') },
  416. // 审定人
  417. { name: 'Approver', value: _util.getValueByKey(basicInformation, 'Approver') },
  418. // 审定人资格证书编号
  419. { name: 'ApproverCertNo', value: _util.getValueByKey(basicInformation, 'ApproverCertNo') },
  420. // 审定时间
  421. { name: 'ApproverDate', value: _util.getValueByKey(basicInformation, 'ApproverDate') },
  422. // 工程总价(元)
  423. {
  424. name: 'Total', dName: '工程总价', type: _type.DECIMAL, required: true,
  425. value: summaryInfo.engineeringCost || '0'
  426. }
  427. ];
  428. _base.Element.call(this, 'ProjectInfo', attrs);
  429. }
  430. // 招标信息 工程量清单、招标控制价时输出
  431. function TendereeInfo(basicInformation) {
  432. const attrs = [
  433. // 招标人
  434. {
  435. name: 'TendereeName', dName: '招标人', required: true,
  436. value: _util.getValueByKey(basicInformation, 'bidInviter')
  437. },
  438. // 招标单位法定代表人或其授权人
  439. {
  440. name: 'TenderAuthorizer',
  441. value: _util.getValueByKey(basicInformation, 'tenderRepresentative')
  442. },
  443. // 招标单位编制人
  444. {
  445. name: 'TenderCompiler',
  446. value: _util.getValueByKey(basicInformation, 'TenderCompiler')
  447. },
  448. // 招标单位编制人资格证书编号
  449. {
  450. name: 'TenderCompilerCertNo',
  451. value: _util.getValueByKey(basicInformation, 'TenderCompilerCertNo')
  452. },
  453. // 招标单位编制时间
  454. {
  455. name: 'TenderCompileDate',
  456. value: _util.getValueByKey(basicInformation, 'TenderCompileDate')
  457. },
  458. // 招标单位审核人
  459. {
  460. name: 'TenderExaminer',
  461. value: _util.getValueByKey(basicInformation, 'TenderExaminer')
  462. },
  463. // 招标单位审核人资格证书编号
  464. {
  465. name: 'TenderExaminerCertNo',
  466. value: _util.getValueByKey(basicInformation, 'TenderExaminerCertNo')
  467. },
  468. // 招标单位审核时间
  469. {
  470. name: 'TenderExamineDate',
  471. value: _util.getValueByKey(basicInformation, 'TenderExamineDate')
  472. },
  473. // 招标单位审定人
  474. {
  475. name: 'TenderApprover',
  476. value: _util.getValueByKey(basicInformation, 'TenderApprover')
  477. },
  478. // 招标单位审定人资格证书编号
  479. {
  480. name: 'TenderApproverCertNo',
  481. value: _util.getValueByKey(basicInformation, 'TenderApproverCertNo')
  482. },
  483. // 招标单位审定时间
  484. {
  485. name: 'TenderApproveDate',
  486. value: _util.getValueByKey(basicInformation, 'TenderApproveDate')
  487. },
  488. // 招标代理 不得为空,如无招标代理,则应填写“无”。
  489. {
  490. name: 'Proxy', dName: '招标代理',
  491. value: _util.getValueByKey(basicInformation, 'Proxy'), required: true
  492. },
  493. // 招标代理资质证书编号
  494. {
  495. name: 'ProxyCertNo',
  496. value: _util.getValueByKey(basicInformation, 'ProxyCertNo')
  497. },
  498. // 招标代理法定代表人或其授权人
  499. {
  500. name: 'ProxyAuthorizer',
  501. value: _util.getValueByKey(basicInformation, 'ProxyAuthorizer')
  502. },
  503. // 招标代理编制人员
  504. {
  505. name: 'ProxyCompiler',
  506. value: _util.getValueByKey(basicInformation, 'ProxyCompiler')
  507. },
  508. // 招标代理编制人员资格证书编号
  509. {
  510. name: 'ProxyCompilerCertNo',
  511. value: _util.getValueByKey(basicInformation, 'ProxyCompilerCertNo')
  512. },
  513. // 招标代理编制时间
  514. {
  515. name: 'ProxyCompileDate',
  516. value: _util.getValueByKey(basicInformation, 'ProxyCompileDate')
  517. },
  518. // 招标代理审核人
  519. {
  520. name: 'ProxyExaminer',
  521. value: _util.getValueByKey(basicInformation, 'ProxyExaminer')
  522. },
  523. // 招标代理审核人资格证书编号
  524. {
  525. name: 'ProxyExaminerCertNo',
  526. value: _util.getValueByKey(basicInformation, 'ProxyExaminerCertNo')
  527. },
  528. // 招标代理审核时间
  529. {
  530. name: 'ProxyExamineDate',
  531. value: _util.getValueByKey(basicInformation, 'ProxyExamineDate')
  532. },
  533. // 招标代理审定人
  534. {
  535. name: 'ProxyApprover',
  536. value: _util.getValueByKey(basicInformation, 'ProxyApprover')
  537. },
  538. // 招标代理审定人资格证书编号
  539. {
  540. name: 'ProxyApproverCertNo',
  541. value: _util.getValueByKey(basicInformation, 'ProxyApproverCertNo')
  542. },
  543. // 招标代理审定时间
  544. {
  545. name: 'ProxyApproveDate',
  546. value: _util.getValueByKey(basicInformation, 'ProxyApproveDate')
  547. },
  548. // 造价咨询 、Consultant(造价咨询):不得为空,如无则应填写“无”。
  549. {
  550. name: 'Consultant', dName: '造价咨询', required: true,
  551. value: _util.getValueByKey(basicInformation, 'Consultant')
  552. },
  553. // 造价咨询资质证书编号
  554. {
  555. name: 'ConsultantCertNo',
  556. value: _util.getValueByKey(basicInformation, 'ConsultantCertNo')
  557. },
  558. // 造价咨询法定代表人或其授权人
  559. {
  560. name: 'ConsultantAuthorizer',
  561. value: _util.getValueByKey(basicInformation, 'ConsultantAuthorizer')
  562. },
  563. // 造价咨询编制人
  564. {
  565. name: 'ConsultantCompiler',
  566. value: _util.getValueByKey(basicInformation, 'ConsultantCompiler')
  567. },
  568. // 造价咨询编制人资格证书
  569. {
  570. name: 'ConsultantCompilerCertNo',
  571. value: _util.getValueByKey(basicInformation, 'ConsultantCompilerCertNo')
  572. },
  573. // 造价咨询编制时间
  574. {
  575. name: 'ConsultantCompileDate',
  576. value: _util.getValueByKey(basicInformation, 'ConsultantCompileDate')
  577. },
  578. // 造价咨询审核人
  579. {
  580. name: 'ConsultantExaminer',
  581. value: _util.getValueByKey(basicInformation, 'ConsultantExaminer')
  582. },
  583. // 造价咨询审核人资格证书编号
  584. {
  585. name: 'ConsultantExaminerCertNo',
  586. value: _util.getValueByKey(basicInformation, 'ConsultantExaminerCertNo')
  587. },
  588. // 造价咨询审核时间
  589. {
  590. name: 'ConsultantExamineDate',
  591. value: _util.getValueByKey(basicInformation, 'ConsultantExamineDate')
  592. },
  593. // 造价咨询审定人
  594. {
  595. name: 'ConsultantApprover',
  596. value: _util.getValueByKey(basicInformation, 'ConsultantApprover')
  597. },
  598. // 造价咨询审定人资格证书编号
  599. {
  600. name: 'ConsultantApproverCertNo',
  601. value: _util.getValueByKey(basicInformation, 'ConsultantApproverCertNo')
  602. },
  603. // 造价咨询审定时间
  604. {
  605. name: 'ConsultantApproveDate',
  606. value: _util.getValueByKey(basicInformation, 'ConsultantApproveDate')
  607. },
  608. // 招标控制价(元)
  609. {
  610. name: 'TenderSumLimit', dName: '招标控制价', type: _type.DECIMAL, required: true,
  611. value: 'todo'
  612. }
  613. ];
  614. _base.Element.call(this, 'TendereeInfo', attrs);
  615. }
  616. // 投标信息
  617. function BidderInfo(basicInformation, summaryInfo) {
  618. const attrs = [
  619. // 投标人
  620. {
  621. name: 'BidName', dName: '投标人', required: true,
  622. value: _util.getValueByKey(basicInformation, 'bidName')
  623. },
  624. // 投标单位法定代表人或其授权人
  625. {
  626. name: 'BidAuthorizer',
  627. value: _util.getValueByKey(basicInformation, 'bidAuthorizer')
  628. },
  629. // 投标总价(元)
  630. {
  631. name: 'BidAuthorizer', dName: '投标总价', type: _type.DECIMAL, required: true,
  632. value: summaryInfo.engineeringCost
  633. },
  634. // 投标单位编制人
  635. {
  636. name: 'BidCompiler',
  637. value: _util.getValueByKey(basicInformation, 'bidCompiler')
  638. },
  639. // 投标单位编制人资格证书编号
  640. {
  641. name: 'BidCompilerCertNo',
  642. value: _util.getValueByKey(basicInformation, 'BidCompilerCertNo')
  643. },
  644. // 投标单位编制时间
  645. {
  646. name: 'BidCompileDate',
  647. value: _util.getValueByKey(basicInformation, 'bidCompileDate')
  648. },
  649. // 投标单位审核人
  650. {
  651. name: 'BidExaminer',
  652. value: _util.getValueByKey(basicInformation, 'bidExaminer')
  653. },
  654. // 投标单位审核人资格证书编号
  655. {
  656. name: 'BidExaminerCertNo',
  657. value: _util.getValueByKey(basicInformation, 'bidExaminerCertNo')
  658. },
  659. // 投标单位审核时间
  660. {
  661. name: 'BidExamineDate',
  662. value: _util.getValueByKey(basicInformation, 'bidExamineDate')
  663. },
  664. // 投标单位审定人
  665. {
  666. name: 'BidApprover',
  667. value: _util.getValueByKey(basicInformation, 'bidApprover')
  668. },
  669. // 投标单位审定人资格证书
  670. {
  671. name: 'BidApproverCertNo',
  672. value: _util.getValueByKey(basicInformation, 'bidApproverCertNo')
  673. },
  674. // 投标单位审定时间
  675. {
  676. name: 'BidApproveDate',
  677. value: _util.getValueByKey(basicInformation, 'BidApproveDate')
  678. }
  679. ];
  680. _base.Element.call(this, 'BidderInfo', attrs);
  681. }
  682. // 费用汇总
  683. function SummaryOfCost(summaryInfo) {
  684. const attrs = [
  685. // 工程造价(元)
  686. {
  687. name: 'Total', type: _type.DECIMAL,
  688. value: summaryInfo.engineeringCost
  689. },
  690. // 建筑工程费
  691. {
  692. name: 'Construction', type: _type.DECIMAL,
  693. value: '0'
  694. },
  695. // 安装工程费
  696. {
  697. name: 'Installation', type: _type.DECIMAL,
  698. value: '0',
  699. },
  700. // 分部分项工程费
  701. {
  702. name: 'DivisionalAndElementalWorks', type: _type.DECIMAL,
  703. value: summaryInfo.subEngineering
  704. },
  705. // 措施项目费
  706. {
  707. name: 'Preliminaries', type: _type.DECIMAL,
  708. value: summaryInfo.measure
  709. },
  710. // 绿色施工安全防护措施费
  711. {
  712. name: 'CostForHSE', type: _type.DECIMAL,
  713. value: summaryInfo.safetyConstruction
  714. },
  715. // 其他措施费
  716. {
  717. name: 'OtherPreliminaries', type: _type.DECIMAL,
  718. value: 'todo'
  719. },
  720. // 其他项目费
  721. {
  722. name: 'SundryCosts', type: _type.DECIMAL,
  723. value: summaryInfo.other
  724. },
  725. // 暂列金额
  726. {
  727. name: 'ProvisionalSums', type: _type.DECIMAL,
  728. value: summaryInfo.provisional
  729. },
  730. // 暂估价材料
  731. {
  732. name: 'ProvisionalMaterial', type: _type.DECIMAL,
  733. value: summaryInfo.materialProvisional
  734. },
  735. // 专业工程暂估价
  736. {
  737. name: 'SpecialtyProvisionalPrice', type: _type.DECIMAL,
  738. value: summaryInfo.engineeringEstimate
  739. },
  740. // 计日工费用
  741. {
  742. name: 'DayWorkRate', type: _type.DECIMAL,
  743. value: summaryInfo.daywork
  744. },
  745. // 总承包服务费
  746. {
  747. name: 'MainContractorAttendance', type: _type.DECIMAL,
  748. value: summaryInfo.turnKeyContract
  749. },
  750. // 索赔费用
  751. {
  752. name: 'ClaimForLossAndExpenses', type: _type.DECIMAL,
  753. value: summaryInfo.claim
  754. },
  755. // 现场签证费用
  756. {
  757. name: 'SiteInstruction', type: _type.DECIMAL,
  758. value: summaryInfo.visa
  759. },
  760. // 规费
  761. {
  762. name: 'StatutoryFees', type: _type.DECIMAL,
  763. value: '0'
  764. },
  765. // 税金
  766. {
  767. name: 'Tax', type: _type.DECIMAL,
  768. value: summaryInfo.tax
  769. },
  770. // 人工费
  771. {
  772. name: 'Labor', type: _type.DECIMAL,
  773. value: 'todo'
  774. },
  775. // 材料费
  776. {
  777. name: 'Material', type: _type.DECIMAL,
  778. value: 'todo'
  779. },
  780. // 设备费
  781. {
  782. name: 'Equipment', type: _type.DECIMAL,
  783. value: 'todo'
  784. },
  785. // 主材设备费
  786. {
  787. name: 'MainMaterialEquipment', type: _type.DECIMAL,
  788. value: 'todo'
  789. },
  790. // 主材费
  791. {
  792. name: 'MainMaterial', type: _type.DECIMAL,
  793. value: 'todo'
  794. },
  795. // 机械费
  796. {
  797. name: 'Machine', type: _type.DECIMAL,
  798. value: 'todo'
  799. },
  800. // 管理费
  801. {
  802. name: 'Overhead', type: _type.DECIMAL,
  803. value: 'todo'
  804. },
  805. // 利润
  806. {
  807. name: 'Profit', type: _type.DECIMAL,
  808. value: 'todo'
  809. },
  810. ];
  811. _base.Element.call(this, 'SummaryOfCost', attrs);
  812. }
  813. // 建筑安装工程费
  814. function ProjectInstallationWorkCost(projectData, summaryInfo) {
  815. const basicInformation = projectData.property.basicInformation;
  816. const attrs = [
  817. // 工程编号
  818. {
  819. name: 'Number',
  820. value: ''
  821. },
  822. // 工程名称
  823. {
  824. name: 'Name', required: true,
  825. value: projectData.name
  826. },
  827. // 金额 (元)
  828. {
  829. name: 'Total', type: _type.DECIMAL,
  830. value: summaryInfo.engineeringCost
  831. },
  832. // 建设规模
  833. {
  834. name: 'Scale', type: _type.DECIMAL, required: true,
  835. value: _util.getValueByKey(basicInformation, 'projectScale')
  836. },
  837. // 建设规模单位
  838. {
  839. name: 'Unit', required: true,
  840. value: _util.getValueByKey(basicInformation, 'todo')
  841. },
  842. // 占总投资比例(%)
  843. {
  844. name: 'Ratios', type: _type.DECIMAL,
  845. value: '0.00'
  846. },
  847. ];
  848. _base.Element.call(this, 'ProjectInstallationWorkCost', attrs);
  849. }
  850. // 单项工程
  851. function SectionWorks({ name, total, rate }) {
  852. const attrs = [
  853. // 工程编号
  854. {
  855. name: 'Number',
  856. value: ''
  857. },
  858. // 工程名称
  859. {
  860. name: 'Name', required: true,
  861. value: name
  862. },
  863. // 金额
  864. {
  865. name: 'Total', type: _type.DECIMAL,
  866. value: total
  867. },
  868. // 建设规模 单项工程没有填写的地方,输出“0”
  869. {
  870. name: 'Scale', dName: '建设规模', type: _type.DECIMAL, required: true,
  871. value: '0'
  872. },
  873. // 建设规模单位 单项工程没有填写的地方,输出和"m2"
  874. {
  875. name: 'Unit', dName: '建设规模单位', required: true,
  876. value: 'm2'
  877. },
  878. // 占总投资比例(%)
  879. {
  880. name: 'Ratios', type: _type.DECIMAL,
  881. value: rate
  882. },
  883. // 费用代号
  884. {
  885. name: 'Code', type: _type.DECIMAL,
  886. value: ''
  887. },
  888. ];
  889. _base.Element.call(this, 'SectionWorks', attrs);
  890. }
  891. // 单位工程
  892. function UnitWorks(projectData, tenderData, summaryInfo) {
  893. const basicInformation = projectData.property.basicInformation;
  894. const projectFeature = tenderData.property.projectFeature;
  895. const attrs = [
  896. // 工程编号
  897. {
  898. name: 'Number', required: true,
  899. value: ''
  900. },
  901. // 工程名称
  902. {
  903. name: 'Name', required: true,
  904. value: tenderData.name
  905. },
  906. // 标段 取建设项目名称
  907. {
  908. name: 'Segment',
  909. value: projectData.name
  910. },
  911. // 工程类别
  912. {
  913. name: 'ProjectCategory', required: true,
  914. value: _util.getValueByKey(basicInformation, 'projectCategory')
  915. },
  916. // 工程类型
  917. {
  918. name: 'ProjectType', required: true,
  919. value: getProjectType(projectData)
  920. },
  921. // 计价模式
  922. {
  923. name: 'ValuationModel', type: _type.INT, required: true,
  924. value: VALUATION_MODEL.bill
  925. },
  926. // 计税模式
  927. {
  928. name: 'TaxModel', type: _type.INT, required: true,
  929. value: tenderData.property.taxType
  930. },
  931. // 地区类别 取建设项目-基本信息-地区类别
  932. {
  933. name: 'AreaKind', type: _type.INT, required: true,
  934. value: _util.getValueByKey(basicInformation, 'regionalCategories')
  935. },
  936. // 金额
  937. {
  938. name: 'Total', type: _type.DECIMAL,
  939. value: summaryInfo.engineeringCost
  940. },
  941. // 专业类别
  942. {
  943. name: 'Specialty', type: _type.INT,
  944. value: Specialty[tenderData.property.engineeringName]
  945. },
  946. // 工程用途
  947. {
  948. name: 'Purposes',
  949. value: ''
  950. },
  951. //建设(编制)范围
  952. {
  953. name: 'RangeOfCompilation',
  954. value: ''
  955. },
  956. // 建设规模 取单位工程-工程特征-建设规模
  957. {
  958. name: 'Scale', type: _type.DECIMAL, required: true,
  959. value: _util.getValueByKey(projectFeature, 'buildScale')
  960. },
  961. // 建设规模单位
  962. {
  963. name: 'Unit', required: true,
  964. value: 'todo'
  965. },
  966. // 占总投资比例(%)
  967. {
  968. name: 'Ratios', type: _type.DECIMAL,
  969. value: src.summaryInfo.rate
  970. },
  971. // 清单数据库,没有则填写 “无”
  972. {
  973. name: 'BillDataBase', required: true,
  974. value: '工程量清单规范(2013广东)',
  975. },
  976. // 定额数据库,没有则填写 “无”,后续获取详细数据(getTenderDetail)的时候填上
  977. {
  978. name: 'NormDataBase', required: true,
  979. value: '无'
  980. },
  981. // 人工材料设备价格文件,没有则填写 “无”
  982. {
  983. name: 'ResInfoPricingFile', required: true,
  984. value: '无'
  985. },
  986. // 总说明
  987. {
  988. name: 'Explains',
  989. value: tenderData.property.compilationIllustrationProject
  990. },
  991. // 导出XML文件名,工程编号+工程名称.xml, 暂时取“名称.xml”,用户设置完工程编号后修改此值
  992. {
  993. name: 'FileName',
  994. value: `${tenderData.name}.xml`
  995. },
  996. // 备注
  997. {
  998. name: 'Remark',
  999. value: ''
  1000. },
  1001. ];
  1002. _base.Element.call(this, 'UnitWorks', attrs);
  1003. }
  1004. // 工程特征信息 AttrInfo, 补充信息AddiInfo
  1005. function Info(eleName) {
  1006. _base.Element.call(this, eleName, []);
  1007. }
  1008. // 工程特征信息明细 AttrInfoItem, 补充信息明细AddiInfoItem
  1009. function InfoItem(eleName, attr) {
  1010. const attrs = [
  1011. {
  1012. name: 'Name', required: true,
  1013. value: attr.dispName,
  1014. },
  1015. { name: 'Value', value: attr.value },
  1016. ];
  1017. if (attr.code) {
  1018. attrs.push({ name: 'Code', value: attr.code });
  1019. }
  1020. if (attr.remark) {
  1021. attrs.push({ name: 'Remark', value: attr.remark });
  1022. }
  1023. _base.Element.call(this, eleName, attrs);
  1024. }
  1025. // 单位工程费用汇总
  1026. function UnitWorksSummary() {
  1027. _base.Element.call(this, 'UnitWorksSummary', []);
  1028. }
  1029. // 单位工程费用汇总标题
  1030. function UnitWorksSummaryGroup(bills) {
  1031. const attrs = [
  1032. // 费用编号
  1033. { name: 'Number', value: bills.code },
  1034. // 费用名称
  1035. {
  1036. name: 'Name', required: true,
  1037. value: bills.name
  1038. },
  1039. // 单位
  1040. { name: 'Unit', value: bills.unit },
  1041. // 工程量
  1042. {
  1043. name: 'Quantity', type: _type.DECIMAL,
  1044. value: bills.quantity
  1045. },
  1046. // 金额
  1047. {
  1048. name: 'Total', type: _type.DECIMAL,
  1049. value: _util.getFee(bills.fees, 'common.totalFee')
  1050. },
  1051. // 技术经济指标(元) 取综合单价
  1052. {
  1053. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1054. value: _util.getFee(bills.fees, 'common.unitFee')
  1055. },
  1056. //章节类型
  1057. {
  1058. name: 'ChapterKind', type: _type.INT, required: true,
  1059. value: '4'
  1060. },
  1061. // 费用代号
  1062. {
  1063. name: 'Code', type: _type.INT, required: true,
  1064. value: getFeeCode(bills)
  1065. },
  1066. // 汇总类型
  1067. {
  1068. name: 'Kind', type: _type.INT, required: true,
  1069. value: '1'
  1070. },
  1071. // 备注
  1072. { name: 'Remark', value: bills.remark }
  1073. ];
  1074. _base.Element.call(this, 'UnitWorksSummaryGroup', attrs);
  1075. }
  1076. // 单位工程费汇总明细
  1077. function UnitWorksSummaryItem(bills) {
  1078. const attrs = [
  1079. { name: 'Number', value: bills.code },
  1080. {
  1081. name: 'Name', required: true,
  1082. value: bills.name
  1083. },
  1084. { name: 'Unit', value: bills.unit },
  1085. {
  1086. name: 'Quantity', type: _type.DECIMAL,
  1087. value: bills.quantity
  1088. },
  1089. // 计算基数:可由费用代号、数字、四则运算符号、小括号组成
  1090. {
  1091. name: 'QtyFormula', type: _type.DECIMAL,
  1092. value: 'todo'
  1093. },
  1094. // 费率
  1095. {
  1096. name: 'Rate', type: _type.DECIMAL,
  1097. value: commonUtil.isDef(bills.feeRate) ? bills.feeRate : '100'
  1098. },
  1099. {
  1100. name: 'Total', type: _type.DECIMAL,
  1101. value: _util.getFee(bills.fees, 'common.totalFee')
  1102. },
  1103. // 技术经济指标(元)
  1104. {
  1105. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1106. value: _util.getFee(bills.fees, 'common.unitFee')
  1107. },
  1108. //章节类型
  1109. {
  1110. name: 'ChapterKind', type: _type.INT, required: true,
  1111. value: '4'
  1112. },
  1113. // 费用代号
  1114. {
  1115. name: 'Code', type: _type.INT, required: true,
  1116. value: getFeeCode(bills)
  1117. },
  1118. // 汇总类型
  1119. {
  1120. name: 'Kind', type: _type.INT, required: true,
  1121. value: '1'
  1122. },
  1123. // 备注
  1124. { name: 'Remark', value: bills.remark }
  1125. ];
  1126. _base.Element.call(this, 'UnitWorksSummaryItem', attrs);
  1127. }
  1128. // 分部分项工程
  1129. function DivisionalAndElementalWorks() {
  1130. _base.Element.call(this, 'DivisionalAndElementalWorks', []);
  1131. }
  1132. // 合计费用
  1133. function SummaryOfBasicCost(items, bills) {
  1134. // 省略了一些
  1135. const attrs = [
  1136. // 人工费
  1137. {
  1138. name: 'Labor', type: _type.DECIMAL,
  1139. value: _util.getFee(bills.fees, 'labour.totalFee')
  1140. },
  1141. // 材料费
  1142. {
  1143. name: 'Material', type: _type.DECIMAL,
  1144. value: _util.getFee(bills.fees, 'material.totalFee')
  1145. },
  1146. // 主材费
  1147. {
  1148. name: 'MainMaterial', type: _type.DECIMAL,
  1149. value: _util.getFee(bills.fees, 'mainMaterial.totalFee')
  1150. },
  1151. // 主材设备费
  1152. {
  1153. name: 'MainMaterialEquipment', type: _type.DECIMAL,
  1154. value: 'todo'
  1155. },
  1156. // 暂估价
  1157. {
  1158. name: 'Appraisal', type: _type.DECIMAL,
  1159. value: 'todo'
  1160. },
  1161. // 机械费
  1162. {
  1163. name: 'Machine', type: _type.DECIMAL,
  1164. value: _util.getFee(bills.fees, 'machine.totalFee')
  1165. },
  1166. // 管理费
  1167. {
  1168. name: 'Overhead', type: _type.DECIMAL,
  1169. value: _util.getFee(bills.fees, 'manage.totalFee')
  1170. },
  1171. // 利润
  1172. {
  1173. name: 'Profit', type: _type.DECIMAL,
  1174. value: _util.getFee(bills.fees, 'profit.totalFee')
  1175. },
  1176. // 分部分项工程费
  1177. {
  1178. name: 'DivisionalAndElementalWorks', type: _type.DECIMAL,
  1179. value: _util.getFeeByFlag(items, fixedFlag.SUB_ENGINERRING, 'mainMaterial.totalFee')
  1180. },
  1181. // 措施项目费
  1182. {
  1183. name: 'Preliminaries', type: _type.DECIMAL,
  1184. value: _util.getFeeByFlag(items, fixedFlag.MEASURE, 'mainMaterial.totalFee')
  1185. },
  1186. // 绿色施工安全防护措施费
  1187. {
  1188. name: 'CostForHSE',type: _type.DECIMAL,
  1189. value: _util.getFeeByFlag(items, fixedFlag.GREEN_MEASURE_FEE, 'mainMaterial.totalFee')
  1190. },
  1191. // 其他项目费
  1192. {
  1193. name: 'SundryCosts', type: _type.DECIMAL,
  1194. value: _util.getFeeByFlag(items, fixedFlag.OTHER_MEASURE_FEE, 'mainMaterial.totalFee')
  1195. },
  1196. // 暂列金额
  1197. {
  1198. name: 'ProvisionalSums', type: _type.DECIMAL,
  1199. value: _util.getFeeByFlag(items, fixedFlag.PROVISIONAL, 'mainMaterial.totalFee')
  1200. },
  1201. // 规费
  1202. {
  1203. name: 'StatutoryFees', type: _type.DECIMAL,
  1204. value: '0'
  1205. },
  1206. // 税金
  1207. {
  1208. name: 'Tax', type: _type.DECIMAL,
  1209. value: _util.getFeeByFlag(items, fixedFlag.TAX, 'mainMaterial.totalFee')
  1210. },
  1211. ];
  1212. _base.Element.call(this, 'SummaryOfBasicCost', attrs);
  1213. }
  1214. // 分部工程
  1215. function DivisionalWorks(bills) {
  1216. const attrs = [
  1217. // 编码
  1218. { name: 'Number', value: bills.code },
  1219. // 名称
  1220. {
  1221. name: 'Name', required: true,
  1222. value: bills.name
  1223. },
  1224. // 特征
  1225. { name: 'Attr', value: '' },
  1226. // 单位
  1227. { name: 'Unit', value: bills.unit },
  1228. // 工程量
  1229. {
  1230. name: 'Quantity', type: _type.DECIMAL,
  1231. value: bills.quantity
  1232. },
  1233. // 综合合价
  1234. {
  1235. name: 'Total', type: _type.DECIMAL,
  1236. value: _util.getFee(bills.fees, 'common.totalFee')
  1237. },
  1238. // 综合单价
  1239. {
  1240. name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
  1241. value: _util.getFee(bills.fees, 'common.unitFee')
  1242. },
  1243. // 章节类型
  1244. {
  1245. name: 'ChapterKind', type: _type.INT, required: true,
  1246. value: '4'
  1247. },
  1248. // 费用字典,拼音首字母
  1249. { name: 'Code', value: getFeeCode(bills)},
  1250. // 备注
  1251. { name: 'Remark', value: bills.remark }
  1252. ];
  1253. _base.Element.call(this, 'DivisionalWorks', attrs);
  1254. }
  1255. // 清单项目
  1256. function WorkElement(bills, kind, specialty) {
  1257. const attrs = [
  1258. // 项目编码
  1259. { name: 'Number', required: true, value: bills.code || ''},
  1260. // 项目名称
  1261. { name: 'Name', required: true, value: bills.name },
  1262. // 项目特征
  1263. { name: 'Attr', value: bills.itemCharacterText },
  1264. // 工作内容
  1265. { name: 'WorkContent', value: bills.jocContentText },
  1266. // 计量单位
  1267. { name: 'Unit', required: true, value: bills.unit },
  1268. // 工程量
  1269. { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
  1270. // 计算基数
  1271. { name: 'QtyFormula', type: _type.DECIMAL, value: 'todo' },
  1272. // 单价(元)
  1273. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
  1274. // 设备单价(元)指清单项目所采用设备的综合单价
  1275. { name: 'EquipmentPrice', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'equipment.unitFee') },
  1276. // 最低限价(元)
  1277. { name: 'PriceLow', type: _type.DECIMAL, value: 'todo' },
  1278. // 最高限价(元)
  1279. { name: 'PriceHigh', type: _type.DECIMAL, value: bills.maxPrice },
  1280. // 费率(%)
  1281. { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
  1282. // 合价(元)
  1283. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
  1284. // 主要清单
  1285. { name: 'Total', type: _type.BOOL, value: !!bills.mainBills },
  1286. // 子目类型
  1287. { name: 'Kind', type: _type.INT, required: true, value: kind },
  1288. // 取费类型
  1289. { name: 'CalculationKind', type: _type.INT, required: true, value: '1' },
  1290. // 费用归属
  1291. { name: 'CostKind', type: _type.INT, required: true, value: '1' },
  1292. // 计算方式 todo
  1293. { name: 'CalcType', type: _type.INT, required: true, value: '1' },
  1294. // 专业类型
  1295. { name: 'Specialty', type: _type.INT, value: specialty },
  1296. // 清单标识
  1297. { name: 'ListingIdentity', value: 'GB50500-2013 1 GD' },
  1298. // 费用代号
  1299. { name: 'Code', value: getFeeCode(bills) },
  1300. // 备注
  1301. { name: 'Remark', value: bills.remark }
  1302. ];
  1303. _base.Element.call(this, 'WorkElement', attrs);
  1304. }
  1305. // 工程量计算表
  1306. function ExpressElement(src) {
  1307. const attrs = [
  1308. // 序号
  1309. { name: 'OrderNumber', value: 'todo', required: true },
  1310. // 工程量计算式
  1311. { name: 'Express', value: 'todo', required: true },
  1312. // 工程量
  1313. { name: 'Quantity', value: 'todo', required: true },
  1314. // 汇总类型
  1315. { name: 'Kind', value: 'todo', type: _type.INT, required: true },
  1316. { name: 'Remark', value: src.remark }
  1317. ];
  1318. _base.Element.call(this, 'ExpressElement', attrs);
  1319. }
  1320. // 工序内容
  1321. function WorkContent(contentText, fee) {
  1322. const attrs = [
  1323. // 定额工作内容
  1324. { name: 'Name', required: true, value: contentText },
  1325. // 取此工作内容下定额子目/量价/定额同级人材机的综合合价之和
  1326. { name: 'Total', type: _type.DECIMAL, value: fee },
  1327. { name: 'Remark', value: '' }
  1328. ];
  1329. _base.Element.call(this, 'WorkContent', attrs);
  1330. }
  1331. // 定额子目
  1332. function Norm(ration, kind, specialty) {
  1333. const attrs = [
  1334. // 定额编码
  1335. { name: 'Number', required: true, value: ration.code },
  1336. { name: 'Name', required: true, value: ration.name },
  1337. { name: 'Unit', required: true, value: ration.unit },
  1338. { name: 'Quantity', type: _type.DECIMAL, value: ration.quantity },
  1339. // 单价
  1340. { name: 'Price', type: _type.DECIMAL, value: _util.getFee(ration.fees, 'common.unitFee') },
  1341. // 合价
  1342. { name: 'Total', type: _type.DECIMAL, value: _util.getFee(src.fees, 'common.totalFee') },
  1343. // 是否定额
  1344. { name: 'IsNorm', type: _type.Bool, required: true, value: 'true' },
  1345. // 子目类型
  1346. { name: 'Kind', type: _type.INT, required: true, value: kind },
  1347. // 取费类型 todo
  1348. { name: 'CalculationKind', type: _type.INT, required: true, value: '1' },
  1349. // 费用归属
  1350. { name: 'CostKind', type: _type.INT, required: true, value: '1' },
  1351. // 降效类型
  1352. {
  1353. name: 'EfficiencyKind', type: _type.INT,
  1354. value: ration.type === rationType.overHeight ? EfficiencyKind.baseReduction : EfficiencyKind.notReduction
  1355. },
  1356. // 子目增加费类型
  1357. { name: 'IncFeeKind', type: _type.INT, value: 'todo' },
  1358. // 换算说明
  1359. { name: 'Conversion', value: 'todo' },
  1360. // 专业类别
  1361. { name: 'Specialty', type: _type.INT, value: specialty },
  1362. //定额标识(定额库编码)
  1363. { name: 'NormIdentity', value: 'todo' },
  1364. // 册 定额书没有分册填写0,有分册的按册号填写
  1365. { name: 'Volume', type: _type.INT, value: getVolume(ration.code) },
  1366. // 章
  1367. { name: 'Chapter', type: _type.INT, value: getChapter(ration.code)},
  1368. { name: 'Remark', value: ration.remark }
  1369. ];
  1370. _base.Element.call(this, 'Norm', attrs);
  1371. }
  1372. // 建设项目节点
  1373. let constructionProjectEle = null;
  1374. /*
  1375. * 加载数据,分两种数据类型
  1376. * 1.建设项目
  1377. * 2.建设项目下单位工程
  1378. * @param {Object}项目数据
  1379. * @return {Array}
  1380. * */
  1381. async function loadData(projectData) {
  1382. // 提取出的数据
  1383. const extractData = [];
  1384. // 建设项目部分
  1385. constructionProject = await loadConstructionProject(projectData);
  1386. extractData.push({
  1387. data: constructionProject,
  1388. dataType: DATA_TYPE.project,
  1389. exportKind,
  1390. fileName: 'Project.xml'
  1391. });
  1392. // 单位工程部分
  1393. // 提取出单位工程级别的项目数据
  1394. const tenderData = projectData.children.reduce((acc, cur) => {
  1395. if (Array.isArray(cur.children)) {
  1396. acc.push(...cur.children)
  1397. }
  1398. return acc;
  1399. }, []);
  1400. // 获取单位工程详细结构
  1401. const isPlainTender = false;
  1402. const tenders = await loadTender(projectData.summaryInfo, tenderData, isPlainTender);
  1403. tenders.forEach(tender => {
  1404. // 单位工程文件名为@_单位工程编码_单位工程名称.xml
  1405. // 因为单位工程编码后续用户可能会改变,这里暂时将fileName设置成单位工程名称.xml
  1406. const name = tender.attrs.find(attr => attr.name === 'Name');
  1407. extractData.push({
  1408. data: tender,
  1409. dataType: DATA_TYPE.tender,
  1410. exportKind,
  1411. fileName: `${name}.xml`
  1412. })
  1413. });
  1414. return extractData;
  1415. }
  1416. /*
  1417. * 加载建设项目
  1418. * @param {Object}项目数据
  1419. * @return {Array}
  1420. * */
  1421. async function loadConstructionProject(projectData) {
  1422. const summaryInfo = projectData.summaryInfo[projectData.ID];
  1423. // 建设项目
  1424. constructionProjectEle = new ConstructionProject(projectData);
  1425. // 系统信息
  1426. const systemInfo = new SystemInfo({
  1427. // 软件相关信息进行base64编码
  1428. ID1: Base64.encode(projectData.softInfo),
  1429. ID2: _util.generateHardwareId(),
  1430. makeDate: moment(Date.now()).format('YYYY-MM-DDTHH:mm:ss'),
  1431. });
  1432. // 工程信息
  1433. const constructionInfo = loadConstructionInfo(projectData);
  1434. // 费用汇总
  1435. const summaryCost = new SummaryOfCost(summaryInfo);
  1436. // 建筑安装工程费
  1437. const projectInstall = new ProjectInstallationWorkCost(projectData, summaryInfo);
  1438. // 单项工程
  1439. const sectionalWorks = await loadEngineering(summaryInfo, projectData.children);
  1440. projectInstall.children.push(...sectionalWorks);
  1441. constructionProject.children.push(
  1442. systemInfo,
  1443. constructionInfo,
  1444. summaryCost,
  1445. projectInstall
  1446. );
  1447. return constructionProject;
  1448. }
  1449. // 加载工程信息相关元素
  1450. function loadConstructionInfo(projectData) {
  1451. const basicInformation = projectData.property.basicInformation;
  1452. const summaryInfo = projectData.summaryInfo[projectData.ID];
  1453. // 工程信息
  1454. const constructionInfo = new ConstructionInfo();
  1455. // 费用精度
  1456. const option = new Option();
  1457. // 估(概、预、结)算信息
  1458. const projectInfo = new ProjectInfo(basicInformation, summaryInfo);
  1459. let exportInfo;
  1460. if (exportKind === _config.EXPORT_KIND.Bid) {
  1461. // 招标信息
  1462. exportInfo = new TendereeInfo(basicInformation);
  1463. } else if (exportKind === _config.EXPORT_KIND.Tender) {
  1464. // 投标信息
  1465. exportInfo = new BidderInfo(basicInformation, summaryInfo);
  1466. }
  1467. constructionInfo.push(option, projectInfo, exportInfo);
  1468. return constructionInfo;
  1469. }
  1470. /*
  1471. * 加载所有单项工程元素
  1472. * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
  1473. * {Array}engineeringData 所有单项工程项目数据
  1474. * @return {Array}
  1475. * */
  1476. async function loadEngineering(summaryInfoMap, engineeringData) {
  1477. const isPlainTender = true;
  1478. const engineeringTasks = engineeringData.map(async engData => {
  1479. const summaryInfo = summaryInfoMap[engData.ID];
  1480. // 单项工程
  1481. const sectionalWork = new SectionWorks({
  1482. name: engData.name,
  1483. total: summaryInfo.engineeringCost,
  1484. rate: summaryInfo.rate,
  1485. });
  1486. // 费用汇总
  1487. const summaryCost = new SummaryOfCost(summaryInfo);
  1488. // 简单结构的单位工程
  1489. const tenders = await loadTender(summaryInfoMap, engData.children, isPlainTender);
  1490. sectionalWork.push(summaryCost, ...tenders);
  1491. return sectionalWork;
  1492. });
  1493. return await Promise.all(engineeringTasks);
  1494. }
  1495. /*
  1496. * 加载所有单位工程元素
  1497. * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
  1498. * {Array}tenderData 所有单项工程项目数据
  1499. * {Boolean}isPlain 是否简单结构(简单结构只含有UnitWorks,其下不含子元素)
  1500. * @return {Array}
  1501. * */
  1502. let tenderDetail = null;
  1503. async function loadTender(summaryInfoMap, tenderData, isPlain) {
  1504. const basicInformation = projectData.property.basicInformation;
  1505. const tenderTasks = tenderData.map(async tData => {
  1506. const summaryInfo = summaryInfoMap[tData.ID];
  1507. // 单位工程
  1508. const unitWork = new UnitWorks(projectData, tData, summaryInfo);
  1509. // 简单结构,不需要继续添加子元素
  1510. if (isPlain) {
  1511. return unitWork;
  1512. }
  1513. // 不是简单结构,继续添加各种子元素
  1514. // 工程特征信息
  1515. const attrInfo = loadAttrInfo(tData.property.projectFeature);
  1516. // 基本信息
  1517. const addiInfo = loadAddiInfo(projectData.property.basicInformation);
  1518. // 费用汇总
  1519. const summaryOfCost = new SummaryOfCost(summaryInfo);
  1520. // 获取单位工程详细数据
  1521. tenderDetail = await _util.getTenderDetail(tData.ID, userID);
  1522. // 单位工程费用汇总
  1523. });
  1524. return await Promise.all(tenderTasks);
  1525. }
  1526. // 加载工程特征信息
  1527. // attrList 单位工程的工程特征,来自property.projectFeature
  1528. function loadAttrInfo(attrList) {
  1529. const attrInfo = new Info('AttrInfo');
  1530. // 有值的才输出
  1531. attrInfo.children = attrList
  1532. .filter(attr => commonUtil.isDef(attr.value))
  1533. .map(attr => new InfoItem('AttrInfoItem', attr));
  1534. return attrInfo;
  1535. }
  1536. // 加载补充信息(基本信息所有条目)
  1537. function loadAddiInfo(infoList) {
  1538. const addiInfo = new Info('AddiInfo');
  1539. addiInfo.children = infoList.map(rootInfoItem => {
  1540. const rootInfo = new InfoItem('AddiInfoItem', rootInfoItem);
  1541. rootInfo.children = rootInfoItem.items.map(infoItem => new InfoItem('AddiInfoItem', infoItem));
  1542. return rootInfo;
  1543. });
  1544. }
  1545. // 加载单位工程费用汇总
  1546. // tenderDetail 单位工程详细数据
  1547. function loadUnitWorksSummary(tenderDetail) {
  1548. const unitWorksSummary = new UnitWorksSummary();
  1549. // 读取单位工程中的固定类别为“分部分项工程”、“措施项目”、“其他项目”的大项费用
  1550. // 分部分项
  1551. const fbfx = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.SUB_ENGINERRING);
  1552. const fbfxGroup = new UnitWorksSummaryGroup(fbfx.data);
  1553. // 分部分项工程的子项,取项目名称的首字母拼接
  1554. const fbfxChildren = fbfx.children.map(node => new UnitWorksSummaryItem(node.data));
  1555. fbfxGroup.children.push(...fbfxChildren);
  1556. // 措施项目
  1557. const csxm = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.MEASURE);
  1558. const csxmGroup = new UnitWorksSummaryGroup(csxm.data);
  1559. // 措施项目的子项,“绿色施工安全防护措施费”、“其他措施费”
  1560. const csxmChildren = csxm.getPosterity()
  1561. .filter(node => [fixedFlag.GREEN_MEASURE_FEE, fixedFlag.OTHER_MEASURE_FEE].includes(node.getFlag()))
  1562. .map(node => new UnitWorksSummaryItem(node.data));
  1563. csxmGroup.children.push(...csxmChildren);
  1564. // 其他项目
  1565. const other = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.OTHER);
  1566. const otherGroup = new UnitWorksSummaryGroup(other.data);
  1567. // 其他项目子项,暂列金额;暂估价;材料(工程设备)暂估价;专业工程暂估价;计日工;总承包服务费;预算包干费;工程优质费;概算幅度差;索赔费用;现场签证费用;其他费用
  1568. const otherChildrenFlags = [
  1569. fixedFlag.PROVISIONAL,
  1570. fixedFlag.ESTIMATE,
  1571. fixedFlag.MATERIAL_PROVISIONAL,
  1572. fixedFlag.ENGINEERING_ESITIMATE,
  1573. fixedFlag.DAYWORK,
  1574. fixedFlag.TURN_KEY_CONTRACT,
  1575. fixedFlag.BUDGET_INCLUDE_WORK_FEE,
  1576. fixedFlag.PROJECT_HIGH_QUALITY_FEE,
  1577. fixedFlag.BUDGET_ESTIMATE_DIFF,
  1578. fixedFlag.CLAIM,
  1579. fixedFlag.VISA,
  1580. fixedFlag.OTHER_FEE
  1581. ];
  1582. const otherChildren = other.getPosterity()
  1583. .filter(node => otherChildrenFlags.includes(node.getFlag()))
  1584. .map(node => new UnitWorksSummaryItem(node.data));
  1585. otherGroup.chilren.push(...otherChildren);
  1586. // 除固定类别为“分部分项工程”、“措施项目”、“其他项目”以外的大项费用,通常无子项,所以显示到Item中。(即使造价书有子项,也显示到Item中,不再列出其子项数据)
  1587. const flags = [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE, fixedFlag.OTEHER];
  1588. const otherRoots = tenderDetail.mainTree.roots
  1589. .filter(node => !flags.includes(node.getFlag()))
  1590. .map(node => new UnitWorksSummaryItem(node.data));
  1591. unitWorksSummary.push(fbfxGroup, csxmGroup, otherGroup, ...otherRoots);
  1592. return unitWorksSummary;
  1593. }
  1594. // 加载分部分项工程
  1595. function loadDivisionalAndElementalWorks(tenderDetail) {
  1596. const division = new DivisionalAndElementalWorks();
  1597. const fbfx = tenderDetail.mainTree.roots.find(node => node.getFlag === fixedFlag.SUB_ENGINERRING);
  1598. const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, fbfx.data);
  1599. }
  1600. // 加载分部分项清单,这部分是分部分项工程和措施项目共用的
  1601. function loadFBFX(nodes, kind) {
  1602. return nodes.map(node => {
  1603. let ele;
  1604. // 有子清单的是分部
  1605. if (node.source.children.length) {
  1606. ele = new DivisionalWorks();
  1607. // 递归获取子元素
  1608. ele.children = loadFBFX(node.source.children);
  1609. } else { // 无子清单的是分项
  1610. ele = loadBills(node.data, kind, specialty);
  1611. }
  1612. return ele;
  1613. });
  1614. }
  1615. // 加载清单
  1616. function loadBills(node, kind) {
  1617. const specialty = Specialty[tenderDetail.property.engineeringName]; // 工程专业
  1618. const workElement = new WorkElement(node.data, kind, specialty);
  1619. const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, node.data);
  1620. // 相同工作内容的定额进行分组
  1621. const workMap = _.groupBy(node.children, node => node.data.jobContentText || '');
  1622. const workContents = Object.entries(workMap).map(([contentText, rationNodes]) => {
  1623. const workContent = new WorkContent(contentText, _util.getAggregateFee(rationNodes));
  1624. workContent.children = rationNodes.map(node => loadRation(node, kind, specialty));
  1625. });
  1626. }
  1627. // 加载定额
  1628. function loadRation(node, kind, specialty) {
  1629. // 定额
  1630. const norm = new Norm(node.data, kind, specialty);
  1631. }
  1632. }
  1633. /*
  1634. * 重置工程编号,广东18 3.0的接口,导出时的文件会用到这个编号
  1635. * 因此重置工程编号后,还需要重置文件名数据
  1636. * @param {Array}codes 工程编号
  1637. * {Array}extractData 提取的数据
  1638. * @return {void}
  1639. * */
  1640. function resetContentCode(codes, extractData) {
  1641. // 提取到的数据分两种类型:
  1642. // 1.根元素为建设项目:需要修改建设项目下的单位工程元素的编码和文件名
  1643. // 2.根元素为单位工程:需要修改单位工程的编码和文件名
  1644. // 获取建设项目数据下的单位工程元素
  1645. const ExtractProjects = extractData.filter(data => data.dataType === DATA_TYPE.project);
  1646. const tenders = ExtractProjects.map(extractP => {
  1647. // 建设项目元素下建筑安装工程费元素
  1648. const projectInstallations = _util.getElementFromSrc(extractP.data, 'ProjectInstallationWorkCost');
  1649. // 建筑安装工程费元素下单项工程元素
  1650. const sectionalWorks = projectInstallations.reduce((acc, cur) => {
  1651. const sections = _util.getElementFromSrc(cur, 'SectionalWorks');
  1652. acc.push(...sections);
  1653. }, []);
  1654. // 单项工程元素下单位工程元素
  1655. return sectionalWorks.reduce((acc, cur) => {
  1656. const tenders = _util.getElementFromSrc(cur, 'UnitWorks');
  1657. acc.push(...tenders);
  1658. }, []);
  1659. });
  1660. // 重置编号
  1661. let idx = 0;
  1662. for (let tender of tenders) {
  1663. let codeItem = tender.attrs.find(attr => attr.name === '编号');
  1664. codeItem.value = codes[idx++];
  1665. }
  1666. }
  1667. })();