| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681 |
- // INTERFACE_EXPORT =,必须这么写,这样才能在导出时动态加载脚本后,覆盖前端代码
- INTERFACE_EXPORT = (() => {
- 'use strict';
- const feeRateMap = {
- '冬季施工增加费': 'DJSGZJFFL',
- '冬季施工': 'DJSGZJFFL',
- '雨季施工增加费': 'YUJSGZJFFL',
- '雨季施工': 'YUJSGZJFFL',
- '夜间施工增加费': 'YEJSGZJFFL',
- '夜间施工': 'YEJSGZJFFL',
- '高原地区施工增加费': 'GYDQSGZJFFL',
- '高原施工': 'GYDQSGZJFFL',
- '风沙地区施工增加费': 'FSDQSGZJFFL',
- '风沙施工': 'FSDQSGZJFFL',
- '沿海地区施工增加费': 'YHDQSGZJFFL',
- '沿海施工': 'YHDQSGZJFFL',
- '行车干扰施工增加费': 'XCGRGCSGZJFFL',
- '行车干扰': 'XCGRGCSGZJFFL',
- '工地转移费': 'GDZYFFL',
- '工地转移': 'GDZYFFL',
- '施工辅助费': 'SGFZFFL',
- '施工辅助': 'SGFZFFL',
- '基本费用': 'JBFYFL',
- '主副食运费补贴': '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'
- }
- /**
- *
- * @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 {
- UTIL,
- Element,
- } = INTERFACE_EXPORT_BASE;
- const {
- EXPORT_KIND: {
- BID_INVITATION,
- BID_SUBMISSION,
- CONTROL
- },
- fixedFlag,
- } = window.commonConstants
- let cprjType = {
- 1: 'ZBKZJ', // 招标
- 2: 'TBBJ', // 投标
- 3: 'GCLQD' // 控制价
- }
- const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
- const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
- const isControl = exportKind === CONTROL; // 是否是控制价
- function emptyElement(name) {
- this.name = name;
- this.attrs = [];
- this.children = [];
- }
- // 建设项目根节点信息
- function CprjInfo(projectName) {
- const attrs = [{
- name: 'CprjName',
- value: projectName
- }, {
- name: 'CprjType',
- value: cprjType[exportKind]
- }];
- Element.call(this, 'CprjInfo', attrs);
- }
- // 项目基本信息
- function SystemInfo(projectData) {
- 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: UTIL.getNowFormatTime()
- }, {
- name: 'Key1',
- value: window.btoa(VERSION)
- }, {
- name: 'Key2',
- value: window.btoa(diskId)
- }, {
- name: 'Key3',
- value: window.btoa(macId)
- }
- ];
- if (isBidSubmission) attrs.splice(6, 0, {
- name: 'BidderVer',
- value: UTIL.getNowFormatTime()
- })
- 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'
- }];
- Element.call(this, 'CostBasis', attrs);
- //定额库信息
- //to do 改成实际的值
- function NormLib() {
- const attrs = [{
- name: 'NormLibNo',
- value: '0'
- }, {
- name: 'NormLibName',
- value: '部颁公路工程预算定额(2018)'
- }, {
- name: 'Type',
- value: 'ZDEK'
- }];
- Element.call(this, 'NormLib', attrs);
- }
- this.children.push(new NormLib());
- }
- function Rate(feeRateInfo) {
- //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
- const attrs = [{
- name: 'RateNo',
- value: feeRateInfo.ID
- }, {
- name: 'Name',
- value: feeRateInfo.name
- }, {
- name: 'RateLibNo',
- value: feeRateInfo.libID
- }];
- Element.call(this, 'Rate', attrs);
- let RateParams = new emptyElement('RateParams');
- 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
- }
- 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'
- }];
- Element.call(this, 'RateParam', attrs);
- }
- let RateValues = new emptyElement('RateValues')
- function RateValue(CostTypeNo, RateTypeNo) {
- const attrs = [{
- name: 'CostTypeNo',
- value: CostTypeNo
- }, {
- name: 'RateTypeNo',
- value: RateTypeNo
- }, {
- name: 'RateValue',
- value: '0'
- }];
- 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]));
- }
- }
- this.children.push(RateValues);
- }
- function Pract(tpdata) {
- let pgljData = tpdata.projectGLJ.datas;
- const attrs = [{
- name: 'PractNo',
- value: pgljData.constData.usedUnitPriceInfo.id
- }, {
- name: 'Name',
- value: pgljData.constData.usedUnitPriceInfo.name
- }];
- Element.call(this, 'Pract', attrs);
- let Param = {
- name: "Param",
- attrs: [{
- name: "TaxLibNo",
- value: "CCSBZ-440000-2019-544"
- }, {
- name: "AuxRate",
- value: pgljData.constData.assistProductionFeeRate
- }],
- children: []
- }
- 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: 'BugetPrice',
- value: g.priceInfo.marketPrice
- }, {
- name: 'NormPrice',
- value: g.priceInfo.basePrice
- }, {
- name: 'IsAdd',
- value: g.unit_price.is_add
- }];
- 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: 'BugetPrice',
- value: g.priceInfo.marketPrice
- }, {
- 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,
- }];
- 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 = [];
- 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) {
- const attrs = [{
- name: 'Code', //待获取
- value: g.code
- }, {
- name: 'Consumption',
- value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity)
- }]
- 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
- }, {
- 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) {
- const attrs = [{
- name: 'Code',
- value: g.code
- }, {
- name: 'PractName',
- value: g.name
- }, {
- name: 'Spec',
- value: g.specs
- }, {
- name: 'Unit',
- value: g.unit
- }, {
- name: 'BugetPrice',
- value: g.priceInfo.marketPrice
- }, {
- name: 'NormPrice',
- value: g.priceInfo.basePrice
- }, {
- name: 'IsAdd',
- value: g.unit_price.is_add
- }];
- Element.call(this, 'Mech', attrs);
- }
- let Mps = new emptyElement("Mps");
- let Materials = new emptyElement("Materials");
- let Mechs = new emptyElement("Mechs");
- for (let g of pgljData.gljList) {
- let type = g.type + "";
- 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') {
- Mechs.children.push(new Mech(g));
- }
- }
- this.children.push(Mps);
- this.children.push(Materials);
- this.children.push(Mechs);
- }
- function EprjInfo(tenderProject) {
- let bills = tenderProject.Bills.datas;
- let totalItem = null;
- let proItem = null; //暂列金额项
- for (let b of bills) {
- if (b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
- if (b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = 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
- }]
- Element.call(this, 'EprjInfo', attrs);
- this.children.push(new SummaryOfCost(totalItem, proItem));
- this.children.push(new MakeInfo(tenderProject));
- }
- function SummaryOfCost(totalItem, proItem) {
- const attrs = [{
- name: 'TenderSumLimit',
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0
- }, {
- name: 'BidTotal',
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0
- }, {
- name: 'BillTotal',
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0
- }, {
- name: 'CostForHSE',
- value: 0
- }, {
- name: 'ProvisionalSums',
- value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0
- }, {
- name: 'Appraisal',
- value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0
- }]
- if (isBidInvitation || isControl) attrs.splice(1, 1) //招标 - 控制价
- if (isBidSubmission) attrs.splice(0, 1) //投标
- Element.call(this, 'SummaryOfCost', attrs);
- }
- function MakeInfo(property) {
- let baseMap = {};
- let baseInfo = _.find(property.basicInformation, {
- 'dispName': "基本信息"
- })
- for (let i of baseInfo.items) {
- let key = i.dispName;
- if (i.dispName == "编制日期") key = '编制时间';
- baseMap[key] = i;
- }
- const attrs = [{
- name: 'ValuationModel',
- value: property.taxType
- }, {
- name: 'Manage',
- value: baseMap['建设单位'] ? baseMap['建设单位'].value : ''
- }, {
- name: 'Designer',
- value: baseMap['设计单位'] ? baseMap['设计单位'].value : ''
- }, {
- name: 'Compile',
- value: baseMap['编制单位'] ? baseMap['编制单位'].value : ''
- }, {
- name: 'CompileApprover',
- value: baseMap['编制人'] ? baseMap['编制人'].value : ''
- }, {
- name: 'CompileCertNo',
- value: baseMap['编制人证书号'] ? baseMap['编制人证书号'].value : ''
- }, {
- name: 'CompileDate',
- value: baseMap['编制时间'] ? baseMap['编制时间'].value : ''
- }, {
- name: 'Review',
- value: baseMap['复核单位'] ? baseMap['复核单位'].value : ''
- }, {
- name: 'ReviewApprover',
- value: baseMap['复核人'] ? baseMap['复核人'].value : ''
- }, {
- name: 'ReviewCertNo',
- value: baseMap['复核人证书'] ? baseMap['复核人证书'].value : ''
- }, {
- name: 'ReviewDate',
- value: baseMap['复核日期'] ? baseMap['复核日期'].value : ''
- }, {
- name: 'Examine',
- value: baseMap['审核单位'] ? baseMap['审核单位'].value : ''
- }, {
- name: 'ExamineApprover',
- value: baseMap['审核人'] ? baseMap['审核人'].value : ''
- }, {
- name: 'ExamineCertNo',
- value: baseMap['审核人证书'] ? baseMap['审核人证书'].value : ''
- }, {
- name: 'ExamineDate',
- value: baseMap['审核日期'] ? baseMap['审核日期'].value : ''
- }, {
- name: 'CompileExplain',
- value: baseMap['编制说明'] ? baseMap['编制说明'].value : ''
- }, {
- name: 'ExamineExplain',
- value: baseMap['审核说明'] ? baseMap['审核说明'].value : ''
- }, {
- name: 'ProjectExplain',
- value: baseMap['工程说明'] ? baseMap['工程说明'].value : ''
- }]
- Element.call(this, 'MakeInfo', attrs);
- }
- let data = new CprjInfo(projectData.name);
- data.children.push(new SystemInfo());
- data.children.push(new CostBasis());
- let tenderProject = tenderDetailMap[projectObj.project.ID()];
- let feeRataDatas = tenderProject.FeeRate.datas;
- data.children.push(new Rate(feeRataDatas));
- data.children.push(new Pract(tenderProject))
- data.children.push(new EprjInfo(tenderProject))
- let property = tenderProject
- return [{
- data: data,
- exportKind: exportKind,
- fileName: projectData.name + INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind]
- }]
- }
- return {
- entry
- };
- })();
|