| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- INTERFACE_EXPORT = (() => {
- 'use strict';
- /**
- *
- * @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,
- WHITE_SPACE
- },
- UTIL: {
- getValueByKey,
- getHan,
- getFee,
- generateHardwareId,
- },
- Element,
- } = INTERFACE_EXPORT_BASE;
- const {
- EXPORT_KIND: { BID_INVITATION, BID_SUBMISSION, CONTROL },
- fixedFlag,
- RationType,
- } = window.commonConstants
- const GljType = gljUtil.gljType;
- const { isEmptyVal, isDef } = window.commonUtil;
- const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
- const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
- const isControl = exportKind === CONTROL; // 是否是控制价
- let serialNo;
- let vTree;
- // ------------------------------------------------------------------------------------------------------------
- // 提取字符串中的数字
- function getNum(str) {
- let num = str.replace(/[^0-9]/ig, "");
- return num;
- }
- function CheckNull(Value) {
- if (!Value)
- return 0
- else
- return Value;
- }
- function GetRationDataType(ration){
- let dt;
- if (calcTools.isRationItem(ration))
- dt = 3
- else if (calcTools.isGljRation(ration))
- dt = 1
- else if (calcTools.isVolumePrice(ration))
- dt = 4;
- return dt;
- }
- // ------------------------------------------------------------------------------------------------------------
- function CreateNode(nodeName, attrArr = []) {
- Element.call(this, nodeName, attrArr);
- }
- function GongCXX(information) {
- const attrs = [
- { name: '项目编号', value: getValueByKey(information, 'projNum') },
- { name: '项目名称', value: getValueByKey(information, '') },
- { name: '建设单位', value: getValueByKey(information, 'constructingUnits') },
- { name: '起始桩号', value: getValueByKey(information, 'startAndChainages') },
- { name: '终点桩号', value: getValueByKey(information, 'startAndChainages') },
- { name: '建设地址', value: getValueByKey(information, '') },
- { name: '项目概况', value: getValueByKey(information, '') },
- { name: '建设性质', value: getValueByKey(information, '') },
- { name: '专业划分', value: getValueByKey(information, '') },
- { name: '道路里程', value: getValueByKey(information, '') },
- { name: '设计单位', value: getValueByKey(information, '') },
- { name: '计税方式', value: getValueByKey(information, 'taxMode') },
- { name: '文件类型', value: getValueByKey(information, 'projType') },
- { name: '标准版本号', value: getValueByKey(information, '') },
- { name: 'GUID', value: getValueByKey(information, '') }
- ];
- Element.call(this, '工程信息', attrs);
- }
- function ZhaoBiaoXx(information) {
- const attrs = [
- { name: '招标人', value: getValueByKey(information, 'tendereeName') },
- { name: '招标人纳税识别号', value: getValueByKey(information, 'tendereeTaxpayerIdentificationNo') },
- { name: '招标法定代表人或其授权人', value: getValueByKey(information, 'tenderAuthorizer') },
- { name: '招标法人或其授权人身份证号', value: getValueByKey(information, 'tenderAuthorizerIDNo') },
- { name: '造价咨询人', value: getValueByKey(information, 'costConsultant') },
- { name: '造价咨询人纳税识别号', value: getValueByKey(information, 'costConsultantTaxpayerIdentificationNo') },
- { name: '造价咨询人法定代表人或其授权人', value: getValueByKey(information, 'consultantAuthorizer') },
- { name: '造价咨询法人或其授权人身份证号', value: getValueByKey(information, 'consultantAuthorizerTaxpayerIdentificationNo') },
- { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
- { name: '编制人资格证号', value: getValueByKey(information, '') },
- { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
- { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
- { name: '复核人资格证号', value: getValueByKey(information, '') },
- { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE }
- ];
- Element.call(this, '招标信息', attrs);
- }
- function ZhaoBiaoKzXx(information, totalCost) {
- const attrs = [
- { name: '招标人', value: getValueByKey(information, 'tendereeName') },
- { name: '招标人纳税识别号', value: getValueByKey(information, 'tendereeTaxpayerIdentificationNo') },
- { name: '招标法定代表人或其授权人', value: getValueByKey(information, 'tenderAuthorizer') },
- { name: '招标法人或其授权人身份证号', value: getValueByKey(information, 'tenderAuthorizerIDNo') },
- { name: '造价咨询人', value: getValueByKey(information, 'costConsultant') },
- { name: '造价咨询人纳税识别号', value: getValueByKey(information, 'costConsultantTaxpayerIdentificationNo') },
- { name: '造价咨询人法定代表人或其授权人', value: getValueByKey(information, 'consultantAuthorizer') },
- { name: '造价咨询法人或其授权人身份证号', value: getValueByKey(information, 'consultantAuthorizerTaxpayerIdentificationNo') },
- { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
- { name: '编制人资格证号', value: getValueByKey(information, '') },
- { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
- { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
- { name: '复核人资格证号', value: getValueByKey(information, '') },
- { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
- { name: '审核人', value: getValueByKey(information, 'tenderExaminer') },
- { name: '审核人资格证号', value: getValueByKey(information, '') },
- { name: '审核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
- { name: '控制价总价', value: totalCost, type: TYPE.DECIMAL },
- { name: '工期', value: getValueByKey(information, '') },
- { name: '质量要求', value: getValueByKey(information, '') }
- ];
- Element.call(this, '招标控制价', attrs);
- }
- function TouBiaoXx(information, totalCost) {
- const attrs = [
- { name: '投标人', value: getValueByKey(information, 'bidderName') },
- { name: '投标人纳税识别号', value: getValueByKey(information, '') },
- { name: '投标人法定代表或其授权人', value: getValueByKey(information, 'bidderAuthorizer') },
- { name: '投标人法人或其授权人身份证号', value: getValueByKey(information, '') },
- { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
- { name: '编制人资格证号', value: getValueByKey(information, '') },
- { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
- { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
- { name: '复核人资格证号', value: getValueByKey(information, '') },
- { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
- { name: '审核人', value: getValueByKey(information, 'tenderExaminer') },
- { name: '审核人资格证号', value: getValueByKey(information, '') },
- { name: '审核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
- { name: '投标总价', value: totalCost, type: TYPE.DECIMAL },
- { name: '工期', value: getValueByKey(information, '') },
- { name: '投标担保金额', value: getValueByKey(information, '') },
- { name: '质量承诺', value: getValueByKey(information, '') },
- { name: '投标担保方式', value: getValueByKey(information, '') },
- { name: '造价软件品牌', value: getValueByKey(information, '') },
- { name: '造价软件版本', value: getValueByKey(information, '') },
- { name: '造价软件加密锁编号', value: getValueByKey(information, '') },
- { name: '计算机硬件信息', value: getValueByKey(information, '') },
- { name: '', value: getValueByKey(information, '') }
- ];
- Element.call(this, '投标信息', attrs);
- }
- function addRationGLJs(rData, rationNode){
- for (let i = 0; i < rData.rationGLJList.length; i++) {
- let glj = rData.rationGLJList[i];
- const attrs = [
- { name: '人材机标识', value: glj.GLJID},
- { name: '人材机含量', value: glj.tenderQuantity}
- ];
- let gljNode = new CreateNode('定额人材机含量明细', attrs);
- rationNode.children.push(gljNode);
- }
- }
- function addRations(ABillItem, ABillNode){
- for (let i = 0; i < ABillItem.children.length; i++) {
- let r = ABillItem.children[i].data;
- const attrs = [
- { name: '序号', value: i + 1},
- { name: '定额编号', value: r.code},
- { name: '定额名称', value: r.name},
- { name: '单位', value: r.unit},
- { name: '数量', value: r.tenderQuantity},
- { name: '单价', value: r.feesIndex && r.feesIndex.common ? r.feesIndex.common.tenderUnitFee : 0},
- { name: '合价', value: r.feesIndex && r.feesIndex.common ? r.feesIndex.common.tenderTotalFee : 0},
- { name: '备注', value: ''},
- { name: '数据类型', value: GetRationDataType(ABillItem.children[i])},
- { name: '人工费', value: getFee(r.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL},
- { name: '主材费', value: getFee(r.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL},
- { name: '辅材费', value: 0},
- { name: '机械使用费', value: getFee(r.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL},
- { name: '设备费', value: 0},
- { name: '措施费1', value: getFee(r.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL}, // FQuery2.FieldByName('OtherDirectFee'},
- { name: '措施费2', value: 0}, //getFee(r.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL
- { name: '企业管理费', value: getFee(r.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL},
- { name: '规费', value: getFee(r.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL},
- { name: '利润', value: getFee(r.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL},
- { name: '税金', value: getFee(r.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL},
- ];
- let rationNode = new CreateNode('定额信息表', attrs);
- ABillNode.children.push(rationNode);
- addRationGLJs(r, rationNode);
- }
- }
- function recursiveAddBills(AItem, AXMLParent) {
- if (AItem == undefined || !calcTools.isBill(AItem)) return;
- let vBillNode;
- function addBillNode () {
- serialNo++;
- let zmh = (AItem.parent == vTree.roots[0]) ? getNum(AItem.data.name) : AItem.data.code;
- const attrs = [
- {name: "序号", value: serialNo}, //AItem.data.ID
- {name: "清单章节号", value: zmh},
- {name: "子目号", value: zmh},
- {name: "子目名称", value: AItem.data.name},
- {name: "单位", value: AItem.data.unit},
- {name: "数量", value: AItem.data.quantity, type: TYPE.DECIMAL}
- ];
- let dj = 0, hj = 0;
- if ((isBidSubmission || isControl) || (AItem.data.specialProvisional == '专业工程')){
- hj = CheckNull(AItem.data.feesIndex && AItem.data.feesIndex.common ? AItem.data.feesIndex.common.tenderTotalFee : 0);
- dj = hj;
- }
- attrs.push({name: "单价", value: dj}, {name: "合价", value: hj});
- attrs.push({name: "备注", value: isBidInvitation ? '' : AItem.data.remark});
- let sjlx;
- if (AItem.data.specialProvisional == '专业工程') // 专项暂定
- sjlx = 21;
- else {
- if (calcTools.isLeafBill(AItem)) {
- if (AItem.data.code == '102-3') // 安全生产费
- sjlx = '22'
- else if ((AItem.data.code == '-a') && (AItem.parent && (AItem.parent.data.code == '101-1'))) // 工程一切险
- sjlx = '23'
- else if ((AItem.data.code == '-b') && (AItem.parent && (AItem.parent.data.code == '101-1'))) // 第三者责任险
- sjlx = '24'
- else
- sjlx = '20';
- }
- else {
- sjlx = '1'; // 父清单
- attrs.find(function getE(e) {return e.name == '单位'}).value = '项';
- }
- }
- attrs.push({name: "数据类型", value: sjlx});
- if (isBidSubmission || isControl){
- attrs.push(
- {name: "人工费", value: getFee(AItem.data.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL},
- {name: "主材费", value: getFee(AItem.data.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL},
- {name: "辅材费", value: 0},
- {name: "机械使用费", value: getFee(AItem.data.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL},
- {name: "设备费", value: 0},
- {name: "措施费1", value: getFee(AItem.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL},
- {name: "措施费2", value: 0}, // getFee(AItem.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL},
- {name: "企业管理费", value: getFee(AItem.data.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL},
- {name: "规费", value: getFee(AItem.data.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL},
- {name: "利润", value: getFee(AItem.data.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL},
- {name: "税金", value: getFee(AItem.data.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL}
- );
- }
- vBillNode = new CreateNode('工程量清单明细', attrs);
- AXMLParent.children.push(vBillNode);
- if (calcTools.isLeafBill(AItem))
- addRations(AItem, vBillNode)
- }
- addBillNode();
- recursiveAddBills(AItem.children[0], vBillNode);
- recursiveAddBills(AItem.nextSibling, AXMLParent);
- }
- // 清单表
- function createGCLQDB(tenderData, gongCLQDB){
- vTree = tenderDetailMap[tenderData.ID].mainTree;
- serialNo = 0;
- recursiveAddBills(vTree.roots[0].children[0], gongCLQDB);
- };
- // 生成标段工程
- function createGLBDGC(tenderData, gongLGCSJ, gongLGCHZ, Num){
- let attrs0 = [
- { name: '序号', value: Num },
- { name: '标段名称', value: tenderData.name },
- { name: '金额', value: projectData.summaryInfo[tenderData.ID].totalCost }
- ];
- const attrs1 = [{ name: '唯一标识-Guid', value: tenderData._id }]; // 公路标段工程
- const gongLBDGC = new CreateNode('公路标段工程', attrs0.concat(attrs1));
- gongLGCSJ.children.push(gongLBDGC);
- const gongCLQDB = new CreateNode('工程量清单表');
- const jiRGXXB = new CreateNode('计日工信息表');
- const ZaoJHZB = new CreateNode('造价汇总表');
- const RenCJHZ = new CreateNode('人材机汇总');
- gongLBDGC.children = [gongCLQDB, jiRGXXB, ZaoJHZB, RenCJHZ];
- createGCLQDB(tenderData, gongCLQDB);
- // createJiRGXXB(jiRGXXB);
- // 同步生成 公路工程汇总明细 数据
- const attrs2 = [{ name: '备注', value: '' }];
- const gongLGCHZMX = new CreateNode('公路工程汇总明细', attrs0.concat(attrs2));
- gongLGCHZ.children.push(gongLGCHZMX);
- }
- // 组装主体框架数据
- function setupConstruction() {
- const information = projectData.property && projectData.property.basicInformation || [];
- const summaryInfo = projectData.summaryInfo[projectData.ID];
- const chiZGLGC = new CreateNode('池州公路工程');
- const gongCXX = new GongCXX(information); // 工程信息
- const zhaoTBXX = new CreateNode('招投标信息');
- const gongLGCSJ = new CreateNode('公路工程数据');
- chiZGLGC.children = [gongCXX, zhaoTBXX, gongLGCSJ];
- if (isBidInvitation)
- zhaoTBXX.children.push(new ZhaoBiaoXx(information));
- else if (isControl)
- zhaoTBXX.children.push(new ZhaoBiaoKzXx(information, summaryInfo.totalCost));
- else
- zhaoTBXX.children.push(new TouBiaoXx(information, summaryInfo.totalCost));
- const gongLGCHZ = new CreateNode('公路工程汇总');
- gongLGCSJ.children.push(gongLGCHZ);
- let n = 0;
- for (const tenderData of projectData.children) {
- n++;
- createGLBDGC(tenderData, gongLGCSJ, gongLGCHZ, n);
- }
- gongLGCSJ.children.push(gongLGCSJ.children.shift());
- const suffix = INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind];
- return [{
- data: chiZGLGC,
- exportKind,
- fileName: `${projectData.name}${suffix}`
- }];
- }
- return setupConstruction();
- }
- return {
- entry
- };
- })();
|