소스 검색

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

TonyKang 7 년 전
부모
커밋
281978c158

+ 1 - 0
config/gulpConfig.js

@@ -17,6 +17,7 @@ module.exports = {
     common_css:[
         'lib/bootstrap/css/bootstrap.min.css',
         'web/building_saas/css/main.css',
+        'web/building_saas/css/custom.css',
         'lib/font-awesome/font-awesome.min.css'
     ],
     login_jspaths:[

+ 1 - 0
modules/all_models/ration.js

@@ -55,6 +55,7 @@ let rationSchema = new Schema({
     rationAssList: [rationAssItemSchema],
     content: String,                            // 工作内容
     ruleText: String,                            // 计算规则
+    prefix: {type: Number, default: 0},                              //定额是补充、借用时用 1 complementary 2 borrow
 
     //工料机特有属性
     projectGLJID:Number,  //项目工料机ID

+ 1 - 1
modules/complementary_ration_lib/controllers/searchController.js

@@ -13,7 +13,7 @@ let callback = function (req, res, err, message, data) {
 class SearchController extends BaseController{
     getRationItem(req, res){
         let data = JSON.parse(req.body.data);
-        searchDao.getRationItem(req.session.sessionUser.id, data.rationRepId, data.code, function (err, data) {
+        searchDao.getRationItem(req.session.sessionUser.id, data.rationRepIds, data.code, function (err, data) {
             callback(req, res, err, '', data);
         });
     }

+ 3 - 3
modules/complementary_ration_lib/models/searchModel.js

@@ -10,16 +10,16 @@ let stdSectionTreeModel = require ('../../ration_repository/models/ration_sectio
 let stdRationModel = require ('../../ration_repository/models/ration_item').Model;
 
 class SearchDao{
-    async getRationItem(userId, rationRepId, code, callback){
+    async getRationItem(userId, rationRepIds, code, callback){
         let ration = null;
         try{
-            let stdRation = await stdRationModel.findOne({rationRepId: rationRepId, code: code, $or: [{isDeleted: null}, {isDeleted: false}]});
+            let stdRation = await stdRationModel.findOne({rationRepId: {$in: rationRepIds}, code: code, $or: [{isDeleted: null}, {isDeleted: false}]});
             if(isDef(stdRation)){
                 ration = stdRation._doc;
                 ration.type = 'std';
             }
             else{
-                let compleRation = await compleRationModel.findOne({userId: userId, rationRepId: rationRepId, code: code, deleteInfo: null});
+                let compleRation = await compleRationModel.findOne({userId: userId, rationRepId: {$in: rationRepIds}, code: code, deleteInfo: null});
                 if(isDef(compleRation)){
                     ration = compleRation._doc;
                     ration.type = 'complementary';

+ 24 - 8
modules/main/facade/ration_facade.js

@@ -30,7 +30,7 @@ async function addNewRation(data) {
     let startTime = +new Date();
     if(query){
         let searchDao = new SearchDao();
-        stdRation = await searchDao.getRationItem(query.userID,query.rationRepId,query.code);
+        stdRation = await searchDao.getRationItem(query.userID,[query.rationRepId],query.code);
         data.newData.code = query.code;
     }
     let stdRationTime = +new Date();
@@ -38,7 +38,7 @@ async function addNewRation(data) {
     if(data.brUpdate.length>0){
         await updateSerialNo(data.brUpdate);
     }
-    let newRation =await insertNewRation(data.newData,stdRation,data.calQuantity);
+    let newRation =await insertNewRation(data.newData,data.firstLibID,stdRation,data.calQuantity);
     let addRationGLJTime = +new Date();
     console.log("插入新定额时间-------------------------------"+(addRationGLJTime - stdRationTime));
     if(stdRation){
@@ -68,7 +68,7 @@ async function  updateSerialNo(serialNoUpdate){
 
 }
 
-async function insertNewRation(newData,std,calQuantity) {//插入新的定额
+async function insertNewRation(newData,firstLibID,std,calQuantity) {//插入新的定额
     let startTime = +new Date();
     if(std){
         newData.name = std.name;
@@ -80,7 +80,14 @@ async function insertNewRation(newData,std,calQuantity) {//插入新的定额
             newData.comments = std.chapter.explanation;
             newData.ruleText = std.chapter.ruleText;
         }
+        newData.prefix = 0;
         newData.from = std.type === 'complementary' ? 'cpt' : 'std';
+        if(firstLibID !== std.rationRepId){//借
+            newData.prefix = 2;
+        }
+        else if(std.rationRepId === firstLibID && newData.from === 'cpt') {
+            newData.prefix = 1;
+        }
         newData.programID = std.feeType;
         newData.rationAssList =  createRationAss(std);
         // calculate ration Quantity
@@ -101,8 +108,8 @@ async function replaceRations(userID,data) {
     let searchDao = new SearchDao();
     let recodes = [];
     for(let recode of data.nodeInfo){
-        let stdRation = await searchDao.getRationItem(userID,data.libID,recode.newCode);
-        let newRecode = await replaceRation(recode,stdRation,data.projectID,data.calQuantity);
+        let stdRation = await searchDao.getRationItem(userID,data.libIDs,recode.newCode);
+        let newRecode = await replaceRation(recode,stdRation,data.firstLibID,data.projectID,data.calQuantity);
         if(newRecode){
             recodes.push(newRecode);
         }else {
@@ -112,10 +119,10 @@ async function replaceRations(userID,data) {
     return recodes;
 }
 
-async function replaceRation(nodeInfo,stdRation,projectID,calQuantity) {
+async function replaceRation(nodeInfo,stdRation,firstLibID,projectID,calQuantity) {
     if(stdRation){
         await deleRationSubRecode(projectID,nodeInfo.ID);
-        let newRation = await updateRation(stdRation,nodeInfo.ID,nodeInfo.billsItemID,projectID,calQuantity);//生成并插入新的定额
+        let newRation = await updateRation(stdRation,firstLibID,nodeInfo.ID,nodeInfo.billsItemID,projectID,calQuantity);//生成并插入新的定额
         return await addRationSubList(stdRation,newRation,nodeInfo.needInstall);
     }else {
         return null;
@@ -291,7 +298,7 @@ async function deleRationSubRecode(projectID,rationID) {//删除挂在定额下
     await rationInstallationModel.deleteMany(delete_query);//删除安装增加费
 }
 
-async function  updateRation(std,rationID,billsItemID,projectID,calQuantity) {
+async function  updateRation(std,firstLibID,rationID,billsItemID,projectID,calQuantity) {
     // insertNewRation
     let ration ={};
     ration.code = std.code;
@@ -309,6 +316,15 @@ async function  updateRation(std,rationID,billsItemID,projectID,calQuantity) {
         ration.ruleText = std.chapter.ruleText;
     }
     ration.from = std.type === 'complementary' ? 'cpt' : 'std';
+    //定额前缀 none:0, complementary:1, borrow: 2
+    ration.prefix = 0;
+    //借用优先级比补充高
+    if(std.rationRepId !== parseInt(firstLibID)){//借用
+        ration.prefix = 2;
+    }
+    else if(std.rationRepId === firstLibID && ration.from === 'cpt') {
+        ration.prefix = 1;
+    }
     ration.programID = std.feeType;
     ration.rationAssList = createRationAss(std);//生成辅助定额
     if(calQuantity){

+ 1 - 0
public/web/sheet/sheet_data_helper.js

@@ -52,6 +52,7 @@ var SheetDataHelper = {
         spread.options.cutCopyIndicatorVisible = false;
         spread.options.allowCopyPasteExcelStyle = false;
         spread.options.allowUserDragDrop = false;
+        spread.options.allowUndo = false;//that.mainSpread.commandManager().setShortcutKey(undefined, GC.Spread.Commands.Key.z, true, false, false, false); 屏蔽undo
         spread.getActiveSheet().setRowCount(3);
         return spread;
     },

+ 12 - 4
public/web/tree_sheet/tree_sheet_controller.js

@@ -40,7 +40,9 @@ var TREE_SHEET_CONTROLLER = {
                         that.setTreeSelected(newNode);
                         that.sheet.setSelection(newNode.serialNo(), sels[0].col, 1, 1);
                         that.sheet.showRow(newNode.serialNo(), GC.Spread.Sheets.VerticalPosition.center);
-                        cbTools.refreshFormulaNodes();
+                        if(typeof cbTools !== 'undefined'){
+                            cbTools.refreshFormulaNodes();
+                        }
                     });
                 }
             }
@@ -53,7 +55,9 @@ var TREE_SHEET_CONTROLLER = {
                         that.sheet.deleteRows(sels[0].row, that.tree.selected.posterityCount() + 1);
                         that.setTreeSelected(that.tree.items[sels[0].row]);
                     });
-                    cbTools.refreshFormulaNodes();
+                    if(typeof cbTools !== 'undefined'){
+                        cbTools.refreshFormulaNodes();
+                    }
                 }
             }
         };
@@ -73,7 +77,9 @@ var TREE_SHEET_CONTROLLER = {
                         that.setTreeSelected(that.tree.items[sels[0].row]);
                         that.sheet.setSelection(sels[0].row,sels[0].col,1,sels[0].colCount);
                     });
-                    cbTools.refreshFormulaNodes();
+                    if(typeof cbTools !== 'undefined'){
+                        cbTools.refreshFormulaNodes();
+                    }
                 }
             }
         };
@@ -98,7 +104,9 @@ var TREE_SHEET_CONTROLLER = {
                         that.sheet.deleteRows(row,1);
                         next?that.setTreeSelected(that.tree.items[row]):"";
                     });
-                    cbTools.refreshFormulaNodes();
+                    if(typeof cbTools !== 'undefined'){
+                        cbTools.refreshFormulaNodes();
+                    }
                 }
             }
         };

+ 0 - 3
public/web/tree_sheet/tree_sheet_helper.js

@@ -310,10 +310,7 @@ var TREE_SHEET_HELPER = {
             if (!node || node.children.length === 0) { return; }
             let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
             let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
-            console.log(hitinfo.x);
             if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
-                console.log(centerX - halfBoxLength);
-                console.log(centerX + halfBoxLength);
                 node.setExpanded(!node.expanded);
                 TREE_SHEET_HELPER.massOperationSheet(hitinfo.sheet, function () {
                     let iCount = node.posterityCount(), i, child;

+ 2 - 2
web/building_saas/complementary_ration_lib/js/ration.js

@@ -500,9 +500,9 @@ let rationOprObj = {
                 if(jobContentOprObj ){
                     jobContentOprObj.currentRationItems = cacheSection;
                     jobContentOprObj.setRadiosDisabled(cacheSection.length > 0 ? false : true, jobContentOprObj.radios);
-                    if(cacheSection.length === 0){
+                  /*  if(cacheSection.length === 0){
                         jobContentOprObj.updateSituation(pageOprObj.rationLibId, me.currentSectionId, 'NONE');
-                    }
+                    }*/
                     jobContentOprObj.setRadiosChecked(jobContentOprObj.currentSituation, jobContentOprObj.radios);
                     if(jobContentOprObj.currentSituation === jobContentOprObj.situations.PARTIAL){
                         jobContentOprObj.buildTablePartial(jobContentOprObj.tablePartial, jobContentOprObj.getGroup(cacheSection));

+ 1 - 1
web/building_saas/complementary_ration_lib/js/ration_coe.js

@@ -242,7 +242,7 @@ var rationCoeOprObj = {
         /*if (ration == undefined || ration.rationCoeList == undefined ||
             ration.rationCoeList.length == 0){return;};*/
 
-        var coeList = ration.rationCoeList;
+        var coeList = ration.rationCoeList ? ration.rationCoeList : [];
         let coeIDs = [];
         for(let i = 0, len = coeList.length; i < len; i++){
             coeIDs.push(coeList[i].ID);

+ 31 - 0
web/building_saas/css/custom.css

@@ -0,0 +1,31 @@
+
+.text-green{
+    color: #172a30
+}
+label.title{
+    display: inline-block;
+    width: 100px;
+}
+.modal-feeRate {max-width: 550px}
+
+
+div.resize{
+    height: 4px;
+    background: #f7f7f9;
+    width: 100%;
+    cursor: s-resize;
+}
+/*.zlfb-check{
+    margin-left: 20px;
+}*/
+legend.legend{
+    display:block;
+    width:auto;
+    font-size:0.9rem;
+    top:-15px;
+    background: white;
+}
+
+.toolsbar_feeRate {
+    border-bottom: 1px solid #ccc
+}

+ 0 - 6
web/building_saas/css/main.css

@@ -352,10 +352,4 @@ body {
 }
 .custom-file-input:lang(zh) ~ .custom-file-label::after {
     content: "浏览";
-}
-div.resize{
-    height: 4px;
-    background: #f7f7f9;
-    width: 100%;
-    cursor: s-resize;
 }

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

@@ -9,6 +9,7 @@
     <!-- inject:css -->
     <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css">
     <link rel="stylesheet" href="/web/building_saas/css/main.css">
+    <link rel="stylesheet" href="/web/building_saas/css/custom.css">
     <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">
     <!--zTree-->
     <link rel="stylesheet" href="/lib/ztree/css/zTreeStyle.css" type="text/css">
@@ -209,6 +210,7 @@
                           </div>
                       </div>
                       <div class="main-side col-lg-0 p-0">
+                          <div class="resize col-lg-0 p-0"></div>
                           <div class="tab-content">
                               <!--清单规则-->
                               <div class="tab-pane" id="qd">
@@ -265,6 +267,7 @@
                                   </div>
                                   <div class="main-data-side-d" id="stdRationChapter">
                                   </div>
+                                  <div class="resize" style="background: #F1F1F1"></div>
                                   <div class="sidebar-bottom container-fluid">
                                       <div class="row">
                                           <div class="col-lg-12 p-0" id="stdSectionRations"></div>

+ 2 - 0
web/building_saas/main/js/models/calc_base.js

@@ -986,6 +986,8 @@ let cbAnalyzer = {
         exp = exp.replace(/(/g, '(');
         //)to )
         exp = exp.replace(/)/g, ')');
+        //f to F
+        exp = exp.replace(new RegExp('f', 'g'), 'F');
         return exp;
     },
     //输入合法性

+ 11 - 9
web/building_saas/main/js/models/calc_program.js

@@ -251,12 +251,12 @@ let calcTools = {
                     if (md.type == gljType.MACHINE_LABOUR) {
                         let q = md["consumption"] ? md["consumption"] : 0;
                         let p = md["basePrice"] ? md["basePrice"] : 0;
-                        mdSum = mdSum + (q * p).toDecimal(decimalObj.process);
-                        mdSum = (mdSum).toDecimal(decimalObj.process);
+                        mdSum = mdSum + (q * p).toDecimal(decimalObj.ration.unitFee);
+                        mdSum = (mdSum).toDecimal(decimalObj.ration.unitFee);
                     }
                 }
-                result = result + (glj["quantity"] * mdSum).toDecimal(decimalObj.process);
-                result = (result).toDecimal(decimalObj.process);
+                result = result + (glj["quantity"] * mdSum).toDecimal(decimalObj.ration.unitFee);
+                result = (result).toDecimal(decimalObj.ration.unitFee);
             }
         }
         return result;
@@ -345,8 +345,9 @@ let calcTools = {
                 };
 
                 for (let obj of GLJObjs){
-                    sumT = sumT + (me.uiGLJQty(obj.quantity) * me.uiGLJPrice(obj.marketPrice)).toDecimal(decimalObj.process);
-                    sumT = sumT.toDecimal(decimalObj.process);
+                    let t = (me.uiGLJQty(obj.quantity) * me.uiGLJPrice(obj.marketPrice)).toDecimal(decimalObj.bills.totalPrice);
+                    sumT = sumT + t;
+                    sumT = sumT.toDecimal(decimalObj.bills.totalPrice);
                 };
                 sumT = sumT.toDecimal(decimalObj.bills.totalPrice);
             }
@@ -1623,17 +1624,18 @@ class CalcProgram {
         this.saveNodes(changedNodes, callback);
     };
 
-    // 排除指定项的综合合价计算(用于带循环计算的情况)
+    // 排除指定项的综合合价计算(用于带循环计算的情况)。
+    // 这里的汇总只到清单级别即可(清单单价取费时,汇总到清单和汇总到定额两个值不一样)
     getTotalFee(baseNodes, excludeNodes){
         let rst = 0;
         function calcNodes(nodes) {
             for (let node of nodes) {
                 if (!excludeNodes.includes(node)){
-                    if (node.children.length > 0) {
+                    if (node.source && node.source.children && node.source.children.length > 0) {
                         calcNodes(node.children);
                     }
                     else{
-                        if (node.sourceType != ModuleNames.ration_glj) {
+                        if (node.sourceType == ModuleNames.bills) {
                             rst = (rst + calcTools.getFee(node, 'common.totalFee')).toDecimal(decimalObj.decimal("totalPrice", node));
                         };
                     }

+ 5 - 0
web/building_saas/main/js/models/main_consts.js

@@ -158,6 +158,11 @@ const rationType = {
     gljRation: 3,
     install:4
 };
+const rationPrefix = { //定额前缀,补/借
+    none: 0,
+    complementary: 1,
+    borrow: 2
+};
 const leafBillGetFeeType = {
     rationContent: 0,
     rationPriceConverse: 1,

+ 9 - 4
web/building_saas/main/js/models/ration.js

@@ -375,13 +375,15 @@ var Ration = {
         };
         ration.prototype.updateRationCodes = function (recodes) {
             let libID =  rationLibObj.getCurrentStdRationLibID();
+            let libIDs = rationLibObj.getStdRationLibIDs();
+            let firstLibID = rationLibObj.getFirstStdRationLibID();
             let engineering = projectInfoObj.projectInfo.property.engineering;
             let projectID = projectInfoObj.projectInfo.ID;
             let project = projectObj.project;
             let mainTree = project.mainTree;
             let nodeInfo =[];
             let refershNodes = [];
-            if(libID == null){
+            if(libIDs == null){
                 return;
             }
             for(let r of recodes){
@@ -395,7 +397,7 @@ var Ration = {
             }
             let calQuantity = optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
             $.bootstrapLoading.start();
-            CommonAjax.post("/ration/replaceRations",{nodeInfo:nodeInfo,libID:libID,projectID:projectID,calQuantity:calQuantity},function (data) {
+            CommonAjax.post("/ration/replaceRations",{nodeInfo:nodeInfo,libIDs:libIDs,firstLibID: firstLibID,projectID:projectID,calQuantity:calQuantity},function (data) {
                 for(let recode of data){
                    let node =  mainTree.getNodeByID(recode.ration.ID);
                    if(node) {
@@ -403,12 +405,15 @@ var Ration = {
                            node.data[temkey] = recode.ration[temkey];
                        }
                        node.data.feesIndex = {};
+                       //删除定额节点下的主材和设备节点
+                       project.ration_glj.removeNodeByRation(recode.ration,projectObj.mainController);
                        project.Ration.deleteSubListOfRation(recode.ration);//删除旧定额下的相关记录
                        //添加新的记录
                        project.ration_glj.addDatasToList(recode.ration_gljs);
                        project.ration_coe.addDatasToList(recode.ration_coes);
                        project.ration_installation.addDatasToList(recode.ration_installs);
-                       //to do 添加增加安装费
+
+                       project.ration_glj.addToMainTree(recode.ration_gljs);
                    }
                 }
                 project.projectGLJ.loadData(function () {
@@ -469,7 +474,7 @@ var Ration = {
                     needInstall = project.Bills.isFBFX(billsNode);//在分部分项插入的定额才需要定额安装增加费
                 }
                 $.bootstrapLoading.start();
-                CommonAjax.post("/ration/addNewRation",{itemQuery:itemQuery,newData:newData,calQuantity:calQuantity,brUpdate:brUpdate,needInstall:needInstall},function (data) {
+                CommonAjax.post("/ration/addNewRation",{itemQuery:itemQuery,newData:newData,firstLibID: rationLibObj.getFirstStdRationLibID(),calQuantity:calQuantity,brUpdate:brUpdate,needInstall:needInstall},function (data) {
                     //更新缓存
                     me.datas.push(data.ration);
                     project.ration_glj.addDatasToList(data.ration_gljs);

+ 20 - 0
web/building_saas/main/js/models/ration_glj.js

@@ -196,6 +196,26 @@ var ration_glj = {
                 }
             }
         };
+        ration_glj.prototype.removeNodeByRation = function(ration,controller){//删除主材或设备节点
+            let glj_list = _.filter(projectObj.project.ration_glj.datas,{'rationID':ration.ID});
+            let deleteNodes = [];
+            for(let rg of glj_list){
+                if(this.needShowToTree(rg)){
+                    let r_node = projectObj.project.mainTree.getNodeByID(rg.ID);
+                    deleteNodes.push(r_node);
+                }
+            }
+            if(deleteNodes.length > 0){
+                let rowIndex = deleteNodes[0].serialNo();
+                if(controller.tree.m_delete(deleteNodes)){
+                    TREE_SHEET_HELPER.massOperationSheet(controller.sheet, function () {
+                        let rowCount = deleteNodes.length;
+                        controller.sheet.deleteRows(rowIndex, rowCount);
+                    });
+                }
+            }
+        };
+
         ration_glj.prototype.refreshAfterUpdate = function (data) {
             var me = this;
             var rationID=null;

+ 12 - 7
web/building_saas/main/js/views/glj_view.js

@@ -357,7 +357,7 @@ var gljOprObj = {
 
     onClipboardPasting: function (sender, args) {
         var me = gljOprObj;
-        if (!me.ration) {
+        if(args.cellRange.rowCount!=1||args.cellRange.colCount!=1){
             args.cancel = true;
         }
     },
@@ -725,13 +725,18 @@ var gljOprObj = {
         var me = gljOprObj;
         if (args.action == GC.Spread.Sheets.RangeChangedAction.clear) {
             args.editingText = null;
-            if (args.sheetName == 'ration_glj') {
-                me.onEditGLJSheet(args);
-            }
-            if (args.sheetName == 'ration_ass') {
-                me.updateRationAss(args);
-            }
+        }else if(args.action == GC.Spread.Sheets.RangeChangedAction.paste){
+            args.editingText = args.sheet.getCell(args.row,args.col).value();
+        }else {
+            return;
+        }
+        if (args.sheetName == 'ration_glj') {
+            me.onEditGLJSheet(args);
         }
+        if (args.sheetName == 'ration_ass') {
+            me.updateRationAss(args);
+        }
+
     },
     generateHtmlString: function () {
 //        return "<div id='edit'><div>";

+ 10 - 5
web/building_saas/main/js/views/main_tree_col.js

@@ -42,12 +42,17 @@ let MainTreeCol = {
             }
         },
         code: function (node) {
-            if(node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration && isDef(node.data.code) && isDef(node.data.from) && node.data.from === 'cpt'){
-                return '补' +  node.data.code.replace(new RegExp('补'), '');
-            }
-            else {
-                return isDef(node.data.code) ? node.data.code : '';
+            if(node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
+                && isDef(node.data.code) && isDef(node.data.prefix)){
+                if(node.data.prefix === rationPrefix.complementary){
+                    return '补' +  node.data.code.replace(new RegExp('补'), '');
+                }
+                if(node.data.prefix === rationPrefix.borrow){
+                    return '借' +  node.data.code.replace(new RegExp('借'), '');
+                }
             }
+
+            return isDef(node.data.code) ? node.data.code : '';
         },
         marketPrice:function (node) {
             if((node.sourceType === projectObj.project.Ration.getSourceType()&&node.data.type!=rationType.ration)||node.sourceType==projectObj.project.ration_glj.getSourceType()){

+ 40 - 8
web/building_saas/main/js/views/project_view.js

@@ -429,7 +429,7 @@ var projectObj = {
                     project.calcBase.calculate(node);
                     if(!project.calcBase.success){
                         let activeCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];
-                        projectObj.mainSpread.getActiveSheet().setValue(activeCell.row, activeCell.col, node.data.calcBase? node.data.calcBase: '');
+                        projectObj.mainController.refreshTreeNode([node]);
                         return;
                     }
                     // if (value) {value = parseFloat(value).toDecimal(decimalObj.decimal("totalPrice", node))};
@@ -487,9 +487,17 @@ var projectObj = {
     mainSpreadEditStarting: function (sender, info) {
         let project = projectObj.project;
         let node = project.mainTree.items[info.row];
-        if(isDef(node) && node.sourceType === project.Ration.getSourceType() && isDef(node.data.code) && isDef(node.data.from) && node.data.from === 'cpt'&&info.col ==0){
-            let orgV = info.sheet.getValue(info.row, info.col);
-            let newV = orgV.replace(new RegExp('补'), '');
+        let fieldName = projectObj.mainController.setting.cols[info.col].data.field;
+        let orgV = info.sheet.getValue(info.row, info.col);
+        let newV;
+        if(node && node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
+            && isDef(node.data.code) && isDef(node.data.prefix) && node.data.prefix !== rationPrefix.none && fieldName === 'code'){
+            if(node.data.prefix === rationPrefix.complementary){
+                newV = orgV.replace(new RegExp('补'), '');
+            }
+            if(node.data.prefix === rationPrefix.borrow){
+                newV = orgV.replace(new RegExp('借'), '');
+            }
             info.sheet.setValue(info.row, info.col, newV);
         }
     },
@@ -648,7 +656,6 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardChanged, that.msClipboardChanged);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, that.onButtonClick);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
-                that.mainSpread.commandManager().setShortcutKey(undefined, GC.Spread.Commands.Key.z, true, false, false, false);
                 //let loadOtherStartTime = +new Date();
                 that.loadMainSpreadContextMenu();
                 that.loadFocusLocation();
@@ -1072,7 +1079,7 @@ var projectObj = {
     },
 
     //根据节点获取行style(颜色、字体加粗)
-    getNodeColorStyle: function (sheet, node, colSetting) {
+    getNodeColorStyle: function (sheet, node, colSetting = null) {
         let colorSetting = optionsOprObj.getOption(optionsOprObj.optionsTypes.COLOROPTS);
         let mapping = {DEFAULT: 'DEFAULT', SELECTED: 'SELECTED', DXFY: 'DXFY', FB: 'FB', UNLEAFBILL: 'UNLEAFBILL',
             FX: 'FX', BX: 'BX', UNCBBILL: 'UNCBBILL', CBBILL: 'CBBILL', ZCSB: 'ZCSB'};
@@ -1205,7 +1212,9 @@ var projectObj = {
         TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
             for(let node of nodes){
                 if(node && node.serialNo()!= -1){
-                    sheet.setStyle(node.serialNo(), -1, me.getNodeColorStyle(sheet, node));
+                    //console.log(me.getNodeColorStyle(sheet, node).backColor);
+                    sheet.getRange(node.serialNo(), -1, 1, -1).backColor(me.getNodeColorStyle(sheet, node).backColor);
+                    //sheet.setStyle(node.serialNo(), -1, me.getNodeColorStyle(sheet, node));
                 }
             }
         });
@@ -1222,6 +1231,7 @@ var projectObj = {
     }
 
 };
+
 // 点击合计框中的复制
 $("body").on("click", "#total-tips a", function() {
     const totalElement = $(this).parent().siblings("p").find("#total");
@@ -1800,4 +1810,26 @@ function doAfterImport(resData){
             });
         });
     }
-}
+}
+
+
+$(function () {
+
+    $("#billsSpread").mouseover(function(){
+        spreadAutoFocus(projectObj.mainSpread,subSpread);
+    });
+
+    $("#subSpread").mouseover(function(){
+        spreadAutoFocus(subSpread,projectObj.mainSpread);
+    });
+
+    function spreadAutoFocus(spread,relateSpread) {
+        if(relateSpread&&relateSpread.getActiveSheet().isEditing()){//关联的spread不在编辑状态的情况下,才自动获得焦点;
+            return;
+        }else {
+            spread?spread.focus():'';
+        }
+    }
+
+
+});

+ 18 - 0
web/building_saas/main/js/views/std_ration_lib.js

@@ -263,6 +263,17 @@ var rationLibObj = {
             }
         }]
     },
+    getStdRationLibIDs: function () {
+        let ids = [];
+        if(projectInfoObj.projectInfo.engineeringInfo.ration_lib.length === 0){
+            alert('当前项目无定额库,请添加定额库。');
+            return null;
+        }
+        for(let rationLib of projectInfoObj.projectInfo.engineeringInfo.ration_lib){
+            ids.push(rationLib.id);
+        }
+        return ids;
+    },
     getCurrentStdRationLibID:function () {
         if(projectInfoObj.projectInfo.engineeringInfo.ration_lib.length === 0){
             alert('当前项目无定额库,请添加定额库。');
@@ -273,6 +284,13 @@ var rationLibObj = {
         }else {
             return projectInfoObj.projectInfo.engineeringInfo.ration_lib[0].id;
         }
+    },
+    getFirstStdRationLibID: function () {
+        if(projectInfoObj.projectInfo.engineeringInfo.ration_lib.length === 0){
+            alert('当前项目无定额库,请添加定额库。');
+            return null;
+        }
+        return parseInt(projectInfoObj.projectInfo.engineeringInfo.ration_lib[0].id);
     }
 
 };

+ 4 - 4
web/building_saas/pm/html/project-management-Recycle.html

@@ -63,8 +63,8 @@
             <div class="modal-body modal-fixed-height">
                 <p>勾选需要恢复的文件,点“确定”按钮,确认从回收站中恢复。</p>
                 <table class="table table-hover table-sm mb-5">
-                    <thead><tr><th>名称</th><th>删除时间</th><th>勾选</th></tr></thead>
-                    <tbody>
+                    <thead><tr style="display: block;"><th width="266px">名称</th><th width="136px">删除时间</th><th width="64px">勾选</th></tr></thead>
+                    <tbody style="display:block; height: 300px; overflow: auto">
                     <tr><td>XX单价文件</td><td>2017-11-01<br>12:11:43</td><td><input type="checkbox"></td></tr>
                     </tbody>
                 </table>
@@ -89,8 +89,8 @@
             <div class="modal-body modal-fixed-height">
                 <p>勾选需要彻底删除的文件,点“确定”按钮,确认从回收站中删除。</p>
                 <table class="table table-hover table-sm mb-5">
-                    <thead><tr><th>名称</th><th>删除时间</th><th>勾选</th></tr></thead>
-                    <tbody>
+                    <thead><tr style="display: block;"><th width="266px">名称</th><th width="136px">删除时间</th><th width="64px">勾选</th></tr></thead>
+                    <tbody style="display:block; height: 300px; overflow: auto">
                     <tr><td>XX单价文件</td><td>2017-11-01<br>12:11:43</td><td><input type="checkbox"></td></tr>
                     </tbody>
                 </table>

+ 2 - 2
web/building_saas/pm/html/project-management.html

@@ -124,7 +124,7 @@
 
                         <legend>单价文件</legend>
                         <table class="table table-bordered table-hover table-sm" id="summary-project-unit-price-table">
-                            <thead><th style="width: 25px;"></th><th style="width: 330px;">名称</th><th style="width:40px;">使用</th></thead>
+                            <thead><th style="width: 40px;"></th><th style="width: 500px;">名称</th><th style="width:50px;">使用</th></thead>
                             <tbody>
                             <tr><td>1</td><td>A单价文件</td></tr>
                             <tr><td>2</td><td>B单价文件</td></tr>
@@ -135,7 +135,7 @@
 
                         <legend>费率文件</legend>
                         <table class="table table-bordered table-hover table-sm" id="summary-project-fee-table">
-                            <thead><th style="width: 25px;"></th><th style="width: 330px;">名称</th><th style="width:40px;">使用</th></thead>
+                            <thead><th style="width: 40px;"></th><th style="width: 500px;">名称</th><th style="width:50px;">使用</th></thead>
                             <tbody>
                             <tr><td>1</td><td>A费率文件</td></tr>
                             <tr><td>2</td><td>B费率文件</td></tr>

+ 3 - 3
web/building_saas/pm/js/pm_gc.js

@@ -658,14 +658,14 @@ function v_getFiles(type, files, tenders, opr = null){
         if(opr && opr === 'delete'){
             //还被引用,不可删除
             if(hasTheFile(tenders, fileId, type)){
-                html += '<tr><td>'+ recName +'</td><td>' + recTimeA + '<br>' + recTimeB + '</td><td><input disabled name="fileItems" type="checkbox" fileId = "' + fileId + '" fileType = "' + type + '"></td></tr>';
+                html += '<tr><td width="266px">'+ recName +'</td><td width="136px">' + recTimeA + '<br>' + recTimeB + '</td><td width="64px"><input disabled name="fileItems" type="checkbox" fileId = "' + fileId + '" fileType = "' + type + '"></td></tr>';
             }
             else {
-                html += '<tr><td>'+ recName +'</td><td>' + recTimeA + '<br>' + recTimeB + '</td><td><input name="fileItems" type="checkbox" fileId = "' + fileId + '" fileType = "' + type + '"></td></tr>';
+                html += '<tr><td width="266px">'+ recName +'</td><td width="136px">' + recTimeA + '<br>' + recTimeB + '</td><td width="64px"><input name="fileItems" type="checkbox" fileId = "' + fileId + '" fileType = "' + type + '"></td></tr>';
             }
         }
         else{
-            html += '<tr><td>'+ recName +'</td><td>' + recTimeA + '<br>' + recTimeB + '</td><td><input name="fileItems" type="checkbox" fileId = "' + fileId + '" fileType = "' + type + '"></td></tr>';
+            html += '<tr><td width="266px">'+ recName +'</td><td width="136px">' + recTimeA + '<br>' + recTimeB + '</td><td width="64px"><input name="fileItems" type="checkbox" fileId = "' + fileId + '" fileType = "' + type + '"></td></tr>';
         }
     }
     return html;

+ 2 - 2
web/building_saas/pm/js/pm_newMain.js

@@ -553,7 +553,7 @@ const projTreeObj = {
                 //建设项目,侧滑汇总
                 if(node.data.projType === projectType.project && withingClickArea()){
                     setDataToSideBar();
-                    $(".slide-sidebar").animate({width:"450"}).addClass("open");
+                    $(".slide-sidebar").animate({width:"650"}).addClass("open");
                     $('body').unbind('click');
                     setTimeout(function () {
                         $("body").bind('click', function (event) {
@@ -2490,7 +2490,7 @@ function set_file_table(target, poj_tenders, fileList, type){
         let fileId = type === fileType.unitPriceFile ? fileList[i].id : fileList[i].ID;
         let usedObj = getUsedObj(poj_tenders, fileId, type);
         let usedHtml = usedObj.usedCount > 0 ?  '<td class="text-center"><a href="javascript:void(0);">' + usedObj.usedCount + '</a></td>' : '<td class="text-center">' + usedObj.usedCount + '</td>';
-        let hoverHtml = '<p style="display: none"><a class="btn btn-sm" href="javascript:void(0);" data-toggle="modal" data-target="#del-wj">删除</a><a class="btn btn-sm" href="javascript:void(0);">重命名</a></p></div>';
+        let hoverHtml = '<p style="display: none; height: 14px;"><a class="btn btn-sm" href="javascript:void(0);" data-toggle="modal" data-target="#del-wj">删除</a><a class="btn btn-sm" href="javascript:void(0);">重命名</a></p></div>';
         let renHtml = '<div class="input-group" style="display: none;">'
             + '<input class="form-control form-control-sm" value="">'
             + '<span class="input-group-btn">'