瀏覽代碼

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

TonyKang 4 年之前
父節點
當前提交
6d4c5579ed

+ 10 - 10
gulpfile.js

@@ -98,8 +98,8 @@ let compleGljOptions = {
     htmlDest: 'web/building_saas/complementary_glj_lib/html',
     htmlName: 'tools-gongliaoji.html',
     injectList: [
-        'web/dest/scripts/compleGlj.all.min' + version + '.js',
-        'web/dest/css/compleGlj.all.min' + version + '.css',
+        'web/dest/scripts/compleGlj.all.min.' + version + '.js',
+        'web/dest/css/compleGlj.all.min.' + version + '.css',
         'web/dest/css/common.all.min.' + version + '.css'
     ]
 };
@@ -114,8 +114,8 @@ let compleRation_rationOptions = {
     htmlDest: 'web/building_saas/complementary_ration_lib/html',
     htmlName: 'dinge.html',
     injectList: [
-        'web/dest/scripts/compleRation_ration.all.min' + version + '.js',
-        'web/dest/css/compleRation_ration.all.min' + version + '.css',
+        'web/dest/scripts/compleRation_ration.all.min.' + version + '.js',
+        'web/dest/css/compleRation_ration.all.min.' + version + '.css',
         'web/dest/scripts/common.all.min.'+version+'.js',
         'web/dest/css/common.all.min.' + version + '.css'
     ]
@@ -131,8 +131,8 @@ let compleRation_gljOptions = {
     htmlDest: 'web/building_saas/complementary_ration_lib/html',
     htmlName: 'gongliao.html',
     injectList: [
-        'web/dest/scripts/compleRation_glj.all.min' + version + '.js',
-        'web/dest/scripts/compleRation_glj.all.min' + version + '.css',
+        'web/dest/scripts/compleRation_glj.all.min.' + version + '.js',
+        'web/dest/scripts/compleRation_glj.all.min.' + version + '.css',
         'web/dest/scripts/common.all.min.'+version+'.js',
         'web/dest/css/common.all.min.' + version + '.css'
     ]
@@ -148,8 +148,8 @@ let compleRation_coeOptions = {
     htmlDest: 'web/building_saas/complementary_ration_lib/html',
     htmlName: 'fuzhu.html',
     injectList: [
-        'web/dest/scripts/compleRation_coe.all.min' + version + '.js',
-        'web/dest/scripts/compleRation_coe.all.min' + version + '.css',
+        'web/dest/scripts/compleRation_coe.all.min.' + version + '.js',
+        'web/dest/scripts/compleRation_coe.all.min.' + version + '.css',
         'web/dest/scripts/common.all.min.'+version+'.js',
         'web/dest/css/common.all.min.' + version + '.css'
     ]
@@ -165,8 +165,8 @@ let compleRation_instOptions = {
     htmlDest: 'web/building_saas/complementary_ration_lib/html',
     htmlName: 'anzhuang.html',
     injectList: [
-        'web/dest/scripts/compleRation_inst.all.min' + version + '.js',
-        'web/dest/scripts/compleRation_inst.all.min' + version + '.css',
+        'web/dest/scripts/compleRation_inst.all.min.' + version + '.js',
+        'web/dest/scripts/compleRation_inst.all.min.' + version + '.css',
         'web/dest/scripts/common.all.min.'+version+'.js',
         'web/dest/css/common.all.min.' + version + '.css'
     ]

+ 1 - 0
modules/main/facade/project_facade.js

@@ -3,6 +3,7 @@
  */
 
 module.exports = {
+    sortChildren,
     markUpdateProject:markUpdateProject,
     removeProjectMark:removeProjectMark,
     updateNodes:updateNodes,

+ 16 - 0
modules/pm/facade/pm_facade.js

@@ -2400,6 +2400,8 @@ async function exportMainData(userID,projectID) {
             if(s.projType =="Tender") tenderIDs.push(s.ID);
         }
     }
+    const constructions = result.projects.filter(item => item.projType === projectType.project);
+    resortImportProjectData(result.projects, constructions);
     let files = {unitFiles:await exportUnitFiles(projectID),feeRateFiles:await exportFeeRateFiles(projectID)};
     result.files = files;
     result = cipher.aesEncrypt(JSON.stringify(result));
@@ -2652,6 +2654,18 @@ async function handleImportInterface(key, session) {
     }
 } */
 
+// 为防止导入的ybp源文件的树结构是错误的,进行重排
+function resortImportProjectData(allData, curDepthData) {
+    curDepthData = project_facade.sortChildren(curDepthData);
+    curDepthData.forEach((cur, index) => {
+        cur.NextSiblingID = curDepthData[index + 1] && curDepthData[index + 1].ID || -1;
+        const nextDepthData = allData.filter(item => item.ParentID === cur.ID);
+        if (nextDepthData.length) {
+            resortImportProjectData(allData, nextDepthData);
+        }
+    });
+}
+
 async function importProjects(data,req,updateData) {
     let result = {error:0};
     let stringArr = data.split("|----|");
@@ -2679,6 +2693,8 @@ async function importProjects(data,req,updateData) {
                 result.msg = `您创建的项目个数超限,请联系我们的客服人员,或者导出建设项目保存到本地备份,删除云上数据。`;
                 return result;
             }
+            const constructions = mainData.projects.filter(item => item.projType === projectType.project);
+            resortImportProjectData(mainData.projects, constructions);
             let [constructionProjectID,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap] = await handleMainProjectDatas(mainData,updateData,req.session.sessionUser.id);
             result.constructionProjectID = constructionProjectID;
             if(datas.length > 1 ){

+ 1 - 1
modules/pm/models/project_property_template.js

@@ -21,7 +21,7 @@ const displaySetting = {
 
 const tenderSetting = {
     gljPriceTenderCoe: 1, //工料机单价调整系数
-    calcPriceOption: 'coeBase'//根据调整系数计算报价
+    calcPriceOption: 'priceBase_RCJ'//根据调整系数计算报价
 };
 
 const calcOptions = {

+ 2 - 0
public/web/socket/connection.js

@@ -97,6 +97,8 @@ socketObject = {
             if (isActive) {
                 $("#message").html(`树结构发生变化,请<a href="javascript:void(0);" id="load-data">点击刷新列表</a>`);
                 $('#load-data').on('click', () => projTreeObj.handleNotifyClick(expandState, selection));
+                $('#notify > button').hide();
+                $('#empty-modal').modal('show');
                 $("#notify").show();
             }
         });

+ 2 - 2
web/building_saas/complementary_glj_lib/html/tools-gongliaoji.html

@@ -37,14 +37,14 @@
         <div class="content" style="margin-left: 0px;">
             <div class="container-fluid">
                 <div class="row" id="dataRow">
-                    <div id="leftContent" style="width: 25%;">
+                    <div id="leftContent" style="width: 28%;">
                         <div class="print-list" >
                             <div class="form-list" style="overflow: hidden">
                                 <div id="gljClassSpread" style="height: 100%; width: 100%;"></div>
                             </div>
                         </div>
                     </div>
-                    <div id="midContent" style="width: 50%; overflow: hidden">
+                    <div id="midContent" style="width: 47%; overflow: hidden">
                         <div id="leftResize" style="width: 1%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
                         <div id="GLJListSheet" class="p-0" style="height: 100%; width: 99%; float: left">
                         </div>

+ 2 - 2
web/building_saas/complementary_glj_lib/js/glj.js

@@ -644,8 +644,8 @@ let repositoryGljObj = {
     },
     //组成物表能编辑则显示,否则隐藏该工作表
     spreadControl: function (showComponent) {
-        let leftWidth = getLocalCache('compleGLjleftContentWidth') || '50%',
-            midWidth = getLocalCache('compleGLjmidContentWidth') || '25%',
+        let leftWidth = getLocalCache('compleGLjleftContentWidth') || '28%',
+            midWidth = getLocalCache('compleGLjmidContentWidth') || '47%',
             rightWidth = getLocalCache('compleGLjrightContentWidth') || '25%';
         [leftWidth, midWidth, rightWidth] = [leftWidth, midWidth, rightWidth].map((v) => parseFloat(v.replace('%', '')));
         let curMidWidth = parseFloat($('#midContent')[0].style.width.replace('%', '')),

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

@@ -3,8 +3,8 @@
     <div class="btn-toolbar py-1">
         <div class="input-group input-group-sm mr-2">
             <select class="form-control form-control-sm" style="width: auto; font-size: .875rem" id="calcPriceOption">
-                <option value="coeBase">按调价系数计算</option>
                 <option value="priceBase_RCJ" >按目标价调整人材机消耗</option>
+                <option value="coeBase">按调价系数计算</option>
                 <option value="priceBase_ZM" >按目标价调整子目工程量</option>
             </select>
         </div>

+ 6 - 4
web/building_saas/main/js/models/calc_program.js

@@ -375,6 +375,8 @@ let calcTools = {
                 for (let md of mds) {
                     if (md.type == detailType) {
                         let q = md["consumption"] ? md["consumption"] : 0;
+                         // 下面这句从养护来,建筑暂时用不上,以后可能会用上
+                        // let p = isTender ? (md["tenderPrice"] ? md["tenderPrice"] : 0) : (md["marketPrice"] ? md["marketPrice"] : 0);
                         let p = md["basePrice"] ? md["basePrice"] : 0;
                         mdSum = mdSum + (q * p).toDecimal(decimalObj.glj.unitPriceHasMix);
                         mdSum = (mdSum).toDecimal(decimalObj.glj.unitPriceHasMix);
@@ -1043,7 +1045,7 @@ let calcTools = {
     
     getTenderCalcType: function () {
         let tenderSetting = projectObj.project.property.tenderSetting;
-        let ct = tenderSetting && tenderSetting.calcPriceOption? tenderSetting.calcPriceOption : "coeBase";
+        let ct = tenderSetting && tenderSetting.calcPriceOption? tenderSetting.calcPriceOption : "priceBase_RCJ";
         if (ct == 'priceBase') ct = 'priceBase_RCJ';   // 兼容旧项目
         return ct;
     }
@@ -2242,7 +2244,7 @@ class CalcProgram {
     // 反向调价
     calcTenderReverse(treeNode, tender){
         if (tender == tenderTypes.ttReverseRation) {
-            if (treeNode.data.feesIndex.common.tenderUnitFee != treeNode.data.feesIndex.common.unitFee) {
+            if (treeNode.data.feesIndex.common && treeNode.data.feesIndex.common.tenderUnitFee != treeNode.data.feesIndex.common.unitFee) {
                 treeNode.data.feesIndex.common.tenderUnitFee = treeNode.data.feesIndex.common.unitFee;
                 treeNode.changed = true;
             }
@@ -2254,11 +2256,11 @@ class CalcProgram {
                 treeNode.changed = true;
             }
             else{    // 既没有目标金额也没有目标单价,此时要初始化使调价合价=原始综合合价,调价单价=原始综合单价。
-                if (treeNode.data.feesIndex.common.tenderUnitFee != treeNode.data.feesIndex.common.unitFee) {
+                if (treeNode.data.feesIndex.common && treeNode.data.feesIndex.common.tenderUnitFee != treeNode.data.feesIndex.common.unitFee) {
                     treeNode.data.feesIndex.common.tenderUnitFee = treeNode.data.feesIndex.common.unitFee;
                     treeNode.changed = true;
                 };
-                if (treeNode.data.feesIndex.common.tenderTotalFee != treeNode.data.feesIndex.common.totalFee) {
+                if (treeNode.data.feesIndex.common && treeNode.data.feesIndex.common.tenderTotalFee != treeNode.data.feesIndex.common.totalFee) {
                     treeNode.data.feesIndex.common.tenderTotalFee = treeNode.data.feesIndex.common.totalFee;
                     treeNode.changed = true;
                 };

+ 20 - 1
web/building_saas/pm/js/pm_newMain.js

@@ -61,7 +61,8 @@ const STATE = {
     addingProject: false,
     addingFolder: false,
     deleting: false,
-    importing: false
+    importing: false,
+    moving: false
 };
 const projTreeObj = {
     tree: null,
@@ -560,11 +561,16 @@ const projTreeObj = {
             }
             projTreeObj.moveTo(selected, null, parent, next, null, action);
             $.bootstrapLoading.end();
+            STATE.moving = false;
             projTreeObj.emitTreeChange();
         });
     },
     //升级后选中节点的后兄弟节点不成为其子节点,因为有层级类型限制(相当于选中节点移动到父项后成为其后兄弟)
     upLevel: function () {
+        if (STATE.moving) {
+            return;
+        }
+        STATE.moving = true;
         let selected = projTreeObj.tree.selected,
             parent = selected.parent.parent,
             next = selected.parent.nextSibling,
@@ -581,6 +587,10 @@ const projTreeObj = {
         this.doAfterTreeOpr({selected, parent, next, projectMap});
     },
     downLevel: function () {
+        if (STATE.moving) {
+            return;
+        }
+        STATE.moving = true;
         let selected = projTreeObj.tree.selected,
             parent = null,
             next = null,
@@ -603,6 +613,10 @@ const projTreeObj = {
         this.doAfterTreeOpr({selected, parent, next, projectMap}, 'downLevel');
     },
     upMove: function () {
+        if (STATE.moving) {
+            return;
+        }
+        STATE.moving = true;
         let selected = projTreeObj.tree.selected,
             parent = selected.parent,
             next = selected.preSibling(),
@@ -620,6 +634,10 @@ const projTreeObj = {
         this.doAfterTreeOpr({selected, parent, next, projectMap});
     },
     downMove: function () {
+        if (STATE.moving) {
+            return;
+        }
+        STATE.moving = true;
         let selected = projTreeObj.tree.selected,
             parent = selected.parent,
             next = selected.nextSibling.nextSibling,
@@ -1713,6 +1731,7 @@ const projTreeObj = {
         init(refresh, callback, expandCallback);
     },
     handleNotifyClick: function(expandState, selection) {
+        $('#empty-modal').modal('hide');
         $('#notify').hide();
         const callback = () => {
             const sheet = this.workBook.getSheet(0);

+ 75 - 3
web/building_saas/pm/js/pm_tree.js

@@ -267,7 +267,79 @@ const pmTree = {
                 }, []);
             };
 
-            Tree.prototype.loadData = function (arrData) {
+            function sortChildren(nodes) {
+                const IDMap = {};
+                const nextMap = {};
+                let firstNode = null;
+                const newList = [];
+                for (const node of nodes) {
+                    // 递规排序
+                    if (node.children && node.children.length > 0) {
+                        node.children = sortChildren(node.children);
+                    }
+                    IDMap[node.data.ID] = node;
+                    if (node.data.NextSiblingID != -1) {
+                        nextMap[node.data.NextSiblingID] = node;
+                    }
+                }
+                for (const node of nodes) {
+                    if (!nextMap[node.data.ID]) { //如果在下一节点映射没找到,则是第一个节点
+                        firstNode = node;
+                        break;
+                    }
+                }
+                if (firstNode) {
+                    newList.push(firstNode);
+                    delete IDMap[firstNode.data.ID];
+                    setNext(firstNode, newList);
+                }
+                // 容错处理,如果链断了的情况,直接添加到后面
+                for (const key in IDMap) {
+                    if (IDMap[key]) {
+                        newList.push(IDMap[key]);
+                    }
+                }
+                return newList;
+
+                function setNext(node, array) {
+                    if (node.data.NextSiblingID != -1) {
+                        const next = IDMap[node.data.NextSiblingID];
+                        node.nextSibling = next || null;
+                        if (next) {
+                            array.push(next);
+                            delete IDMap[next.data.ID];
+                            setNext(next, array);
+                        }
+                    }
+                }
+            }
+
+            Tree.prototype.loadData = function (treeData) {
+                this.sourceData = treeData;
+                // 建立节点及索引
+                const nodes = [];
+                const parentMap = {};
+                const IDMap = {};
+                treeData.forEach(nodeData => {
+                    const node = new Node(this, nodeData);
+                    this.maxNodeId(node.id());
+                    IDMap[node.data.ID] = node;
+                    (parentMap[node.data.ParentID] || (parentMap[node.data.ParentID] = [])).push(node);
+                    nodes.push(node);
+                });
+                // 过滤出各节点的children、设置节点parent
+                nodes.forEach(node => {
+                    node.children = parentMap[node.data.ID] || [];
+                    node.parent = IDMap[node.data.ParentID] || this._root;
+                });
+                const roots = parentMap['-1']||[];
+                // 将各节点的children进行排序,并设置nextSibling
+                this._root.children = sortChildren(roots);
+                // 生成tree.items
+                sortTreeItems(this);
+            };
+
+/*             Tree.prototype.loadData = function (arrData) {
                 this.sourceData = arrData;
                 let i, that = this;
                 let nodesIndex = {};
@@ -331,7 +403,7 @@ const pmTree = {
                 }
                 //set items
                 sortTreeItems(this);
-            };
+            }; */
 
             Tree.prototype.addNodeData = function (data, parent, nextSibling, nodeState = null) {
                 this.sourceData.push(data);
@@ -409,7 +481,7 @@ const pmTree = {
                 function isValid(nodes) {
                     for (let node of nodes) {
                         if (node.data.ParentID !== -1 &&
-                            (!node.parent || node.parent.data.ID !== node.data.ParentID)) {
+                            (!node.parent || !node.parent.data || node.parent.data.ID !== node.data.ParentID)) {
                             console.log(`${node.serialNo() + 1}:${node.data.name} parent对应错误`);
                             return false;
                         }

+ 4 - 0
web/common/html/header.html

@@ -207,6 +207,10 @@
         </div>
     </div>
 </div>
+<div class="modal fade" id="empty-modal" data-backdrop="static" style="display: none;" aria-hidden="true">
+    <div class="modal-dialog" role="document">
+    </div>
+</div>
 <!--激活产品 & 售后服务 & 联系客服-->
 <!--办事处客服列表-->
 <div class="modal fade z-index-3000" id="activ" data-backdrop="static" style="display: none; overflow: auto;" aria-hidden="true">