1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275 |
- /**
- *
- *
- * @author Zhong
- * @date 2019/6/24
- * @version
- */
- /*
- * 广东建设工程政府投资项目造价数据标准3.0
- * */
- const XMLStandard = (function () {
- // 广东18的导出文件中,需要把建设项目和单位工程文件分开
- // 数据类别,辨别提取的数据,哪份是以建设项目为根元素,哪份以单位工程为根元素
- const DATA_TYPE = {
- 'project': 1,
- 'tender': 2,
- };
- // 精度
- const Decimal = {
- // 工料机消耗量、含量、用量类小数精度
- GLJ: 4,
- // 工程量、数量类小数精度
- QUANTITY: 3,
- // 金额、合价、费用类小数精度
- FEE: 2,
- // 费率、指数、比例(%)类小数精度
- RATE: 3,
- };
- // 建设性质
- const ConstructionType = {
- '新建': '1',
- '扩建': '2',
- '改建': '3',
- '修缮': '4',
- '修复': '5',
- '维护保养': '6',
- '其他': '9',
- };
- // 造价类型
- const CostType = {
- '投资估算': '1',
- '设计概算': '2',
- '施工图预算': '3',
- '招标工程量清单': '4',
- '招标控制价(最高投标限价)': '5',
- '投标报价': '6',
- '签约合同价': '7',
- '竣工结算价': '8',
- };
- // 软件中的文件类型与造假类型映射
- const FileKind = {
- '1': '6', // 投标
- '2': '4', // 招标
- '3': '5', // 控制价
- };
- // 计价模式
- const ValuationModel = {
- 'bill': '1', // 清单计价
- 'ration': '2', // 定额计价
- };
- // 地区类别
- const AreaKind = {
- '一类地区': '1',
- '二类地区': '2',
- '三类地区': '3',
- '四类地区': '4',
- };
- // 专业类别
- const Specialty = {
- '房屋建筑与装饰工程': '1',
- '仿古建筑': '2',
- '通用安装工程': '3',
- '市政工程': '4',
- '园林绿化': '5',
- '矿山': '6',
- '构筑物': '7',
- '城市轨道交通工程': '8',
- '爆破': '9',
- '装饰装修': '10',
- '市政交通设施': '11',
- '市政养护': '12',
- '修缮': '13',
- '环卫': '14',
- '古建筑': '15',
- '节能': '16',
- '抗震加固': '17',
- '绿色建筑': '18',
- '工业建筑': '19',
- '地下管廊': '20',
- '装配式建筑': '21',
- '营造林': '22',
- '修复': '23',
- '其他': '99',
- };
- // 需要用固定类别关联的费用字典,用固定类别来映射
- // 数据节选自标准pdf文件《《建设工程政府投资项目造价数据标准》信息公开版》,附录C-费用名称与费用代号
- // 若映射表中没有映射关系,则费用字典取名称首字母
- const FlagFeeCodeMap = {
- // 分部分项工程
- [fixedFlag.SUB_ENGINERRING]: 'QDF',
- // 措施项目
- [fixedFlag.MEASURE]: 'CSF',
- // 其他项目
- [fixedFlag.OTHER]: 'QTF',
- // 措施项目的子项
- [fixedFlag.GREEN_MEASURE_FEE]: 'AQWMSGF', // 绿色施工安全防护措施费
- [fixedFlag.OTHER_MEASURE_FEE]: 'QTCSF', // 其他措施费
- // 其他项目的子项
- [fixedFlag.PROVISIONAL]: 'ZLF', // 暂列金额
- [fixedFlag.ESTIMATE]: 'ZGJ', // 暂估价
- [fixedFlag.MATERIAL_PROVISIONAL]: 'ZGC', // 材料(工程设备)暂估价
- [fixedFlag.ENGINEERING_ESITIMATE]: 'ZGGC', // 专业工程暂估价
- [fixedFlag.DAYWORK]: 'LXF', // 计日工
- [fixedFlag.TURN_KEY_CONTRACT]: 'ZCBFWF', // 总承包服务费
- [fixedFlag.BUDGET_INCLUDE_WORK_FEE]: 'YSBGF', // 预算包干费
- [fixedFlag.PROJECT_HIGH_QUALITY_FEE]: 'GCYZF', // 工程优质费
- [fixedFlag.BUDGET_ESTIMATE_DIFF]: 'GSFDC', // 概算幅度差
- [fixedFlag.CLAIM]: 'SPFY', // 索赔费用
- [fixedFlag.VISA]: 'XCQZFY', // 现场签证
- [fixedFlag.OTHER_FEE]: 'QTFY', // 其他费用
- // 税金
- [fixedFlag.TAX]: 'SJ',
- // 工程造价
- [fixedFlag.ENGINEERINGCOST]: 'ZZJ',
- };
- // 需要用计算基数关联的费用字典
- const FormulaFeeCodeMap = {
- '{分部分项工程费}': 'QDF',
- '{分部分项人工费}': 'QRG',
- '{分部分项材料费}': 'QCL',
- '{分部分项施工机具费}': 'QJX',
- '{分部分项主材费}': 'QZCF',
- '{分部分项设备费}': 'QSBF',
- '{分部分项人工工日}': 'FBFXRGGR', // 标准没有,自增
- '{建筑面积}': 'JZMZ', // 自增
- '{措施项目费}': 'CSF',
- '{其他项目费}': 'QTF',
- '{甲供人工费}': 'JGRGF', // 自增
- '{甲供材料费}': 'JGC',
- '{甲供施工机具费}': 'JGSGJJF', // 自增
- '{甲定人工费}': 'JDRGF', // 自增
- '{甲定材料费}': 'JDCLF', // 自增
- '{甲定施工机具费}': 'JDSGJJF', // 自增
- '{甲定主材费}': 'JDZCF', // 自增
- '{甲定设备费}': 'JDSBF', // 自增
- '{暂估材料费(从子目汇总)}': 'ZGCLFCZMHZ', // 自增
- '{税金}': 'SJ',
- };
- // 费用字典占用列表,普通清单根据首字母获取费用字典时,与下列占用费用字典重复时,需要加上_序号后缀
- const feeCodeList = [
- 'QDF', 'QRG', 'QCL', 'QJX', 'ZCSB', 'QZCF', 'QSBF', 'QGL', 'QLR', 'QZGJ', 'CSF', 'AQWMSGF', 'AXSJSCSXMF',
- 'QTCSF', 'LSSGCSF', 'SGYCWRFZF', 'YGSMGLF', 'DXJXSBJCCJAC', 'GGCSF', 'CSRG', 'CSCL', 'CSJX', 'CSZCSB',
- 'CSZCF', 'CSSBF', 'CSGL', 'CSLR', 'CSZGJ', 'QTF', 'ZGJ', 'ZGC', 'ZLF', 'ZGGC', 'ZCBFWF', 'LXF', 'CLBGF',
- 'YSBGF', 'SPFY', 'XCQZFY', 'DLF', 'QTFY', 'YLJ', 'GF', 'SJ', 'ZZJ', 'ZJF', 'RGF', 'JXRG', 'CLF', 'JXF',
- 'ZCF', 'SBF', 'ZZCSB', 'JC', 'RGJC', 'CLJC', 'JXJC', 'JGC', 'GLF', 'LR', 'DJ', 'HJ', 'YNZTYSYPFFY',
- 'JZYWSHBXF', 'GCFY', 'JZAZGCF', 'SBJGQJGZF', 'GCJSQTFY', 'YBF', 'CLGZF', 'JSQDKLX', 'PDLDZJ'
- ];
- // 计算程序名称-计算基数映射
- const CalculationQtyMap = {
- '直接费': 'RGF+CLF+JXF+ZCF+SBF+GLF',
- '人工费': 'RGF',
- '材料费': 'CLF',
- '施工机具费': 'JXF',
- '主材费': 'ZCF',
- '设备费': 'SBF',
- '管理费': 'GLF',
- '利润': 'LR',
- '综合单价': 'RGF+CLF+JXF+ZCF+SBF+GLF+LR',
- };
- // 计算程序名称-费用代号映射
- const CalculationCodeMap = {
- '直接费': 'DEZJF',
- '人工费': 'RGF',
- '材料费': 'CLF',
- '施工机具费': 'JXF',
- '主材费': 'ZCF',
- '设备费': 'SBF',
- '管理费': 'GLF',
- '利润': 'LR',
- '综合单价': 'DJ',
- }
- // 章节类型
- const ChapterKind = {
- '章': '1',
- '节': '2',
- '细目': '3',
- '其他': '4',
- };
- // 汇总类型
- const SummrayKind = {
- YES: '1', // 汇总
- NO: '2', // 不汇总
- };
- // 工程量计算累加与汇总类型映射
- const SummationKindMap = {
- '0': SummrayKind.NO,
- '1': SummrayKind.YES,
- }
- // 清单子目类型
- const BillsKind = {
- FBFX: '1', // 分部分项子目
- '模板及支架': '2',
- '脚手架': '3',
- '现场围挡': '4',
- '防尘降噪绿色施工防护': '5',
- MEASURE: '6', // 其他措施子目
- };
- // 取费类型
- const CalcKind = {
- '地上工程': '1',
- '地下明(盖)挖工程': '2',
- '地下暗挖工程': '3',
- '盾构工程': '4',
- '轨道工程': '5',
- '通信工程': '6',
- '信号工程': '7',
- '供电工程': '8',
- '智能与控制系统工程': '9',
- '机电工程': '10',
- '其他': '15',
- };
- // 费用归属
- const CostKind = {
- '建筑工程费': '1',
- '安装工程费': '2',
- '其他': '3',
- };
- // 计算方式
- const CalcType = {
- 'quantityMulTotalUnitPrice': '1', // 工程量×综合单价
- 'formulaAddFeeRate': '2', // 计算基数×费率
- 'quantityMulUnitPrice': '3', // 工程量×单价
- };
- // 降效类型 建筑装饰工程定额超高降效费用计算标记
- const EfficiencyKind = {
- 'baseReduction': '1', // 降效基础定额
- 'notReduction': '2', // 非降效定额
- 'marketPriceReduction': '3', // 按市场价计算降效费用定额
- 'rationPriceReduction': '4', // 按定额价计算降效费用定额
- };
- // 子目增加费类型 安装工程定额子目增加费的费用计算标记
- const IncFeeKind = {
- 'subBase': '1', // 子目增加费基础定额
- 'notSubBase': '2', // 非子目增加费定额
- 'subCalc': '3', // 子目增加费用计算定额
- };
- // 工料机类型
- const GLJKind = {
- };
- // 供料方式
- const Provider = {
- }
- // 通用设置和工具
- const _base = XML_EXPORT_BASE;
- const _config = _base.CONFIG;
- const _type = _config.TYPE;
- const _util = _base.UTIL;
- const _cache = _base.CACHE;
- // 项目汇总字段
- const summaryObj = {
- // 取固定清单的综合合价进行汇总
- feeFields: [
- { k: fixedFlag.ENGINEERINGCOST, v: 'engineeringCost' },
- { k: fixedFlag.SUB_ENGINERRING, v: 'subEngineering' },
- { k: fixedFlag.MEASURE, v: 'measure' },
- { k: fixedFlag.GREEN_MEASURE_FEE, v: 'greenMeasureFee' },
- { k: fixedFlag.OTHER_MEASURE_FEE, v: 'otherPreliminaries' },
- { k: fixedFlag.OTHER, v: 'other' },
- { k: fixedFlag.PROVISIONAL, v: 'provisional' },
- { k: fixedFlag.MATERIAL_PROVISIONAL, v: 'materialProvisional' },
- { k: fixedFlag.ENGINEERING_ESITIMATE, v: 'engineeringEstimate' },
- { k: fixedFlag.DAYWORK, v: 'daywork' },
- { k: fixedFlag.TURN_KEY_CONTRACT, v: 'turnKeyContract' },
- { k: fixedFlag.CLAIM, v: 'claim' },
- { k: fixedFlag.VISA, v: 'visa' },
- { k: fixedFlag.TAX, v: 'tax' }
- ],
- // 取工程造价的一些费用进行汇总,k为汇总到summaryInfo的字段,v为取的工程造价费用字段
- engineeringCostFields: [
- { k: 'labour', v: 'labour' },
- { k: 'material', v: 'material' },
- { k: 'equipment', v: 'equipment' },
- { k: 'mainMaterial', v: 'mainMaterial' },
- { k: 'machine', v: 'machine' },
- { k: 'overhead', v: 'manage' },
- { k: 'profit', v: 'profit' },
- ]
- };
- // 获取工程类型:枚举单位工程的工程专业+费用标准,用“;”分隔
- function getProjectType(projectData) {
- // 工程类型 工程专业+费用标准
- return projectData.children.reduce((acc, eng) => {
- const tenderProjectTypeArr = eng.children.reduce((acc, tender) => {
- const engineeringName = tender.property.engineeringName.replace('工程', '');
- const feeStandardName = tender.property.feeStandardName;
- acc.push(`${engineeringName}${feeStandardName}`);
- return acc;
- }, []);
- acc.push(...tenderProjectTypeArr);
- return acc;
- }, []).join(';');
- }
- // 清单名称首字母包含的清单ID eg: 'AABC': ['ID1', 'ID2']
- const firstLetterMap = {};
- // 对已被占用的费用字典进行占位处理
- feeCodeList.forEach(feeCode => firstLetterMap[feeCode] = [null]);
- /**
- * 获取费用字典
- * @param {Object} bills - 清单数据,清单获取费用字典时用
- * @param {String} formula - 文本内容,非ID引用基数获取费用字典时用 eg: {分部分项工程费}
- * @return {String}
- */
- function getFeeCode(bills, formula) {
- let feeCode;
- // 清单获取费用字典,如果根据固定类别找不到对应的费用字典,才用名称首字母获取
- if (bills) {
- const flag = bills.flagsIndex && bills.flagsIndex.fixed ? bills.flagsIndex.fixed.flag : null;
- feeCode = FlagFeeCodeMap[flag];
- if (feeCode) {
- return feeCode;
- }
- const name = bills.name || '';
- // 出现重名,应以“费用代号_顺序号”规则,顺序号为自然数,从 1 开始
- const tempFeeCode = pinyinUtil.getFirstLetter(name);
- const sameFeeCodes = firstLetterMap[tempFeeCode] ? firstLetterMap[tempFeeCode] : firstLetterMap[tempFeeCode] = [];
- feeCode = sameFeeCodes.includes(bills.ID)
- ? `${tempFeeCode}${sameFeeCodes.indexOf(bills.ID) === 0 ? '' : '_' + sameFeeCodes.indexOf(bills.ID)}`
- : sameFeeCodes.length
- ? `${tempFeeCode}_${sameFeeCodes.length}`
- : tempFeeCode;
- sameFeeCodeIDs.push(bills.ID);
- return feeCode;
- } else { // 非ID引用基数获取费用字典
- return FormulaFeeCodeMap[formula] || '';
- }
- }
- // 获取转换后的计算基数
- // 1.有子项,则取固定清单对应基数
- // 2.无子项,有基数,转换为费用字典
- function getQtyFormula(node) {
- let expr = node.data.calcBase || '';
- if (node.children.length) {
- return FlagCalcBaseMap[node.getFlag()] || '';
- }
- if (expr) {
- let illegal = false;
- let normalBase = _util.getNormalBase(expr),
- idBase = _util.getIDBase(expr);
- //普通基数转费用字典
- normalBase.forEach(base => {
- const feeCode = getFeeCode(null, base);
- expr = expr.replace(new RegExp(base, 'g'), feeCode);
- });
- //id引用转换为费用字典
- idBase.forEach(base => {
- const id = base.match(/[^@]+/)[0];
- const theNode = node.tree.getNodeByID(id);
- const feeCode = getFeeCode(theNode.data);
- expr = expr.replace(new RegExp(base, 'g'), feeCode);
- });
- return expr;
- }
- }
- // 获取定额册 取定额编号开头字母后面、-前面的数字,没有则取0
- // 如: A2-1-1 则册为2
- function getVolume(code) {
- if (!code) {
- return '0';
- }
- const reg = /^[A-Za-z](\d+)(?=-)/;
- const rst = reg.exec(code);
- return rst ? rst[1] : '0';
- }
- // 获取定额章 取定额编号第一个-和第二个-之间的数字
- // 如: A1-2-3 则章为2
- function getChapter(code) {
- if (!code) {
- return '0';
- }
- const reg = /^[A-Za-z]\d+-(\d+)(?=-)/;
- const rst = reg.exec(code);
- return rst ? rst[1] : '0';
- }
- /*
- * 提取数据入口
- * @param {String}userID 用户ID
- * {Number}exportKind 导出类型(投标1、招标2、控制价3
- * {Object}projectData 项目数据(项目自身的数据、建设、单项、单位的数据(projects表的数据),不包含详细的清单定额等数据)
- * @return {Array} [{data: Object, exportKind: Number, fileName: String}]
- * */
- async function entry(userID, exportKind, projectData) {
- // name为导出的xml节点属性名称 dName为可能需要显示给用户属性时使用的名称,比如自检提示的时候用,这里只有required为true时需要设置dNam
- // 建设项目
- function ConstructionProject(projectData) {
- const basicInformation = projectData.property.basicInformation;
- const attrs = [
- // 项目编号
- {
- name: 'Number', dName: '项目编号', required: true,
- value: ''
- },
- // 项目名称
- {
- name: 'Name', dName: '项目名称', required: true,
- value: projectData.name
- },
- // 工程类别
- {
- name: 'ProjectCategory', dName: '工程类别', required: true,
- value: _util.getValueByKey(basicInformation, 'projectCategory')
- },
- // 工程类型
- {
- name: 'ProjectType', dName: '工程类型', required: true,
- value: getProjectType(projectData)
- },
- // 建设性质
- {
- name: 'ConstructionType', type: _type.INT, enumeration: Object.keys(ConstructionType),
- value: ConstructionType[_util.getValueByKey(basicInformation, 'constructionType')]
- },
- // 文件类型
- {
- name: 'FileKind', dName: '造价类型', type: _type.INT, required: true, enumeration: Object.keys(CostType),
- value: FileKind[exportKind]
- },
- // 计价模式
- {
- name: 'ValuationModel', dName: '计价模式', type: _type.INT, required: true,
- value: ValuationModel.bill
- },
- // 计税模式
- {
- name: 'TaxModel', dName: '计税模式', type: _type.INT, required: true,
- value: projectData.property.taxType
- },
- // 地区类别
- {
- name: 'AreaKind', dName: '地区类别', type: _type.INT, required: true, enumeration: Object.keys(AreaKind),
- value: _util.getValueByKey(basicInformation, 'regionalCategories')
- },
- // 工程地点
- {
- name: 'ProjectSite',
- value: _util.getValueByKey(basicInformation, 'projLocation')
- },
- // 建设单位
- {
- name: 'BuildUnit', dName: '建设单位', required: true,
- value: _util.getValueByKey(basicInformation, 'constructingUnits')
- },
- // 建设单位法定代表人或其授权人
- {
- name: 'BulidAuthorizer',
- value: _util.getValueByKey(basicInformation, 'constructingUnitsPerson')
- },
- // 数据交换标准名称
- {
- name: 'StandardName', required: true,
- value: '建设工程政府投资项目造价数据标准'
- },
- // 数据交换标准编号
- {
- name: 'StandardNumber', required: true,
- value: 'DBJ/T XX-XX-2018'
- },
- // 建设(编制)范围
- {
- name: 'RangeOfCompilation',
- value: _util.getValueByKey(basicInformation, 'rangeOfCompilation')
- },
- // 建设规模
- {
- name: 'Scale', dName: '工程规模', type: _type.DECIMAL, required: true,
- value: _util.getValueByKey(basicInformation, 'projectScale')
- },
- // 建设规模单位
- {
- name: 'Unit', dName: '建设规模单位', required: true,
- value: _util.getValueByKey(basicInformation, 'unit')
- },
- // 技术经济指标(元) 取单方造价
- {
- name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
- value: summaryInfo.perCost
- },
- // 总说明 编制说明
- {
- name: 'Explains',
- value: projectData.property.compilationIllustration
- }
- ];
- //唯一约束
- this.constraints = {
- billsCode: [], //清单项目项目编码(xsd中没体现,通过跟pm沟通得知)
- };
- _base.Element.call(this, 'ConstructionProject', attrs);
- }
- // 系统信息
- function SystemInfo({ ID1, ID2, makeDate }) {
- const attrs = [
- // 编制软件信息
- { name: 'ID1', value: ID1 },
- // 编制机器硬件信息,不输出
- { name: 'ID2', value: ID2 },
- // 文件生成时间
- {
- name: 'MakeDate', dName: '文件生成时间', type: _type.DATE_TIME, required: true,
- value: makeDate
- }
- ];
- _base.Element.call(this, 'SystemInfo', attrs);
- }
- // 工程信息
- function ConstructionInfo() {
- _base.Element.call(this, 'ConstructionInfo', []);
- }
- // 费用精度
- function Option() {
- const attrs = [
- // 工料机消耗量、含量、用量类小数精度
- {
- name: 'ResPrecision', type: _type.INT, required: true,
- value: Decimal.GLJ
- },
- // 工程量、数量类小数精度
- {
- name: 'QuantityPrecision', type: _type.INT, required: true,
- value: Decimal.QUANTITY
- },
- // 金额、合价、费用类小数精度
- {
- name: 'CostPrecision', type: _type.INT, required: true,
- value: Decimal.Fee
- },
- // 费率、指数、比例(%)类小数精度
- {
- name: 'RatePrecision', type: _type.INT, required: true,
- value: Decimal.RATE
- }
- ];
- _base.Element.call(this, 'Option', attrs);
- }
- // 估(概、预、结)算信息
- function ProjectInfo(basicInformation, summaryInfo) {
- const attrs = [
- // 设计单位
- { name: 'Designer', value: _util.getValueByKey(basicInformation, 'designUnits') },
- // 承包单位
- { name: 'Contractor', value: _util.getValueByKey(basicInformation, 'constructionUnits') },
- // 编制单位
- {
- name: 'CompileCompany', dName: '编制单位', required: true,
- value: _util.getValueByKey(basicInformation, 'establishUnit') || '无'
- },
- // 编制单位法定代表人或其授权人
- { name: 'Authorizer', value: _util.getValueByKey(basicInformation, 'constructingUnitsPerson') },
- // 编制人
- { name: 'Compiler', value: _util.getValueByKey(basicInformation, 'establishUnitAuthor') },
- // 编制人资格证书编号
- { name: 'CompilerCertNo', value: _util.getValueByKey(basicInformation, 'establishDate') },
- // 编制时间
- {
- name: 'CompileDate', dName: '编制时间', required: true,
- value: 'todo',
- },
- // 审核人
- { name: 'Examiner', value: _util.getValueByKey(basicInformation, 'auditUnitAuditor') },
- // 审核人资格证书编号
- { name: 'ExaminerCertNo', value: _util.getValueByKey(basicInformation, 'ExaminerCertNo') },
- // 审核时间
- { name: 'ExamineDate', value: _util.getValueByKey(basicInformation, 'auditDate') },
- // 审定人
- { name: 'Approver', value: _util.getValueByKey(basicInformation, 'Approver') },
- // 审定人资格证书编号
- { name: 'ApproverCertNo', value: _util.getValueByKey(basicInformation, 'ApproverCertNo') },
- // 审定时间
- { name: 'ApproverDate', value: _util.getValueByKey(basicInformation, 'ApproverDate') },
- // 工程总价(元)
- {
- name: 'Total', dName: '工程总价', type: _type.DECIMAL, required: true,
- value: summaryInfo.engineeringCost || '0'
- }
- ];
- _base.Element.call(this, 'ProjectInfo', attrs);
- }
- // 招标信息 工程量清单、招标控制价时输出
- function TendereeInfo(basicInformation) {
- const attrs = [
- // 招标人
- {
- name: 'TendereeName', dName: '招标人', required: true,
- value: _util.getValueByKey(basicInformation, 'bidInviter')
- },
- // 招标单位法定代表人或其授权人
- {
- name: 'TenderAuthorizer',
- value: _util.getValueByKey(basicInformation, 'tenderRepresentative')
- },
- // 招标单位编制人
- {
- name: 'TenderCompiler',
- value: _util.getValueByKey(basicInformation, 'TenderCompiler')
- },
- // 招标单位编制人资格证书编号
- {
- name: 'TenderCompilerCertNo',
- value: _util.getValueByKey(basicInformation, 'TenderCompilerCertNo')
- },
- // 招标单位编制时间
- {
- name: 'TenderCompileDate',
- value: _util.getValueByKey(basicInformation, 'TenderCompileDate')
- },
- // 招标单位审核人
- {
- name: 'TenderExaminer',
- value: _util.getValueByKey(basicInformation, 'TenderExaminer')
- },
- // 招标单位审核人资格证书编号
- {
- name: 'TenderExaminerCertNo',
- value: _util.getValueByKey(basicInformation, 'TenderExaminerCertNo')
- },
- // 招标单位审核时间
- {
- name: 'TenderExamineDate',
- value: _util.getValueByKey(basicInformation, 'TenderExamineDate')
- },
- // 招标单位审定人
- {
- name: 'TenderApprover',
- value: _util.getValueByKey(basicInformation, 'TenderApprover')
- },
- // 招标单位审定人资格证书编号
- {
- name: 'TenderApproverCertNo',
- value: _util.getValueByKey(basicInformation, 'TenderApproverCertNo')
- },
- // 招标单位审定时间
- {
- name: 'TenderApproveDate',
- value: _util.getValueByKey(basicInformation, 'TenderApproveDate')
- },
- // 招标代理 不得为空,如无招标代理,则应填写“无”。
- {
- name: 'Proxy', dName: '招标代理',
- value: _util.getValueByKey(basicInformation, 'Proxy'), required: true
- },
- // 招标代理资质证书编号
- {
- name: 'ProxyCertNo',
- value: _util.getValueByKey(basicInformation, 'ProxyCertNo')
- },
- // 招标代理法定代表人或其授权人
- {
- name: 'ProxyAuthorizer',
- value: _util.getValueByKey(basicInformation, 'ProxyAuthorizer')
- },
- // 招标代理编制人员
- {
- name: 'ProxyCompiler',
- value: _util.getValueByKey(basicInformation, 'ProxyCompiler')
- },
- // 招标代理编制人员资格证书编号
- {
- name: 'ProxyCompilerCertNo',
- value: _util.getValueByKey(basicInformation, 'ProxyCompilerCertNo')
- },
- // 招标代理编制时间
- {
- name: 'ProxyCompileDate',
- value: _util.getValueByKey(basicInformation, 'ProxyCompileDate')
- },
- // 招标代理审核人
- {
- name: 'ProxyExaminer',
- value: _util.getValueByKey(basicInformation, 'ProxyExaminer')
- },
- // 招标代理审核人资格证书编号
- {
- name: 'ProxyExaminerCertNo',
- value: _util.getValueByKey(basicInformation, 'ProxyExaminerCertNo')
- },
- // 招标代理审核时间
- {
- name: 'ProxyExamineDate',
- value: _util.getValueByKey(basicInformation, 'ProxyExamineDate')
- },
- // 招标代理审定人
- {
- name: 'ProxyApprover',
- value: _util.getValueByKey(basicInformation, 'ProxyApprover')
- },
- // 招标代理审定人资格证书编号
- {
- name: 'ProxyApproverCertNo',
- value: _util.getValueByKey(basicInformation, 'ProxyApproverCertNo')
- },
- // 招标代理审定时间
- {
- name: 'ProxyApproveDate',
- value: _util.getValueByKey(basicInformation, 'ProxyApproveDate')
- },
- // 造价咨询 、Consultant(造价咨询):不得为空,如无则应填写“无”。
- {
- name: 'Consultant', dName: '造价咨询', required: true,
- value: _util.getValueByKey(basicInformation, 'Consultant')
- },
- // 造价咨询资质证书编号
- {
- name: 'ConsultantCertNo',
- value: _util.getValueByKey(basicInformation, 'ConsultantCertNo')
- },
- // 造价咨询法定代表人或其授权人
- {
- name: 'ConsultantAuthorizer',
- value: _util.getValueByKey(basicInformation, 'ConsultantAuthorizer')
- },
- // 造价咨询编制人
- {
- name: 'ConsultantCompiler',
- value: _util.getValueByKey(basicInformation, 'ConsultantCompiler')
- },
- // 造价咨询编制人资格证书
- {
- name: 'ConsultantCompilerCertNo',
- value: _util.getValueByKey(basicInformation, 'ConsultantCompilerCertNo')
- },
- // 造价咨询编制时间
- {
- name: 'ConsultantCompileDate',
- value: _util.getValueByKey(basicInformation, 'ConsultantCompileDate')
- },
- // 造价咨询审核人
- {
- name: 'ConsultantExaminer',
- value: _util.getValueByKey(basicInformation, 'ConsultantExaminer')
- },
- // 造价咨询审核人资格证书编号
- {
- name: 'ConsultantExaminerCertNo',
- value: _util.getValueByKey(basicInformation, 'ConsultantExaminerCertNo')
- },
- // 造价咨询审核时间
- {
- name: 'ConsultantExamineDate',
- value: _util.getValueByKey(basicInformation, 'ConsultantExamineDate')
- },
- // 造价咨询审定人
- {
- name: 'ConsultantApprover',
- value: _util.getValueByKey(basicInformation, 'ConsultantApprover')
- },
- // 造价咨询审定人资格证书编号
- {
- name: 'ConsultantApproverCertNo',
- value: _util.getValueByKey(basicInformation, 'ConsultantApproverCertNo')
- },
- // 造价咨询审定时间
- {
- name: 'ConsultantApproveDate',
- value: _util.getValueByKey(basicInformation, 'ConsultantApproveDate')
- },
- // 招标控制价(元)
- {
- name: 'TenderSumLimit', dName: '招标控制价', type: _type.DECIMAL, required: true,
- value: 'todo'
- }
- ];
- _base.Element.call(this, 'TendereeInfo', attrs);
- }
- // 投标信息
- function BidderInfo(basicInformation, summaryInfo) {
- const attrs = [
- // 投标人
- {
- name: 'BidName', dName: '投标人', required: true,
- value: _util.getValueByKey(basicInformation, 'bidName')
- },
- // 投标单位法定代表人或其授权人
- {
- name: 'BidAuthorizer',
- value: _util.getValueByKey(basicInformation, 'bidAuthorizer')
- },
- // 投标总价(元)
- {
- name: 'BidAuthorizer', dName: '投标总价', type: _type.DECIMAL, required: true,
- value: summaryInfo.engineeringCost
- },
- // 投标单位编制人
- {
- name: 'BidCompiler',
- value: _util.getValueByKey(basicInformation, 'bidCompiler')
- },
- // 投标单位编制人资格证书编号
- {
- name: 'BidCompilerCertNo',
- value: _util.getValueByKey(basicInformation, 'BidCompilerCertNo')
- },
- // 投标单位编制时间
- {
- name: 'BidCompileDate',
- value: _util.getValueByKey(basicInformation, 'bidCompileDate')
- },
- // 投标单位审核人
- {
- name: 'BidExaminer',
- value: _util.getValueByKey(basicInformation, 'bidExaminer')
- },
- // 投标单位审核人资格证书编号
- {
- name: 'BidExaminerCertNo',
- value: _util.getValueByKey(basicInformation, 'bidExaminerCertNo')
- },
- // 投标单位审核时间
- {
- name: 'BidExamineDate',
- value: _util.getValueByKey(basicInformation, 'bidExamineDate')
- },
- // 投标单位审定人
- {
- name: 'BidApprover',
- value: _util.getValueByKey(basicInformation, 'bidApprover')
- },
- // 投标单位审定人资格证书
- {
- name: 'BidApproverCertNo',
- value: _util.getValueByKey(basicInformation, 'bidApproverCertNo')
- },
- // 投标单位审定时间
- {
- name: 'BidApproveDate',
- value: _util.getValueByKey(basicInformation, 'BidApproveDate')
- }
- ];
- _base.Element.call(this, 'BidderInfo', attrs);
- }
- // 费用汇总
- function SummaryOfCost(summaryInfo) {
- const attrs = [
- // 工程造价(元)
- {
- name: 'Total', type: _type.DECIMAL,
- value: summaryInfo.engineeringCost
- },
- // 建筑工程费
- {
- name: 'Construction', type: _type.DECIMAL,
- value: '0'
- },
- // 安装工程费
- {
- name: 'Installation', type: _type.DECIMAL,
- value: '0',
- },
- // 分部分项工程费
- {
- name: 'DivisionalAndElementalWorks', type: _type.DECIMAL,
- value: summaryInfo.subEngineering
- },
- // 措施项目费
- {
- name: 'Preliminaries', type: _type.DECIMAL,
- value: summaryInfo.measure
- },
- // 绿色施工安全防护措施费
- {
- name: 'CostForHSE', type: _type.DECIMAL,
- value: summaryInfo.greenMeasureFee
- },
- // 其他措施费
- {
- name: 'OtherPreliminaries', type: _type.DECIMAL,
- value: summaryInfo.otherPreliminaries
- },
- // 其他项目费
- {
- name: 'SundryCosts', type: _type.DECIMAL,
- value: summaryInfo.other
- },
- // 暂列金额
- {
- name: 'ProvisionalSums', type: _type.DECIMAL,
- value: summaryInfo.provisional
- },
- // 暂估价材料
- {
- name: 'ProvisionalMaterial', type: _type.DECIMAL,
- value: summaryInfo.materialProvisional
- },
- // 专业工程暂估价
- {
- name: 'SpecialtyProvisionalPrice', type: _type.DECIMAL,
- value: summaryInfo.engineeringEstimate
- },
- // 计日工费用
- {
- name: 'DayWorkRate', type: _type.DECIMAL,
- value: summaryInfo.daywork
- },
- // 总承包服务费
- {
- name: 'MainContractorAttendance', type: _type.DECIMAL,
- value: summaryInfo.turnKeyContract
- },
- // 索赔费用
- {
- name: 'ClaimForLossAndExpenses', type: _type.DECIMAL,
- value: summaryInfo.claim
- },
- // 现场签证费用
- {
- name: 'SiteInstruction', type: _type.DECIMAL,
- value: summaryInfo.visa
- },
- // 规费
- {
- name: 'StatutoryFees', type: _type.DECIMAL,
- value: '0'
- },
- // 税金
- {
- name: 'Tax', type: _type.DECIMAL,
- value: summaryInfo.tax
- },
- // 人工费
- {
- name: 'Labor', type: _type.DECIMAL,
- value: summaryInfo.labour
- },
- // 材料费
- {
- name: 'Material', type: _type.DECIMAL,
- value: summaryInfo.material
- },
- // 设备费
- {
- name: 'Equipment', type: _type.DECIMAL,
- value: summaryInfo.equipment
- },
- // 主材设备费
- {
- name: 'MainMaterialEquipment', type: _type.DECIMAL,
- value: scMathUtil.roundForObj(summaryInfo.mainMaterial + summaryInfo.equipment, Decimal.FEE)
- },
- // 主材费
- {
- name: 'MainMaterial', type: _type.DECIMAL,
- value: summaryInfo.mainMaterial
- },
- // 机械费
- {
- name: 'Machine', type: _type.DECIMAL,
- value: summaryInfo.machine
- },
- // 管理费
- {
- name: 'Overhead', type: _type.DECIMAL,
- value: summaryInfo.overhead
- },
- // 利润
- {
- name: 'Profit', type: _type.DECIMAL,
- value: summaryInfo.profit
- },
- ];
- _base.Element.call(this, 'SummaryOfCost', attrs);
- }
- // 建筑安装工程费
- function ProjectInstallationWorkCost(projectData, summaryInfo) {
- const basicInformation = projectData.property.basicInformation;
- const attrs = [
- // 工程编号
- {
- name: 'Number',
- value: ''
- },
- // 工程名称
- {
- name: 'Name', required: true,
- value: projectData.name
- },
- // 金额 (元)
- {
- name: 'Total', type: _type.DECIMAL,
- value: summaryInfo.engineeringCost
- },
- // 建设规模
- {
- name: 'Scale', type: _type.DECIMAL, required: true,
- value: _util.getValueByKey(basicInformation, 'projectScale')
- },
- // 建设规模单位
- {
- name: 'Unit', required: true,
- value: _util.getValueByKey(basicInformation, 'todo')
- },
- // 占总投资比例(%)
- {
- name: 'Ratios', type: _type.DECIMAL,
- value: '0.00'
- },
- ];
- _base.Element.call(this, 'ProjectInstallationWorkCost', attrs);
- }
- // 单项工程
- function SectionWorks({ name, total, rate }) {
- const attrs = [
- // 工程编号
- {
- name: 'Number',
- value: ''
- },
- // 工程名称
- {
- name: 'Name', required: true,
- value: name
- },
- // 金额
- {
- name: 'Total', type: _type.DECIMAL,
- value: total
- },
- // 建设规模 单项工程没有填写的地方,输出“0”
- {
- name: 'Scale', dName: '建设规模', type: _type.DECIMAL, required: true,
- value: '0'
- },
- // 建设规模单位 单项工程没有填写的地方,输出和"m2"
- {
- name: 'Unit', dName: '建设规模单位', required: true,
- value: 'm2'
- },
- // 占总投资比例(%)
- {
- name: 'Ratios', type: _type.DECIMAL,
- value: rate
- },
- // 费用代号
- {
- name: 'Code', type: _type.DECIMAL,
- value: ''
- },
- ];
- _base.Element.call(this, 'SectionWorks', attrs);
- }
- // 单位工程
- function UnitWorks(projectData, tenderData, summaryInfo) {
- const basicInformation = projectData.property.basicInformation;
- const projectFeature = tenderData.property.projectFeature;
- const attrs = [
- // 工程编号
- {
- name: 'Number', required: true,
- value: ''
- },
- // 工程名称
- {
- name: 'Name', required: true,
- value: tenderData.name
- },
- // 标段 取建设项目名称
- {
- name: 'Segment',
- value: projectData.name
- },
- // 工程类别
- {
- name: 'ProjectCategory', required: true,
- value: _util.getValueByKey(basicInformation, 'projectCategory')
- },
- // 工程类型
- {
- name: 'ProjectType', required: true,
- value: getProjectType(projectData)
- },
- // 计价模式
- {
- name: 'ValuationModel', type: _type.INT, required: true,
- value: VALUATION_MODEL.bill
- },
- // 计税模式
- {
- name: 'TaxModel', type: _type.INT, required: true,
- value: tenderData.property.taxType
- },
- // 地区类别 取建设项目-基本信息-地区类别
- {
- name: 'AreaKind', type: _type.INT, required: true,
- value: _util.getValueByKey(basicInformation, 'regionalCategories')
- },
- // 金额
- {
- name: 'Total', type: _type.DECIMAL,
- value: summaryInfo.engineeringCost
- },
- // 专业类别
- {
- name: 'Specialty', type: _type.INT,
- value: Specialty[tenderData.property.engineeringName]
- },
- // 工程用途
- {
- name: 'Purposes',
- value: ''
- },
- //建设(编制)范围
- {
- name: 'RangeOfCompilation',
- value: ''
- },
- // 建设规模 取单位工程-工程特征-建设规模
- {
- name: 'Scale', type: _type.DECIMAL, required: true,
- value: _util.getValueByKey(projectFeature, 'buildScale')
- },
- // 建设规模单位
- {
- name: 'Unit', required: true,
- value: 'todo'
- },
- // 占总投资比例(%)
- {
- name: 'Ratios', type: _type.DECIMAL,
- value: src.summaryInfo.rate
- },
- // 清单数据库,没有则填写 “无”
- {
- name: 'BillDataBase', required: true,
- value: '工程量清单规范(2013广东)',
- },
- // 定额数据库,没有则填写 “无”,后续获取详细数据(getTenderDetail)的时候填上
- {
- name: 'NormDataBase', required: true,
- value: '无'
- },
- // 人工材料设备价格文件,没有则填写 “无”
- {
- name: 'ResInfoPricingFile', required: true,
- value: '无'
- },
- // 总说明
- {
- name: 'Explains',
- value: tenderData.property.compilationIllustrationProject
- },
- // 导出XML文件名,工程编号+工程名称.xml, 暂时取“名称.xml”,用户设置完工程编号后修改此值
- {
- name: 'FileName',
- value: `${tenderData.name}.xml`
- },
- // 备注
- {
- name: 'Remark',
- value: ''
- },
- ];
- _base.Element.call(this, 'UnitWorks', attrs);
- }
- // 工程特征信息 AttrInfo, 补充信息AddiInfo
- function Info(eleName) {
- _base.Element.call(this, eleName, []);
- }
- // 工程特征信息明细 AttrInfoItem, 补充信息明细AddiInfoItem
- function InfoItem(eleName, attr) {
- const attrs = [
- {
- name: 'Name', required: true,
- value: attr.dispName,
- },
- { name: 'Value', value: attr.value },
- ];
- if (attr.code) {
- attrs.push({ name: 'Code', value: attr.code });
- }
- if (attr.remark) {
- attrs.push({ name: 'Remark', value: attr.remark });
- }
- _base.Element.call(this, eleName, attrs);
- }
- // 单位工程费用汇总
- function UnitWorksSummary() {
- _base.Element.call(this, 'UnitWorksSummary', []);
- }
- // 单位工程费用汇总标题
- function UnitWorksSummaryGroup(bills) {
- const attrs = [
- // 费用编号
- { name: 'Number', value: bills.code },
- // 费用名称
- {
- name: 'Name', required: true,
- value: bills.name
- },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 工程量
- {
- name: 'Quantity', type: _type.DECIMAL,
- value: bills.quantity
- },
- // 金额
- {
- name: 'Total', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'common.totalFee')
- },
- // 技术经济指标(元) 取综合单价
- {
- name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'common.unitFee')
- },
- //章节类型
- {
- name: 'ChapterKind', type: _type.INT, required: true,
- value: '4'
- },
- // 费用代号
- {
- name: 'Code', type: _type.INT, required: true,
- value: getFeeCode(bills)
- },
- // 汇总类型
- {
- name: 'Kind', type: _type.INT, required: true,
- value: '1'
- },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'UnitWorksSummaryGroup', attrs);
- }
- // 单位工程费汇总明细
- function UnitWorksSummaryItem(node) {
- const bills = node.data;
- const attrs = [
- { name: 'Number', value: bills.code },
- {
- name: 'Name', required: true,
- value: bills.name
- },
- { name: 'Unit', value: bills.unit },
- {
- name: 'Quantity', type: _type.DECIMAL,
- value: bills.quantity
- },
- // 计算基数:可由费用代号、数字、四则运算符号、小括号组成
- {
- name: 'QtyFormula', type: _type.DECIMAL,
- value: getQtyFormula(node)
- },
- // 费率
- {
- name: 'Rate', type: _type.DECIMAL,
- value: commonUtil.isDef(bills.feeRate) ? bills.feeRate : '100'
- },
- {
- name: 'Total', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'common.totalFee')
- },
- // 技术经济指标(元)
- {
- name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'common.unitFee')
- },
- //章节类型
- {
- name: 'ChapterKind', type: _type.INT, required: true,
- value: '4'
- },
- // 费用代号
- {
- name: 'Code', type: _type.INT, required: true,
- value: getFeeCode(bills)
- },
- // 汇总类型
- {
- name: 'Kind', type: _type.INT, required: true,
- value: '1'
- },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'UnitWorksSummaryItem', attrs);
- }
- // 分部分项工程
- function DivisionalAndElementalWorks() {
- _base.Element.call(this, 'DivisionalAndElementalWorks', []);
- }
- // 措施项目
- function Preliminaries() {
- _base.Element.call(this, 'Preliminaries', []);
- }
- // 合计费用
- function SummaryOfBasicCost(items, bills) {
- // 省略了一些
- const mainMaterial = _util.getFee(bills.fees, 'mainMaterial.totalFee');
- const equipment = _util.getFee(bills.fees, 'equipment.totalFee');
- const mainMaterialEquipment = scMathUtil.roundForObj(mainMaterial + equipment, Decimal.FEE); // 主材设备费 = 主材 + 设备 (设备不输出)
- const attrs = [
- // 人工费
- {
- name: 'Labor', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'labour.totalFee')
- },
- // 材料费
- {
- name: 'Material', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'material.totalFee')
- },
- // 主材费
- {
- name: 'MainMaterial', type: _type.DECIMAL,
- value: mainMaterial
- },
- // 主材设备费
- {
- name: 'MainMaterialEquipment', type: _type.DECIMAL,
- value: mainMaterialEquipment
- },
- // 暂估价
- {
- name: 'Appraisal', type: _type.DECIMAL,
- value: _util.getFeeByFlag(items, fixedFlag.ESTIMATE, 'common.totalFee')
- },
- // 机械费
- {
- name: 'Machine', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'machine.totalFee')
- },
- // 管理费
- {
- name: 'Overhead', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'manage.totalFee')
- },
- // 利润
- {
- name: 'Profit', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'profit.totalFee')
- },
- // 分部分项工程费
- {
- name: 'DivisionalAndElementalWorks', type: _type.DECIMAL,
- value: _util.getFeeByFlag(items, fixedFlag.SUB_ENGINERRING, 'common.totalFee')
- },
- // 措施项目费
- {
- name: 'Preliminaries', type: _type.DECIMAL,
- value: _util.getFeeByFlag(items, fixedFlag.MEASURE, 'common.totalFee')
- },
- // 绿色施工安全防护措施费
- {
- name: 'CostForHSE', type: _type.DECIMAL,
- value: _util.getFeeByFlag(items, fixedFlag.GREEN_MEASURE_FEE, 'common.totalFee')
- },
- // 其他项目费
- {
- name: 'SundryCosts', type: _type.DECIMAL,
- value: _util.getFeeByFlag(items, fixedFlag.OTHER_MEASURE_FEE, 'common.totalFee')
- },
- // 暂列金额
- {
- name: 'ProvisionalSums', type: _type.DECIMAL,
- value: _util.getFeeByFlag(items, fixedFlag.PROVISIONAL, 'common.totalFee')
- },
- // 规费
- {
- name: 'StatutoryFees', type: _type.DECIMAL,
- value: '0'
- },
- // 税金
- {
- name: 'Tax', type: _type.DECIMAL,
- value: _util.getFeeByFlag(items, fixedFlag.TAX, 'common.totalFee')
- },
- ];
- _base.Element.call(this, 'SummaryOfBasicCost', attrs);
- }
- // 分部工程
- function DivisionalWorks(bills) {
- const attrs = [
- // 编码
- { name: 'Number', value: bills.code },
- // 名称
- {
- name: 'Name', required: true,
- value: bills.name
- },
- // 特征
- { name: 'Attr', value: '' },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 工程量
- {
- name: 'Quantity', type: _type.DECIMAL,
- value: bills.quantity
- },
- // 综合合价
- {
- name: 'Total', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'common.totalFee')
- },
- // 综合单价
- {
- name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
- value: _util.getFee(bills.fees, 'common.unitFee')
- },
- // 章节类型
- {
- name: 'ChapterKind', type: _type.INT, required: true,
- value: '4'
- },
- // 费用字典,拼音首字母
- { name: 'Code', value: getFeeCode(bills) },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'DivisionalWorks', attrs);
- }
- // 清单项目
- function WorkElement(node, kind, specialty) {
- const bills = node.data;
- const attrs = [
- // 项目编码
- { name: 'Number', required: true, value: bills.code || '' },
- // 项目名称
- { name: 'Name', required: true, value: bills.name },
- // 项目特征
- { name: 'Attr', value: bills.itemCharacterText },
- // 工作内容
- { name: 'WorkContent', value: bills.jocContentText },
- // 计量单位
- { name: 'Unit', required: true, value: bills.unit },
- // 工程量
- { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', type: _type.DECIMAL, value: getQtyFormula(node) },
- // 单价(元)
- { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
- // 设备单价(元)指清单项目所采用设备的综合单价
- { name: 'EquipmentPrice', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'equipment.unitFee') },
- // 最低限价(元)
- { name: 'PriceLow', type: _type.DECIMAL, value: 'todo' },
- // 最高限价(元)
- { name: 'PriceHigh', type: _type.DECIMAL, value: bills.maxPrice },
- // 费率(%)
- { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
- // 合价(元)
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 主要清单
- { name: 'Total', type: _type.BOOL, value: !!bills.mainBills },
- // 子目类型
- { name: 'Kind', type: _type.INT, required: true, value: kind },
- // 取费类型
- { name: 'CalculationKind', type: _type.INT, required: true, value: '1' },
- // 费用归属
- { name: 'CostKind', type: _type.INT, required: true, value: '1' },
- // 计算方式 todo
- { name: 'CalcType', type: _type.INT, required: true, value: '1' },
- // 专业类型
- { name: 'Specialty', type: _type.INT, value: specialty },
- // 清单标识
- { name: 'ListingIdentity', value: 'GB50500-2013 1 GD' },
- // 费用代号
- { name: 'Code', value: getFeeCode(bills) },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'WorkElement', attrs);
- }
- // 工程量计算表
- function ExpressElement(quantityDetail) {
- const attrs = [
- // 序号
- { name: 'OrderNumber', required: true, value: quantityDetail.name },
- // 工程量计算式
- { name: 'Express', required: true, value: quantityDetail.regex },
- // 工程量
- { name: 'Quantity', required: true, value: quantityDetail.result },
- // 汇总类型
- { name: 'Kind', type: _type.INT, required: true, value: SummationKindMap[quantityDetail.isSummation] },
- ];
- _base.Element.call(this, 'ExpressElement', attrs);
- }
- // 工序内容
- function WorkContent(contentText, fee) {
- const attrs = [
- // 定额工作内容
- { name: 'Name', required: true, value: contentText },
- // 取此工作内容下定额子目/量价/定额同级人材机的综合合价之和
- { name: 'Total', type: _type.DECIMAL, value: fee },
- { name: 'Remark', value: '' }
- ];
- _base.Element.call(this, 'WorkContent', attrs);
- }
- // 定额子目
- function Norm(ration, libCode, kind, specialty) {
- const attrs = [
- // 定额编码
- { name: 'Number', required: true, value: ration.code },
- { name: 'Name', required: true, value: ration.name },
- { name: 'Unit', required: true, value: ration.unit },
- { name: 'Quantity', type: _type.DECIMAL, value: ration.quantity },
- // 单价
- { name: 'Price', type: _type.DECIMAL, value: _util.getFee(ration.fees, 'common.unitFee') },
- // 合价
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(src.fees, 'common.totalFee') },
- // 是否定额
- { name: 'IsNorm', type: _type.Bool, required: true, value: 'true' },
- // 子目类型
- { name: 'Kind', type: _type.INT, required: true, value: kind },
- // 取费类型 todo
- { name: 'CalculationKind', type: _type.INT, required: true, value: '1' },
- // 费用归属
- { name: 'CostKind', type: _type.INT, required: true, value: '1' },
- // 降效类型
- {
- name: 'EfficiencyKind', type: _type.INT,
- value: ration.type === rationType.overHeight ? EfficiencyKind.baseReduction : EfficiencyKind.notReduction
- },
- // 子目增加费类型
- { name: 'IncFeeKind', type: _type.INT, value: 'todo' },
- // 换算说明
- { name: 'Conversion', value: 'todo' },
- // 专业类别
- { name: 'Specialty', type: _type.INT, value: specialty },
- //定额标识(定额库编码)
- { name: 'NormIdentity', value: libCode },
- // 册 定额书没有分册填写0,有分册的按册号填写
- { name: 'Volume', type: _type.INT, value: getVolume(ration.code) },
- // 章
- { name: 'Chapter', type: _type.INT, value: getChapter(ration.code) },
- { name: 'Remark', value: ration.remark }
- ];
- _base.Element.call(this, 'Norm', attrs);
- }
- // 子目管理费
- function ManageFees(calcTemplate, calcItems) {
- const calcItems = (calcTemplate || {}).calcItems;
- const manageItem = (calcItems || []).find(item => item.name === '管理费');
- const fee1 = manageItem ? manageItem.unitFee : '0';
- const rate = manageItem && commonUtil.isDef(manageItem.feeRate) ? manageItem.feeRate : '100';
- const attrs = [
- // 一类地区管理费 输出定额计算程序的管理费单价
- { name: 'Fee1', type: _type.DECIMAL, required: true, value: fee1 },
- // 二类地区管理费
- { name: 'Fee2', type: _type.DECIMAL, required: true, value: '0' },
- // 三类地区管理费
- { name: 'Fee3', type: _type.DECIMAL, required: true, value: '0' },
- // 四类地区管理费
- { name: 'Fee4', type: _type.DECIMAL, required: true, value: '0' },
- // 管理费换算比例
- { name: 'Rate', type: _type.DECIMAL, required: true, value: rate },
- ];
- _base.Element.call(this, 'ManageFees', attrs);
- }
- // 工料机含量明细
- function LabourMaterialsEquipmentsMachinesElement(rationGLJ) {
- const attrs = [
- // 工料机编码
- { name: 'Number', value: rationGLJ.code },
- // 消耗量
- { name: 'Quantity', value: rationGLJ.quantity },
- // 不计价材料
- { name: 'NOCost', typ: _type.BOOL, value: 'false' },
- // 备注
- { name: 'Remark', value: '' }
- ];
- _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesElement', attrs);
- }
- //子目单价计算
- function UnitPriceCalculationOfItem(calcItem) {
- const feeRate = commonUtil.isDef(calcItem.feeRate) ? calcItem.feeRate : '100';
- const attrs = [
- // 费用名称
- { name: 'Name', required: true, value: calcItem.name },
- // 计算基数
- { name: 'QtyFormula', value: CalculationQtyMap[calcItem.name] },
- // 费率
- { name: 'Rate', value: feeRate },
- // 金额
- { name: 'Total', value: calcItem.totalFee },
- // 费用代号
- { name: 'Code', value: CalculationCodeMap[calcItem.name] },
- // 备注
- { name: 'Remark', value: '' },
- ];
- _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesElement', attrs);
- }
- // 其他项目
- function Sundry() {
- _base.Element.call(this, 'Sundry', []);
- }
- // 其他项目汇总子目
- function SundryItem(eleName, bills) {
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 费用代号
- { name: 'Code', required: true, value: getFeeCode(bills) },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, eleName, attrs);
- }
- // 其他项目费标题
- function SundryCostsGroup(bills) {
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 费用代号
- { name: 'Code', required: true, value: getFeeCode(bills) },
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.YES },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'SundryCostsGroup', attrs);
- }
- // 其他项目费明细
- function SundryCostsItem(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 工程量
- { name: 'Quantity', value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 单价
- { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
- // 费率
- { name: 'Rate', value: bills.feeRate },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 费用代号
- { name: 'Code', required: true, value: getFeeCode(bills) },
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'SundryCostsItem', attrs);
- }
- // 暂列金额标题
- function ProvisionalSumsGroup(bills) {
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.YES },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'ProvisionalSumsGroup', attrs);
- }
- // 暂列金额明细
- function ProvisionalSumsItem(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 工程量
- { name: 'Quantity', value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 单价
- { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
- // 费率
- { name: 'Rate', value: bills.feeRate },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'ProvisionalSumsItem', attrs);
- }
- // 材料设备暂估价明细
- // 读取单位工程-其他项目费的材料暂估价的组成数据,业务上这个清单是使用清单基数计算得来,所以此部分读取整个单位工程下打勾暂估的材料
- function ProvisionalMaterialEquipmentItem(glj) {
- const attrs = [
- // 编码
- { name: 'Number', value: glj.code },
- // 名称
- { name: 'Name', required: true, value: glj.name },
- // 型号规格
- { name: 'Specification', value: glj.specs },
- // 单位
- { name: 'Unit', required: true, value: bills.unit },
- // 工程量(总消耗量)
- { name: 'Quantity', value: glj.quantity },
- // 单价
- { name: 'Price', value: 'todo' },
- // 金额
- { name: 'Total', value: 'todo'},
- // 备注
- { name: 'Remark', value: 'todo' }
- ];
- _base.Element.call(this, 'ProvisionalMaterialEquipmentItem', attrs);
- }
- // 专业工程暂估价标题
- function SpecialtyProvisionalPriceGroup(bills) {
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 工程内容
- { name: 'Content', value: bills.engineeringContent },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.YES },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'SpecialtyProvisionalPriceGroup', attrs);
- }
- // 专业工程暂估价明细
- function SpecialtyProvisionalPriceItem(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 工程内容
- { name: 'Content', value: bills.engineeringContent },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 工程量
- { name: 'Quantity', value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 单价
- { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
- // 费率
- { name: 'Rate', value: bills.feeRate },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'SpecialtyProvisionalPriceItem', attrs);
- }
- // 计日工标题
- function DayWorkRateGroup(bills) {
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 费用代号
- { name: 'Code', value: getFeeCode(bills) },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'DayWorkRateGroup', attrs);
- }
- // 计日工明细
- function DayWorkRateItem(bills) {
- const bills = node.data;
- const attrs = [
- // 编码
- { name: 'Number', value: bills.code },
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 型号规格
- { name: 'Specification', value: '' },
- // 单位
- { name: 'Unit', required: true, value: bills.unit },
- // 工程量
- { name: 'Quantity', value: bills.quantity },
- // 单价
- { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'DayWorkRateItem', attrs);
- }
- // 总承包服务费标题
- function MainContractorAttendanceGroup(bills) {
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.YES },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'MainContractorAttendanceGroup', attrs);
- }
- // 总承包服务费明细
- function MainContractorAttendanceItem(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 项目价值
- { name: 'Quantity', value: bills.quantity },
- // 服务内容
- { name: 'Content', value: bills.serviceContent },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 费率
- { name: 'Rate', value: bills.feeRate },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'MainContractorAttendanceItem', attrs);
- }
- // 索赔、签证费用标题
- function ClaimVisaCostGroup(eleName, bills) {
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.YES },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, eleName, attrs);
- }
- // 索赔费用明细
- function ClaimVisaCostItem(eleName, node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', required: true, value: bills.name },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 数量
- { name: 'Quantity', value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 单价
- { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
- // 费率
- { name: 'Rate', value: bills.feeRate },
- // 金额
- { name: 'Total', value: _util.getFee(bills.fees, 'common.totalFee')},
- // 依据
- { name: 'Reason', value: ''},
- // 汇总类型
- { name: 'Kind', required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, eleName, attrs);
- }
- // 建设项目节点
- let constructionProjectEle = null;
- /*
- * 加载数据,分两种数据类型
- * 1.建设项目
- * 2.建设项目下单位工程
- * @param {Object}项目数据
- * @return {Array}
- * */
- async function loadData(projectData) {
- // 提取出的数据
- const extractData = [];
- // 建设项目部分
- constructionProject = await loadConstructionProject(projectData);
- extractData.push({
- data: constructionProject,
- dataType: DATA_TYPE.project,
- exportKind,
- fileName: 'Project.xml'
- });
- // 单位工程部分
- // 提取出单位工程级别的项目数据
- const tenderData = projectData.children.reduce((acc, cur) => {
- if (Array.isArray(cur.children)) {
- acc.push(...cur.children)
- }
- return acc;
- }, []);
- // 获取单位工程详细结构
- const isPlainTender = false;
- const tenders = await loadTender(projectData.summaryInfo, tenderData, isPlainTender);
- tenders.forEach(tender => {
- // 单位工程文件名为@_单位工程编码_单位工程名称.xml
- // 因为单位工程编码后续用户可能会改变,这里暂时将fileName设置成单位工程名称.xml
- const name = tender.attrs.find(attr => attr.name === 'Name');
- extractData.push({
- data: tender,
- dataType: DATA_TYPE.tender,
- exportKind,
- fileName: `${name}.xml`
- })
- });
- return extractData;
- }
- /*
- * 加载建设项目
- * @param {Object}项目数据
- * @return {Array}
- * */
- async function loadConstructionProject(projectData) {
- const summaryInfo = projectData.summaryInfo[projectData.ID];
- // 建设项目
- constructionProjectEle = new ConstructionProject(projectData);
- // 系统信息
- const systemInfo = new SystemInfo({
- // 软件相关信息进行base64编码
- ID1: Base64.encode(projectData.softInfo),
- ID2: _util.generateHardwareId(),
- makeDate: moment(Date.now()).format('YYYY-MM-DDTHH:mm:ss'),
- });
- // 工程信息
- const constructionInfo = loadConstructionInfo(projectData);
- // 费用汇总
- const summaryCost = new SummaryOfCost(summaryInfo);
- // 建筑安装工程费
- const projectInstall = new ProjectInstallationWorkCost(projectData, summaryInfo);
- // 单项工程
- const sectionalWorks = await loadEngineering(summaryInfo, projectData.children);
- projectInstall.children.push(...sectionalWorks);
- constructionProject.children.push(
- systemInfo,
- constructionInfo,
- summaryCost,
- projectInstall
- );
- return constructionProject;
- }
- // 加载工程信息相关元素
- function loadConstructionInfo(projectData) {
- const basicInformation = projectData.property.basicInformation;
- const summaryInfo = projectData.summaryInfo[projectData.ID];
- // 工程信息
- const constructionInfo = new ConstructionInfo();
- // 费用精度
- const option = new Option();
- // 估(概、预、结)算信息
- const projectInfo = new ProjectInfo(basicInformation, summaryInfo);
- let exportInfo;
- if (exportKind === _config.EXPORT_KIND.Bid) {
- // 招标信息
- exportInfo = new TendereeInfo(basicInformation);
- } else if (exportKind === _config.EXPORT_KIND.Tender) {
- // 投标信息
- exportInfo = new BidderInfo(basicInformation, summaryInfo);
- }
- constructionInfo.push(option, projectInfo, exportInfo);
- return constructionInfo;
- }
- /*
- * 加载所有单项工程元素
- * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
- * {Array}engineeringData 所有单项工程项目数据
- * @return {Array}
- * */
- async function loadEngineering(summaryInfoMap, engineeringData) {
- const isPlainTender = true;
- const engineeringTasks = engineeringData.map(async engData => {
- const summaryInfo = summaryInfoMap[engData.ID];
- // 单项工程
- const sectionalWork = new SectionWorks({
- name: engData.name,
- total: summaryInfo.engineeringCost,
- rate: summaryInfo.rate,
- });
- // 费用汇总
- const summaryCost = new SummaryOfCost(summaryInfo);
- // 简单结构的单位工程
- const tenders = await loadTenders(summaryInfoMap, engData.children, isPlainTender);
- sectionalWork.push(summaryCost, ...tenders);
- return sectionalWork;
- });
- return await Promise.all(engineeringTasks);
- }
- /*
- * 加载所有单位工程元素
- * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
- * {Array}tenderData 所有单项工程项目数据
- * {Boolean}isPlain 是否简单结构(简单结构只含有UnitWorks,其下不含子元素)
- * @return {Array}
- * */
- let tenderDetail = null;
- async function loadTenders(summaryInfoMap, tenderData, isPlain) {
- const basicInformation = projectData.property.basicInformation;
- const tenderTasks = tenderData.map(async tData => {
- const summaryInfo = summaryInfoMap[tData.ID];
- // 单位工程
- const unitWork = new UnitWorks(projectData, tData, summaryInfo);
- // 简单结构,不需要继续添加子元素
- if (isPlain) {
- return unitWork;
- }
- // 不是简单结构,继续添加各种子元素
- // 工程特征信息
- const attrInfo = loadAttrInfo(tData.property.projectFeature);
- // 基本信息
- const addiInfo = loadAddiInfo(projectData.property.basicInformation);
- // 费用汇总
- const summaryOfCost = new SummaryOfCost(summaryInfo);
- // 获取单位工程详细数据
- tenderDetail = await _util.getTenderDetail(tData.ID, userID);
- // 单位工程费用汇总
- const unitWorksSummary = loadUnitWorksSummary(tenderDetail);
- // 分部分项工程
- const divisionalElements = loadDivisionalAndElementalWorks();
- // 措施项目
- const preliminaries = loadPreliminaries();
- // 其他项目
-
- unitWork.children.push(attrInfo, addiInfo, summaryOfCost, unitWorksSummary, divisionalElements, preliminaries);
- });
- return await Promise.all(tenderTasks);
- }
- // 加载工程特征信息
- // attrList 单位工程的工程特征,来自property.projectFeature
- function loadAttrInfo(attrList) {
- const attrInfo = new Info('AttrInfo');
- // 有值的才输出
- attrInfo.children = attrList
- .filter(attr => commonUtil.isDef(attr.value))
- .map(attr => new InfoItem('AttrInfoItem', attr));
- return attrInfo;
- }
- // 加载补充信息(基本信息所有条目)
- function loadAddiInfo(infoList) {
- const addiInfo = new Info('AddiInfo');
- addiInfo.children = infoList.map(rootInfoItem => {
- const rootInfo = new InfoItem('AddiInfoItem', rootInfoItem);
- rootInfo.children = rootInfoItem.items.map(infoItem => new InfoItem('AddiInfoItem', infoItem));
- return rootInfo;
- });
- }
- // 加载单位工程费用汇总
- // tenderDetail 单位工程详细数据
- function loadUnitWorksSummary() {
- const unitWorksSummary = new UnitWorksSummary();
- // 读取单位工程中的固定类别为“分部分项工程”、“措施项目”、“其他项目”的大项费用
- // 分部分项
- const fbfx = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.SUB_ENGINERRING);
- const fbfxGroup = new UnitWorksSummaryGroup(fbfx.data);
- // 分部分项工程的子项,取项目名称的首字母拼接
- const fbfxChildren = fbfx.children.map(node => new UnitWorksSummaryItem(node));
- fbfxGroup.children.push(...fbfxChildren);
- // 措施项目
- const csxm = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.MEASURE);
- const csxmGroup = new UnitWorksSummaryGroup(csxm.data);
- // 措施项目的子项,“绿色施工安全防护措施费”、“其他措施费”
- const csxmChildren = csxm.getPosterity()
- .filter(node => [fixedFlag.GREEN_MEASURE_FEE, fixedFlag.OTHER_MEASURE_FEE].includes(node.getFlag()))
- .map(node => new UnitWorksSummaryItem(node));
- csxmGroup.children.push(...csxmChildren);
- // 其他项目
- const other = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.OTHER);
- const otherGroup = new UnitWorksSummaryGroup(other.data);
- // 其他项目子项,暂列金额;暂估价;材料(工程设备)暂估价;专业工程暂估价;计日工;总承包服务费;预算包干费;工程优质费;概算幅度差;索赔费用;现场签证费用;其他费用
- const otherChildrenFlags = [
- fixedFlag.PROVISIONAL,
- fixedFlag.ESTIMATE,
- fixedFlag.MATERIAL_PROVISIONAL,
- fixedFlag.ENGINEERING_ESITIMATE,
- fixedFlag.DAYWORK,
- fixedFlag.TURN_KEY_CONTRACT,
- fixedFlag.BUDGET_INCLUDE_WORK_FEE,
- fixedFlag.PROJECT_HIGH_QUALITY_FEE,
- fixedFlag.BUDGET_ESTIMATE_DIFF,
- fixedFlag.CLAIM,
- fixedFlag.VISA,
- fixedFlag.OTHER_FEE
- ];
- const otherChildren = other.getPosterity()
- .filter(node => otherChildrenFlags.includes(node.getFlag()))
- .map(node => new UnitWorksSummaryItem(node));
- otherGroup.chilren.push(...otherChildren);
- // 除固定类别为“分部分项工程”、“措施项目”、“其他项目”以外的大项费用,通常无子项,所以显示到Item中。(即使造价书有子项,也显示到Item中,不再列出其子项数据)
- const flags = [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE, fixedFlag.OTEHER];
- const otherRoots = tenderDetail.mainTree.roots
- .filter(node => !flags.includes(node.getFlag()))
- .map(node => new UnitWorksSummaryItem(node));
- unitWorksSummary.children.push(fbfxGroup, csxmGroup, otherGroup, ...otherRoots);
- return unitWorksSummary;
- }
- // 加载分部分项工程
- function loadDivisionalAndElementalWorks() {
- const division = new DivisionalAndElementalWorks();
- const subEngineering = tenderDetail.mainTree.roots.find(node => node.getFlag === fixedFlag.SUB_ENGINERRING);
- // 合计费用
- const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, subEngineering.data);
- // 分部、分项
- const fbfx = loadFBFX(subEngineering.children, BillsKind.FBFX);
- division.children.push(summaryCost, ...fbfx);
- return division;
- }
- // 加载措施项目
- function loadPreliminaries() {
- const preliminaries = new Preliminaries();
- const measure = tenderDetail.mainTree.roots.find(node => node.getFlag === fixedFlag.MEASURE);
- // 合计费用
- const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, measure.data);
- // 分部、分项
- const fbfx = loadFBFX(measure.children, BillsKind.MEASURE);
- preliminaries.children.push(summaryCost, ...fbfx);
- return preliminaries;
- }
- // 加载其他项目
- function loadSundry(params) {
- const sundry = new Sundry();
- // 其他项目费
-
- const sundryCosts = new SundryItem()
- }
- // 加载分部分项清单,这部分是分部分项工程和措施项目共用的
- function loadFBFX(nodes, kind) {
- return nodes.map(node => {
- let ele;
- // 有子清单的是分部
- if (node.source.children.length) {
- ele = new DivisionalWorks(node.data);
- // 递归获取子元素
- ele.children = loadFBFX(node.source.children);
- } else { // 无子清单的是分项
- ele = loadBills(node.data, kind, specialty);
- }
- return ele;
- });
- }
- // 加载清单
- function loadBills(node, kind) {
- const specialty = Specialty[tenderDetail.property.engineeringName]; // 工程专业
- const workElement = new WorkElement(node, kind, specialty);
- // 合计费用
- const summaryCost = new SummaryOfBasicCost(tenderDetail.mainTree.items, node.data);
- workElement.children.push(summaryCost);
- // 工程量计算表
- const expressElement = loadQuantityExpressions(tenderDetail.quantity_detail.datas, true, node.data.ID);
- workElement.children.push(...expressElement);
- // 相同工作内容的定额进行分组
- const workMap = _.groupBy(node.children, node => node.data.jobContentText || '');
- const workContents = Object.entries(workMap).map(([contentText, rationNodes]) => {
- const workContent = new WorkContent(contentText, _util.getAggregateFee(rationNodes));
- workContent.children = rationNodes.map(node => loadRation(node, kind, specialty));
- });
- workElement.children.push(...workContents);
- return workElement
- }
- // 加载工程量计算表
- function loadQuantityExpressions(quantityDetails, isBills, ID) {
- if (quantityDetails.length) {
- return [];
- }
- quantityDetails.sort((a, b) => a.seq - b.seq);
- const key = isBills ? 'billID' : 'rationID';
- return quantityDetails
- .filter(quantityDetail => quantityDetail[key] === ID)
- .map(quantityDetail => new ExpressElement(quantityDetail));
- }
- // 获取定额的定额库编码
- function getLibCode(ration, rationLibs) {
- const theLib = rationLibs.find(lib => lib.id === ration.libID);
- return theLib ? theLib.libCode : '';
- }
- // 加载定额
- function loadRation(node, kind, specialty) {
- // 定额
- const libCode = getLibCode(node.data, tenderDetail.projectInfo.engineeringInfo.ration_lib);
- const norm = new Norm(node.data, libCode, kind, specialty);
- // 工程量计算表
- const expressElement = loadQuantityExpressions(tenderDetail.quantity_detail.datas, false, node.data.ID);
- if (expressElement.length) {
- norm.children.push(...expressElement);
- }
- // 触发计算程序计算,否则定额calcTemplate数据必为空
- calcProgramObj.refreshCalcProgram(node, 4);
- // 子目管理费
- const manageFees = new ManageFees(node.data.calcTemplate);
- norm.children.push(manageFees);
- // 定额人材机含量明细
- let rationGLJs = tenderDetail.ration_glj.datas.filter(rGLJ => rGLJ.rationID === node.data.ID);
- rationGLJs = gljUtil.sortRationGLJ(rationGLJs); // 定额人材机排序
- const rationGLJElements = rationGLJs
- .filter(rGLJ => {
- // 总消耗量为0的,不输出
- const totalQuantity = gljUtil.getTotalQuantity(rGLJ, node.data, Decimal.GLJ, Decimal.QUANTITY);
- const parsedTotalQuantity = parseFloat(totalQuantity);
- return parsedTotalQuantity;
- })
- .map(rGLJ => new LabourMaterialsEquipmentsMachinesElement(rGLJ));
- norm.children.push(...rationGLJElements);
- // 子目单价计算(定额计算程序)
- if (node.data.calcTemplate) {
- const unitPriceCalculationOfItems = node.data.calcTemplate.calcItems.map(item => new UnitPriceCalculationOfItem(item));
- norm.children.push(...unitPriceCalculationOfItems);
- }
- return norm;
- }
- }
- /*
- * 重置工程编号,广东18 3.0的接口,导出时的文件会用到这个编号
- * 因此重置工程编号后,还需要重置文件名数据
- * @param {Array}codes 工程编号
- * {Array}extractData 提取的数据
- * @return {void}
- * */
- function resetContentCode(codes, extractData) {
- // 提取到的数据分两种类型:
- // 1.根元素为建设项目:需要修改建设项目下的单位工程元素的编码和文件名
- // 2.根元素为单位工程:需要修改单位工程的编码和文件名
- // 获取建设项目数据下的单位工程元素
- const ExtractProjects = extractData.filter(data => data.dataType === DATA_TYPE.project);
- const tenders = ExtractProjects.map(extractP => {
- // 建设项目元素下建筑安装工程费元素
- const projectInstallations = _util.getElementFromSrc(extractP.data, 'ProjectInstallationWorkCost');
- // 建筑安装工程费元素下单项工程元素
- const sectionalWorks = projectInstallations.reduce((acc, cur) => {
- const sections = _util.getElementFromSrc(cur, 'SectionalWorks');
- acc.push(...sections);
- }, []);
- // 单项工程元素下单位工程元素
- return sectionalWorks.reduce((acc, cur) => {
- const tenders = _util.getElementFromSrc(cur, 'UnitWorks');
- acc.push(...tenders);
- }, []);
- });
- // 重置编号
- let idx = 0;
- for (let tender of tenders) {
- let codeItem = tender.attrs.find(attr => attr.name === '编号');
- codeItem.value = codes[idx++];
- }
- }
- })();
|