Forráskód Böngészése

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

zhangweicheng 5 éve
szülő
commit
89229c1231

+ 10 - 2
public/common_constants.js

@@ -114,7 +114,7 @@
     };
 
     // 工程量清单类型
-    const BOQType = { 
+    const BOQType = {
         BID_INVITATION: 1, // 招标
         BID_SUBMISSION: 2, // 投标
     };
@@ -150,6 +150,13 @@
         SHARE_CANCEL: 2,
     };
 
+    // 导出的文件类型选项
+    const EXPORT_KIND = {
+        BID_INVITATION: 1, // 招标
+        BID_SUBMISSION: 2, // 投标
+        CONTROL: 3 // 控制价
+    };
+
     return {
         fixedFlag,
         GRANULARITY,
@@ -161,6 +168,7 @@
         StorageKey,
         SharePermissionChangeType,
         PageTarget,
-        BlankType
+        BlankType,
+        EXPORT_KIND,
     };
 })

+ 1 - 0
web/building_saas/main/html/main.html

@@ -2154,6 +2154,7 @@
     <script type="text/javascript" src="/web/building_saas/main/js/views/divide_view.js"></script>
     <script type="text/javascript" src="/public/web/storageUtil.js"></script>
     <script type="text/javascript" src="/web/building_saas/report/js/rpt_jspdf.js"></script>
+    <script src="/web/building_saas/standard_interface/config.js"></script>;
     <script src="/web/building_saas/standard_interface/index.js"></script>;
     <script src="/web/building_saas/standard_interface/export/base.js"></script>;
     <script src="/web/building_saas/standard_interface/export/view.js"></script>;

+ 0 - 1
web/building_saas/pm/html/project-management.html

@@ -714,7 +714,6 @@
 <script type="text/javascript" src="/public/web/syntax-detection.js"></script>
 <script src="/web/building_saas/js/global.js"></script>
 <script src="/public/web/uuid.js"></script>
-<script src="/public/web/PerfectLoad.js"></script>
 <script src="/public/web/date_util.js"></script>
 <script src="/web/building_saas/pm/js/pm_tree.js"></script>
 <script src="/public/web/id_tree.js"></script>

+ 1 - 1
web/building_saas/pm/js/pm_share.js

@@ -867,7 +867,7 @@ const pmShare = (function () {
         }
         for (let node of items) {
             if (node.children.length === 0) {//project
-                rst.push({ ID: node.data.ID, fileHierarchyName: getFileHierarchyName(node), valuationType: node.data.property.valuationType || '' })
+                rst.push({ ID: node.data.ID, fileHierarchyName: getFileHierarchyName(node), valuationType: node.data.property && node.data.property.valuationType || '' })
             }
         }
         return rst;

+ 53 - 0
web/building_saas/standard_interface/config.js

@@ -0,0 +1,53 @@
+/*
+ * @Descripttion: 地区配置
+ * @Author: vian
+ * @Date: 2020-08-20 16:03:23
+ */
+
+const INTERFACE_CONFIG = (() => {
+    const { EXPORT_KIND: { BID_INVITATION, BID_SUBMISSION, CONTROL } } = window.commonConstants;
+
+    // 注意:相同地区的导入导出接口js文件名称应相同。eg: 安徽马鞍山导出:在export目录下:anhui_maanshan.js; 在import目录下:anhui_maanshan.js;
+    return {
+        '安徽@马鞍山': {
+            scriptName: 'anhui_maanshan.js',
+            fileSuffix: {
+                [BID_INVITATION]: '.MASGLZB',
+                [BID_SUBMISSION]: '.MASGLTB',
+                [CONTROL]: '.MASGLKZJ',
+            },
+        },
+        '安徽@淮北': {
+            scriptName: 'anhui_maanshan.js',
+            fileSuffix: {
+                [BID_INVITATION]: '.HBGLZB',
+                [BID_SUBMISSION]: '.HBGLTB',
+                [CONTROL]: '.HBGLKZJ',
+            },
+        },
+        '安徽@芜湖': {
+            scriptName: 'anhui_maanshan.js',
+            fileSuffix: {
+                [BID_INVITATION]: '.WHGLZB',
+                [BID_SUBMISSION]: '.WHGLTB',
+                [CONTROL]: '.WHGLKZJ',
+            },
+        },
+        '安徽@黄山': {
+            scriptName: 'anhui_maanshan.js',
+            fileSuffix: {
+                [BID_INVITATION]: '.HSGLZB',
+                [BID_SUBMISSION]: '.HSGLTB',
+                [CONTROL]: '.HSGLKZJ',
+            },
+        },
+        '安徽@宣城': {
+            scriptName: 'anhui_maanshan.js',
+            fileSuffix: {
+                [BID_INVITATION]: '.XCGLZB',
+                [BID_SUBMISSION]: '.XCGLTB',
+                [CONTROL]: '.XCGLKZJ',
+            },
+        },
+    };
+})()

+ 60 - 3
web/building_saas/standard_interface/export/anhui_maanshan.js

@@ -11,13 +11,70 @@ INTERFACE_EXPORT = (() => {
     /**
      * 
      * @param {String} userID - 用户ID
+     * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
      * @param {Number} exportKind - 导出类型,招标、投标、控制价
      * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
      * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
-     * @return {Promise<Object>} - 返回的数据结构必须按照规定,参考web\building_saas\standard_interface\index.js中的注释说明
+     * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
      */
-    async function entry(userID, exportKind, projectData, tenderDetailMap) {
-        
+    async function entry(userID, areaKey, exportKind, projectData, tenderDetailMap) {
+        const {
+            CONFIG: { TYPE, EXPORT_KIND },
+            UTIL: {
+                getValueByKey,
+            },
+            Element,
+        } = XML_EXPORT_BASE;
+
+        const czzt = {
+            [EXPORT_KIND.BID_INVITATION]: '招标',
+            [EXPORT_KIND.BID_SUBMISSION]: '投标',
+            [EXPORT_KIND.CONTROL]: '招标控制',
+        };
+        // 建设项目基本信息
+        function JingJiBiao(projectName, information) {
+            const attrs = [
+                { name: 'Xmbh', value: getValueByKey(information, 'projNum') }, // 项目编号
+                { name: 'Xmmc', value: projectName }, // 项目名称
+                { name: 'Bzlx', value: '清单' }, // 项目编制类型
+                { name: 'Jjyj', value: '【18清单】2018部颁清单计价依据' }, // 计价依据
+                { name: 'Xmqzzh', value: getValueByKey(information, '') }, // 项目起止桩号
+                { name: 'Jsdw', value: getValueByKey(information, '') }, // 建设单位
+                { name: 'Czzt', value: czzt[exportKind] }, // 操作状态:招标、投标、招标控制,即导出接口时,所选的文件类型
+                { name: 'Jsfs', value: getValueByKey(information, '') || '1', type: TYPE.INT }, // 计税方式,默认1。1=一般计税 2=简易计税
+                { name: 'Version', value: '1.0' },
+            ];
+            Element.call(this, 'JingJiBiao', attrs);
+        }
+        // 招标信息
+        function ZhaoBiaoXx(information) {
+            const attrs = [
+                { name: 'Zbr', value: getValueByKey(information, '') }, // 招标人
+                { name: 'Zxr', value: getValueByKey(information, '') }, // 造价咨询人
+                { name: 'ZbrDb', value: getValueByKey(information, '') }, // 招标人法定代表人或其授权人
+                { name: 'ZxrDb', value: getValueByKey(information, '') }, // 造价咨询人法定代表人或其授权人
+                { name: 'Bzr', value: getValueByKey(information, '') }, // 编制人
+                { name: 'Fhr', value: getValueByKey(information, '') }, // 复核人
+                { name: 'BzTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 编制时间
+                { name: 'FhTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 复核时间
+            ];
+            Element.call(this, 'ZhaoBiaoXx', attrs);
+        }
+        // 招标信息
+        function ZhaoBiaoXx(information) {
+            const attrs = [
+                { name: 'Zbr', value: getValueByKey(information, '') }, // 招标人
+                { name: 'Zxr', value: getValueByKey(information, '') }, // 造价咨询人
+                { name: 'ZbrDb', value: getValueByKey(information, '') }, // 招标人法定代表人或其授权人
+                { name: 'ZxrDb', value: getValueByKey(information, '') }, // 造价咨询人法定代表人或其授权人
+                { name: 'Bzr', value: getValueByKey(information, '') }, // 编制人
+                { name: 'Fhr', value: getValueByKey(information, '') }, // 复核人
+                { name: 'BzTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 编制时间
+                { name: 'FhTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 复核时间
+            ];
+            Element.call(this, 'ZhaoBiaoXx', attrs);
+        }
+
     }
 
     return {

+ 33 - 10
web/building_saas/standard_interface/export/base.js

@@ -35,14 +35,10 @@ const XML_EXPORT_BASE = (() => {
     };
     // 加载数据间隔,减少服务器压力
     const TIMEOUT_TIME = 400;
-    // 导出粒度
-    const { GRANULARITY } = window.commonConstants;
-    // 导出的文件类型选项
-    const EXPORT_KIND = {
-        BID_INVITATION: 1, // 招标
-        BID_SUBMISSION: 2, // 投标
-        CONTROL: 3 // 控制价
-    };
+    const { 
+        GRANULARITY,
+        EXPORT_KIND 
+    } = window.commonConstants;
     const EXPORT_KIND_NAME = {
         1: '招标',
         2: '投标',
@@ -141,6 +137,16 @@ const XML_EXPORT_BASE = (() => {
             return data;
         });
     }
+
+    // 获取Date类型默认值
+    function getDateTypeDefaultValue(date) {
+        const month = String(date.getMonth() + 1);
+        const formattedMonth = month.length === 1 ? `0${month}` : month;
+        const day = String(date.getDate());
+        const formattedDay = day.length === 1 ? `0${day}` : day;
+        return `${date.getFullYear()}-${formattedMonth}-${formattedDay}`;
+    }
+
     /*
      * 检查
      * 创建节点时检查节点的数据(原本是用于自检,现在来处理默认值)
@@ -161,6 +167,22 @@ const XML_EXPORT_BASE = (() => {
                 data.value = data.value.trim();
                 data.value = data.value.replace(/\s{1,}/g, ' ');
             }
+            // 类型对应得值不正确时,赋类型对应默认值
+            if (!data.type) {
+                return;
+            }
+            const dateReg = /([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))/;
+            if (data.type === TYPE.DATE && !dateReg.test(data.value)) {
+                data.value = getDateTypeDefaultValue(new Date());
+            } else if (data.type === TYPE.INT && !Number.isInteger(parseFloat(data.value))) {
+                data.value = DEFAULT_VALUE[TYPE.INT];
+            } else if (data.type === TYPE.DECIMAL && isNaN(parseFloat(data.value))) {
+                data.value = DEFAULT_VALUE[TYPE.DECIMAL];
+            } else if (data.type === TYPE.NUM2) {
+                data.value = DEFAULT_VALUE[TYPE.NUM2];
+            } else if (data.type === TYPE.BOOL && !['true', 'false'].includes(String(data.value))) {
+                data.value = DEFAULT_VALUE[TYPE.BOOL];
+            }
         }
     }
     // 等待一段时间
@@ -644,11 +666,12 @@ const XML_EXPORT_BASE = (() => {
      * @param {Function} entryFunc - 提取数据的入口方法
      * @param {Object} requestForSummaryInfo - 项目表级汇总字段(建设项目、单位工程汇总)
      * @param {Number} exportKind - 导出的文件类型:1-招标、2-投标、3-控制价
+     * @param {String} areaKey - 地区标识,如:'安徽@马鞍山'
      * @param {Number} tenderID - 单位工程ID
      * @param {String} userID - 用户ID
      * @return {Promise<Array>} - [{data: Object, exportKind: Number, fileName: String}]
      */
-    async function extractExportData(entryFunc, requestForSummaryInfo, exportKind, tenderID, userID) {
+    async function extractExportData(entryFunc, requestForSummaryInfo, exportKind, areaKey, tenderID, userID) {
         // 默认导出投标文件
         if (!exportKind || ![1, 2, 3].includes(exportKind)) {
             exportKind = EXPORT_KIND.BID_SUBMISSION;
@@ -670,7 +693,7 @@ const XML_EXPORT_BASE = (() => {
             tenderDetail = await getTenderDetail(tenderItem.ID, userID);
         }
         // 提取相关项目的详细导出数据
-        return await entryFunc(userID, exportKind, projectData, tenderDetailMap);
+        return await entryFunc(userID, areaKey, exportKind, projectData, tenderDetailMap);
     }
 
     /**

+ 1 - 1
web/building_saas/standard_interface/export/view.js

@@ -51,7 +51,7 @@ const EXPORT_VIEW = (() => {
                         const boqType = parseInt($(checkedData).val());
                         const requestForSummaryInfo = INTERFACE_EXPORT.requestForSummaryInfo || {};
                         const projectID = projectObj.project.ID();
-                        const exportData = await _base.extractExportData(INTERFACE_EXPORT.entry, requestForSummaryInfo, boqType, projectID, userID);
+                        const exportData = await _base.extractExportData(INTERFACE_EXPORT.entry, requestForSummaryInfo, boqType, areaKey, projectID, userID);
                         _exportCache.push(...exportData);
                     }
                     if (_exportCache && _exportCache.length) {

+ 11 - 12
web/building_saas/standard_interface/index.js

@@ -7,7 +7,8 @@
 /**
  * 用于导出的挂载变量,各地区对外接口需要作覆盖它。
  * 注意:导出脚本必须有一个“entry”方法挂载在“INTERFACE_EXPORT”对象上。 eg: INTERFACE_EXPORT = { entry: () => void }
- * entry方法返回的结果必须为xml的object形式:
+ * entry方法返回的结果必须为[{ data, exportKind,(导出类型,招、投标、控制价) fileName(文件名) }]
+ * 其中data为xml的object形式:
  * xml: 
  * <JingJiBiao Xmbh="001">
  *   <ZhaoBiaoXx Zbr="vian">
@@ -34,15 +35,9 @@ let INTERFACE_IMPORT = {};
 const STD_INTERFACE = (() => {
     'use strict';
 
-    // 地区配置,key为地区,value为该地区接口的js文件名。
-    // 注意:相同地区的导入导出接口js文件名称应相同。eg: 安徽马鞍山导出:在export目录下:anhui_maanshan.js; 在import目录下:anhui_maanshan.js;
-    const config = {
-        '安徽@马鞍山': 'anhui_maanshan.js',
-    };
-
     // 根据地区配置,初始化地区选项
     function initExportAreas($parentAreas, $subAreas) {
-        const connectedAreas = Object.keys(config);
+        const connectedAreas = Object.keys(INTERFACE_CONFIG);
         const parentMap = {};
         connectedAreas.forEach(connectedArea => {
             const areas = connectedArea.split('@');
@@ -114,11 +109,15 @@ const STD_INTERFACE = (() => {
             return;
         }
         curArea = area;
-        const path = config[area];
-        if (!path) {
-            throw new Error(`[${area}]不存在有效script配置。`);
+        const configItem = INTERFACE_CONFIG[area];
+        if (!configItem) {
+            throw new Error(`[${area}]不存在有效配置。`);
+        }
+        const scriptName = configItem.scriptName;
+        if (!scriptName) {
+            throw new Error(`[${area}]不存在有效脚本。`);
         }
-        const fullPath = `/web/building_saas/standard_interface/${scriptType}/${path}`;
+        const fullPath = `/web/building_saas/standard_interface/${scriptType}/${scriptName}`;
         await loadScript(fullPath);
     }
 

+ 72 - 1
web/over_write/js/quanguo_2018.js

@@ -5,4 +5,75 @@ if (typeof module !== 'undefined' && !module.nodeType) {
         progression,
         deficiency
     };
-}
+}
+
+
+let isQG2018 = true;
+function overwriteRationCalcBases() {
+    if (typeof rationCalcBases == 'undefined') return;
+    for (let key in rationCalcBases) delete rationCalcBases[key];
+
+    rationCalcBases['人工费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['材料费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['施工机械使用费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptMarketPrice, isTender);
+    };
+    rationCalcBases['施工机械人工费'] = function (node, isTender) {
+        return calcTools.machineDetailFee(node, node.data.gljList, [], gljType.MACHINE_LABOUR, isTender);
+    };
+    rationCalcBases['设备购置费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptMarketPrice, isTender);
+    };
+
+    rationCalcBases['定额人工费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.LABOUR], priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额材料费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMaterialTypes, priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额施工机械使用费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, baseMachineTypes, priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额商品砼费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR], priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额设备费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.EQUIPMENT], priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额外购砼构件费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.PURCHASE_COMPONENT], priceTypes.ptBasePrice, isTender);
+    };
+    rationCalcBases['定额绿化苗木费'] = function (node, isTender) {
+        return calcTools.rationBaseFee(node, [gljType.GREEN_SEEDLING], priceTypes.ptBasePrice, isTender);
+    };
+};
+
+(function overwriteFeeTypes() {
+    if (typeof cpFeeTypes == 'undefined') return;
+    cpFeeTypes = [
+        { type: 'marketLabour', name: '人工费' },
+        { type: 'marketMaterial', name: '材料费' },
+        { type: 'marketMachine', name: '施工机械使用费' },
+        { type: 'marketMachineLabour', name: '施工机械人工费' },
+        { type: 'marketEquipment', name: '设备购置费' },
+        { type: 'marketDirect', name: '直接费' },
+
+        { type: 'labour', name: '定额人工费' },
+        { type: 'material', name: '定额材料费' },
+        { type: 'machine', name: '定额施工机械使用费' },
+        { type: 'equipment', name: '定额设备费' },
+        { type: 'direct', name: '定额直接费' },
+
+        { type: 'measure', name: '措施费' },
+        { type: 'manage', name: '企业管理费' },
+        { type: 'force', name: '规费' },
+        { type: 'profit', name: '利润' },
+        { type: 'tax', name: '税金' },
+        { type: 'common', name: '建安费' },
+        { type: 'rationCommon', name: '定额建安费' }
+    ];
+})();