vian пре 5 година
родитељ
комит
8f4d12a760

+ 11 - 3
modules/pm/facade/pm_facade.js

@@ -1618,16 +1618,24 @@ async function importProject(importObj, userID, compilationID) {
         data.property.lockBills = true;
         //工料机单价调整系数
         data.property.tenderSetting = tenderSetting;
-        //工程特征相关更新
+        //工程特征相关更新 (配对更新+追加)
         let featureLib = await getProjectFeature(data.property.valuation, data.property.engineeringName, data.property.feeStandardName);
         if (featureLib) {
             //把导入的数据设置到默认生成的数据中,按名称匹配 (导入项不确定,因此无法确定获取项的key)
+            // 只匹配第一层
+            const unmatched = [];
             data.projectFeature.forEach(importF => {
-                let matchData = featureLib.feature.find(f => f.dispName === importF.name);
+                let matchData = featureLib.feature.find(f => f.dispName === importF.dispName);
                 if (matchData) {
                     matchData.value = importF.value;
+                    if (importF.items) {
+                        matchData.items = importF.items;
+                    }
+                } else {
+                    unmatched.push(importF);
                 }
             });
+            featureLib.feature.push(...unmatched);
             //设置工程专业的值为费用标准的值..
             featureLib.feature.forEach(f => {
                 if (f.key === 'engineering') {
@@ -1670,7 +1678,7 @@ async function importTenderDetail(tenderData) {
         await billsModel.insertMany(tenderData.bills);
     }
     // 工程量明细
-    if (tenderData.quantityDetails.length) {
+    if (tenderData.quantityDetails && tenderData.quantityDetails.length) {
         await quantityDetailModel.insertMany(tenderData.quantityDetails);
     }
     //投标文件中,才会有下面这些数据

+ 1 - 1
web/building_saas/main/js/views/project_property_projFeature.js

@@ -302,7 +302,7 @@ let projFeatureView = {
         // ParentID为null的数据是为显示而加入的“工程特征” ParentID为1的数据即为工程特征下的第一层数据,其他数据是从ParentID为1的数据中的items递归打平出来的
         // 因此原数据格式就是ParentID为1的数据
         const saveData = datas.filter(item => item.ParentID === 1);
-        saveData.forEach(item => delete item.ID && delete item.ParentID);
+        saveData.forEach(item => delete item.ID && delete item.ParentID && delete item.collapsed);
         return saveData;
     },
 

+ 7 - 7
web/over_write/js/chongqing_2018_import.js

@@ -202,12 +202,12 @@ const importXML = (() => {
     //工程特征相关,特征项没有固定的项,不清楚导入的项无法用已有key对应,而且工程特征名称不会有重复,因此用名称与我们软件的工程特征对应
     function loadProjectFeature(tenderSrc) {
         let feature = [];
-        feature.push({ name: '建筑分类', value: getValue(tenderSrc, ['工程特征', '_建筑分类']) });
-        feature.push({ name: '工程分类', value: getValue(tenderSrc, ['工程特征', '_工程分类']) });
-        feature.push({ name: '建设规模', value: getValue(tenderSrc, ['工程特征', '_建设规模']) });
+        feature.push({ dispName: '建筑分类', value: getValue(tenderSrc, ['工程特征', '_建筑分类']) });
+        feature.push({ dispName: '工程分类', value: getValue(tenderSrc, ['工程特征', '_工程分类']) });
+        feature.push({ dispName: '建设规模', value: getValue(tenderSrc, ['工程特征', '_建设规模']) });
         let items = arrayValue(tenderSrc, ['工程特征', '特征项']);
         feature.push(...items.map(item => {
-            return { name: getValue(item, ['_名称']), value: getValue(item, ['_内容']) };
+            return { dispName: getValue(item, ['_名称']), value: getValue(item, ['_内容']) };
         }));
         return feature;
     }
@@ -258,7 +258,7 @@ const importXML = (() => {
     function extractBills(billsSrc, type) {
         let { features, contents } = getFeaturesAndContents(billsSrc);
         // 特征及内容窗口
-        let { itemCharacter, jobContent } = featureAndContent(features, contents);
+        //let { itemCharacter, jobContent } = featureAndContent(features, contents);
         let obj = {
             type: type, //清单类型
             code: getValue(billsSrc, ['_项目编码']),
@@ -269,8 +269,8 @@ const importXML = (() => {
             quantity: getValue(billsSrc, ['_工程量']) || '0',
             remark: getValue(billsSrc, ['_备注']),
             itemCharacterText: featureAndContentText(features, contents),
-            itemCharacter: itemCharacter,
-            jobContent: jobContent
+            /* itemCharacter: itemCharacter, // 不导入到清单下方的特征及内容窗口
+            jobContent: jobContent */
         };
         //投标和控制价,需要导入最高限价
         if ([FileKind.tender, FileKind.control].includes(importFileKind)) {

+ 69 - 60
web/over_write/js/guangdong_2018_export.js

@@ -93,61 +93,61 @@ const XMLStandard = (function () {
         '修复': '23',
         '其他': '99',
     };
-/*     // 需要用固定类别关联的费用字典,用固定类别来映射
-    // 数据节选自标准pdf文件《《建设工程政府投资项目造价数据标准》信息公开版》,附录C-费用名称与费用代号
-    // 若映射表中没有映射关系,则费用字典取名称首字母
-    const FlagFeeCodeMap = {
-        // 分部分项工程
-        [fixedFlag.SUB_ENGINERRING]: 'QDF',
-        // 措施项目
-        [fixedFlag.MEASURE]: 'CSF',
-        // 其他项目
-        [fixedFlag.OTHER]: 'QTF',
-        // 措施项目的子项
-        [fixedFlag.GREEN_MEASURE_FEE]: 'AQWMSGF', // 绿色施工安全防护措施费
-        [fixedFlag.OTHER_MEASURE_FEE]: 'QTCSF', // 其他措施费
-        // 其他项目的子项
-        [fixedFlag.PROVISIONAL]: 'ZLF', // 暂列金额
-        [fixedFlag.ESTIMATE]: 'ZGJ', // 暂估价
-        [fixedFlag.MATERIAL_PROVISIONAL]: 'ZGC', // 材料(工程设备)暂估价
-        [fixedFlag.ENGINEERING_ESITIMATE]: 'ZGGC', // 专业工程暂估价
-        [fixedFlag.DAYWORK]: 'LXF', // 计日工
-        [fixedFlag.TURN_KEY_CONTRACT]: 'ZCBFWF', // 总承包服务费
-        [fixedFlag.BUDGET_INCLUDE_WORK_FEE]: 'YSBGF', // 预算包干费
-        [fixedFlag.PROJECT_HIGH_QUALITY_FEE]: 'GCYZF', // 工程优质费
-        [fixedFlag.BUDGET_ESTIMATE_DIFF]: 'GSFDC', // 概算幅度差
-        [fixedFlag.CLAIM]: 'SPFY', // 索赔费用
-        [fixedFlag.VISA]: 'XCQZFY', // 现场签证
-        [fixedFlag.OTHER_FEE]: 'QTFY', // 其他费用
-        // 税金
-        [fixedFlag.TAX]: 'SJ',
-        // 工程造价
-        [fixedFlag.ENGINEERINGCOST]: 'ZZJ',
-    }; */
+    /*     // 需要用固定类别关联的费用字典,用固定类别来映射
+        // 数据节选自标准pdf文件《《建设工程政府投资项目造价数据标准》信息公开版》,附录C-费用名称与费用代号
+        // 若映射表中没有映射关系,则费用字典取名称首字母
+        const FlagFeeCodeMap = {
+            // 分部分项工程
+            [fixedFlag.SUB_ENGINERRING]: 'QDF',
+            // 措施项目
+            [fixedFlag.MEASURE]: 'CSF',
+            // 其他项目
+            [fixedFlag.OTHER]: 'QTF',
+            // 措施项目的子项
+            [fixedFlag.GREEN_MEASURE_FEE]: 'AQWMSGF', // 绿色施工安全防护措施费
+            [fixedFlag.OTHER_MEASURE_FEE]: 'QTCSF', // 其他措施费
+            // 其他项目的子项
+            [fixedFlag.PROVISIONAL]: 'ZLF', // 暂列金额
+            [fixedFlag.ESTIMATE]: 'ZGJ', // 暂估价
+            [fixedFlag.MATERIAL_PROVISIONAL]: 'ZGC', // 材料(工程设备)暂估价
+            [fixedFlag.ENGINEERING_ESITIMATE]: 'ZGGC', // 专业工程暂估价
+            [fixedFlag.DAYWORK]: 'LXF', // 计日工
+            [fixedFlag.TURN_KEY_CONTRACT]: 'ZCBFWF', // 总承包服务费
+            [fixedFlag.BUDGET_INCLUDE_WORK_FEE]: 'YSBGF', // 预算包干费
+            [fixedFlag.PROJECT_HIGH_QUALITY_FEE]: 'GCYZF', // 工程优质费
+            [fixedFlag.BUDGET_ESTIMATE_DIFF]: 'GSFDC', // 概算幅度差
+            [fixedFlag.CLAIM]: 'SPFY', // 索赔费用
+            [fixedFlag.VISA]: 'XCQZFY', // 现场签证
+            [fixedFlag.OTHER_FEE]: 'QTFY', // 其他费用
+            // 税金
+            [fixedFlag.TAX]: 'SJ',
+            // 工程造价
+            [fixedFlag.ENGINEERINGCOST]: 'ZZJ',
+        }; */
     // 需要用计算基数关联的费用字典
-/*     const FormulaFeeCodeMap = {
-        '{分部分项工程费}': 'QDF',
-        '{分部分项人工费}': 'QRG',
-        '{分部分项材料费}': 'QCL',
-        '{分部分项施工机具费}': 'QJX',
-        '{分部分项主材费}': 'QZCF',
-        '{分部分项设备费}': 'QSBF',
-        '{分部分项人工工日}': 'FBFXRGGR', // 标准没有,自增
-        '{建筑面积}': 'JZMZ', // 自增
-        '{措施项目费}': 'CSF',
-        '{其他项目费}': 'QTF',
-        '{甲供人工费}': 'JGRGF', // 自增
-        '{甲供材料费}': 'JGC',
-        '{甲供施工机具费}': 'JGSGJJF', // 自增
-        '{甲定人工费}': 'JDRGF', // 自增
-        '{甲定材料费}': 'JDCLF', // 自增
-        '{甲定施工机具费}': 'JDSGJJF', // 自增
-        '{甲定主材费}': 'JDZCF', // 自增
-        '{甲定设备费}': 'JDSBF', // 自增
-        '{暂估材料费(从子目汇总)}': 'ZGCLFCZMHZ', // 自增
-        '{税金}': 'SJ',
-
-    }; */
+    /*     const FormulaFeeCodeMap = {
+            '{分部分项工程费}': 'QDF',
+            '{分部分项人工费}': 'QRG',
+            '{分部分项材料费}': 'QCL',
+            '{分部分项施工机具费}': 'QJX',
+            '{分部分项主材费}': 'QZCF',
+            '{分部分项设备费}': 'QSBF',
+            '{分部分项人工工日}': 'FBFXRGGR', // 标准没有,自增
+            '{建筑面积}': 'JZMZ', // 自增
+            '{措施项目费}': 'CSF',
+            '{其他项目费}': 'QTF',
+            '{甲供人工费}': 'JGRGF', // 自增
+            '{甲供材料费}': 'JGC',
+            '{甲供施工机具费}': 'JGSGJJF', // 自增
+            '{甲定人工费}': 'JDRGF', // 自增
+            '{甲定材料费}': 'JDCLF', // 自增
+            '{甲定施工机具费}': 'JDSGJJF', // 自增
+            '{甲定主材费}': 'JDZCF', // 自增
+            '{甲定设备费}': 'JDSBF', // 自增
+            '{暂估材料费(从子目汇总)}': 'ZGCLFCZMHZ', // 自增
+            '{税金}': 'SJ',
+    
+        }; */
     // 费用字典占用列表,普通清单根据首字母获取费用字典时,与下列占用费用字典重复时,需要加上_序号后缀
     const feeCodeList = [
         'QDF', 'QRG', 'QCL', 'QJX', 'ZCSB', 'QZCF', 'QSBF', 'QGL', 'QLR', 'QZGJ', 'CSF', 'AQWMSGF', 'AXSJSCSXMF',
@@ -366,7 +366,7 @@ const XMLStandard = (function () {
                 const feeCode = getFeeCode(null, base);
                 if (/[\(\)]/.test(base)) {
                     // 将()进行处理不然会被当成组
-                    base = base.replace(/[\(\)]/g, function(matched) {
+                    base = base.replace(/[\(\)]/g, function (matched) {
                         return matched === '(' ? '\\(' : '\\)'
                     });
                 }
@@ -2270,11 +2270,20 @@ const XMLStandard = (function () {
         // attrList 单位工程的工程特征,来自property.projectFeature
         function loadAttrInfo(attrList) {
             const attrInfo = new Info('AttrInfo');
-            // 有值的才输出
-            attrInfo.children = attrList
-                .filter(attr => commonUtil.isDef(attr.value))
-                .map(attr => new InfoItem('AttrInfoItem', attr));
-            return attrInfo;
+            attrInfo.children = loadItems(attrList);
+
+            // 递归导出子项
+            function loadItems(items) {
+                const children = [];
+                items.forEach(item => {
+                    const infoItem = new InfoItem('AttrInfoItem', item);
+                    children.push(infoItem);
+                    if (item.items && item.items.length) {
+                        infoItem.children = loadItems(item.items);
+                    }
+                });
+                return children;
+            }
         }
 
         // 加载补充信息(基本信息所有条目)

+ 22 - 6
web/over_write/js/guangdong_2018_import.js

@@ -210,18 +210,34 @@ const importXML = (() => {
     }
     // 提取工程特征数据
     function extractProjectFeature(tenderSrc) {
-        // TODO 支持嵌套子项
-        const attrInfoItems = arrayValue(tenderSrc, ['AttrInfo', 'AttrInfoItem']);
-        return attrInfoItems.map(item => {
-            return { name: getValue(item, ['_Name']), value: getValue(item, ['_Value']) };
-        });
+        // 支持嵌套子项
+        const attrInfoSrc = getValue(tenderSrc, ['AttrInfo']);
+        const featureData = extractItemsRecur(attrInfoSrc, [['AttrInfoItem']], (src) => ({
+            dispName: getValue(src, ['_Name']),
+            value: getValue(src, ['_Value'])
+        }));
+        clearEmptyItems(featureData);
+        return featureData;
+        
+        function clearEmptyItems(items) {
+            items.forEach(item => {
+                if(!item.items) {
+                    return;
+                }
+                if (!item.items.length) {
+                    delete item.items;
+                } else {
+                    clearEmptyItems(item.items);
+                }
+            })
+        }
     }
     // 提取大项费用
     function extractWorkSummary(tenderSrc) {
         const summarySrc = getValue(tenderSrc, ['UnitWorksSummary']);
         const fields = [['UnitWorksSummaryGroup'], ['UnitWorksSummaryItem']];
         return extractItemsRecur(summarySrc, fields, (src, curField) => {
-            const item = {
+            const item = { 
                 code: getValue(src, ['_Number']),
                 name: getValue(src, ['_Name']),
                 quantity: getValue(src, ['_Quantity']),