123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691 |
- /**
- *
- *
- * @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 = {
- BASE_REDUCTION: '1', // 降效基础定额
- NOT_BASE_REDUCTION: '2', // 非降效定额
- MARKET_PRICE_REDUCTION: '3', // 按市场价计算降效费用定额
- RATION_PRICE_REDUCTION: '4', // 按定额价计算降效费用定额
- };
- // 子目增加费类型 安装工程定额子目增加费的费用计算标记
- const IncFeeKind = {
- SUB_BASE: '1', // 子目增加费基础定额
- NOT_SUB_BASE: '2', // 非子目增加费定额
- SUB_CALC: '3', // 子目增加费用计算定额
- };
- // 工料机类型
- const GLJKind = {
- };
- // 供料方式
- const Provider = {
- [supplyType.ZXCG]: '1',
- [supplyType.BFJG]: '2',
- [supplyType.WQJG]: '2',
- [supplyType.WQJG]: '3',
- }
- // 通用设置和工具
- 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, enumerable) {
- // 工程类型 工程专业+费用标准
- if (!enumerable) {
- const engineeringName = projectData.property.engineeringName.replace('工程', '');
- const feeStandardName = projectData.property.feeStandardName;
- return `${engineeringName}${feeStandardName}`;
- }
- 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;
- if (!sameFeeCodes.includes(bills.ID)) {
- sameFeeCodes.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 FlagFeeCodeMap[node.getFlag()] || '';
- }
- if (expr) {
- const normalBase = _util.getNormalBase(expr);
- const 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;
- }
- }
- // 获取计算计算说明
- function getCalBasis(node) {
- let expr = node.data.calcBase || '';
- expr = expr.replace(new RegExp('{', 'g'), '');
- expr = expr.replace(new RegExp('}', 'g'), '');
- 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';
- }
- // 获取人材机类型
- function getGLJKind(type) {
- // 标准中的定义: 1=人工;2=材料;3=机械;4=主材;5=设备;6=配合比(砂浆、混凝土);7=机械(具)台班;8=定额材料;15=其他。
- // 处理人材机类型:2=除了配合比、砂浆、混凝土的材料; 3=除了机械台班的机械
- type = +type;
- switch (type) {
- case 202:
- case 203:
- case 204:
- return '6'; // 配合比、砂浆、混凝土
- case 301:
- return '7'; // 机械台班
- case 6:
- case 7:
- case 8:
- return '15'; // 管理费、利润、一般风险费
- }
- const rootTypeReg = /\d/;
- const rootType = rootTypeReg.exec(type)[0];
- return ['1', '2', '3', '4', '5', '6'].includes(rootType) ? rootType : '15';
- }
- /*
- * 提取数据入口
- * @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
- // 错误列表
- const _failList = _cache.getItem('failList');
- // 建设项目
- function ConstructionProject(projectData, summaryInfo) {
- const basicInformation = projectData.property.basicInformation;
- const attrs = [
- // 项目编号
- {
- name: 'Number', dName: '项目编号', required: true,
- value: _util.getValueByKey(basicInformation, 'projNum')
- },
- // 项目名称
- {
- 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, true)
- },
- // 建设性质
- {
- name: 'ConstructionType', type: _type.INT, enumeration: Object.values(ConstructionType), enumerationHint: Object.keys(ConstructionType),
- value: ConstructionType[_util.getValueByKey(basicInformation, 'constructionType')]
- },
- // 文件类型
- {
- name: 'FileKind', dName: '文件类型', type: _type.INT, required: true,
- 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.values(AreaKind), enumerationHint: Object.keys(AreaKind),
- value: AreaKind[_util.getValueByKey(basicInformation, 'regionalCategories')]
- },
- // 工程地点
- {
- name: 'ProjectSite',
- value: _util.getValueByKey(basicInformation, 'projLocation')
- },
- // 建设单位
- {
- name: 'BulidUnit', 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, 'scale')
- },
- // 建设规模单位
- {
- name: 'Unit', dName: '建设规模单位', required: true,
- value: _util.getValueByKey(basicInformation, 'unit')
- },
- // 技术经济指标(元) 取单方造价
- {
- name: 'TechnicalAndEconomicIndex', type: _type.DECIMAL,
- value: summaryInfo.perCost
- },
- // 总说明 编制说明
- {
- name: 'Explains',
- value: projectData.property.compilationIllustrationProject
- }
- ];
- //唯一约束
- 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', mustHasValue: true, value: _util.getValueByKey(basicInformation, 'designUnits') },
- // 承包单位
- { name: 'Contractor', mustHasValue: true, value: _util.getValueByKey(basicInformation, 'constructionUnits') },
- // 编制单位
- {
- name: 'CompileCompany', dName: '编制单位', required: true,
- value: _util.getValueByKey(basicInformation, 'establishUnit') || '无'
- },
- // 编制时间,投标文件取bidCompileDate。招标、控制价文件取tenderCompileDate
- {
- name: 'CompileDate', dName: '编制时间', required: true,
- value: exportKind === _config.EXPORT_KIND.Tender
- ? _util.getValueByKey(basicInformation, 'bidCompileDate')
- : _util.getValueByKey(basicInformation, 'tenderCompileDate')
- },
- // 编制单位法定代表人或其授权人
- { name: 'Authorizer', mustHasValue: true, value: _util.getValueByKey(basicInformation, 'authorizer') },
- // 工程总价(元)
- {
- name: 'Total', dName: '工程总价', type: _type.DECIMAL, required: true,
- value: summaryInfo.engineeringCost
- }
- ];
- _base.Element.call(this, 'ProjectInfo', attrs, '建设项目基本信息');
- }
- // 招标信息 工程量清单、招标控制价时输出
- // 有内容的属性才输出
- function TendereeInfo(basicInformation, summaryInfo) {
- const attrs = [
- // 招标人
- {
- name: 'TendereeName', dName: '招标人', required: true,
- value: _util.getValueByKey(basicInformation, 'tendereeName')
- },
- // 招标单位法定代表人或其授权人
- {
- name: 'TenderAuthorizer', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderAuthorizer')
- },
- // 招标单位编制人
- {
- name: 'TenderCompiler', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderCompiler')
- },
- // 招标单位编制人资格证书编号
- {
- name: 'TenderCompilerCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderCompilerCertNo')
- },
- // 招标单位编制时间
- {
- name: 'TenderCompileDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderCompileDate')
- },
- // 招标单位审核人
- {
- name: 'TenderExaminer', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderExaminer')
- },
- // 招标单位审核人资格证书编号
- {
- name: 'TenderExaminerCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderExaminerCertNo')
- },
- // 招标单位审核时间
- {
- name: 'TenderExamineDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderExamineDate')
- },
- // 招标单位审定人
- {
- name: 'TenderApprover', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderApprover')
- },
- // 招标单位审定人资格证书编号
- {
- name: 'TenderApproverCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderApproverCertNo')
- },
- // 招标单位审定时间
- {
- name: 'TenderApproveDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'tenderApproveDate')
- },
- // 招标代理 不得为空,如无招标代理,则应填写“无”。
- {
- name: 'Proxy', dName: '招标代理',
- value: _util.getValueByKey(basicInformation, 'proxy') || '无', required: true
- },
- // 招标代理资质证书编号
- {
- name: 'ProxyCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyCertNo')
- },
- // 招标代理法定代表人或其授权人
- {
- name: 'ProxyAuthorizer', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyAuthorizer')
- },
- // 招标代理编制人员
- {
- name: 'ProxyCompiler', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyCompiler')
- },
- // 招标代理编制人员资格证书编号
- {
- name: 'ProxyCompilerCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyCompilerCertNo')
- },
- // 招标代理编制时间
- {
- name: 'ProxyCompileDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyCompileDate')
- },
- // 招标代理审核人
- {
- name: 'ProxyExaminer', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyExaminer')
- },
- // 招标代理审核人资格证书编号
- {
- name: 'ProxyExaminerCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyExaminerCertNo')
- },
- // 招标代理审核时间
- {
- name: 'ProxyExamineDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyExamineDate')
- },
- // 招标代理审定人
- {
- name: 'ProxyApprover', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyApprover')
- },
- // 招标代理审定人资格证书编号
- {
- name: 'ProxyApproverCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyApproverCertNo')
- },
- // 招标代理审定时间
- {
- name: 'ProxyApproveDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'proxyApproveDate')
- },
- // 造价咨询 、Consultant(造价咨询):不得为空,如无则应填写“无”。
- {
- name: 'Consultant', dName: '造价咨询', required: true,
- value: _util.getValueByKey(basicInformation, 'consultant') || '无'
- },
- // 造价咨询资质证书编号
- {
- name: 'ConsultantCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantCertNo')
- },
- // 造价咨询法定代表人或其授权人
- {
- name: 'ConsultantAuthorizer', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantAuthorizer')
- },
- // 造价咨询编制人
- {
- name: 'ConsultantCompiler', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantCompiler')
- },
- // 造价咨询编制人资格证书
- {
- name: 'ConsultantCompilerCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantCompilerCertNo')
- },
- // 造价咨询编制时间
- {
- name: 'ConsultantCompileDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantCompileDate')
- },
- // 造价咨询审核人
- {
- name: 'ConsultantExaminer', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantExaminer')
- },
- // 造价咨询审核人资格证书编号
- {
- name: 'ConsultantExaminerCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantExaminerCertNo')
- },
- // 造价咨询审核时间
- {
- name: 'ConsultantExamineDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantExamineDate')
- },
- // 造价咨询审定人
- {
- name: 'ConsultantApprover', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantApprover')
- },
- // 造价咨询审定人资格证书编号
- {
- name: 'ConsultantApproverCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantApproverCertNo')
- },
- // 造价咨询审定时间
- {
- name: 'ConsultantApproveDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'consultantApproveDate')
- },
- // 招标控制价(元)
- {
- name: 'TenderSumLimit', dName: '招标控制价', type: _type.DECIMAL, required: true,
- value: summaryInfo.engineeringCost
- }
- ];
- _base.Element.call(this, 'TendereeInfo', attrs, '招标信息');
- }
- // 投标信息
- function BidderInfo(basicInformation, summaryInfo) {
- const attrs = [
- // 投标人
- {
- name: 'BidName', dName: '投标人', required: true,
- value: _util.getValueByKey(basicInformation, 'bidName') || '无'
- },
- // 投标单位法定代表人或其授权人
- {
- name: 'BidAuthorizer', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidAuthorizer')
- },
- // 投标总价(元)
- {
- name: 'BidTotal', dName: '投标总价', type: _type.DECIMAL, required: true,
- value: summaryInfo.engineeringCost
- },
- // 投标单位编制人
- {
- name: 'BidCompiler', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidCompiler')
- },
- // 投标单位编制人资格证书编号
- {
- name: 'BidCompilerCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidCompilerCertNo')
- },
- // 投标单位编制时间
- {
- name: 'BidCompileDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidCompileDate')
- },
- // 投标单位审核人
- {
- name: 'BidExaminer', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidExaminer')
- },
- // 投标单位审核人资格证书编号
- {
- name: 'BidExaminerCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidExaminerCertNo')
- },
- // 投标单位审核时间
- {
- name: 'BidExamineDate', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidExamineDate')
- },
- // 投标单位审定人
- {
- name: 'BidApprover', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidApprover')
- },
- // 投标单位审定人资格证书
- {
- name: 'BidApproverCertNo', mustHasValue: true,
- value: _util.getValueByKey(basicInformation, 'bidApproverCertNo')
- },
- // 投标单位审定时间
- {
- name: 'BidApproveDate', mustHasValue: true,
- 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: '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', dName: '工程名称', required: true,
- value: projectData.name
- },
- // 金额 (元)
- {
- name: 'Total', type: _type.DECIMAL,
- value: summaryInfo.engineeringCost
- },
- // 建设规模
- {
- name: 'Scale', dName: '建设规模', type: _type.DECIMAL, required: true,
- value: _util.getValueByKey(basicInformation, 'projectScale')
- },
- // 建设规模单位
- {
- name: 'Unit', dName: '建设规模单位', required: true,
- value: _util.getValueByKey(basicInformation, 'unit')
- },
- // 占总投资比例(%)
- {
- name: 'Ratios', type: _type.DECIMAL,
- value: '0.00'
- },
- ];
- _base.Element.call(this, 'ProjectInstallationWorkCost', attrs, '建筑安装工程费');
- }
- // 单项工程
- function SectionalWorks({ name, total, rate }) {
- const attrs = [
- // 工程编号
- {
- name: 'Number',
- value: ''
- },
- // 工程名称
- {
- name: 'Name', dName: '工程名称', 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, 'SectionalWorks', attrs, '单项工程');
- }
- // 单位工程
- function UnitWorks(projectData, tenderData, defaultRationLibName, summaryInfo) {
- const basicInformation = projectData.property.basicInformation;
- const projectFeature = tenderData.property.projectFeature;
- const attrs = [
- // 工程编号
- {
- name: 'Number', dName: '工程编号', required: true,
- value: ''
- },
- // 工程名称
- {
- name: 'Name', dName: '工程名称', required: true,
- value: tenderData.name
- },
- // 标段 取建设项目名称
- {
- name: 'Segment',
- value: projectData.name
- },
- // 工程类别
- {
- name: 'ProjectCategory', dName: '工程类别', required: true,
- value: _util.getValueByKey(basicInformation, 'projectCategory')
- },
- // 工程类型
- {
- name: 'ProjectType', dName: '工程类型', required: true,
- value: getProjectType(tenderData, false)
- },
- // 计价模式
- {
- name: 'ValuationModel', dName: '计价模式', type: _type.INT, required: true,
- value: ValuationModel.BILL
- },
- // 计税模式
- {
- name: 'TaxModel', dName: '计税模式', type: _type.INT, required: true,
- value: tenderData.property.taxType
- },
- // 地区类别 取建设项目-基本信息-地区类别
- {
- name: 'AreaKind', dName: '地区类别', type: _type.INT, required: true, enumeration: Object.values(AreaKind), enumerationHint: Object.keys(AreaKind),
- value: AreaKind[_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', dName: '建设规模', type: _type.DECIMAL, required: true,
- value: _util.getValueByKey(projectFeature, 'buildScale')
- },
- // 建设规模单位 暂取'm2'
- {
- name: 'Unit', dName: '建设规模单位', required: true,
- value: 'm2'
- },
- // 占总投资比例(%)
- {
- name: 'Ratios', type: _type.DECIMAL,
- value: summaryInfo.rate
- },
- // 清单数据库,没有则填写 “无”
- {
- name: 'BillDataBase', dName: '清单数据库', required: true,
- value: '工程量清单规范(2013广东)',
- },
- {
- // 定额数据库,默认的定额库名称,没有则填写 “无”
- name: 'NormDataBase', dName: '定额数据库', required: true,
- value: defaultRationLibName || '无'
- },
- // 人工材料设备价格文件,没有则填写 “无”
- {
- name: 'ResInfoPricingFile', dName: '人工材料设备价格文件', required: true,
- value: '无'
- },
- // 总说明
- {
- name: 'Explains',
- value: tenderData.property.compilationIllustration
- },
- // 导出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', dName: '工程名称', 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', dName: '名称', 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', dName: '章节类型', type: _type.INT, required: true,
- value: '4'
- },
- // 费用代号
- {
- name: 'Code', dName: '费用代号', required: true,
- value: getFeeCode(bills)
- },
- // 汇总类型
- {
- name: 'Kind', dName: '汇总类型', 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', dName: '名称', 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', dName: '章节类型', type: _type.INT, required: true,
- value: '4'
- },
- // 费用代号
- {
- name: 'Code', dName: '费用代号', required: true,
- value: getFeeCode(bills)
- },
- // 汇总类型
- {
- name: 'Kind', dName: '汇总类型', 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', dName: '名称', 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', dName: '章节类型', 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', dName: '项目编码', required: true, value: bills.code || '' },
- // 项目名称
- { name: 'Name', dName: '项目名称', required: true, value: bills.name },
- // 项目特征
- { name: 'Attr', value: bills.itemCharacterText },
- // 工作内容
- { name: 'WorkContent', value: bills.jocContentText },
- // 计量单位
- { name: 'Unit', dName: '计量单位', 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: 'Major', type: _type.BOOL, value: !!bills.mainBills },
- // 子目类型
- { name: 'Kind', dName: '子目类型', type: _type.INT, required: true, value: kind },
- // 取费类型
- { name: 'CalculationKind', dName: '取费类型', type: _type.INT, required: true, value: '1' },
- // 费用归属
- { name: 'CostKind', dName: '费用归属', type: _type.INT, required: true, value: '1' },
- // 计算方式
- { name: 'CalcType', dName: '计算方式', 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', dName: '序号', required: true, value: quantityDetail.name },
- // 工程量计算式
- { name: 'Express', dName: '工程量计算式', required: true, value: quantityDetail.regex },
- // 工程量
- { name: 'Quantity', dName: '工程量', required: true, value: quantityDetail.result },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummationKindMap[quantityDetail.isSummation] },
- ];
- _base.Element.call(this, 'ExpressElement', attrs, '工程量计算表');
- }
- // 工序内容
- function WorkContent(contentText, fee) {
- const attrs = [
- // 定额工作内容
- { name: 'Name', dName: '定额工作内容', 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', dName: '定额编码', required: true, value: ration.code },
- { name: 'Name', dName: '定额名称', required: true, value: ration.name },
- { name: 'Unit', dName: '计量单位', 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(ration.fees, 'common.totalFee') },
- // 是否定额
- { name: 'IsNorm', dName: '是否定额', type: _type.Bool, required: true, value: 'true' },
- // 子目类型
- { name: 'Kind', dName: '子目类型', type: _type.INT, required: true, value: kind },
- // 取费类型
- { name: 'CalculationKind', dName: '取费类型', type: _type.INT, required: true, value: '1' },
- // 费用归属
- { name: 'CostKind', dName: '费用归属', type: _type.INT, required: true, value: '1' },
- // 降效类型
- {
- name: 'EfficiencyKind', type: _type.INT,
- value: ration.type === rationType.overHeight ? EfficiencyKind.BASE_REDUCTION : EfficiencyKind.NOT_BASE_REDUCTION
- },
- // 子目增加费类型itemIncrease
- {
- name: 'IncFeeKind', type: _type.INT,
- value: ration.type === rationType.overHeight ? IncFeeKind.SUB_BASE : IncFeeKind.NOT_SUB_BASE
- },
- // 换算说明
- { name: 'Conversion', value: ration.adjustState },
- // 专业类别
- { 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) {
- 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', dName: '一类地区管理费', type: _type.DECIMAL, required: true, value: fee1 },
- // 二类地区管理费
- { name: 'Fee2', dName: '二类地区管理费', type: _type.DECIMAL, required: true, value: '0' },
- // 三类地区管理费
- { name: 'Fee3', dName: '三类地区管理费', type: _type.DECIMAL, required: true, value: '0' },
- // 四类地区管理费
- { name: 'Fee4', dName: '四类地区管理费', type: _type.DECIMAL, required: true, value: '0' },
- // 管理费换算比例
- { name: 'Rate', dName: '管理费换算比例', type: _type.DECIMAL, required: true, value: rate },
- ];
- _base.Element.call(this, 'ManageFees', attrs, '子目管理费');
- }
- // 工料机含量明细
- function LabourMaterialsEquipmentsMachinesElement(glj, quantity) {
- const attrs = [
- // 工料机编码
- { name: 'Number', value: glj.code },
- // 消耗量
- { name: 'Quantity', type: _type.DECIMAL, value: 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', dName: '费用名称', required: true, value: calcItem.name },
- // 计算基数
- { name: 'QtyFormula', value: CalculationQtyMap[calcItem.name] },
- // 费率
- { name: 'Rate', type: _type.DECIMAL, value: feeRate },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: calcItem.totalFee },
- // 费用代号
- { name: 'Code', value: CalculationCodeMap[calcItem.name] },
- // 备注
- { name: 'Remark', value: '' },
- ];
- _base.Element.call(this, 'UnitPriceCalculationOfItem', attrs, '子目单价计算');
- }
- // 其他项目
- function Sundry() {
- _base.Element.call(this, 'Sundry', []);
- }
- // 其他项目汇总子目
- function SundryItem(eleName, bills) {
- const attrs = [
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 费用代号
- { name: 'Code', dName: '费用代号', required: true, value: getFeeCode(bills) },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, eleName, attrs, '其他项目汇总项');
- }
- // 其他项目费标题
- function SundryCostsGroup(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 费用代号
- { name: 'Code', dName: '费用代号', required: true, value: getFeeCode(bills) },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, 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', dName: '名称', required: true, value: bills.name },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 工程量
- { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 单价
- { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
- // 费率
- { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 费用代号
- { name: 'Code', dName: '费用代号', required: true, value: getFeeCode(bills) },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'SundryCostsItem', attrs, '其他项目费明细');
- }
- // 暂列金额标题
- function ProvisionalSumsGroup(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, 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', dName: '名称', required: true, value: bills.name },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 工程量
- { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 单价
- { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
- // 费率
- { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'ProvisionalSumsItem', attrs, '暂列金额明细');
- }
- // 材料设备暂估价明细
- // 读取单位工程-其他项目费的材料暂估价的组成数据,业务上这个清单是使用清单基数计算得来,所以此部分读取整个单位工程下打勾暂估的材料
- function ProvisionalMaterialEquipmentItem(glj, price) {
- const attrs = [
- // 编码
- { name: 'Number', value: glj.code },
- // 名称
- { name: 'Name', dName: '名称', required: true, value: glj.name },
- // 型号规格
- { name: 'Specification', value: glj.specs },
- // 单位
- { name: 'Unit', dName: '单位', required: true, value: bills.unit },
- // 工程量(总消耗量)
- { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
- // 单价 取市场价
- { name: 'Price', type: _type.DECIMAL, value: price.marketPrice },
- // 金额 round(总消耗量*市场价,2)
- { name: 'Total', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.quantity * price.marketPrice, 2) },
- // 备注
- { name: 'Remark', value: glj.remark }
- ];
- _base.Element.call(this, 'ProvisionalMaterialEquipmentItem', attrs, '材料设备暂估价明细');
- }
- // 专业工程暂估价标题
- function SpecialtyProvisionalPriceGroup(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 工程内容
- { name: 'Content', value: bills.engineeringContent },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, 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', dName: '名称', required: true, value: bills.name },
- // 工程内容
- { name: 'Content', value: bills.engineeringContent },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 工程量
- { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 单价
- { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
- // 费率
- { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'SpecialtyProvisionalPriceItem', attrs, '专业工程暂估价明细');
- }
- // 计日工标题
- function DayWorkRateGroup(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 金额
- { name: 'Total', type: _type.DECIMAL, 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(node) {
- const bills = node.data;
- const attrs = [
- // 编码
- { name: 'Number', value: bills.code },
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 型号规格
- { name: 'Specification', value: '' },
- // 单位
- { name: 'Unit', dName: '单位', required: true, value: bills.unit },
- // 工程量
- { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
- // 单价
- { name: 'Price', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.unitFee') },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'DayWorkRateItem', attrs, '计日工明细');
- }
- // 总承包服务费标题
- function MainContractorAttendanceGroup(node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, 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', dName: '名称', required: true, value: bills.name },
- // 项目价值
- { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
- // 服务内容
- { name: 'Content', value: bills.serviceContent },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 费率
- { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, 'MainContractorAttendanceItem', attrs, '总承包服务费明细');
- }
- // 索赔、签证费用标题
- function ClaimVisaCostGroup(eleName, node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, 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', dName: '名称', required: true, value: bills.name },
- // 单位
- { name: 'Unit', value: bills.unit },
- // 数量
- { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 单价
- { name: 'Price', value: _util.getFee(bills.fees, 'common.unitFee') },
- // 费率
- { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 依据
- { name: 'Reason', value: '' },
- // 汇总类型
- { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, eleName, attrs, '索赔费用明细');
- }
- // 规费
- function StatutoryFees() {
- const attrs = [
- { name: 'Name', dName: '名称', required: true, value: '规费' },
- { name: 'Code', dName: '费用代号', required: true, value: 'GF' }
- ];
- _base.Element.call(this, 'StatutoryFees', attrs, '规费');
- }
- // 税金
- function Tax(eleName, node) {
- const bills = node.data;
- const attrs = [
- // 名称
- { name: 'Name', dName: '名称', required: true, value: bills.name },
- // 计算基数说明
- { name: 'CalBasis', value: getCalBasis(node) },
- // 计算基数
- { name: 'QtyFormula', value: getQtyFormula(node) },
- // 费率
- { name: 'Rate', type: _type.DECIMAL, value: bills.feeRate },
- // 金额
- { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
- // 费用代号
- { name: 'Code', value: getFeeCode(bills) },
- // 备注
- { name: 'Remark', value: bills.remark }
- ];
- _base.Element.call(this, eleName, attrs, '税金');
- }
- // 人材机汇总
- function LabourMaterialsEquipmentsMachinesSummary(glj, price, infoData, coeData) {
- const attrs = [
- // 编码
- { name: 'Number', dName: '编码', required: true, value: glj.code },
- // 名称
- { name: 'Name', dName: '名称', required: true, value: glj.name },
- // 规格型号
- { name: 'Specification', value: glj.specs },
- // 单位
- { name: 'Unit', dName: '单位', required: true, value: glj.unit },
- // 数量(总消耗量)
- { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
- // 风险系数 从承包人主要材料设备-造价信息差额调整法读取,取不到则输出"0"
- { name: 'ProviderExp', type: _type.DECIMAL, value: infoData && infoData.riskCoe || '0' },
- // 基准单价 从承包人主要材料设备-造价信息差额调整法读取,取不到则输出"0"
- { name: 'ProviderBase', type: _type.DECIMAL, value: infoData && infoData.standardPrice || '0' },
- // 除税定额价(定额价)
- { name: 'NoTaxOrgPrice', type: _type.DECIMAL, value: price.basePrice },
- // 除税编制价(市场价)
- { name: 'NoTaxPrice', type: _type.DECIMAL, value: price.marketPrice },
- // 含税定额价 不存在这个字段,输出"0"
- { name: 'TaxOrgPrice', type: _type.DECIMAL, value: '0' },
- // 含税编制价 暂时取市场价
- { name: 'TaxPrice', type: _type.DECIMAL, value: price.marketPrice },
- // 引进部分
- { name: 'ForeignCurrency', type: _type.DECIMAL, value: '0' },
- // 折合人民币
- { name: 'ConvertedIntoRMB', type: _type.DECIMAL, value: '0' },
- // 除税定额价合价 取Round(定额价*总消耗量,2)
- { name: 'NoTaxOrgTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.basePrice * glj.quantity, 2) },
- // 除税编制价合价(元) 取Round(不含税市场价*总消耗量,2)
- { name: 'NoTaxTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.marketPrice * glj.quantity, 2) },
- // 含税定额价合价
- { name: 'TaxOrgTotal', type: _type.DECIMAL, value: '0' },
- // 含税编制价合价 取Round(含税市场价*总消耗量,2) (暂时用市场价)
- { name: 'TaxTotal', type: _type.DECIMAL, value: scMathUtil.roundForObj(price.marketPrice * glj.quantity, 2) },
- // 变值权重 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
- { name: 'Weight', type: _type.DECIMAL, value: coeData && coeData.varWeight || '0' },
- // 基本价格指数 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
- { name: 'BasicPrice', type: _type.DECIMAL, value: coeData && coeData.FO || '0' },
- // 现行价格指数 从承包人主要材料设备-价格指数调整法读取,取不到则输出“0”
- { name: 'CurrentPrice', type: _type.DECIMAL, value: coeData && coeData.FI || '0' },
- // 工料机类型
- { name: 'Kind', type: _type.INT, value: getGLJKind(glj.type) },
- // 工料机归属
- { name: 'Class', value: '' },
- // 扩展属性
- { name: 'ExtKind', type: _type.INT, value: 1 },
- // 商品砼 如果工料机类型是“商品混凝土”、“商品砂浆”、“商品配合比”(软件中没有),则取“true”;否则取“false”
- { name: 'Concrete', type: _type.BOOL, value: [205, 206].includes(glj.type) },
- // 主要材料
- { name: 'MainMaterial', type: _type.BOOL, value: !!glj.is_main_material },
- // 是否暂估价材料
- { name: 'ProvisionalMaterial', type: _type.BOOL, value: !!glj.is_evaluate },
- // 供料方式
- { name: 'Provider', type: _type.INT, value: Provider[glj.supply] },
- // 价格来源
- { name: 'PriceSource', value: '' },
- // 交货方式
- { name: 'Delivery', value: glj.delivery },
- // 送达地点
- { name: 'Location', value: glj.delivery_address },
- // 产地
- { name: 'ProducingArea', value: glj.originPlace },
- // 供应商
- { name: 'Supplier', value: glj.vender },
- // 质量要求
- { name: 'Character', value: glj.qualityGrace },
- // 备注
- { name: 'Remark', value: glj.remark }
- ];
- _base.Element.call(this, 'LabourMaterialsEquipmentsMachinesSummary', attrs, '人材机汇总');
- }
- // 评标主要材料
- function BidEvaluationMainMaterial(glj) {
- const attrs = [
- // 序号
- { name: 'Code', dName: '序号', required: true, value: glj.seq },
- // 编码
- { name: 'Number', value: glj.code },
- // 名称
- { name: 'Name', dName: '名称', required: true, value: glj.name },
- // 规格型号
- { name: 'Specification', value: glj.specs },
- // 单位
- { name: 'Unit', dName: '单位', required: true, value: glj.unit },
- // 市场价
- { name: 'Price', type: _type.DECIMAL, value: glj.marketPrice },
- // 最高限价
- { name: 'LimitedPrice', type: _type.DECIMAL, value: '0' },
- // 总消耗量
- { name: 'Quantity', type: _type.DECIMAL, value: glj.quantity },
- // 金额 Round(市场价*总消耗量,2)
- { name: 'Total', type: _type.DECIMAL, value: scMathUtil.roundForObj(glj.marketPrice * glj.quantity, 2) },
- // 交货方式
- { name: 'Delivery', type: _type.DECIMAL, value: glj.delivery },
- // 送达地点
- { name: 'DeliPlace', value: glj.delivery_address },
- // 产地
- { name: 'ProducingArea', value: glj.originPlace },
- // 供应商
- { name: 'Supplier', value: glj.vender },
- // 质量要求
- { name: 'Character', value: glj.qualityGrace },
- // 备注
- { name: 'Remark', value: glj.remark }
- ];
- _base.Element.call(this, 'BidEvaluationMainMaterial', attrs, '评标主要材料');
- }
- // 建设项目节点
- let constructionProjectEle = null;
- /*
- * 加载数据,分两种数据类型
- * 1.建设项目
- * 2.建设项目下单位工程
- * @param {Object}项目数据
- * @return {Array}
- * */
- async function loadData(projectData) {
- // 标记自检提示的开始(一次性多出多个文件类型,会导出多次)
- _failList.push(_config.HINT_START);
- // 提取出的数据
- const extractData = [];
- // 建设项目部分
- constructionProjectEle = await loadConstructionProject(projectData);
- extractData.push({
- data: constructionProjectEle,
- 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 loadTenders(projectData.summaryInfo, tenderData, isPlainTender);
- tenders.forEach(tender => {
- // 单位工程文件名为@_单位工程编码_单位工程名称.xml
- // 因为单位工程编码后续用户可能会改变,这里暂时将fileName设置成单位工程名称
- const name = tender.attrs.find(attr => attr.name === 'Name');
- extractData.push({
- data: tender,
- dataType: DATA_TYPE.TENDER,
- exportKind,
- fileName: name
- });
- });
- return extractData;
- }
- /*
- * 加载建设项目
- * @param {Object}项目数据
- * @return {Array}
- * */
- async function loadConstructionProject(projectData) {
- const summaryInfo = projectData.summaryInfo[projectData.ID];
- // 建设项目
- const constructionProject = new ConstructionProject(projectData, summaryInfo);
- // 系统信息
- 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(projectData.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.Tender) {
- // 投标文件输出招标、投标信息
- exportInfo = [
- new TendereeInfo(basicInformation, summaryInfo),
- new BidderInfo(basicInformation, summaryInfo)
- ];
- } else {
- // 招标或控制价文件只输出招标信息
- exportInfo = [new TendereeInfo(basicInformation, summaryInfo)];
- }
- constructionInfo.children.push(option, projectInfo, ...exportInfo);
- return constructionInfo;
- }
- /*
- * 加载所有单项工程元素
- * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
- * {Array}engineeringData 所有单项工程项目数据
- * @return {Array}
- * */
- async function loadEngineering(summaryInfoMap, engineeringData) {
- const isPlainTender = true;
- const sectionalWorks = [];
- for (const engData of engineeringData) {
- const summaryInfo = summaryInfoMap[engData.ID];
- // 单项工程
- const sectionalWork = new SectionalWorks({
- name: engData.name,
- total: summaryInfo.engineeringCost,
- rate: summaryInfo.rate,
- });
- // 费用汇总
- const summaryCost = new SummaryOfCost(summaryInfo);
- // 简单结构的单位工程
- const tenders = await loadTenders(summaryInfoMap, engData.children, isPlainTender);
- sectionalWork.children.push(summaryCost, ...tenders);
- sectionalWorks.push(sectionalWork);
- }
- return sectionalWorks;
- }
- /*
- * 加载所有单位工程元素
- * @param {Object}summaryInfoMap 总的汇总价格映射表(与项目ID映射)
- * {Array}tenderData 所有单项工程项目数据
- * {Boolean}isPlain 是否简单结构(简单结构只含有UnitWorks,其下不含子元素)
- * @return {Array}
- * */
- let tenderDetail = null;
- async function loadTenders(summaryInfoMap, tenderData, isPlain) {
- const unitWorks = [];
- for (const tData of tenderData) {
- // 需要请求项目详细数据的时候,间隔一段时间再初始单位工程数据,减少服务器压力
- const tenderDetailMap = _cache.getItem('tenderDetailMap');
- if (!tenderDetailMap[tData.ID]) {
- await _util.setTimeoutSync(() => { }, _config.TIMEOUT_TIME);
- }
- // 获取单位工程详细数据
- tenderDetail = await _util.getTenderDetail(tData.ID, userID);
- // 先计算人材机总消耗量,以供后面需要
- gljUtil.calcProjectGLJQuantity(tenderDetail.projectGLJ.datas,
- tenderDetail.ration_glj.datas, tenderDetail.Ration.datas, tenderDetail.Bills.datas, Decimal.GLJ, _, scMathUtil);
- const summaryInfo = summaryInfoMap[tData.ID];
- const defaultRationLib = tenderDetail.projectInfo.engineeringInfo.ration_lib.find(lib => lib.isDefault);
- const defaultRationLibName = defaultRationLib.name;
- // 单位工程
- const unitWork = new UnitWorks(projectData, tData, defaultRationLibName, summaryInfo);
- // 简单结构,不需要继续添加子元素
- if (isPlain) {
- unitWorks.push(unitWork);
- continue;
- }
- // 不是简单结构,继续添加各种子元素
- // 方便用户看错误来自哪个单位工程
- _failList.push(`<span style="font-weight: bold">单位工程“${tData.name}”下:</span>`);
- const orgLen = _failList.length;
- // 工程特征信息
- const attrInfo = loadAttrInfo(tData.property.projectFeature);
- // 基本信息
- const addiInfo = loadAddiInfo(projectData.property.basicInformation);
- // 费用汇总
- const summaryOfCost = new SummaryOfCost(summaryInfo);
- /* // 获取单位工程详细数据
- tenderDetail = await _util.getTenderDetail(tData.ID, userID);
- // 先计算人材机总消耗量,以供后面需要
- gljUtil.calcProjectGLJQuantity(tenderDetail.projectGLJ.datas,
- tenderDetail.ration_glj.datas, tenderDetail.Ration.datas, tenderDetail.Bills.datas, Decimal.GLJ, _, scMathUtil); */
- // 单位工程费用汇总
- const unitWorksSummary = loadUnitWorksSummary(tenderDetail);
- // 分部分项工程
- const divisionalElements = loadDivisionalAndElementalWorks();
- // 措施项目
- const preliminaries = loadPreliminaries();
- // 其他项目
- const sundry = loadSundry();
- // 规费
- const statutoryFees = new StatutoryFees();
- // 税金
- const tax = loadTax();
- // 人材机汇总
- const gljSummary = loadGLJSummary();
- // 评标材料
- const bidEvaluations = loadBidEvaluation();
- // 人材机汇总和评标材料需要汇总到建设项目
- const projectInstallationWorkCost = constructionProjectEle.children.find(ele => ele.name === 'ProjectInstallationWorkCost');
- projectInstallationWorkCost.children.push(...gljSummary, ...bidEvaluations);
- unitWork.children.push(
- attrInfo,
- addiInfo,
- summaryOfCost,
- unitWorksSummary,
- divisionalElements,
- preliminaries,
- sundry,
- statutoryFees,
- tax,
- ...gljSummary,
- ...bidEvaluations
- );
- // 只有方便用户看错误来自哪个单位工程的提示,说明该单位工程没有报错
- if (_failList.length === orgLen) {
- _failList.pop();
- }
- unitWorks.push(unitWork);
- }
- return unitWorks;
- }
- // 加载工程特征信息
- // 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;
- });
- return addiInfo;
- }
- // 加载单位工程费用汇总
- // 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.children.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 loadFBFX(nodes, kind) {
- return nodes.map(node => {
- let ele;
- // 有子清单的是分部
- if (node.source.children.length) {
- ele = new DivisionalWorks(node.data);
- // 递归获取子元素
- ele.children = loadFBFX(node.children);
- } else { // 无子清单的是分项
- ele = loadBills(node, kind);
- }
- return ele;
- });
- }
- // 加载清单
- function loadBills(node, kind) {
- const specialty = Specialty[tenderDetail.projectInfo.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));
- return workContent;
- });
- 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 => {
- const totalQuantity = gljUtil.getTotalQuantity(rGLJ, node.data, Decimal.GLJ, Decimal.QUANTITY);
- return new LabourMaterialsEquipmentsMachinesElement(rGLJ, totalQuantity)
- });
- 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;
- }
- // 递归加载标题和子目
- function loadGroupAndItems(nodes, groupFactory, itemFactory) {
- return nodes.map(node => {
- let ele;
- // 有子清单的是标题
- if (node.source.children.length) {
- ele = groupFactory(node);
- // 递归获取子元素
- ele.children = loadGroupAndItems(node.children, groupFactory, itemFactory);
- } else { // 无子清单的是分项
- ele = itemFactory(node);
- }
- return ele;
- });
- }
- // 加载其他项目
- function loadSundry() {
- // 加载材料设备暂估价明细
- // 业务上这个清单是使用清单基数计算得来,所以此部分读取整个单位工程下打勾暂估的材料。is_evaluate = 1
- function loadProvisionalMaterialDetail(gljList) {
- return gljList
- .filter(glj => glj.is_evaluate)
- .map(glj => {
- const price = gljUtil.getGLJPrice(glj, tenderDetail.projectGLJ.datas, // 价格信息
- tenderDetail.projectInfo.property.calcOptions, tenderDetail.labourCoe.datas, tenderDetail.projectInfo.property.decimal, false, _, scMathUtil);
- return new ProvisionalMaterialEquipmentItem(glj, price);
- });
- }
- const sundry = new Sundry();
- // 其他项目费
- const other = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.OTHER);
- const sundryCosts = new SundryItem('SundryCosts', other.data);
- sundryCosts.children = loadGroupAndItems(
- other.children,
- (node) => new SundryCostsGroup(node),
- (node) => new SundryCostsItem(node)
- );
- // 暂列金额
- const provisional = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.PROVISIONAL);
- const provisionalSums = new SundryItem('ProvisionalSums', provisional.data);
- provisionalSums.children = loadGroupAndItems(
- provisional.children,
- (node) => new ProvisionalSumsGroup(node),
- (node) => new ProvisionalSumsItem(node)
- );
- // 材料设备暂估价
- const provisionalMaterial = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.MATERIAL_PROVISIONAL);
- const provisionalMaterialEle = new SundryItem('ProvisionalMaterialEquipment', provisionalMaterial.data);
- provisionalMaterialEle.children = loadProvisionalMaterialDetail(tenderDetail.projectGLJ.datas.gljList);
- // 专业工程暂估价
- const specialtyProvisionalNode = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.ENGINEERING_ESITIMATE);
- const specialtyProvisional = new SundryItem('SpecialtyProvisionalPrice', specialtyProvisionalNode.data);
- specialtyProvisional.children = loadGroupAndItems(
- specialtyProvisionalNode.children,
- (node) => new SpecialtyProvisionalPriceGroup(node),
- (node) => new SpecialtyProvisionalPriceItem(node)
- );
- // 计日工
- const daywork = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.DAYWORK);
- const dayworkRate = new SundryItem('DayWorkRate', daywork.data);
- // 计日工最多只能有两层子项
- const isValidDepth = _util.validDepth(2, daywork);
- if (!isValidDepth) {
- _failList.push('计日工子项超过两层')
- } else {
- dayworkRate.children = loadGroupAndItems(
- daywork.children,
- (node) => new DayWorkRateGroup(node),
- (node) => new DayWorkRateItem(node)
- );
- }
- // 总承包服务费
- const turnKeyContract = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.TURN_KEY_CONTRACT);
- const mainContractorAttendance = new SundryItem('MainContractorAttendance', turnKeyContract.data);
- mainContractorAttendance.children = loadGroupAndItems(
- turnKeyContract.children,
- (node) => new MainContractorAttendanceGroup(node),
- (node) => new MainContractorAttendanceItem(node)
- );
- // 索赔费用
- const claim = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.CLAIM);
- const claimsCost = new SundryItem('ClaimsCost', claim.data);
- claimsCost.children = loadGroupAndItems(
- claim.children,
- (node) => new ClaimVisaCostGroup('ClaimsCostGroup', node),
- (node) => new ClaimVisaCostItem('ClaimsCostItem', node)
- );
- // 签证费用
- const visa = tenderDetail.mainTree.items.find(node => node.getFlag() === fixedFlag.VISA);
- const siteInstructionCost = new SundryItem('SiteInstructionCost', visa.data);
- siteInstructionCost.children = loadGroupAndItems(
- visa.children,
- (node) => new ClaimVisaCostGroup('SiteInstructionCostGroup', node),
- (node) => new ClaimVisaCostItem('SiteInstructionCostItem', node)
- );
- sundry.children.push(sundryCosts, provisionalSums, specialtyProvisional, dayworkRate, mainContractorAttendance, claimsCost, siteInstructionCost);
- return sundry;
- }
- // 加载税金
- function loadTax() {
- const tax = tenderDetail.mainTree.roots.find(node => node.getFlag() === fixedFlag.TAX);
- const taxEle = new Tax('Tax', tax);
- // 加载税金子项,若无税金子项,税金本身也作为子项
- const taxChildren = tax.source.children.length ? tax.source.children : [tax];
- taxEle.children = taxChildren.map(taxItem => new Tax('TaxItem', taxItem));
- return taxEle;
- }
- // 加载人材机汇总
- function loadGLJSummary() {
- // 所有人材机
- const gljList = gljUtil.sortRationGLJ(tenderDetail.projectGLJ.datas.gljList); // 汇总排序
- const contractorList = tenderDetail.contractor_list.datas;
- const decimalObj = tenderDetail.projectInfo.property.decimal;
- // 总承包人造价信息差额调整法数据
- const infoDatas = materialAdjustObj.getPirceInfoDatas(gljList, contractorList, decimalObj)
- // 总承包人价格指数调整法数据
- const engineeringCostNode = tenderDetail.Bills.tree.roots.find(node => node.getFlag() === fixedFlag.ENGINEERINGCOST);
- const ecTotalFee = _util.getFee(engineeringCostNode.data.fees, 'common.totalFee');
- const coeDatas = materialAdjustObj.getPriceCoeDatas(gljList, contractorList, ecTotalFee, decimalObj);
- return gljList.map(glj => {
- // 人材机
- const price = gljUtil.getGLJPrice(glj, tenderDetail.projectGLJ.datas, // 价格信息
- tenderDetail.projectInfo.property.calcOptions, tenderDetail.labourCoe.datas, tenderDetail.projectInfo.property.decimal, false, _, scMathUtil);
- // 人材机对应的造价信息差额数据
- const infoData = infoDatas.find(item => item.projectGLJID === glj.id);
- // 人材机对应的价格指数数据
- const coeData = coeDatas.find(item => item.projectGLJID === glj.id);
- const gljEle = new LabourMaterialsEquipmentsMachinesSummary(glj, price, infoData, coeData);
- // 人材机组成物
- const connectKey = gljUtil.getIndex(glj, gljKeyArray);
- const ratios = tenderDetail.projectGLJ.datas.mixRatioMap[connectKey] || [];
- gljEle.children = ratios.map(ratio => new LabourMaterialsEquipmentsMachinesElement(ratio, ratio.consumption));
- return gljEle;
- });
- }
- // 加载评标材料
- function loadBidEvaluation() {
- const gljList = tenderDetail.projectGLJ.datas.gljList;
- const bidEvaluationSrc = tenderDetail.bid_evaluation_list.datas;
- const decimalObj = tenderDetail.projectInfo.property.decimal;
- const bidEvaluationList = configMaterialObj.getBidMaterialDatas(gljList, bidEvaluationSrc, decimalObj);
- return bidEvaluationList.map(glj => {
- const projectGLJ = gljList.find(pGLJ => pGLJ.id === glj.projectGLJID);
- if (projectGLJ) {
- glj.delivery = projectGLJ.delivery;
- glj.delivery_address = projectGLJ.delivery_address;
- glj.originPlace = projectGLJ.originPlace;
- glj.vender = projectGLJ.vender;
- glj.qualityGrace = projectGLJ.qualityGrace;
- }
- return new BidEvaluationMainMaterial(glj);
- });
- }
- // 返回提取的数据
- return await loadData(projectData);
- }
- /*
- * 重置工程编号,广东18 3.0的接口,导出时的文件会用到这个编号
- * 因此重置工程编号后,还需要重置文件名数据
- * @param {Array}codes 工程编号
- * {Array}extractData 提取的数据
- * @return {void}
- * */
- function resetContentCode(codes, extractData) {
- // 提取到的数据分两种类型:
- // 1.根元素为建设项目:需要修改建设项目下的单位工程元素的编码和文件名
- // 2.根元素为单位工程:需要修改单位工程的编码和文件名
- // 获取建设项目数据下的单位工程元素
- const extractProject = extractData.find(data => data.dataType === DATA_TYPE.PROJECT);
- const extractTenders = extractData.filter(data => data.dataType === DATA_TYPE.TENDER)
- // 建设项目元素下建筑安装工程费元素
- const projectInstallations = _util.getElementFromSrc(extractProject.data, 'ProjectInstallationWorkCost');
- // 建筑安装工程费元素下单项工程元素
- const sectionalWorks = projectInstallations.reduce((acc, cur) => {
- const sections = _util.getElementFromSrc(cur, 'SectionalWorks');
- acc.push(...sections);
- return acc;
- }, []);
- let idx = 0;
- // 单项工程
- sectionalWorks.forEach(sectionalWork => {
- _util.setAttr(sectionalWork, 'Number', codes[idx++]);
- });
- // 建筑安装工程费元素下单位工程元素, 顺序与提取的单位工程文件(extractTenders)是一一对应的
- const unitWorks = sectionalWorks.reduce((acc, cur) => {
- const tenders = _util.getElementFromSrc(cur, 'UnitWorks');
- acc.push(...tenders);
- return acc;
- }, []);
- unitWorks.forEach((unitWork, index) => {
- // 更改编号
- const code = codes[idx++];
- _util.setAttr(unitWork, 'Number', code);
- // 更改文件名:@_单位工程编码_单位工程名称.xml
- const name = _util.getAttr(unitWork, 'Name');
- const fileName = `@_${code}_${name}.xml`;
- _util.setAttr(unitWork, 'FileName', fileName);
- // 更改提取的单位工程详细文件的导出名称、单位工程节点编号、文件名
- const extractTender = extractTenders[index];
- extractTender.fileName = fileName;
- const extractUnitWork = extractTender.data;
- _util.setAttr(extractUnitWork, 'Number', code);
- _util.setAttr(extractUnitWork, 'FileName', fileName);
- });
- }
- /*
- * 导出文件的结构逻辑,每个费用定额导出的最终文件结构要求可能不同,需要各自定义
- * 广东18费用定额,由建设项目文件和若干个单位工程文件组成。存储成 XML 文件时,
- * 建设项目文件应与单位工程文件分开,然后用ZIP算法技术压缩成一个后缀名为COS文件。
- * 同一类型(投标、招标、控制价)的文件被包含在一个cos文件中,有多个类型的文件则多个cos文件一个个导出
- * @param {Array}fileData 文件数据
- * @return {void}
- * */
- async function saveAsFile(fileData) {
- // 根据导出类型分组
- const groupedData = _.groupBy(fileData, 'exportKind');
- for (const exportKind in groupedData) {
- const files = groupedData[exportKind];
- const zip = new JSZip();
- for (const file of files) {
- zip.file(file.fileName, file.blob, { binary: true });
- }
- const zipFile = await zip.generateAsync({ type: 'blob' });
- const exportKindName = _config.EXPORT_KIND_NAME[exportKind];
- saveAs(zipFile, `广东标准交换数据(${exportKindName}).COS`);
- }
- }
- return {
- summaryObj,
- entry,
- resetContentCode,
- saveAsFile
- };
- })();
|