| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155 |
- // INTERFACE_EXPORT =,必须这么写,这样才能在导出时动态加载脚本后,覆盖前端代码
- INTERFACE_EXPORT = (() => {
- "use strict";
- const feeRateMap = {
- 冬季施工增加费: "DJSGZJFFL",
- 冬季施工: "DJSGZJFFL",
- 雨季施工增加费: "YUJSGZJFFL",
- 雨季施工: "YUJSGZJFFL",
- 夜间施工增加费: "YEJSGZJFFL",
- 夜间施工: "YEJSGZJFFL",
- 高原地区施工增加费: "GYDQSGZJFFL",
- 高原施工: "GYDQSGZJFFL",
- 风沙地区施工增加费: "FSDQSGZJFFL",
- 风沙施工: "FSDQSGZJFFL",
- 沿海地区施工增加费: "YHDQSGZJFFL",
- 沿海施工: "YHDQSGZJFFL",
- 行车干扰施工增加费: "XCGRGCSGZJFFL",
- 行车干扰: "XCGRGCSGZJFFL",
- 工地转移费: "GDZYFFL",
- '工地转移(km)': "GDZYFFL",
- 施工辅助费: "SGFZFFL",
- 施工辅助: "SGFZFFL",
- 基本费用: "JBFYFL",
- 主副食运费补贴: "ZFSYFBTFL",
- '综合里程(km)': "ZFSYFBTFL",
- 职工探亲路费: "ZGTQLFFL",
- 职工探亲: "ZGTQLFFL",
- 职工取暖补贴: "ZGQNBTFL",
- 职工取暖: "ZGQNBTFL",
- 财务费用: "CWFYFL",
- 养老保险费: "YANGLBXFFL",
- 失业保险费: "SYBXFFL",
- 医疗保险费: "YILBXFFL",
- 工伤保险费: "GSBXFL",
- 养老保险: "YANGLBXFFL",
- 失业保险: "SYBXFFL",
- 医疗保险: "YILBXFFL",
- 工伤保险: "GSBXFL",
- 住房公积金: "ZFGJJFL",
- 规费: "GFZHFL",
- 利润: "LRL",
- 税金: "SL",
- 土方: "TF",
- 石方: "SF",
- 运输: "YS",
- 路面: "LM",
- "路面(不计雨)": "LM",
- 隧道: "SD",
- 构造物I: "GZW1",
- "构造物I(不计冬)": "GZW1",
- "构造物I(不计雨)": "GZW1",
- 构造物II: "GZW2",
- "构造物III(桥梁)": "GZW3",
- "构造物III(除桥以外)": "GZW3",
- "构造物III(除桥以外不计雨夜)": "GZW3",
- 技术复杂大桥: "JSFZDQ",
- "钢材及钢结构(桥梁)": "GJG",
- "钢材及钢结构(除桥以外)": "GJG",
- "钢材及钢结构(除桥以外不计夜)": "GJG",
- };
- //计算程序有,这里没有:施工机械使用费\施工机械人工费\定额人工费\定额材料费\定额施工机械使用费
- const itemFeeMap = {
- 'marketLabour': 'RGF',
- 'marketMaterial': 'CLF',
- 'marketMachine': 'SGJXSYF',
- 'marketEquipment': 'SBGZF',
- 'direct': 'DEZJF',
- 'equipment': 'DESBF',
- 'marketDirect': 'ZJF',
- 'measure': 'CSF',
- 'measure1': 'CSF1',
- 'measure2': 'CSF2',
- 'manage': 'QYGLF',
- 'force': 'GF',
- 'profit': 'LR',
- 'tax': 'SJ',
- 'common': 'JAF',
- 'rationCommon': 'DEJAF'
- };
- const feeLibNoMap = {
- 'eba0e7c0-cfe6-11ea-ba15-739be477d1fe': 'GYSFL-000000-2018-86',
- '451d3180-e02e-11ea-8056-1514dfc2f39e': 'GYSFL-340000-2019-210',
- '32923ff0-e912-11ea-8b20-d93bc370e960': 'GYSFL-440000-2019-544'
- };
- const FixedCostMap = {
- //折旧费、检修费、维护费、安拆辅助费
- '折旧费': 1,
- '检修费': 1,
- '维护费': 1,
- '安拆辅助费': 1
- }
- const RoadGradeMap = {
- "高速公路": "0",
- "一级公路": "1",
- "二级公路": "2",
- "三级公路": "3",
- "四级公路": "4",
- "等外公路": "5",
- "独立桥梁": "6",
- "独立隧道": "7"
- }
- const sectionNameMap = {
- // "清单 第100章 总则": true,
- // "清单 第200章 路基": true,
- // "清单 第300章 路面": true,
- // "清单 第400章 桥梁、涵洞": true,
- // "清单 第500章 隧道": true,
- // "清单 第600章 安全设施及预埋管线": true,
- // "清单 第700章 绿化及环境保护设施": true,
- // "清单 第800章 机电工程": true,
- // "清单 第900章 附属区房建工程":true
- "清单第100章总则": true,
- "清单第200章路基": true,
- "清单第300章路面": true,
- "清单第400章桥梁、涵洞": true,
- "清单第500章隧道": true,
- "清单第600章安全设施及预埋管线": true,
- "清单第700章绿化及环境保护设施": true,
- // "清单第800章机电工程": true,
- // "清单第900章附属区房建工程":true,
- "清单第900章机电工程": true, // 临时改
- }
- const ListCodeMap = {
- "第100章至700章清单合计": ["1", "A"],
- "清单 第100章 总则": ["一", "A1"],
- "清单 第200章 路基": ["二", "A2"],
- "清单 第300章 路面": ["三", "A3"],
- "清单 第400章 桥梁、涵洞": ["四", "A4"],
- "清单 第500章 隧道": ["五", "A5"],
- "清单 第600章 安全设施及预埋管线": ["六", "A6"],
- "清单 第700章 绿化及环境保护设施": ["七", "A7"],
- // "清单 第800章 机电工程": ["八", "A8"],
- // "清单 第900章 附属区房建工程": ["九", "A9"],
- "已包含在清单合计中的材料、工程设备、专业工程暂估价合计": ["8", "B"],
- "清单合计减去材料、工程设备、专业工程暂估价合计": ["9", "C"],
- "计日工合计": ["10", "D"],
- "劳务": ["10.1", "D1"],
- "材料": ["10.2", "D2"],
- "机械": ["10.3", "D3"],
- "暂列金额(不含计日工总额)": ["11", "E"],
- "投标报价": ["12", "Total"]
- }
- const ratioCodeMap = {
- "01ZJF": "0",
- "02JXF": "1",
- "03WHF": "2",
- "04ACFZF": "3"
- }
- const reg1 = new RegExp('\n', 'g'), reg2 = new RegExp('\r', 'g'),
- reg3 = new RegExp(' ', 'g'), reg4 = new RegExp('\t', 'g'),
- reg5 = new RegExp('(', 'g'), reg6 = new RegExp(')', 'g')
- ;
- function getBasePrice(projectGLJID, tenderProject) {
- let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
- id: projectGLJID
- })
- return glj ? gljUtil.getBasePrice(glj, null, null, null, decimalObj, false, _, scMathUtil) : 0;
- }
- function getFeeRate(programID, fieldName, tenderProject) {
- let rate = 0;
- let template = tenderProject.calcProgram.compiledTemplates;
- if (template[programID]) {
- let item = _.find(template[programID].calcItems, {
- fieldName: fieldName
- })
- if (item) rate = item.feeRate;
- }
- return rate;
- }
- function _billStrFilter(billStr) {
- let rst = billStr || '';
- if (typeof billStr === 'string') {
- rst = billStr.replace(reg1, '').replace(reg2, '').replace(reg3, '').replace(reg4, '').replace(reg5, '(').replace(reg6, ')');
- }
- return rst;
- }
- function billNameChecking(bNode, projectName, fixedFlag) {
- let data = bNode.data;
- let fail = null;
- let pass = true;
- if (data.flagsIndex && data.flagsIndex.fixed) {
- let flag = data.flagsIndex.fixed.flag;
- switch (flag) {
- case fixedFlag.ONE_SEVEN_BILLS:
- pass = data.name == "第100章至700章清单" || data.name == "第100章至700章清单合计";
- break;
- case fixedFlag.PROVISIONAL_TOTAL:
- pass = data.name == "已包含在清单合计中的材料、工程设备、专业工程暂估价合计";
- break;
- case fixedFlag.BILLS_TOTAL_WT_PROV:
- pass = data.name == "清单合计减去材料、工程设备、专业工程暂估价合计";
- break;
- case fixedFlag.DAYWORK_LABOR:
- pass = data.name == "计日工合计";
- break;
- /*
- case fixedFlag.LABOUR_SERVICE:
- pass = data.name == "劳务";
- break;
- case fixedFlag.MATERIAL:
- pass = data.name == "材料";
- break;
- case fixedFlag.CONSTRUCTION_MACHINE:
- pass = data.name == "机械";
- break;
- //*/
- case fixedFlag.PROVISIONAL:
- pass = data.name == "暂列金额(不含计日工总额)";
- break;
- case fixedFlag.TOTAL_COST:
- pass = data.name == "投标报价";
- break;
- case fixedFlag.ONE_HUNDRED_BILLS:
- // pass = data.name == "清单 第100章 总则";
- pass = _billStrFilter(data.name) == "清单第100章总则";
- break;
- }
- } else {
- if (bNode.parent) {
- const pdata = bNode.parent.data;
- if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
- if (!sectionNameMap[_billStrFilter(data.name)]) pass = false
- }
- }
- }
- pass = true; // 新要求,不检查清单名称了 (这个检测随时变化)
- if (pass == false) fail = { hint: `清单:"${data.name ? data.name : ""}",名字不符合规范!`, type: projectName }
- return fail;
- }
- /**
- *
- * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
- * @param {Number} exportKind - 导出类型,招标、投标、控制价
- * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
- * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
- * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
- */
- async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
- const {
- CONFIG: {
- TYPE
- },
- UTIL,
- Element
- } = INTERFACE_EXPORT_BASE;
- const {
- EXPORT_KIND: {
- BID_INVITATION,
- BID_SUBMISSION,
- CONTROL
- },
- fixedFlag,
- } = window.commonConstants;
- let cprjType = {
- 1: "QDYS", // 招标
- 2: "QDYS", // 投标
- 3: "QDYS", // 控制价
- };
- const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
- const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
- const isControl = exportKind === CONTROL; // 是否是控制价
- function emptyElement(name) {
- this.name = name;
- this.attrs = [];
- this.children = [];
- }
- if (projectData.keyIDData === null || projectData.keyIDData === undefined) {
- projectData.keyIDData = {};
- }
- // 建设项目根节点信息
- function CprjInfo(projectName) {
- let baseInfo = _.find(projectData.property.basicInformation, {
- dispName: "基本信息",
- });
- let zbr = _.find(baseInfo.items, { "key": "tendereeName" });
- let Zbdljg = _.find(baseInfo.items, { "key": "proxy" });
- let Shijian = _.find(baseInfo.items, { "key": "compileDate" });
- let Zbbh = _.find(baseInfo.items, { "key": "projNum" });
- const attrs = [{
- name: "CprjName",
- value: projectName,
- },
- {
- name: "CprjType",
- value: cprjType[exportKind],
- },
- {
- name: "Zbbh",
- value: Zbbh ? Zbbh.value : ""
- },
- {
- name: "Zbr",
- value: zbr ? zbr.value : ""
- },
- {
- name: "Zbdljg",
- value: Zbdljg ? Zbdljg.value : ""
- },
- {
- name: "ShiJian",
- value: Shijian ? Shijian.value : ""
- },
- {
- name: "KeyId",
- value: projectData.keyIDData.cprjInfo || uuid.v1()
- }
- ];
- Element.call(this, "CprjInfo", attrs);
- }
- // 项目基本信息
- function SystemInfo(projectData) {
- let baseInfo = _.find(projectData.property.basicInformation, {
- dispName: "基本信息",
- });
- //“招标工程量清单”、“招标控制价”时,输出该字段,为导出该文件的当前时间
- let makeData = {
- value: UTIL.getNowFormatTime(true)
- }
- //投标的时候取基本信息的makeData字段
- if (isBidSubmission) makeData = _.find(baseInfo.items, { "key": "makeDate" });
- let hardID = UTIL.generateHardwareId();
- let [cpuId, diskId, macId] = hardID.split(";");
- const attrs = [{
- name: "Name",
- value: "广西公路工程造价文件数据交换标准化规定",
- },
- {
- name: "Version",
- value: "1.0",
- },
- {
- name: "SoftwareName",
- value: "纵横公路云造价",
- },
- {
- name: "SoftwareVer",
- value: "V" + VERSION,
- },
- {
- name: "SoftwareCompany",
- value: "珠海纵横创新软件有限公司",
- },
- {
- name: "MakeDate",
- value: makeData ? makeData.value : "",
- },
- {
- name: "SoftwareNumber",
- // value: window.btoa(userID),
- value: $('#certifyInputForGX')[0].value
- },
- {
- name: "HardNumber",
- value: window.btoa(diskId),
- },
- {
- name: "MacAddress",
- value: window.btoa(macId),
- },
- {
- name: "KeyId",
- value: projectData.keyIDData.systemInfo || uuid.v1()
- }
- ];
- // if (isBidSubmission)
- // attrs.splice(6, 0, {
- // name: "BidderVer",
- // value: UTIL.getNowFormatTime(true),
- // });
- Element.call(this, "SystemInfo", attrs);
- }
- //造价依据
- function CostBasis() {
- // ItemStandardNo="GYSFX-000000-2018-86"
- const attrs = [{
- name: "MakeRuleNo",
- value: "GYSBB-000000-2018-86",
- },
- {
- name: "MakeRuleName",
- value: "公路工程建设项目概算预算编制办法",
- },
- {
- name: "ItemStandardNo",
- value: "GYSFX-000000-2018-86",
- },
- {
- name: "KeyId",
- value: projectData.keyIDData.costBasis || uuid.v1()
- }
- ];
- Element.call(this, "CostBasis", attrs);
- //定额库信息
- //to do 改成实际的值
- function NormLib() {
- const attrs = [{
- name: "NormLibNo",
- value: "YSDE-000000-2018-86",
- },
- {
- name: "NormLibName",
- value: "部颁公路工程预算定额(2018)",
- },
- {
- name: "Type",
- value: "ZDEK",
- },
- {
- name: "KeyId",
- value: uuid.v1()
- },
- ];
- Element.call(this, "NormLib", attrs);
- }
- this.children.push(new NormLib());
- }
- function Rate(tenderProject, feeRateInfo, seirNo) {
- //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
- const attrs = [{
- name: "RateNo",
- value: seirNo,
- },
- {
- name: "Name",
- value: feeRateInfo.name,
- },
- {
- name: "RateLibNo",
- value: feeLibNoMap[feeRateInfo.libID],
- },
- {
- name: "KeyId",
- value: projectData.keyIDData.rate || uuid.v1()
- }
- ];
- Element.call(this, "Rate", attrs);
- let RateParams = new emptyElement("RateParams");
- RateParams.attrs = [{
- name: "KeyId",
- value: projectData.keyIDData.rateParams || uuid.v1()
- }];
- let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
- for (let s of subRates) {
- let sname = s.name.replace("(%)", "");
- sname = sname.replace("(%)", "");
- if (feeRateMap[sname]) {
- let value = "";
- if (s.editable) {
- let sel = _.find(s.optionList, {
- selected: true,
- });
- if (sel) {
- value = sel.name;
- } else if (gljUtil.isDef(s.value)) {
- value = s.value;
- }
- } else {
- value = _.findIndex(s.optionList, {
- selected: true,
- });
- if (value == -1) value = 0;
- }
- /* if (sname == '利润') tenderProject.ProfitRate = value;
- if (sname == '税金') tenderProject.TaxRate = value; */
- RateParams.children.push(new RateParam(feeRateMap[sname], value));
- }
- }
- this.children.push(RateParams);
- function RateParam(RateTypeNo, RateParamNo) {
- //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
- const attrs = [{
- name: "RateTypeNo",
- value: RateTypeNo,
- },
- {
- name: "RateParamNo",
- value: RateParamNo,
- },
- {
- name: "Ratio",
- value: "100",
- },
- {
- name: "KeyId",
- value: uuid.v1()
- }
- ];
- Element.call(this, "RateParam", attrs);
- }
- let RateValues = new emptyElement("RateValues");
- RateValues.attrs = [{
- name: "KeyId",
- value: projectData.keyIDData.rateValues || uuid.v1()
- }];
- function RateValue(CostTypeNo, RateTypeNo, value) {
- const attrs = [{
- name: "CostTypeNo",
- value: CostTypeNo,
- },
- {
- name: "RateTypeNo",
- value: RateTypeNo,
- },
- {
- name: "RateValue",
- value: value,
- },
- {
- name: "KeyId",
- value: uuid.v1()
- }
- ];
- Element.call(this, "RateValue", attrs);
- }
- let prefix = "";
- for (let r of feeRateInfo.rates) {
- if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
- if (feeRateMap[r.name] && r.ParentID) {
- RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
- }
- }
- this.children.push(RateValues);
- }
- function Pract(tpdata, seriNo) {
- let pgljData = tpdata.projectGLJ.datas;
- let decimalObj = tpdata.property.decimal;
- let ccsObj = $("#vvTax")[0];
- const attrs = [{
- name: "PractNo",
- value: seriNo,
- },
- {
- name: "Name",
- value: pgljData.constData.usedUnitPriceInfo.name,
- },
- {
- name: "TaxLibNo",
- value: ccsObj.options[ccsObj.selectedIndex].text //读取车船税标准名称
- },
- {
- name: "PriceFileNo",
- value: "JGXX"
- },
- {
- name: "KeyId",
- value: projectData.keyIDData.pract || uuid.v1()
- }
- ];
- Element.call(this, "Pract", attrs);
- let Param = {
- name: "Param",
- attrs: [{
- name: "TaxLibNo",
- value: "CCSBZ-440000-2019-544",
- },
- {
- name: "AuxRate",
- value: pgljData.constData.assistProductionFeeRate,
- },
- ],
- children: [],
- };
- if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
- let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
- electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
- for (let e of elecDatas) {
- let Electro = {
- name: "Electro",
- attrs: [{
- name: "Code",
- value: e.code,
- },
- {
- name: "Price",
- value: e.electPrice,
- },
- {
- name: "Ratio",
- value: e.coe,
- },
- ],
- children: [],
- };
- Param.children.push(Electro);
- }
- }
- // this.children.push(Param);
- function Mp(g) {
- const attrs = [{
- name: "Code",
- value: g.code,
- },
- {
- name: "PractName",
- value: g.name,
- },
- {
- name: "Spec",
- value: g.specs,
- },
- {
- name: "Unit",
- value: g.unit,
- },
- {
- name: "BudgetPrice",
- value: g.priceInfo.tenderPrice,
- },
- {
- name: "NormPrice",
- value: g.priceInfo.basePrice,
- },
- {
- name: "IsAdd",
- value: g.unit_price.is_add,
- },
- {
- name: "Num",
- value: (g.quantity) ? g.quantity : 0,
- },
- {
- name: "BudgetSum",
- value: scMathUtil.roundForObj(g.quantity * g.unit_price.market_price, tpdata.property.decimal.bills.unitPrice), //项目的人工费(人工预算价*人工数量)
- },
- {
- name: "NormSum",
- value: scMathUtil.roundForObj(g.quantity * g.unit_price.base_price, tpdata.property.decimal.bills.unitPrice), //项目的定额人工费(人工定额价*人工数量)
- },
- {
- name: "KeyId",
- value: uuid.v1()
- },
- ];
- Element.call(this, "Mp", attrs);
- }
- function Material(g) {
- const attrs = [{
- name: "Code",
- value: g.code,
- },
- {
- name: "PractName",
- value: g.name,
- },
- {
- name: "Spec",
- value: g.specs,
- },
- {
- name: "Unit",
- value: g.unit,
- },
- {
- name: "BudgetPrice",
- value: g.priceInfo.tenderPrice,
- },
- {
- name: "NormPrice",
- value: g.priceInfo.basePrice,
- },
- {
- name: "IsAdd",
- value: g.unit_price.is_add,
- },
- {
- name: "OrgPrice",
- value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
- },
- {
- name: "TransFee",
- value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
- },
- {
- name: "GwRate",
- value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
- },
- {
- name: "OffSiteLf",
- value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
- },
- {
- name: "OnSiteLf",
- value: 0,
- },
- {
- name: "LoadLf",
- value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
- },
- {
- name: "StoreRate",
- value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
- },
- {
- name: "PackageRecycleFee",
- value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
- },
- {
- name: "Num",
- value: (g.quantity) ? g.quantity : 0,
- },
- {
- name: "BudgetSum",
- value: scMathUtil.roundForObj(g.quantity * g.unit_price.market_price, tpdata.property.decimal.bills.unitPrice), //项目的材料费(材料预算价*材料数量)
- },
- {
- name: "NormSum",
- value: scMathUtil.roundForObj(g.quantity * g.unit_price.base_price, tpdata.property.decimal.bills.unitPrice), //项目的定额材料费(材料定额价*材料数量)
- },
- {
- name: "KeyId",
- value: uuid.v1()
- },
- ];
- Element.call(this, "Material", attrs);
- // if (g.unit_price.calcMaterial == 1) { //有材料计算
- // let index = gljUtil.getIndex(g);
- // let orList = [];
- // for (let o of pgljData.originalList) {
- // if (o.connect_key == index) orList.push(new OrgPrices(o));
- // }
- // if (orList.length > 0) this.children = orList;
- // }
- // function CostStructure(r) {
- // //待获取
- // this.name = "CostStructure";
- // this.attrs = [];
- // this.children = [];
- // }
- // function Consume(r, o) {
- // this.name = "Consume";
- // this.attrs = [{
- // name: "KeyId",
- // value: uuid.v1()
- // }];
- // this.children = [];
- // for (let g of o.ration_gljs) {
- // if (g.rationID == r.ID) {
- // let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
- // this.children.push(new ConsumeItem(g, r_quantity));
- // }
- // }
- // }
- // function ConsumeItem(g, ration_quantity) {
- // let costType = parseInt(g.type);
- // if (costType < 100) {
- // costType = 1;
- // } else if (costType >= 300) {
- // costType = 3;
- // } else {
- // //判断主材
- // for (let pglj of pgljData.gljList) {
- // if (pglj.glj_id === g.GLJID) {
- // if (pglj.is_main_material == 1) {
- // costType = 3;
- // } else {
- // costType = 2;
- // }
- // break;
- // }
- // }
- // }
- // const attrs = [{
- // name: "Code", //待获取
- // value: g.code,
- // },
- // {
- // name: "Consumption",
- // value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
- // },
- // {
- // name: "CostType",
- // value: costType,
- // },
- // {
- // name: "KeyId",
- // value: uuid.v1()
- // },
- // ];
- // Element.call(this, "ConsumeItem", attrs);
- // }
- // function Norm(r, o) {
- // const attrs = [{
- // name: "NormLibNo", //待获取
- // value: "",
- // },
- // {
- // name: "DisplayCode",
- // value: r.code,
- // },
- // {
- // name: "Name",
- // value: r.name,
- // },
- // {
- // name: "Unit",
- // value: r.unit,
- // },
- // {
- // name: "Num",
- // value: r.quantity || 0,
- // },
- // {
- // name: "CostTypeNo",
- // value: "", //待获取
- // },
- // {
- // name: "FabricationCost", //待获取
- // value: "",
- // },
- // {
- // name: "AdjustStatus",
- // value: "",
- // },
- // ];
- // Element.call(this, "Norm", attrs);
- // this.children.push(new CostStructure(r));
- // this.children.push(new Consume(r, o));
- // }
- // function SelfCollect(o) {
- // const attrs = [{
- // name: "OtherCost",
- // value: 0,
- // },];
- // Element.call(this, "SelfCollect", attrs);
- // for (let r of o.rations) {
- // this.children.push(new Norm(r, o));
- // }
- // }
- // function OrgPrices(o) {
- // const attrs = [{
- // name: "OrgPricevalue",
- // value: o.supplyPrice,
- // },
- // {
- // name: "Ratio",
- // value: o.coe,
- // },
- // ];
- // Element.call(this, "OrgPrices", attrs);
- // if (!o.rations) return;
- // this.children.push(new SelfCollect(o));
- // }
- }
- function Mech(g, gljKeyMap) {
- const attrs = [{
- name: "Code",
- value: g.code,
- },
- {
- name: "PractName",
- value: g.name,
- },
- {
- name: "Spec",
- value: g.specs,
- },
- {
- name: "Unit",
- value: g.unit,
- },
- {
- name: "BudgetPrice",
- value: g.priceInfo.tenderPrice,
- },
- {
- name: "NormPrice",
- value: g.priceInfo.basePrice,
- },
- {
- name: "IsAdd",
- value: g.unit_price.is_add,
- },
- {
- name: "Num",
- value: (g.quantity) ? g.quantity : 0,
- },
- {
- name: "BudgetSum",
- value: scMathUtil.roundForObj(g.quantity * g.unit_price.market_price, tpdata.property.decimal.bills.unitPrice), //项目的机械费(机械预算价*机械数量)
- },
- {
- name: "NormSum",
- value: scMathUtil.roundForObj(g.quantity * g.unit_price.base_price, tpdata.property.decimal.bills.unitPrice), //项目的定额机械费(机械定额价*机械数量)
- },
- {
- name: "KeyId",
- value: uuid.v1()
- },
- ];
- Element.call(this, "Mech", attrs);
- let FixedCostItems = [];
- let fcsum = 0;
- let VariableCostItems = [];
- let vcsum = 0;
- if (g.ratio_data && g.ratio_data.length > 0) {
- for (let ratio of g.ratio_data) {
- let rIndex = gljUtil.getIndex(ratio);
- let rglj = gljKeyMap[rIndex];
- let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
- if (FixedCostMap[ratio.name]) {
- FixedCostItems.push(new FixedCostItem(ratio));
- fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
- } else {
- VariableCostItems.push(new VariableCostItem(ratio));
- vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
- }
- }
- }
- if (FixedCostItems.length > 0) {
- let fc = new FixedCost(fcsum);
- fc.children = FixedCostItems;
- this.children.push(fc);
- }
- if (VariableCostItems.length > 0) {
- let vc = new VariableCost(vcsum);
- vc.children = VariableCostItems;
- this.children.push(vc);
- }
- function VariableCost(sum) {
- const attrs = [{
- name: "VariableCostSum",
- value: sum,
- }, {
- name: "KeyId",
- value: uuid.v1()
- }];
- Element.call(this, "VariableCost", attrs);
- }
- function VariableCostItem(item) {
- const attrs = [{
- name: "VariableCostNo",
- value: item.code,
- }, {
- name: "Consumption",
- value: item.consumption,
- }, {
- name: "KeyId",
- value: uuid.v1()
- }]
- Element.call(this, "VariableCostItem", attrs);
- }
- function FixedCost(sum) {
- const attrs = [{
- name: "FixedCostSum",
- value: sum,
- }, {
- name: "FixedRate",
- value: 1,
- }, {
- name: "KeyId",
- value: uuid.v1()
- }];
- Element.call(this, "FixedCost", attrs);
- }
- function FixedCostItem(item) {
- const attrs = [{
- name: "FixedCostNo",
- value: ratioCodeMap[item.code],
- }, {
- name: "Sum",
- value: item.consumption,
- }, {
- name: "KeyId",
- value: uuid.v1()
- }]
- Element.call(this, "FixedCostItem", attrs);
- }
- }
- let Mps = new emptyElement("Mps");
- Mps.attrs = [{
- name: "KeyId",
- value: projectData.keyIDData.mps || uuid.v1()
- }];
- let Materials = new emptyElement("Materials");
- Materials.attrs = [{
- name: "KeyId",
- value: projectData.keyIDData.materials || uuid.v1()
- }];
- let Mechs = new emptyElement("Mechs");
- Mechs.attrs = [{
- name: "KeyId",
- value: projectData.keyIDData.mechs || uuid.v1()
- }];
- let gljKeyMap = {};
- let temMechs = [];
- if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
- for (let g of pgljData.gljList) {
- if (!g.quantity) {
- continue;
- }
- let type = g.type + "";
- gljKeyMap[gljUtil.getIndex(g)] = g;
- type = type.charAt(0);
- if (type == "1") {
- Mps.children.push(new Mp(g));
- } else if (type == "2" || type == 5) {
- Materials.children.push(new Material(g));
- } else if (type == "3") {
- temMechs.push(g);
- }
- }
- for (let t of temMechs) {
- Mechs.children.push(new Mech(t, gljKeyMap));
- }
- }
- this.children.push(Mps);
- this.children.push(Materials);
- this.children.push(Mechs);
- }
- function EprjInfo(tenderProject) {
- let bills = tenderProject.Bills.datas;
- let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
- let totalItem = null;
- let proItem = null; //暂列金额项
- let safeItem = null;
- let oneToSevenItem = null;
- for (let b of bills) {
- if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
- if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
- if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) oneToSevenItem = b;
- if (b.code == "102-3" && b.name == "安全生产费") safeItem = b;
- }
- const attrs = [{
- name: "Name",
- value: tenderProject.projectInfo.name,
- },
- {
- name: "Sums",
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
- },
- {
- name: "KeyId",
- value: projectData.keyIDData.eprjInfo || uuid.v1()
- }
- ];
- //输出控制价、投标文件时,取调价后的标段总造价。
- //输出招标文件时,取0
- if (isBidInvitation) attrs[1].value = 0;
- Element.call(this, "EprjInfo", attrs);
- // this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature));
- this.children.push(new MakeInfo(tenderProject));
- this.children.push(new Params(tenderProject));
- this.children.push(new getBillsItems(tenderProject));
- // this.children.push(new getIndexs(tenderProject));
- // let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
- // if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
- }
- function _getZeroValueIfNotValid(orgVal) {
- let rst = orgVal;
- if (orgVal === undefined || orgVal === null || orgVal === "") {
- rst = 0;
- }
- return rst;
- }
- function _getNumValueByExportKind(orgSum) {
- let rst = orgSum;
- // const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
- // const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
- // const isControl = exportKind === CONTROL; // 是否是控制价
- //根据导出类型(上面3个),输出实际合计或price
- if (isBidInvitation) {
- rst = 0;
- }
- return rst;
- }
- function _getStrValueByExportKind(orgStr) {
- let rst = orgStr;
- if (isBidInvitation) {
- rst = '';
- }
- return rst;
- }
- function getBidEvaluationMainMaterial(tenderProject) {
- let bidMaterials = [];
- let i = 1;
- for (let b of tenderProject.bidMaterialData) {
- bidMaterials.push(new BidEvaluationMainMaterial(b, i));
- i++
- }
- return bidMaterials;
- function BidEvaluationMainMaterial(b, index) {
- const attrs = [{
- name: "Code",
- value: b.seq,
- },
- {
- name: "Number",
- value: b.code
- },
- {
- name: "Name",
- value: b.name
- },
- {
- name: "Specification",
- value: b.specs
- },
- {
- name: "Unit",
- value: b.unit
- },
- {
- name: "Price",
- value: b.marketPrice || '0',
- type: TYPE.DECIMAL
- },
- {
- name: "LimitedPrice",
- value: b.marketPrice || '0',
- type: TYPE.DECIMAL
- },
- {
- name: "Quantity",
- value: 0,//b.quantity
- type: TYPE.DECIMAL
- },
- {
- name: "Total",
- value: 0//b.totalPrice
- },
- {
- name: "Remark",
- value: b.remark
- }
- ];
- if (isBidSubmission || isControl) {
- attrs[7].value = b.quantity;
- attrs[8].value = b.totalPrice;
- }
- Element.call(this, "BidEvaluationMainMaterial", attrs);
- }
- }
- function getIndexs(tenderProject) {
- let Indexs = new emptyElement('Indexs');
- Indexs.attrs = [{
- name: "KeyId",
- value: projectData.keyIDData.indexs || uuid.v1()
- // value: uuid.v1()
- }];
- let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
- for (let f of feature) {
- if (f.code) Indexs.children.push(new IndexItem(f))
- }
- return Indexs;
- function IndexItem(fea) {
- const attrs = [{
- name: "Code",
- value: fea.code,
- },
- {
- name: "Name",
- value: fea.dispName,
- },
- {
- name: "Unit",
- value: fea.unit,
- },
- {
- name: "Value",
- value: fea.value,
- },
- {
- name: "Remark",
- value: fea.remark,
- },
- {
- name: "KeyId",
- value: uuid.v1()
- }
- ]
- Element.call(this, "IndexItem", attrs);
- }
- }
- function getBillsItems(tenderProject) {
- let items = new emptyElement("Items");
- items.attrs = [{
- name: "KeyId",
- value: projectData.keyIDData.items || uuid.v1()
- }];
- let rootNodes = tenderProject.mainTree.roots;
- for (let r of rootNodes) {
- setItem(r, -1, items.children);
- }
- return items;
- function setItem(bNode, level, list) {
- if (bNode.sourceType == ModuleNames.ration) return;
- let item = new bill(bNode, level);
- if (bNode.children && bNode.children.length > 0) {
- level += 1;
- for (let c of bNode.children) {
- setItem(c, level, item.children);
- }
- }
- list.push(item);
- function getCalcType(node) {
- /*
- 判断是否父项:
- 是父项,则取1;
- 是叶子项,则判断其下有无套定额/量价/工料机:
- 有则取1;
- 无则判断有无基数计算:
- 有则取2;
- 无则取3 */
- if (node.children && node.children.length > 0) {
- return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
- } else {
- return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
- }
- }
- function getItemType(node) {
- let Bills = projectObj.project.Bills;
- //是100~900章部分、或是计日工部分,叶子清单输出1,父项输出0;
- if (Bills.isBelongOneToSeven(node) || Bills.isBelongDayWork(node)) {
- if (node.children && node.children.length > 0) {
- return node.children[0].sourceType == ModuleNames.ration ? 1 : 0
- }
- return 1 //叶子清单输出1
- } else {
- return 0;
- /* //非100~900章部分,
- // 是暂列金额,判断暂列金额的金额等于0,则输出为0;暂列金额的金额不等于0,则输出为1;
- if (node.data.name && node.data.name.indexOf("暂列金额") != -1) {
- let sum = node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : "";
- return gljUtil.isNotEmpty(sum) ? 1 : 0
- } else { //非暂列金额,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
- return gljUtil.isNotEmpty(node.data.quantity) ? 1 : 0
- } */
- }
- }
- function _getDecimal(unit) {
- let rst = 3;
- if (tenderProject.property.billsQuantityDecimal) {
- for (let bdec of tenderProject.property.billsQuantityDecimal) {
- if (bdec.unit === '其他未列单位') {
- rst = bdec.decimal;
- if (unit === null || unit === undefined || unit === '') {
- break;
- }
- }
- if (bdec.unit === unit) {
- rst = bdec.decimal;
- break;
- }
- }
- }
- return rst;
- }
- function _isChapter100(bNode) {
- let rst = false;
- if (bNode) {
- rst = _billStrFilter(bNode.data.name) == "清单第100章总则";
- if (!rst && bNode.parent) {
- rst = _isChapter100(bNode.parent);
- }
- }
- return rst;
- }
- function _getMapStrByBillFlag(billData) {
- let rst = ['', ''];
- if (billData && billData.flags && billData.flags.length > 0) {
- for (let idx = 0; idx < billData.flags.length; idx++) {
- if (billData.flags[idx].fieldName === 'fixed') {
- switch(billData.flags[idx].flag) {
- case 23:
- rst = ["10.1", "D1"]; // 劳务
- break;
- case 24:
- rst = ["10.2", "D2"]; // 材料
- break;
- case 25:
- rst = ["10.3", "D3"]; // 机械
- break;
- case 19:
- rst = ["1", "A"]; // 第100章至700章清单
- break;
- case 26:
- rst = ["11", "E"]; // 暂列金额 fixedFlag.PROVISIONAL
- break;
- default:
- break;
- }
- break;
- }
- }
- }
- return rst;
- }
- function bill(bNode, level) {
- let data = bNode.data;
- let CostKind = 3;
- if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
- if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
- //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
- let CalcType = getCalcType(bNode);
- //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
- let ProvisionalType = "";
- if (data.specialProvisional == "材料暂估") ProvisionalType = 0;
- if (data.specialProvisional == "工程设备") ProvisionalType = 1;
- if (data.specialProvisional == "专业工程") ProvisionalType = 2;
- //MpRatio
- let MpRatio = "";
- let MaterialRatio = "";
- let MechRatio = "";
- if (data.quantityCoe) {
- if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
- if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
- if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
- }
- let fail = null;
- // if (!isBidSubmission) {
- fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag);
- // }
- // 投标的不去判断
- // let fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag)
- //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
- let ListCode = "";
- if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name][0];
- if (data.code && data.code != "") ListCode = data.code;
- let formulaCode = "";
- // ListCodeFlagMap
- if (ListCodeMap[data.name]) {
- formulaCode = ListCodeMap[data.name][1];
- } else {
- formulaCode = _getMapStrByBillFlag(data)[1];
- }
- let perKeyId = '';
- if (data.ParentID != -1) {
- const parent = bNode.tree.findNode(bNode.data.ParentID)
- if (parent) {
- perKeyId = parent.data.keyIDData?.item || parent.data.ID;
- }
- }
- const attrs = [{
- name: "ListCode",
- value: ListCode,
- },
- {
- name: "ListName",
- value: data.name,
- fail: fail
- },
- {
- name: "Unit",
- value: data.unit,
- },
- {
- name: "Num",
- value: data.quantity || 0,
- type: TYPE.DECIMAL,
- toFix: _getDecimal(data.unit)
- },
- // {
- // name: "QtyFormula",
- // value: _getStrValueByExportKind(data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : ""),
- // type: TYPE.DECIMAL,
- // toFix:2
- // },
- {
- name: "Price",
- value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
- type: TYPE.DECIMAL,
- toFix: 2
- },
- {
- name: "Sum",
- value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
- type: TYPE.DECIMAL,
- toFix: 2
- },
- {
- name: "ProvisionalType",
- value: ProvisionalType,
- mustHasValue: true
- },
- {
- name: "MeterRules",
- value: "",
- },
- {
- name: "Content",
- value: data.jobContentText,
- },
- {
- name: "Remarks",
- value: data.remark,
- },
- {
- name: "ItemType",
- value: getItemType(bNode),
- },
- {
- name: "FormulaCode",
- value: formulaCode
- },
- {
- name: "KeyId",
- value: data.keyIDData?.item || data.ID
- },
- {
- name: "PerKeyId",
- value: perKeyId
- }
- ];
- //投标、招标控制价时。取单价。
- //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
- if (isBidSubmission || isControl || CostKind == 1 || CostKind == 2) {
- attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
- attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
- //暂列金额 数量为0的时候,单价输出0
- if (CostKind == 2 && !gljUtil.isNotEmpty(data.quantity)) attrs[4].value = 0
- }
- // 计日工合计下的劳务、材料、机械Item节点单价及合价(Price, Sum)也要输出
- if (bNode.children && bNode.children.length === 0 && _getFee(bNode) > 0) { //先检测是否有费用
- // 再检测是否计日工合计清单下
- if (_chkIfJRGHJ(bNode, ['计日工合计'])) {
- attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
- attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
- }
- }
- // 清单的专项暂定有选择了专业工程的清单Item节点单价及合价(Price, Sum)也要输出
- if (ProvisionalType === 2) {
- attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
- attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
- }
- //特殊清单
- if (isBidInvitation) {
- // 招标工程量清单 读计日工和已包含在清单合计中的材料、工程设备、专业工程暂估价合计。
- const specialBills = ['计日工合计', '已包含在清单合计中的材料、工程设备、专业工程暂估价合计'];
- if (bNode.children && bNode.children.length > 0 && _chkIfJRGHJ(bNode, specialBills)) {
- attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
- }
- if (bNode.data.name === '投标报价') {
- let rootNodes = tenderProject.mainTree.roots;
- let ttlSum = 0;
- for (let r of rootNodes) {
- if (specialBills.includes(r.data.name)) {
- ttlSum += _getFee(r);
- }
- }
- attrs[5].value = '' + ttlSum;
- }
- }
- // 导出招标时 清单100章Price、Sum不用输出
- if (isBidInvitation && _isChapter100(bNode)) {
- attrs[4].value = 0;
- attrs[5].value = 0;
- }
- Element.call(this, "Item", attrs);
- let cc = CostComposition(bNode);
- if (cc) this.children.push(cc);
- this.children.push(CostStructure(data))
- // function _chkIfHas
- function _chkIfJRGHJ(bNode, exArr = []) {
- //检测是否在指定清单的子目录下(如:计日工合计等)
- let rst = false;
- let pNode = bNode;
- while (pNode !== null && pNode !== undefined) {
- if ((typeof pNode.data.name === 'string') && exArr.includes(pNode.data.name)) {
- rst = true;
- break;
- }
- pNode = pNode.parent;
- }
- return rst;
- }
- function _getFee(bNode, key = 'common', valueKey = 'tenderTotalFee') {
- let rstSum = 0;
- if (bNode) {
- let dtlB = (bNode.data) ? bNode.data : bNode;
- if (dtlB.fees) {
- for (let fee of dtlB.fees) {
- if (fee.fieldName === key) {
- rstSum = parseFloat(fee[valueKey]);
- if (isNaN(rstSum)) rstSum = 0;
- break;
- }
- }
- }
- }
- return rstSum;
- }
- function _chkIfNeedCostComposition(bNode) {
- let rst = isBidInvitation && !(ProvisionalType === 0 || ProvisionalType === 1);
- if (rst) {
- //计日工合计下的劳务、材料、机械 有费用也要输出
- if (bNode.children && bNode.children.length === 0 && _getFee(bNode) > 0) { //先检测是否有费用
- // 再检测是否计日工合计清单下
- rst = !_chkIfJRGHJ(bNode, ['计日工合计']);
- }
- }
- return rst;
- }
- function CostComposition(bNode) {
- if (_chkIfNeedCostComposition(bNode)) return null;
- let CostComposition = new emptyElement('CostComposition');
- CostComposition.attrs = [{
- name: "KeyId",
- value: bNode.data.keyIDData?.costComposition || uuid.v1()
- }];
- let Norms = [];
- let Costs = [];
- if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
- for (let r of bNode.children) {
- if (r.data.type == rationType.ration) {
- if (isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
- Norms.push(new Ration(r.data));
- } else {
- Costs.push(new Cost(r.data));
- }
- }
- }
- if (Costs.length === 0 && _chkIfJRGHJ(bNode, ['计日工合计'])) {
- Costs.push(new Cost(bNode.data));
- for (let idx = 0; idx < Costs[Costs.length - 1].attrs.length; idx++) {
- if (Costs[Costs.length - 1].attrs[idx].name === 'Num') {
- Costs[Costs.length - 1].attrs[idx].value = '' + (bNode.data.quantity || 0);
- } else if (Costs[Costs.length - 1].attrs[idx].name === 'BasePrice') {
- Costs[Costs.length - 1].attrs[idx].value = '' + _getFee(bNode, 'common', 'tenderUnitFee');
- }
- }
- }
- if (Costs.length > 0) CostComposition.children.push(...Costs);
- if (Norms.length > 0) CostComposition.children.push(...Norms);
- if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
- return (CostComposition.children.length > 0) ? CostComposition : null;
- //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
- function isEmptyRation(ration) {
- return !gljUtil.isNotEmpty(ration.code) && !gljUtil.isNotEmpty(ration.name) && !gljUtil.isNotEmpty(ration.unit) && (!gljUtil.isNotEmpty(ration.quantity) || ration.quantity == 0)
- }
- function Formula(bills) {
- const attrs = [{
- name: "Name",
- value: bills.name
- },
- {
- name: "Formulas",
- value: bills.calcBase
- },
- {
- name: "Ratio",
- value: 1
- },
- {
- name: "Sum",
- value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
- type: TYPE.DECIMAL
- },
- {
- name: "Remarks",
- value: bills.remark
- },
- {
- name: "KeyId",
- value: bills.keyIDData?.formula || uuid.v1()
- }
- ]
- Element.call(this, "Formula", attrs);
- // 1.Name
- // 名称/描述。取清单的名称。
- // 2.Formulas
- // 计算式。读取计算基数的文本。
- // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
- // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
- // 3.Ratio
- // 系数。输出为1,非必填。
- // 4.Sum
- // 取金额。
- // 5.Remarks
- }
- function Cost(item) {
- let BasePrice = 0;
- if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
- BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
- } else {
- BasePrice = getBasePrice(item.projectGLJID, tenderProject)
- }
- let calcMap = tenderProject.calcProgram.compiledTemplateMaps
- let CostTypeNo = '';
- if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
- const attrs = [{
- name: "Code",
- value: item.code,
- }, {
- name: 'Name',
- value: item.name
- }, {
- name: 'Spec',
- value: item.specs
- }, {
- name: 'Unit',
- value: item.unit
- }, {
- name: 'Num',
- value: item.tenderQuantity || ''
- }, {
- name: 'BasePrice',
- value: BasePrice
- }, {
- name: 'Price',
- value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
- }, {
- name: 'IsEquipment',
- value: item.subType == gljType.EQUIPMENT ? 1 : 0
- }, {
- name: 'CostTypeNo',
- value: CostTypeNo
- }, {
- name: 'ProfitRate',
- value: getFeeRate(item.programID, 'profit', tenderProject)
- },
- {
- name: 'TaxRate',
- value: getFeeRate(item.programID, 'tax', tenderProject)
- },
- {
- name: 'MpRatio',
- value: item.subType == gljType.LABOUR ? 100 : 0
- },
- {
- name: 'MaterialRatio',
- value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
- },
- {
- name: 'MechRatio',
- value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
- },
- {
- name: "KeyId",
- value: uuid.v1()
- }
- ]
- Element.call(this, "Cost", attrs);
- this.children.push(CostStructure(item));
- }
- function Ration(ration) {
- let calcMap = tenderProject.calcProgram.compiledTemplateMaps
- let CostTypeNo = '';
- if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
- const attrs = [{
- name: "NormLibNo",
- value: 'YSDE-000000-2018-86',
- }, {
- name: 'DisplayCode',
- value: ration.code
- }, {
- name: 'Name',
- value: ration.name
- }, {
- name: 'Unit',
- value: ration.unit
- }, {
- name: 'Num',
- value: ration.tenderQuantity || 0
- },
- {
- name: 'CostTypeNo',
- value: CostTypeNo
- },
- {
- name: 'ProfitRate',
- value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
- },
- {
- name: 'TaxRate',
- value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
- },
- {
- name: 'FabricationCost',
- value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
- },
- {
- name: 'AdjustStatus',
- value: ration.adjustState
- },
- {
- name: "KeyId",
- value: uuid.v1()
- }
- ]
- Element.call(this, "Norm", attrs);
- this.children.push(CostStructure(ration));
- this.children.push(Consume(ration));
- }
- }
- function Consume(ration) {
- let consume = new emptyElement('Consume');
- consume.attrs = [{
- name: "KeyId",
- value: uuid.v1()
- }];
- for (let rg of ration.rationGLJList) {
- consume.children.push(new ConsumeItem(rg));
- }
- return consume;
- function ConsumeItem(rg) {
- const attrs = [{
- name: "Code",
- value: rg.code,
- }, {
- name: "Consumption",
- value: rg.tenderQuantity || 0
- }, {
- name: "KeyId",
- value: uuid.v1()
- }];
- Element.call(this, "ConsumeItem", attrs);
- }
- }
- function CostStructure(item) {
- let CostStructure = new emptyElement('CostStructure');
- CostStructure.attrs = [{
- name: "KeyId",
- value: item.keyIDData?.costStructure || uuid.v1()
- }];
- for (let f of cpFeeTypes) {
- if (itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item, f.type))
- }
- if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({}, ""))
- function CostItem(item, type) {
- const attrs = [{
- name: "ItemNo",
- value: itemFeeMap[type],
- }, {
- name: 'Sum',
- value: 0 //fee.tenderTotalFee
- }, {
- name: "KeyId",
- value: uuid.v1()
- }
- ]
- if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
- Element.call(this, "CostItem", attrs);
- }
- return CostStructure;
- }
- }
- }
- }
- function Params(tenderProject) {
- let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
- let featrueMap = {};
- debugger;
- let baseMap = {};
- for (let f of feature) {
- featrueMap[f.key] = f;
- }
- let baseInfo = _.find(tenderProject.property.basicInformation, {
- dispName: "基本信息",
- });
- for (let i of baseInfo.items) {
- let key = i.key;
- //if (i.dispName == "编制日期") key = "编制时间";
- baseMap[key] = i;
- }
- let BuildType = "";
- if (baseMap["natureConstruction"]) {
- if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
- if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
- }
- let Terrain = "";
- if (baseMap["terrainCategory"]) {
- if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
- if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
- }
- let DesignSpeed = parseFloat(featrueMap["designSpeed"].value);
- if (isNaN(DesignSpeed)) DesignSpeed = 0;
- let Structure = 0;
- if (featrueMap["pavementStructure"]) {
- if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
- if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
- if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
- }
- let RoadGrade = "";
- if (baseMap["roadGrade"] && RoadGradeMap[baseMap["roadGrade"].value]) {
- RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
- }
- const attrs = [{
- name: "PrjArea",
- value: baseMap["location"] ? baseMap["location"].value : ""
- },
- {
- name: "StartPileNo",
- value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
- mustHasValue: true
- },
- {
- name: "EndPileNo",
- value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
- mustHasValue: true
- },
- {
- name: "BuildType",
- value: BuildType,
- },
- {
- name: "Terrain",
- value: Terrain,
- mustHasValue: true
- },
- {
- name: "RoadGrade",
- value: RoadGrade,
- mustHasValue: true
- },
- {
- name: "DesignSpeed",
- value: DesignSpeed
- },
- {
- name: "Structure",
- value: Structure
- },
- {
- name: "SubgradeWidth",
- value: featrueMap["subgradeWidth"] ? _getZeroValueIfNotValid(featrueMap["subgradeWidth"].value) : 0
- },
- {
- name: "RoadLength",
- value: featrueMap["roadLength"] ? _getZeroValueIfNotValid(featrueMap["roadLength"].value) : 0
- },
- {
- name: "BridgeLength",
- value: featrueMap["bridgeLength"] ? _getZeroValueIfNotValid(featrueMap["bridgeLength"].value) : 0
- },
- {
- name: "TunnelLength",
- value: featrueMap["tunnelLength"] ? _getZeroValueIfNotValid(featrueMap["tunnelLength"].value) : 0
- },
- {
- name: "BriTunRate",
- value: featrueMap["briTunRate"] ? _getZeroValueIfNotValid(featrueMap["briTunRate"].value) : 0
- },
- {
- name: "InterchangeNum",
- value: featrueMap["interchangeNum"] ? _getZeroValueIfNotValid(featrueMap["interchangeNum"].value) : 0
- },
- {
- name: "RisingRate",
- value: 0,
- mustHasValue: true
- },
- {
- name: "RisingYears",
- value: 0,
- mustHasValue: true
- },
- {
- name: "RateNo",
- value: uuid.v1()
- },
- {
- name: "PractNo",
- value: uuid.v1()
- },
- {
- name: "StubLengths",
- value: featrueMap["stubLengths"] ? _getZeroValueIfNotValid(featrueMap["stubLengths"].value) : 0
- },
- {
- name: "LaneLength",
- value: featrueMap["laneLength"] ? _getZeroValueIfNotValid(featrueMap["laneLength"].value) : 0
- },
- {
- name: "KeyId",
- value: projectData.keyIDData.params || uuid.v1()
- }
- ];
- Element.call(this, "Params", attrs);
- }
- function SummaryOfCost(totalItem, proItem, safeItem, oneToSevenItem, feature) {
- let attrs = [{
- name: "TenderSumLimit",
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "BidTotal",
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "BillTotal",
- value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "CostForHSE",
- value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "ProvisionalSums",
- value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "Appraisal",
- value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- ];
- if (isBidInvitation) {
- attrs.splice(0, 3) //招标
- }
- //if (isControl) attrs.splice(1, 5); //控制价
- if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
- let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
- if (tenderSumLimit) attrs[0].value = tenderSumLimit.value
- }
- Element.call(this, "SummaryOfCost", attrs);
- }
- function MakeInfo(tenderProject) {
- let property = tenderProject.property;
- let baseMap = {};
- let baseInfo = _.find(property.basicInformation, {
- dispName: "基本信息",
- });
- for (let i of baseInfo.items) {
- let key = i.key;
- //if (i.dispName == "编制日期") key = "编制时间";
- baseMap[key] = i;
- }
- //mustHasValue
- const attrs = [
- // {
- // name: "ValuationModel",
- // value: property.taxType,
- // },
- {
- name: "Manage",
- value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
- },
- {
- name: "Designer",
- value: baseMap["designUnit"] ? baseMap["designUnit"].value : ""
- },
- {
- name: "Compile",
- value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
- },
- {
- name: "CompileApprover",
- value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
- },
- {
- name: "CompileCertNo",
- value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : ""
- },
- {
- name: "CompileDate",
- value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : ""
- },
- {
- name: "Review",
- value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : ""
- },
- {
- name: "ReviewApprover",
- value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : ""
- },
- {
- name: "ReviewCertNo",
- value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : ""
- },
- {
- name: "ReviewDate",
- value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : ""
- },
- {
- name: "Examine",
- value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
- mustHasValue: true
- },
- {
- name: "ExamineApprover",
- value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
- mustHasValue: true
- },
- {
- name: "ExamineCertNo",
- value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
- mustHasValue: true
- },
- {
- name: "ExamineDate",
- value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
- mustHasValue: true
- },
- {
- name: "CompileExplain",
- value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
- mustHasValue: true
- },
- {
- name: "ExamineExplain",
- value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
- mustHasValue: true
- },
- {
- name: "ProjectExplain",
- value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
- mustHasValue: true
- },
- {
- name: "KeyId",
- value: projectData.keyIDData.makeInfo || uuid.v1()
- }
- ];
- if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
- // attrs.splice(11, 7);
- // attrs.splice(7, 1);
- }
- Element.call(this, "MakeInfo", attrs);
- }
- let data = new CprjInfo(projectData.name);
- data.children.push(new SystemInfo(projectData));
- data.children.push(new CostBasis());
- let seriNo = 1;
- let Rates = [];
- let Practs = [];
- let EprjInfos = [];
- let Indexs = [];
- for (let c of projectData.children) {
- let tenderProject = tenderDetailMap[c.ID];
- let feeRataDatas = tenderProject.FeeRate.datas;
- Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
- Practs.push(new Pract(tenderProject, seriNo));
- EprjInfos.push(new EprjInfo(tenderProject));
- if (seriNo === 1) Indexs.push(new getIndexs(tenderProject));
- seriNo++;
- }
- data.children.push(...Rates, ...Practs, ...EprjInfos, ...Indexs);
- return [{
- data: data,
- exportKind: exportKind,
- fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
- },];
- }
- return {
- entry,
- };
- })();
|