Bladeren bron

Merge branch '1.0.0_online' of http://192.168.1.12:3000/SmartCost/ConstructionCost into 1.0.0_online

TonyKang 7 jaren geleden
bovenliggende
commit
55fc838457

+ 1 - 1
Dockerfile

@@ -2,7 +2,7 @@ FROM costbase:latest
 
 WORKDIR /home/ConstructionCost
 
-RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionCost master
+RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionCost 1.0.0_online
 
 RUN cnpm install
 

+ 1 - 1
Dockerfile_pp

@@ -2,7 +2,7 @@ FROM costbase:latest
 
 WORKDIR /home/ConstructionCost
 
-RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionCost master
+RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionCost 1.0.0_online
 
 RUN cnpm install
 

+ 1 - 1
Dockerfile_qa

@@ -2,7 +2,7 @@ FROM costbase:latest
 
 WORKDIR /home/ConstructionCost
 
-RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionCost master
+RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionCost 1.0.0_online
 
 RUN cnpm install
 

+ 1 - 1
config/config.js

@@ -31,7 +31,7 @@ module.exports = {
     pp:{server: "172.18.111.228", port: "27017"},
     prod:{
         dbURL:"mongodb://smartcost:SmartCost3850888@dds-wz9da4d5ca0fdd341.mongodb.rds.aliyuncs.com:3717,dds-wz9da4d5ca0fdd342.mongodb.rds.aliyuncs.com:3717/scConstruct?authSource=admin;replicaSet=mgset-7518601",
-        LicenseKey:"civil.smartcost.com.cn,834986144349993#A0XNdYDO9QzM8IiOiQWSiwSflNHbhZmOiI7ckJye0ICbuFkI1pjIEJCLi4TPnNnMEVXS4RGejhFZkNVMZZHTvVTWBZlcsNTaiZFbKJ HSklmM8cENUJTTnJUN9NGZTVTdrU4LmVHeudDcwtySsNWW5s4UPdVZVRDe7ETNnNHduZnWwsmI0IyUiwSO4MTNwYDO5gTM0IicfJye35XX3JyMiZzZiojIDJCLiETMuYHIT pEIkFWZyB7UiojIOJyebpjIkJHUiwiIzUTNxkDMgQjM7ADOxAjMiojI4J7QiwiIuNmLt36YuQ7cvNGdyFWbz9CbpZXajJiOiMXbEJCLig1jlzahlDZmpnInmb1uk/avoDrlmvJilrKqmXrunfb tmD0jnLiOiEmTDJCLiMTO9kZNdQ"
+        LicenseKey:"civil.smartcost.com.cn,834986144349993#A0XNdYDO9QzM8IiOiQWSiwSflNHbhZmOiI7ckJye0ICbuFkI1pjIEJCLi4TPnNnMEVXS4RGejhFZkNVMZZHTvVTWBZlcsNTaiZFbKJHSklmM8cENUJTTnJUN9NGZTVTdrU4LmVHeudDcwtySsNWW5s4UPdVZVRDe7ETNnNHduZnWwsmI0IyUiwSO4MTNwYDO5gTM0IicfJye35XX3JyMiZzZiojIDJCLiETMuYHITpEIkFWZyB7UiojIOJyebpjIkJHUiwiIzUTNxkDMgQjM7ADOxAjMiojI4J7QiwiIuNmLt36YuQ7cvNGdyFWbz9CbpZXajJiOiMXbEJCLig1jlzahlDZmpnInmb1uk/avoDrlmvJilrKqmXrunfbtmD0jnLiOiEmTDJCLiMTO9kZNdQ"
     },
     redis_local:{server:'127.0.0.1',port:'6379',pwd:'smartCost'},
     redis_qa:{server:'192.168.1.184',port:'6379',pwd:'smartCost'},

+ 3 - 1
config/db/db_manager.js

@@ -49,7 +49,9 @@ module.exports = {
     connect:function (env="local") {
         var config = require("../config.js");
         var dbURL = 'mongodb://' + config[env].server + ":" + config[env].port + '/scConstruct';
-        if(config[env].options){
+        if(config[env].dbURL){
+            mg.connect(config[env].dbURL,{connectTimeoutMS: 20000,useMongoClient: true});
+        } else if(config[env].options){
             mg.connect(dbURL,config[env].options);
         }else {
             mg.connect(dbURL,{connectTimeoutMS: 20000,useMongoClient: true});//useMongoClient': true*! //报 DeprecationWarning: `open()` is deprecated in mongoose这个错

+ 1 - 0
config/gulpConfig.js

@@ -33,6 +33,7 @@ module.exports = {
     ],
     pm_jspaths:[
         'public/web/date_util.js',
+        'public/web/id_tree.js',
         'public/web/tree_sheet/tree_sheet_helper.js',
         'public/web/sheet/sheet_data_helper.js',
         'public/web/common_ajax.js',

+ 5 - 0
modules/pm/controllers/pm_controller.js

@@ -537,7 +537,12 @@ module.exports = {
     getProjectsByQuery: async function (req, res) {
         try{
             let data = JSON.parse(req.body.data);
+            let compilation = req.session.sessionCompilation._id;
             let query = data.query;
+            query.compilation = compilation;
+            console.log(`compilation===============================`);
+            console.log(compilation);
+            console.log(query);
             let options = data.options;
             let projects = await projectModel.find(query, options);
             callback(req, res, 0, 'success', projects);

+ 5 - 4
modules/pm/models/project_model.js

@@ -179,12 +179,12 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                 }
 
                 newProject = new Projects(data.updateData);
-                // 查找同级是否存在同名数据
+               /* // 查找同级是否存在同名数据
                 let exist = await this.isExist(userId, compilationId, data.updateData.name, data.updateData.ParentID);
                 if (exist) {
                     callback(1, '同级目录已存在相同名称数据.', null);
                     return;
-                }
+                }*/
                 if (data.updateData.projType === 'Tender') {
                     let feeRateFileID = await feeRateFacade.newFeeRateFile(userId, data.updateData);
                     newProject.property.feeFile = feeRateFileID ? feeRateFileID : -1;
@@ -380,11 +380,12 @@ ProjectsDAO.prototype.rename = async function (userId, compilationId, data, call
             throw '请填写名称!';
         }
         data.newName = data.newName.trim();
-        // 查找同级是否存在同名数据
+        //重名前端控制
+       /* // 查找同级是否存在同名数据
         let exist = await this.isExist(userId, compilationId, data.newName, data.parentID);
         if (exist) {
             throw '同级目录已存在相同名称数据';
-        }
+        }*/
 
         Projects.update({userID: userId, ID: data.id}, {name: data.newName}, function (err) {
             if (err) {

+ 6 - 5
public/web/gljUtil.js

@@ -205,8 +205,9 @@ let gljUtil = {
             }
             return scMathUtil.roundForObj(p,price_hasM_decimal);
         }else {
-            let tem_decimal = isRadio==true?process_decimal:price_decimal;
-            return scMathUtil.roundForObj(parseFloat(glj.unit_price.market_price)*priceCoe,tem_decimal);
+            let tem_decimal =price_decimal; //isRadio==true?process_decimal:price_decimal;
+            let tem_price = scMathUtil.roundForObj(glj.unit_price.market_price,price_decimal);
+            return scMathUtil.roundForObj(tem_price*priceCoe,tem_decimal);
         }
     },
     getBasePrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil) {
@@ -232,7 +233,7 @@ let gljUtil = {
             }
             return scMathUtil.roundForObj(p,price_hasM_decimal);
         }else {
-            let tem_decimal = isRadio==true?process_decimal:price_decimal;
+            let tem_decimal =price_decimal; //isRadio==true?process_decimal:price_decimal;
             return scMathUtil.roundForObj(glj.unit_price.base_price,tem_decimal);
         }
     },
@@ -245,7 +246,7 @@ let gljUtil = {
         if (glj.unit_price.type == this.gljType.LABOUR || glj.unit_price.type == this.gljType.MACHINE_LABOUR) {//人工、机上人工,调整价根据定额价*调整系数计算得出。
             let labour = _.find(labourCoeDatas.coes,{'ID':glj.adjCoe});
             let coe = labour && labour.coe ? labour.coe : 1;
-            return scMathUtil.roundTo(parseFloat(coe * scMathUtil.roundForObj(glj.unit_price.base_price,tem_decimal)), -tem_decimal);
+            return scMathUtil.roundTo(parseFloat(coe * scMathUtil.roundForObj(glj.unit_price.base_price,decimal)), -decimal);
         } else if (notEditType.indexOf(glj.unit_price.type)!=-1&&glj.ratio_data.length>0) {//对于混凝土、配合比、砂浆、机械台班,调整价根据组成物计算得出。
             let p =0;
             for(let ratio of glj.ratio_data){
@@ -264,7 +265,7 @@ let gljUtil = {
             }
             return scMathUtil.roundForObj(p,price_hasM_decimal);
         } else {//对于其他普通材料等,无调整系数,调整价=定额价。
-            return  scMathUtil.roundForObj(glj.unit_price.base_price,tem_decimal)
+            return  scMathUtil.roundForObj(glj.unit_price.base_price,decimal)
         }
     },
     calcPriceDiff:function (glj,calcOptions) {

+ 1 - 1
web/building_saas/css/main.css

@@ -97,7 +97,7 @@ body {
     left:0
 }
 .pm-content{
-    padding-left:58px
+    padding-left:45px
 }
 .content {
     border-left: 1px solid #ccc;

+ 2 - 2
web/building_saas/main/js/models/calc_program.js

@@ -295,8 +295,8 @@ let calcTools = {
         };
 
         if (priceType == priceTypes.ptDiffPrice){
-            // result = (temp.toDecimal(decimalObj.ration.unitPrice) - temp2.toDecimal(decimalObj.ration.unitPrice)).toDecimal(decimalObj.ration.unitPrice);
-            result = (temp - temp2).toDecimal(decimalObj.ration.unitPrice);
+            result = (temp.toDecimal(decimalObj.ration.unitPrice) - temp2.toDecimal(decimalObj.ration.unitPrice)).toDecimal(decimalObj.ration.unitPrice);
+            // result = (temp - temp2).toDecimal(decimalObj.ration.unitPrice);
         }
         else{
             result = result.toDecimal(decimalObj.ration.unitPrice);

+ 9 - 5
web/building_saas/main/js/views/project_view.js

@@ -546,11 +546,15 @@ var projectObj = {
             }
         }
     },
-    onColumnWidthChanged: function (sender, info) {
-        projectObj.mainSpread.getActiveSheet().setColumnVisible(4, false);
-        projectObj.mainSpread.getActiveSheet().setColumnVisible(4, true);
-        projectObj.mainSpread.refresh();
-        projectObj.mainSpread.repaint();
+    onColumnWidthChanged: function (sender, info) {         // CSL,2018.07.25
+        if (info.colList.includes(4) || info.colList.includes(5)){
+            let items = projectObj.project.mainTree.items;
+            let sheet = projectObj.mainSpread.getActiveSheet();
+            for (let i = 0; i < items.length; i++) {
+                if ((info.colList.includes(4) && items[i].data.itemCharacterText) || (info.colList.includes(5) && items[i].data.jobContentText))
+                    sheet.autoFitRow(i);
+            }
+        }
     },
     mainSpreadEditEnded: function (sender, info) {
         console.log('enterEDEnd');

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

@@ -538,6 +538,7 @@
 <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>
 <script src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
 <script src="/public/web/sheet/sheet_data_helper.js"></script>
 <script type="text/javascript" src="/public/web/common_ajax.js"></script>

+ 12 - 4
web/building_saas/pm/js/pm_newMain.js

@@ -1403,7 +1403,8 @@ $(document).ready(function() {
     // 重命名操作
     $("#rename-confirm").click(function() {
         let select = projTreeObj.tree.selected;
-        let newName = $('#rename-name').val();
+        let parent = select ? select.parent : Tree._root;
+        let newName = $('#rename-name').val().trim();
         let dialog = $('#rename-dialog');
         if (newName === '') {
             setDangerInfo($('#rename-name-info'), '请输入重命名');
@@ -1414,6 +1415,10 @@ $(document).ready(function() {
             dialog.modal('hide');
             return false;
         }
+        if(existName(newName, parent.children, select.data.projType)){
+            setDangerInfo($('#rename-name-info'), `已存在“${newName}”`);
+            return;
+        }
         RenameProject(select.id(), newName, select.data.ParentID, function () {
             setDangerInfo($('#rename-name-info'), '', false);
             dialog.modal('hide');
@@ -1912,7 +1917,7 @@ function AddSiblingsItem(selected, name, property, type, existCallback, sucCallb
     }
     let parent = selected ? selected.parent : projTreeObj.tree._root;
     let next = selected ? selected.nextSibling : projTreeObj.tree.firstNode();
-    if(existName(name, parent.children)){
+    if(existName(name, parent.children, type)){
         //alert('同级目录已存在相同名称数据.');
         existCallback();
     }
@@ -1982,10 +1987,13 @@ function getNodeByName(name, nodes){
     return null;
 }
 
-//同级是否重名
-function existName(name , nodes){
+//同级是否重名,文件夹与建设项目可以同名
+function existName(name , nodes, projType = null){
     for(let i = 0, len = nodes.length; i < len; i++){
         if(name === nodes[i].data.name){
+            if(projType && projType === projectType.folder && nodes[i].data.projType === projectType.project){
+                continue;
+            }
             return true;
         }
     }

+ 31 - 5
web/building_saas/pm/js/pm_share.js

@@ -645,20 +645,46 @@ const pmShare = (function () {
             }
         });
     }
+    //从其他建设项目中复制中,建设项目的文件层次结构名称和顺序
+    //@param {Array}treeData @return {Array}
+    function getFileHierarchyInfo(treeData){
+        let tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1});
+        tree.loadDatas(treeData);
+        let items = tree.items;
+        let rst = [];
+        function getFileHierarchyName(node){
+            let nodeName = node.data.name;
+            let name = [];
+            while (node.parent){
+                name.push(node.parent.data.name ? node.parent.data.name : '');
+                node = node.parent;
+            }
+            name = name.reverse();
+            name.push(nodeName);
+            return name.join('\\');
+        }
+        for(let node of items){
+            if(node.children.length === 0 ){//project
+                rst.push({ID: node.data.ID, fileHierarchyName: getFileHierarchyName(node)})
+            }
+        }
+        return rst;
+    }
     //设置拷贝工程下拉选择
     //@return {void}
     function setCopyModal(){
         //获取建设项目
-        let projQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], projType: projectType.project, userID: userID};
+        let projQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], projType: {$in: [projectType.project, projectType.folder]}, userID: userID};
         CommonAjax.post('/pm/api/getProjectsByQuery', {user_id: userID, query: projQuery, options: '-_id -property'}, function (rstData) {
+            let fileHierarchyData = getFileHierarchyInfo(rstData);
             $('#copyShare_selectProj').empty();
-            for(let proj of rstData){
-                let opt = $('<option>').val(proj.ID).text(proj.name);
+            for(let proj of fileHierarchyData){
+                let opt = $('<option>').val(proj.ID).text(proj.fileHierarchyName);
                 $('#copyShare_selectProj').append(opt);
             }
             //初始选择
-            if(rstData.length > 0){
-                setEng(rstData[0].ID);
+            if(fileHierarchyData.length > 0){
+                setEng(fileHierarchyData[0].ID);
             }
         });
     }

+ 2 - 2
web/users/html/user-info.html

@@ -42,11 +42,11 @@
                     <form id="info-form" method="post" action="/user/info">
                         <div class="form-group">
                             <label class="form-control-label">您的姓名</label>
-                            <input class="form-control" value="<%= userData.real_name %>" placeholder="输入您的姓名" id="name" name="real_name"/>
+                            <input class="form-control" value="<%= userData.real_name %>" placeholder="输入您的姓名" id="name" name="real_name" autocomplete="off">
                         </div>
                         <div class="form-group">
                             <label class="form-control-label">企业名称</label>
-                            <input class="form-control" value="<%= userData.company %>" placeholder="输入您的企业名称" id="company" name="company"/>
+                            <input class="form-control" value="<%= userData.company %>" placeholder="输入您的企业名称" id="company" name="company" autocomplete="off">
                         </div>
                         <div class="form-group">
                             <label class="form-control-label">企业所在地区</label>