Explorar el Código

Merge remote-tracking branch 'origin/master' into 3.0.3_online

# Conflicts:
#	web/building_saas/main/js/views/main_tree_col.js
zhangweicheng hace 5 años
padre
commit
07fa8cd9f8

+ 1 - 1
config/config.js

@@ -123,7 +123,7 @@ module.exports = {
   pp_sc: {
     title: "纵横公路云造价",
     startPort: 3060,
-    server: "172.18.111.231",
+    server: "112.74.42.187",
     port: "27017",
     dbname: 'smartcost',
     options: {

+ 11 - 2
modules/pm/models/project_model.js

@@ -188,15 +188,24 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     //data.updateData.property.basicInformation = basicInformation;
                     //工程特征
                     if(data.updateData.property.featureLibID){
+                        const matchedConstructionProject = datas.find(item => item.updateData.projType === projectType.project);
+                        let constructionProjectName = '';
+                        if (matchedConstructionProject) {
+                            constructionProjectName = matchedConstructionProject.updateData.name;
+                        } else {
+                            const findConstructionProject = await Projects.findOne({ ID: data.updateData.ParentID }).lean();
+                            constructionProjectName = findConstructionProject && findConstructionProject.name || '';
+                        }
                         //项目类别(valuationType)、养护类别(engineering)、费用标准(feeStandard)根据新建分选的选项去赋值
                         let assign = {
                             valuationType: data.updateData.property.valuationType === ValuationType.BUDGET ? '预算' : '工程量清单',
                             engineering: data.updateData.property.engineeringName,
                             feeStandard: data.updateData.property.feeStandardName,
-                            // 新建分段文件时,默认将“工程特征”-“单项工程名称”、“编制范围”填写分段文件的名称
+                            // 新建分段文件时,默认将“编制范围”填写分段文件的名称
                             // 为了防止用户漏填,导出电子招标文件时,有数据
                             compilationScope: data.updateData.name,
-                            singleProjName: data.updateData.name,
+                            // 新建分段文件时,默认将“工程特征”-“单项工程名称”填写建设项目名称
+                            singleProjName: constructionProjectName,
                         };
                         data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, assign);
                     }

+ 1 - 3
modules/users/controllers/login_controller.js

@@ -287,9 +287,7 @@ class LoginController {
             const userinfo2 = await userModel.findDataByAccount(userData.mobile);
             if (userinfo2.isLoginValid === 1) {
                 // 获取本次访问ip
-                let ip = request.connection.remoteAddress;
-                ip = ip.split(':');
-                ip = ip[3] === undefined ? '' : ip[3];
+                let ip = request.headers["x-real-ip"]? request.headers["x-real-ip"]:"";
                 let logModel = new LogModel();
                 let logCount = await logModel.count();
                 logCount = logCount > 30 ? 30 : logCount;

+ 24 - 5
public/billsUtil.js

@@ -15,7 +15,7 @@
         window.BILLS_UTIL = factory();
     }
 })(() => {
-    // 清单模板各清单重设ID时,重新转换清单基数的ID引用
+    // 清单模板各清单重设ID时,重新转换清单基数的ID引用(清单模板基数中使用@x标识行号)
     function parseCalcBase(calcBase, uuidMapping) {
         const orgIDRefs = [...new Set(calcBase.match(/@\d+/g))];
         orgIDRefs.forEach(orgRef => {
@@ -31,12 +31,24 @@
         return calcBase;
     }
 
+    // 重新转换清单基数的ID引用(@xxx标识的是ID)
+    function parseIDRefCalcBase(calcBase, uuidMapping) {
+        let rst = calcBase;
+        Object
+            .entries(uuidMapping)
+            .forEach(([orgID, newID]) => {
+                rst = rst.replace(orgID, newID);
+            });
+        return rst;
+    }
+
     /*
      * @param {Array}billsList (完整的清单树结构数据)
      * @param {Function}idFactory 生成ID的方法
+     * @param {boolean}isIDRef 清单的计算基数,是否可能使用了ID引用(区分模板清单的行引用)
      * @return {void}
      * */
-    function resetTreeData(billsList, idFactory) {
+    function resetTreeData(billsList, idFactory, isIDRef = false) {
         const idMapping = {};
         idMapping['-1'] = -1;
         // 建立新ID-旧ID映射
@@ -46,9 +58,16 @@
             bills.ID = idMapping[bills.ID] ? idMapping[bills.ID] : -1;
             bills.ParentID = idMapping[bills.ParentID] ? idMapping[bills.ParentID] : -1;
             bills.NextSiblingID = idMapping[bills.NextSiblingID] ? idMapping[bills.NextSiblingID] : -1;
-            const needToParseCalcBase = bills.calcBase && reg.test(bills.calcBase);
-            if (needToParseCalcBase) {
-                bills.calcBase = parseCalcBase(bills.calcBase, idMapping);
+            if (isIDRef) {
+                const IDRefReg = /@/;
+                if (bills.calcBase && IDRefReg.test(bills.calcBase)) {
+                    bills.calcBase = parseIDRefCalcBase(bills.calcBase, idMapping);
+                }
+            } else {
+                const needToParseCalcBase = bills.calcBase && reg.test(bills.calcBase);
+                if (needToParseCalcBase) {
+                    bills.calcBase = parseCalcBase(bills.calcBase, idMapping);
+                }
             }
         });
     }

+ 4 - 2
web/building_saas/main/js/models/project.js

@@ -484,12 +484,14 @@ var PROJECT = {
 
           function setChildren(pnode,newValue,datas) {//同步设置所有子项
               if(pnode.children.length > 0 && pnode.children[0].sourceType == ModuleNames.bills){//设置子项不包括定额
-                  for(let c of pnode.children){
+                  for(let c of pnode.children){  
                       let data =  {
                           type:c.sourceType,
                           data:{ID:c.data.ID}
                       };
-                      setData(data.data,newval,fieldName);
+                      //有基数计算的子项值清空
+                      let val = fieldName == "lockUnitPrice" && c.data.calcBase && c.data.calcBase != ""?null:newval;
+                      setData(data.data,val,fieldName);
                       datas.push(data);
                       setChildren(c,newValue,datas)
                   }

+ 1 - 0
web/building_saas/main/js/views/main_tree_col.js

@@ -327,6 +327,7 @@ let MainTreeCol = {
         if (node.data.programID != null){
           let tpl = projectObj.project.calcProgram.compiledTemplates[node.data.programID];
           if(tpl) tips = tpl.ID + ' ' + tpl.name + ':' + (tpl.memo ? tpl.memo : '[无]');   // 加个判断保护,兼容旧项目此处空值
+          
         };
         let dynamicCombo = sheetCommonObj.getTipsCombo(true, tips, setting, node);
         dynamicCombo.itemHeight(10).items(projectObj.project.calcProgram.compiledTemplateNames).editable(false);

+ 17 - 2
web/building_saas/standard_interface/import/base.js

@@ -329,6 +329,22 @@ const INTERFACE_EXPORT_BASE = (() => {
     return rst;
   }
 
+  function getTemplateBillsTarget(templateBills) {
+    const templateTarget = _.cloneDeep(templateBills);
+    const ungroupedData = [];
+    function getBillsFromChildren(billsData) {
+      for (const bills of billsData) {
+        ungroupedData.push(bills);
+        if (bills.children && bills.children.length) {
+          getBillsFromChildren(bills.children);
+        }
+      }
+    }
+    getBillsFromChildren(templateTarget);
+    BILLS_UTIL.resetTreeData(ungroupedData, uuid.v1, true);
+    return templateTarget;
+  }
+
   // 处理单位工程数据
   function handleTenderData(tenders, templateData) {
     tenders.forEach((tender, index) => {
@@ -374,8 +390,7 @@ const INTERFACE_EXPORT_BASE = (() => {
         feeFile: { name: tender.name, id: `newFeeRate@@${taxData.fee_lib.id}` } // 新建费率文件
       };
       delete tender.feature;
-      const tenderDataBills = _.cloneDeep(templateData.bills);
-      BILLS_UTIL.resetTreeData(tenderDataBills, uuid.v1);
+      const tenderDataBills = getTemplateBillsTarget(templateData.bills);
       tender.bills = handleBills(tender.bills, tenderDataBills, tender.ID,); // 必须要拷贝一份,否则多单位工程情况下,前单位工程的清单数据会被后单位工程的覆盖
       // 给暂估材料和评标材料设置项目数据
       const setGLJRefFunc = glj => {