Browse Source

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost into 1.0.0_online

chenshilong 6 years ago
parent
commit
c49dbe0f3b

+ 1 - 1
modules/complementary_ration_lib/models/compleRationModel.js

@@ -172,7 +172,7 @@ class CompleRatoinDao {
                          glj = await complementaryGljModel.findOne({uesrId: userId, ID: rationGlj.gljId});
                     }
                     if(isDef(glj)){
-                        hintsArr.push(` ${glj.code} ${glj.name}${glj.specs ? ' ' + glj.specs : ''} ${glj.unit} ${rationGlj.consumeAmt}`);
+                        hintsArr.push(` ${glj.code} ${glj.name}${glj.specs ? '   ' + glj.specs : ''} &nbsp ${glj.unit}   ${rationGlj.consumeAmt}`);
                     }
                 }
                 hintsArr.push(`基价 元 ${ration.basePrice}`);

+ 4 - 0
modules/main/facade/ration_facade.js

@@ -462,6 +462,10 @@ async function CalculateQuantity (ration,billsItemID,projectID) {
     let decimalObject =await decimal_facade.getProjectDecimal(projectID,project);
     let quantity_decimal = (decimalObject&&decimalObject.ration&&decimalObject.ration.quantity)?decimalObject.ration.quantity:3;
     let pbill = await bill_model.model.findOne({projectID:projectID,ID:billsItemID});
+    let  t_unit = ration.unit.replace(/^\d+/,"");
+    if(t_unit!=pbill.unit){//如果定额工程量的单位去除前面的数字后不等于清单单位,定额工程量保持不变
+        return ;
+    }
     let billsQuantity = pbill.quantity ? pbill.quantity : 0;
     let bill_decimal = await decimal_facade.getBillsQuantityDecimal(projectID,pbill.unit,project);
     billsQuantity=scMathUtil.roundForObj(billsQuantity,bill_decimal);

+ 1 - 1
modules/std_billsGuidance_lib/facade/facades.js

@@ -39,7 +39,7 @@ async function getLibWithBills(libID){
     if(!billsLib){
         throw '引用的清单规则库不存在!';
     }
-    let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id -ruleText -recharge');
+    let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id');
     return {guidanceLib: guidanceLib[0], bills};
 }
 

+ 81 - 6
modules/users/controllers/cld_controller.js

@@ -41,25 +41,44 @@ class CLDController {
      */
     async getUsersAndCompilationList(request, response) {
         let mobile = request.query.mobile;
+        let ssoID = request.query.ssoID;
         try {
             //获取用户信息
+            if (mobile === undefined && ssoID === undefined) {
+                throw '传参有误';
+            }
             let userModel = new UserModel();
-            let userData = await userModel.findDataByMobile(mobile);
+            let userData = '';
+            if (mobile !== undefined) {
+                userData = await userModel.findDataByMobile(mobile);
+            } else {
+                userData = await userModel.findDataBySsoId(ssoID);
+            }
             if (userData === null || userData === '') {
                 throw '不存在该建筑用户';
             }
+            userData = JSON.parse(JSON.stringify(userData));
+
+            userData.company_scale = userData.company_scale === null || userData.company_scale === undefined ? '' : userModel.companyScale[userData.company_scale] + '人';
+            userData.company_type = userData.company_type === null || userData.company_type === undefined ? '' : userModel.companyType[userData.company_type];
+            userData.province = userModel.province[userData.province];
+
+            let date = new Date(userData.create_time);
+            userData.create_time = date.getFullYear() + '年' +
+                (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '月' +
+                (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '日';
 
             //获取编办列表
             let compilationModel = new CompilationModel();
-            let compilationList = await compilationModel.getList();
+            let compilationList = JSON.parse(JSON.stringify(await compilationModel.getList()));
             if (userData.upgrade_list !== undefined) {
                 let userUpgradeList = userData.upgrade_list;
-                for (let index in userUpgradeList) {
-                    let oneCompilationIndex = compilationList.findIndex(function (item) {
-                        return item.id === userUpgradeList[index].compilationID;
+                for (let i in userUpgradeList) {
+                    let oneCompilationIndex = await compilationList.findIndex(function (item) {
+                        return item._id === userUpgradeList[i].compilationID;
                     });
                     if (oneCompilationIndex !== -1) {
-                        compilationList[oneCompilationIndex].isUpgrade = userUpgradeList[index].isUpgrade;
+                        compilationList[oneCompilationIndex].isUpgrade = userUpgradeList[i].isUpgrade;
                     }
                 }
             }
@@ -68,6 +87,62 @@ class CLDController {
             response.json({error: 1, msg: err});
         }
     }
+
+    /**
+     * 设置用户编办专业版
+     *
+     * @param request
+     * @param response
+     * @return {Promise.<void>}
+     */
+    async setUsersUpgrade(request, response) {
+        let ssoID = request.body.ssoId;
+        let compilationID = request.body.cid;
+        try {
+
+            let userModel = new UserModel();
+
+            let userData = await userModel.findDataBySsoId(ssoID);
+
+            let compilationModel = new CompilationModel();
+
+            let compilationData = compilationModel.getCompilationById(compilationID);
+
+            if (compilationData === null || compilationData === undefined) {
+                throw '不存在该编办或者编办未发布';
+            }
+
+            let upgrade_list = userData.upgrade_list !== undefined ? JSON.parse(JSON.stringify(userData.upgrade_list)) : [];
+
+            let upgradeIndex = upgrade_list.findIndex(function (item) {
+                return item.compilationID === compilationID
+            });
+
+            let upgradeInfo = {
+                compilationID:compilationID,//编办ID
+                upgrade_time:new Date().getTime(),
+                isUpgrade:true,
+                remark: ''
+            };
+
+            if (upgradeIndex === -1) {
+                upgrade_list.push(upgradeInfo);
+            } else {
+                upgrade_list.splice(upgradeIndex, 1, upgradeInfo);
+            }
+
+            let condition = {ssoId: ssoID};
+            let result = await userModel.updateUser(condition, {upgrade_list: upgrade_list});
+
+            if (result) {
+                response.json({error: 0, msg: 'success'});
+            } else {
+                throw '更新失败';
+            }
+        } catch (err) {
+            response.json({error: 1, msg: err});
+        }
+    }
 }
 
 export default CLDController;

+ 3 - 1
modules/users/routes/cld_route.js

@@ -15,10 +15,12 @@ import CLDController from "../controllers/cld_controller";
 module.exports = function (app) {
     let router = express.Router();
     let cldController = new CLDController();
-    // 登录页面action
+
     router.get('/getCategoryStaff', cldController.getCategoryStaff);
 
     router.get('/getUsersAndCompilation', cldController.getUsersAndCompilationList);
 
+    router.post('/setUserUpgrade', cldController.setUsersUpgrade);
+
     app.use('/cld',router)
 };

+ 88 - 2
public/web/sheet/sheet_common.js

@@ -502,11 +502,36 @@ var sheetCommonObj = {
             if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex() && (!forLocked || forLocked && !sheet.getCell(options.row, options.col).locked())) {
                 return GC.Spread.Sheets.CellTypes.ComboBox.prototype.getHitInfo.apply(this, arguments);
             } else {
-                return GC.Spread.Sheets.CellTypes.Base.prototype.getHitInfo.apply(this, arguments);
+                return  {
+                    x: x,
+                    y: y,
+                    row: options.row,
+                    col: options.col,
+                    cellStyle: cellStyle,
+                    cellRect: cellRect,
+                    sheetArea: options.sheetArea
+                };//GC.Spread.Sheets.CellTypes.Text.prototype.getHitInfo.apply(this, arguments);
             }
         };
         return new ComboCellForActiveCell();
     },
+    getTipsCombo:function (forLocked,tips,setting) {
+        let getTipsCombo = function () {
+
+        };
+        getTipsCombo.prototype = sheetCommonObj.getDynamicCombo(forLocked);
+        if(tips && tips !=""){
+            getTipsCombo.prototype.processMouseEnter = function(hitinfo){
+                console.log(hitinfo);
+                TREE_SHEET_HELPER.delayShowTips(hitinfo,setting,tips);
+            };
+            getTipsCombo.prototype.processMouseLeave = function (hitinfo) {
+                TREE_SHEET_HELPER.hideTipsDiv();
+            };
+        }
+        return new getTipsCombo();
+    },
+
     setDynamicCombo: function (sheet, beginRow, col, rowCount, items, itemsHeight, itemsType) {
         let me = this;
         sheet.suspendPaint();
@@ -739,6 +764,67 @@ var sheetCommonObj = {
             sheet.resumeEvent();
             sheet.resumePaint();
         }
+    },
+    drowRect:function (ctx, x, y, w, h,rectW,rectH,margin) {
+        ctx.save();
+        ctx.strokeStyle = "gray";
+        ctx.translate(0.5, 0.5);
+        ctx.beginPath();
+        let rectX = x + margin;
+        let rectY = y + Math.round(h / 2) - rectH / 2;
+        ctx.moveTo(rectX, rectY);
+        ctx.lineTo(rectX, rectY + rectH);
+        ctx.lineTo(rectX + rectW, rectY + rectH);
+        ctx.lineTo(rectX + rectW, rectY);
+        ctx.lineTo(rectX, rectY);
+        ctx.moveTo(rectX + rectW, y + Math.round(h / 2));
+        ctx.lineTo(rectX + rectW + 5, y + Math.round(h / 2));
+        ctx.stroke();
+        ctx.restore();
+    },
+    drawLine : function (ctx, x1, y1, x2, y2, color) {
+        let l_color = color?color:"gray";
+        ctx.save();
+        ctx.translate(0.5, 0.5);
+        ctx.beginPath();
+        ctx.moveTo(x1, y1);
+        ctx.lineTo(x2, y2);
+        ctx.strokeStyle = l_color;
+        ctx.stroke();
+        ctx.restore();
+    },
+    drowSymbol :function (ctx, x, y, w, h,rectW,rectH,margin,collapsed) {
+        ctx.save();
+        ctx.strokeStyle = "#000000";
+        ctx.translate(0.5, 0.5);
+        ctx.beginPath();
+        ctx.moveTo(x + margin + 2, y + Math.round(h / 2));
+        ctx.lineTo(x + margin + 8, y + Math.round(h / 2));
+        let rectY = y + Math.round(h / 2) - rectH / 2;
+        if (collapsed) {
+            ctx.moveTo(x + margin + rectW / 2, rectY + 2);
+            ctx.lineTo(x + margin + rectW / 2, rectY + 2 + 6);
+        }
+        ctx.stroke();
+        ctx.restore();
+    },
+    drowSubItem: function (ctx, x, y, w, h, offset, hasNext,step) {
+        let t_step = step?step:6;
+        offset += t_step;
+        ctx.save();
+        ctx.strokeStyle = "gray";
+        ctx.translate(0.5, 0.5);
+        ctx.beginPath();
+        ctx.moveTo(x + offset, y);
+        ctx.lineTo(x + offset, y + Math.round(h / 2));
+        offset += 9;
+        ctx.lineTo(x + offset, y + Math.round(h / 2));
+        if (hasNext) {
+            ctx.moveTo(x + offset - 9, y + Math.round(h / 2));
+            ctx.lineTo(x + offset - 9, y + h);
+        }
+        ctx.stroke();
+        ctx.restore();
+        return offset;
     }
-
 }

+ 8 - 2
public/web/tree_sheet/tree_sheet_controller.js

@@ -3,7 +3,7 @@
  */
 
 var TREE_SHEET_CONTROLLER = {
-    createNew: function (tree, sheet, setting) {
+    createNew: function (tree, sheet, setting, loadSheetHeader = true) {
         var controller = function () {
             this.tree = tree;
             this.sheet = sheet;
@@ -12,7 +12,9 @@ var TREE_SHEET_CONTROLLER = {
                 refreshBaseActn: null,
                 treeSelectedChanged: null
             };
-            TREE_SHEET_HELPER.loadSheetHeader(this.setting, this.sheet);
+            if(loadSheetHeader){
+                TREE_SHEET_HELPER.loadSheetHeader(this.setting, this.sheet);
+            }
         };
 
         controller.prototype.showTreeData = function () {
@@ -74,6 +76,10 @@ var TREE_SHEET_CONTROLLER = {
                             sels[0].row = beginRow;
                         }
                         that.sheet.deleteRows(sels[0].row, rowCount);
+                        if(sels[0].row >=  that.tree.items.length){
+                            sels[0].row = that.tree.items.length-1;
+                            sels[0].colCount = 1;
+                        }
                         that.setTreeSelected(that.tree.items[sels[0].row]);
                         that.sheet.setSelection(sels[0].row,sels[0].col,1,sels[0].colCount);
                     });

+ 14 - 6
public/web/tree_sheet/tree_sheet_helper.js

@@ -167,9 +167,9 @@ var TREE_SHEET_HELPER = {
                         let tag ="";
                         if(node.sourceType == ModuleNames.ration){//定额的时候换算子目
                             tag = node.data.adjustState?node.data.adjustState:'';
-                        }else if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示
+                        }/*else if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示  这里改成在 计量单位那里提示
                             tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
-                        }
+                        }*/
                         sheet.setTag(iRow, iCol,tag);
                     }
                     /*if(colSetting.data.field=="name"){ 2018-08-06 改成在编号列悬浮提示
@@ -187,7 +187,7 @@ var TREE_SHEET_HELPER = {
                     cell.value(getFieldText2());
                 }
                 if (colSetting.data.cellType && Object.prototype.toString.apply(colSetting.data.cellType) !== "[object String]") {
-                    cell.cellType(colSetting.data.cellType(node));
+                    cell.cellType(colSetting.data.cellType(node,setting));
                 }
                 if(colSetting.data.autoHeight == true){
                     colSetting.setAutoHeight(cell,node);
@@ -486,7 +486,7 @@ var TREE_SHEET_HELPER = {
                     setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
                 }
                 if(text) text = replaceAll(/[\n]/,'<br>',text);
-                $(this._toolTipElement).html(`<span>${text}</span><div class="triangle-border tb-border"></div><div class="triangle-border tb-background"></div>`);
+                $(this._toolTipElement).html(`<span>${text}</span><div class="triangle-border tb-border_up"></div><div class="triangle-border tb-background_up"></div>`);
                 //清单指引、清单库做特殊处理
                 if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(hitinfo.sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
                     $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
@@ -497,9 +497,15 @@ var TREE_SHEET_HELPER = {
                     $(this._toolTipElement).css("top", setting.pos.y + hitinfo.cellRect.y  -$(this._toolTipElement).height() -20).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
                 } else {
                     //计算显示的初始位置
+               /*   显示在单元格上方,三角形指向下的版本
                     let top = setting.pos.y + hitinfo.cellRect.y -$(this._toolTipElement).height() -26;
                     let left =  setting.pos.x + hitinfo.cellRect.x;
+                    $(this._toolTipElement).css("top", top).css("left", left);*/
+                    //显示在下方,三角形指
+                    let top = setting.pos.y  + hitinfo.cellRect.y+26;
+                    let left =  setting.pos.x + hitinfo.cellRect.x;
                     $(this._toolTipElement).css("top", top).css("left", left);
+
                 }
                 $(this._toolTipElement).show("fast");
                 TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
@@ -527,14 +533,16 @@ var TREE_SHEET_HELPER = {
             }
         },600)
     },
-    delayShowTips:function(hitinfo,setting){//延时显示
+    delayShowTips:function(hitinfo,setting,tips){//延时显示
         let delayTimes = 500; //延时时间
         let now_timeStamp = +new Date();
         TREE_SHEET_HELPER.tipTimeStamp = now_timeStamp;
         setTimeout(function () {
             if(now_timeStamp - TREE_SHEET_HELPER.tipTimeStamp == 0){//鼠标停下的时候才显示
-                let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
                 let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
+                if(tips && tips !=""){ //有tips的话优先显示tips
+                    tag = tips;
+                }
                 if(tag&&tag!=''){
                     TREE_SHEET_HELPER.showTipsDiv(tag,setting,hitinfo);
                 }

+ 4 - 1
web/building_saas/css/custom.css

@@ -96,7 +96,10 @@ legend.legend{
 }
 .tb-background_up {
     top:-11px;
-    border-color:transparent transparent #000 transparent;}
+    border-color:transparent transparent #000 transparent;
+}
+
+
 .elf-options:hover{
     background-color: #CCCCCC;
 }

+ 1 - 1
web/building_saas/js/global.js

@@ -31,7 +31,7 @@ function autoFlashHeight(){
     $(".share-list").height($(window).height()-headerHeight-toolsbarHeight-40);
     $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight);
     $(".form-list").height($(window).height()-headerHeight-50 );
-
+    typeof(adaptiveTzjnrWidth)== 'function' ?adaptiveTzjnrWidth():''
 };
 
 

+ 22 - 11
web/building_saas/main/html/main.html

@@ -111,9 +111,9 @@
                           <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">清单指引</a>
                           </li>
-                          <li class="nav-item">
+                         <!-- <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsTab' relaPanel="#qd">清单规则</a>
-                          </li>
+                          </li>-->
                           <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id="stdRationTab" relaPanel="#de">定额库</a>
                           </li>
@@ -173,9 +173,9 @@
                                       <div class="main-data-bottom ovf-hidden" style="display: none" id="comments">
                                           <textarea class="form-control" rows="8" readonly=""></textarea>
                                       </div>
-                                      <div id="tzjnrCon" class="container-fluid main-data-bottom" style="background: #F1F1F1">
+                                      <div id="tzjnrCon" class="container-fluid main-data-bottom" style="background: #F1F1F1; overflow: hidden">
                                           <div class="row" style="overflow: hidden">
-                                              <div class="col-4 p-0">
+                                              <div class="p-0" id="jobDiv" style="position:relative">
                                                   <div class="main-data-bottom ovf-hidden" id="jobSpread">
                                                   </div>
                                                   <!--工具栏-->
@@ -187,7 +187,7 @@
                                                       <a href="javascript:void(0);" id="jobUp" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
                                                   </div>
                                               </div>
-                                              <div class="col-4 p-0">
+                                              <div class="p-0" id="itemDiv" style="position:relative">
                                                   <div class="main-data-bottom ovf-hidden"  id="itemSpread">
                                                   </div>
                                                   <!--工具栏-->
@@ -199,15 +199,19 @@
                                                       <a href="javascript:void(0);" id="itemUp" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
                                                   </div>
                                               </div>
-                                              <!-- <div class="col-auto p-0">
+                                               <div class="p-0" id="openTypeSetting" >
                                                    <div class="tn-nav d-flex align-items-start flex-column" data-toggle="tooltip" data-placement="left" title="" data-original-title="打开排版规则">
                                                        <span class="mt-3 ml-2 text-primary">排版规则</span>
                                                        <i class="fa fa-arrow-left mt-auto mb-3 text-primary ml-2"></i>
                                                    </div>
-                                               </div>-->
-                                              <div class="col-4 p-0">
+                                               </div>
+                                              <div class="p-0">
                                                   <div class="main-data-bottom" id="add-rule" style="display: none;">
                                                       <div class="container-fluid my-2">
+                                                          <div class="mb-1 row" style="text-align: center">
+                                                              <label class="col-5 px-0 col-form-label text-right">排版规则</label>
+                                                              <a id="closeTypeSetting" data-toggle="tooltip" data-placement="top" data-original-title="关闭排版规则" class="col-7 px-0 col-form-label" href="javascript:void(0);"><i class="fa fa-arrow-right"></i></a>
+                                                          </div>
                                                           <p style="text-align: center">
                                                               <% if (projectData.property.lockBills == true) { %>
                                                               <button class="btn btn-primary btn-sm disabled" type="button" id="use-to-current">应用到选中清单</button>
@@ -307,10 +311,10 @@
                                                   </div>
                                               </div>
                                           </div>
-                                          <div class="col p-0">
+                                          <!--<div class="col p-0">
                                               <button id="guidanceInsertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
                                               <button id="guidanceInsertBills" class="btn btn-primary btn-sm" type="button">插入清单</button>
-                                          </div>
+                                          </div>-->
                                       </div>
                                       <!--搜索结果窗体-->
                                       <div class="side-search-box col-12 p-2" id="billsGuidanceSearchResult" style="display: none;">
@@ -326,6 +330,13 @@
                                       </div>
                                   </div>
                                   <div class="resize" id="zyResize" style="background: #F1F1F1"></div>
+                                  <div class="p-1 row" style="background: #F1F1F1">
+                                      <div class="col">
+                                          <button id="guidanceInsertBills" class="btn btn-primary btn-sm" type="button">插入清单</button>
+                                          <button id="guidanceInsertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
+                                          <button id="guidanceInsertBillsAndRation" class="btn btn-primary btn-sm" type="button">插入清单和定额</button>
+                                      </div>
+                                  </div>
                                   <div class="bottom-content">
                                       <div class="main-data-side-zi" id="billsGuidance_items"></div>
                                   </div>
@@ -742,7 +753,7 @@
                     </div>
                 </div>
                 <div class="modal-footer">
-                    <a href="javascript:void(0);" class="btn btn-primary" id="property_default" data-dismiss="modal">恢复默认系统设置</a>
+                    <a href="javascript:void(0);" class="btn btn-primary" id="property_default" data-dismiss="modal" style="margin-right: 485px">恢复默认系统设置</a>
                     <a href="javascript:void(0);" class="btn btn-primary" id="property_ok" data-dismiss="modal">确定</a>
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                 </div>

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

@@ -100,6 +100,7 @@ function slideResize(eles, limit, type, callback) {
 
     // 鼠标点下时
     resizeElement.mousedown(function(e) {
+        mouseMoveCount = 0;
         drag = true;
         startP = type === 'height' ? e.clientY : e.clientX;
         // 获取左(上)部分的宽度(高度)

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

@@ -168,6 +168,12 @@ let calcTools = {
 
         return flagsArr.includes(flag);
     },
+    isFBFX:function (treeNode) {
+        return projectObj.project.Bills.isFBFX(treeNode);
+    },
+    isTechMeasure:function(treeNode){
+       return projectObj.project.Bills.isTechMeasure(treeNode)
+    },
     getChildrenFormulaNodes: function (self, allFormulaNodesArr, parentNodes){       // 获取结点parentNodes下有公式的子结点
         let nodes = [];
         for (let pn of parentNodes){
@@ -1760,7 +1766,8 @@ class CalcProgram {
             };
 
             // 第1、2部分以外的叶子清单在没有公式的情况下可以手工修改综合单价并参与计算。
-            if(!calcTools.isInheritFrom(treeNode, [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE])){
+            // 2017-09-27 需求改了,除了第 1 、 2.2部分以外,都可以手工修改综合单价、综合合价并参与计算
+            if(!calcTools.isFBFX(treeNode) && !calcTools.isTechMeasure(treeNode)){ // if(!calcTools.isInheritFrom(treeNode, [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE]))
                 if (treeNode.data.feesIndex && treeNode.data.feesIndex.common){
                     let ftObj = {};
                     ftObj.fieldName = 'common';
@@ -1768,8 +1775,7 @@ class CalcProgram {
                     ftObj.totalFee = (ftObj.unitFee * nQ).toDecimal(decimalObj.bills.totalPrice);
                     calcTools.checkFeeField(treeNode, ftObj);
                 }
-            }
-            else{
+            } else{
                 if (treeNode.data.fees && treeNode.data.fees.length > 0){
                     treeNode.data.fees = null;
                     treeNode.data.feesIndex = null;

+ 7 - 6
web/building_saas/main/js/views/character_content_view.js

@@ -28,7 +28,7 @@ let contentOprObj = {
     },
     setRateWith: function (workBookWidth) {
         let me = this;
-        let otherWidthRate = me.setting.header[1]['headerWidth'] / workBookWidth;
+        let otherWidthRate = scMathUtil.roundTo(me.setting.header[1]['headerWidth'] / workBookWidth, -3);
         let contentWidthRate = 1 - otherWidthRate;
         me.setting.header[0]['rateWidth'] = contentWidthRate;
     },
@@ -1475,13 +1475,14 @@ let pageCCOprObj = {
     },
     resizeWidth: function () {
         let workBookWidth = pageCCOprObj.getWorkBookWidth();
-        contentOprObj.setRateWith(workBookWidth);
-        sheetCommonObj.setColumnWidthByRate(workBookWidth, contentOprObj.workBook, contentOprObj.setting.header);
-        characterOprObj.setRateWith(workBookWidth);
-        sheetCommonObj.setColumnWidthByRate(workBookWidth, characterOprObj.workBook, characterOprObj.setting.header);
+        contentOprObj.setRateWith($('#jobDiv').width() - 40);
+        sheetCommonObj.setColumnWidthByRate($('#jobDiv').width() - 40, contentOprObj.workBook, contentOprObj.setting.header);
+        characterOprObj.setRateWith($('#itemDiv').width() - 40);
+        sheetCommonObj.setColumnWidthByRate($('#itemDiv').width() - 40, characterOprObj.workBook, characterOprObj.setting.header);
     }
 }
 
+/*
 $(window).resize(function () {
     pageCCOprObj.resizeWidth();
-});
+});*/

+ 101 - 50
web/building_saas/main/js/views/fee_rate_view.js

@@ -139,8 +139,10 @@ var feeRateObject={
         feeRateObject.feeRateSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick,feeRateObject.onCellDoubleClick);
     },
     showFeeRateTree:function (sheet,setting,data) {
+
         let ch = GC.Spread.Sheets.SheetArea.viewport;
-        let parentMap=_.indexBy(data, 'ParentID');
+        let parentMap=_.groupBy(data, 'ParentID');
+        let visibleMap = {};
         sheet.suspendPaint();
         sheet.suspendEvent();
         for (let col = 0; col < setting.header.length; col++) {
@@ -168,18 +170,13 @@ var feeRateObject={
                 }
                 sheet.setValue(row, col, val, ch);
                 if(col==0){
-                    sheet.getCell(row, 0).textIndent(feeRateObject.getFeeRateLevel(data[row],data));//设置层级,0 为第一层
+                    let treeType = feeRateObject.getTreeNodeCellType(data,row,parentMap);
+                    sheet.getCell(row, 0).cellType(treeType);
+                    visibleMap[data[row].ID] = treeType.collapsed;
+                    if(visibleMap[data[row].ParentID] ) sheet.getRange(row , -1, 1, -1).visible(false);//显示或隐藏
                 }
             }
         }
-        sheet.outlineColumn.options({columnIndex: 0, maxLevel: 10});//设置树结构显示的列,和最大层级
-        for(let i =0;i<data.length;i++){
-            if(parentMap[data[i].ID]){
-                sheet.rowOutlines.setCollapsed(i, true);
-            }
-        }
-        sheet.showRowOutline(false);
-        sheet.outlineColumn.refresh();
         sheet.resumeEvent();
         sheet.resumePaint();
     },
@@ -212,52 +209,63 @@ var feeRateObject={
         feeRateObject.onCellClick({type: 'CellClick'}, {row:rowIdx});
         
         function expandParent(ID,datas,sheet) {//递归展开父节点
-            let index = _.findIndex(datas,{'ID':ID});
-            sheet.rowOutlines.setCollapsed(index, false);
-            if(datas[index].ParentID){
-                expandParent(datas[index].ParentID,datas,sheet)
+             let cellType = setCollapsed(ID);
+             cellType.refreshChildrenVisible(sheet);
+            function setCollapsed(parentID){
+                let index = _.findIndex(datas,{'ID':parentID});
+                let type = sheet.getCellType(index,0);
+                type.collapsed = false;
+                if(datas[index].ParentID){
+                    setCollapsed(datas[index].ParentID)
+                }
+                return type
             }
+
         }
     },
-    getTreeNodeCellType:function () {//这个方法费率已暂时不用了
+    getTreeNodeCellType:function (datas,row,parentMap) {// 2018-09-26  不用spreadjs默认的树结构,自定义控件
         var ns = GC.Spread.Sheets;
+        let rectW = 10;
+        let rectH = 10;
+        let margin = 3;
         function TreeNodeCellType() {
+            this.collapsed = true; //默认是折叠的
+            this.rectInfo = {};
         }
         TreeNodeCellType.prototype = new ns.CellTypes.Text();
         TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            var level = options.sheet.rowOutlines.getLevel(options.row);
-            var nlevel = -1;
-            if (options.row < options.sheet.getRowCount() - 1) {
-                nlevel = options.sheet.rowOutlines.getLevel(options.row + 1);
-            }
-            var hoffset = (level + 2) * 12;
-            x += hoffset;
-            w -= hoffset;
-            GC.Spread.Sheets.CellTypes.Base.prototype.paint.apply(this, arguments);
-            if (options.row == options.sheet.getRowCount() - 1) return; //last row
-            if (nlevel > level) {
-                var collapsed = options.sheet.rowOutlines.isCollapsed(options.row + 1);
-                x--;
-                y += h / 2 - 3;
-                ctx.save();
-                ctx.fillStyle = "black";
-                ctx.beginPath();
-                if (collapsed) {
-                    ctx.moveTo(x - 5, y);
-                    ctx.lineTo(x, y + 3);
-                    ctx.lineTo(x - 5, y + 6);
-                } else {
-                    ctx.moveTo(x, y);
-                    ctx.lineTo(x, y + 5);
-                    ctx.lineTo(x - 5, y + 5);
+            let offset = 0;
+            let step = 7;
+            let level = getTreeLevel(datas[row],datas);//从0开始,取当前节点是第几级的
+            let tem = offset+margin+ rectW/2+step;//两条线之间的间隔
+            let t_offset = offset;
+            let temParentID = datas[row].ParentID;
+            for(let i = level;i>0;i--){//这里是画子节点前面的竖线,从第二级开始
+                let temParent = getParent(temParentID,datas);
+                if(temParent){//父节点有下一个兄弟节点才需要画
+                    if(hasNextBrother(parentMap,temParent)) sheetCommonObj.drawLine(ctx,x+t_offset+tem*i,y,x+t_offset+tem*i,y+h);
+                    temParentID = temParent.ParentID;
                 }
-                ctx.fill();
-                ctx.restore();
+                offset +=tem;
             }
-            else {
-                ctx.save();
-                ctx.restore();
+            offset+=step;
+            if(hasChildern(datas[row].ID,datas)){//如果是有子节点
+                //第一条不用画方框头上那条竖线其它都要
+                if(row !=0) sheetCommonObj.drawLine(ctx,x+offset+ rectW/2+margin,y,x+offset+ rectW/2+margin,y + Math.round(h / 2) - rectH / 2);
+                //画方框下面的那条竖线,如果没有下一个兄弟节点,则不用画
+               if(hasNextBrother(parentMap,datas[row])) sheetCommonObj.drawLine(ctx,x+offset+ rectW/2+margin,y + Math.round(h / 2) + rectH / 2,x+offset+ rectW/2+margin,y + h);
+                sheetCommonObj.drowRect(ctx, x+offset, y, w, h,rectW,rectH,margin);
+                sheetCommonObj.drowSymbol(ctx, x+offset, y, w, h,rectW,rectH,margin, this.collapsed);
+                this.rectInfo = {x:x+offset+margin,rectW:rectW}//计录一下可点击位置
+            }else {
+                let hasNext = datas[row+1]?datas[row+1].ParentID == datas[row].ParentID:false;
+                sheetCommonObj.drowSubItem(ctx, x, y, w, h, offset,hasNext,margin+ rectW/2);
             }
+            offset += step;
+            offset += rectW;
+            x = x + offset;//设置偏移
+            w = w - offset;
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         // override getHitInfo to allow cell type get mouse messages
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
@@ -272,16 +280,59 @@ var feeRateObject={
             };
         }
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
-            var level = hitinfo.sheet.rowOutlines.getLevel(hitinfo.row);
-            var hoffset = (level + 2) * 12 + hitinfo.cellRect.x;
-            if (level==-1&&hitinfo.x < hoffset && hitinfo.x > hoffset - 10) {
-                var collapsed = hitinfo.sheet.rowOutlines.isCollapsed(hitinfo.row + 1);
-                hitinfo.sheet.rowOutlines.setCollapsed(hitinfo.row, !collapsed);
+            if (!_.isEmpty(this.rectInfo)&&hitinfo.x < this.rectInfo.x+this.rectInfo.rectW && hitinfo.x > this.rectInfo.x) {
+                this.collapsed = !this.collapsed;
+                this.refreshChildrenVisible(hitinfo.sheet);
                 hitinfo.sheet.invalidateLayout();
                 hitinfo.sheet.repaint();
             }
         };
+        TreeNodeCellType.prototype.refreshChildrenVisible = function (sheet) {
+            sheet.suspendPaint();
+            sheet.suspendEvent();
+            refreshVisible(datas[row]);
+            sheet.resumeEvent();
+            sheet.resumePaint();
+            function refreshVisible(item){
+                if(parentMap[item.ID]){
+                    for(let sub of parentMap[item.ID]){
+                        refreshVisible(sub)
+                    }
+                }
+                let parent = getParent(item.ParentID,datas);
+                if(parent){
+                    let prow= datas.indexOf(parent);
+                    let visible = !sheet.getCellType(prow,0).collapsed;
+                    let trow = datas.indexOf(item);
+                    sheet.getRange(trow , -1, 1, -1).visible(visible);
+                }
+            }
+        };
         return new TreeNodeCellType()
+
+        function getTreeLevel(item,data) {
+            if(item.ParentID){
+                 let pitem =  _.find(data,{'ID':item.ParentID});
+                 return  getTreeLevel(pitem,data) + 1;
+             }else {
+                 return 0
+             }
+         }
+        function hasChildern(ID,data) {//返回是否有子项
+             let p = _.find(data,{'ParentID':ID});
+             if(p) return true;
+             return false
+         }
+        function getParent(ParentID,data) {
+             let p = _.find(data,{'ID':ParentID});
+             return p;
+         }
+        function hasNextBrother(parentMap,item){
+            let children =parentMap[item.ParentID];
+            if(children && children.indexOf(item) == children.length -1) return false;
+            return true
+        }
+
     },
     getFeeRateEditCellType:function () {
         var ns = GC.Spread.Sheets;

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

@@ -1280,56 +1280,6 @@ var gljOprObj = {
         function TreeNodeCellType() {
             this.ctx = null;
         }
-        function drowRect(ctx, x, y, w, h) {
-            ctx.save();
-            ctx.strokeStyle = "gray";
-            ctx.translate(0.5, 0.5);
-            ctx.beginPath();
-            let rectX = x + margin;
-            let rectY = y + Math.round(h / 2) - rectH / 2;
-            ctx.moveTo(rectX, rectY);
-            ctx.lineTo(rectX, rectY + rectH);
-            ctx.lineTo(rectX + rectW, rectY + rectH);
-            ctx.lineTo(rectX + rectW, rectY);
-            ctx.lineTo(rectX, rectY);
-            ctx.moveTo(rectX + rectW, y + Math.round(h / 2));
-            ctx.lineTo(rectX + rectW + 5, y + Math.round(h / 2));
-            ctx.stroke();
-            ctx.restore();
-        }
-        function drowSymbol(ctx, x, y, w, h, collapsed) {
-            ctx.save();
-            ctx.strokeStyle = "#000000";
-            ctx.translate(0.5, 0.5);
-            ctx.beginPath();
-            ctx.moveTo(x + margin + 2, y + Math.round(h / 2));
-            ctx.lineTo(x + margin + 8, y + Math.round(h / 2));
-            let rectY = y + Math.round(h / 2) - rectH / 2;
-            if (collapsed) {
-                ctx.moveTo(x + margin + rectW / 2, rectY + 2);
-                ctx.lineTo(x + margin + rectW / 2, rectY + 2 + 6);
-            }
-            ctx.stroke();
-            ctx.restore();
-        }
-        function drowSubItem(ctx, x, y, w, h, offset, nextItem) {
-            offset += 6;
-            ctx.save();
-            ctx.strokeStyle = "gray";
-            ctx.translate(0.5, 0.5);
-            ctx.beginPath();
-            ctx.moveTo(x + offset, y);
-            ctx.lineTo(x + offset, y + Math.round(h / 2));
-            offset += 9;
-            ctx.lineTo(x + offset, y + Math.round(h / 2));
-            if (nextItem && nextItem.isMixRatio) {
-                ctx.moveTo(x + offset - 9, y + Math.round(h / 2));
-                ctx.lineTo(x + offset - 9, y + h);
-            }
-            ctx.stroke();
-            ctx.restore();
-            return offset;
-        }
         TreeNodeCellType.prototype =  comboboxOptions?sheetCommonObj.getDynamicCombo():new ns.CellTypes.Text();
         TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
             this.ctx= ctx;
@@ -1345,11 +1295,12 @@ var gljOprObj = {
                 let offset = margin + rectW + 6;
                 let recode = data[options.row];
                 if (recode && recode.hasOwnProperty('subList')) {
-                    drowRect(ctx, x, y, w, h);
+                    sheetCommonObj.drowRect(ctx, x, y, w, h,rectW,rectH,margin);
                     let collapsed = recode.collapsed == undefined ? true : recode.collapsed;//options.sheet.getTag(options.row,options.col);
-                    drowSymbol(ctx, x, y, w, h, collapsed);
+                    sheetCommonObj.drowSymbol(ctx, x, y, w, h,rectW,rectH,margin, collapsed);
                 } else if (recode && recode.isMixRatio) {
-                    offset = drowSubItem(ctx, x, y, w, h, offset, data[options.row + 1]);
+                    let hasNext = data[options.row + 1] && data[options.row + 1].isMixRatio;
+                    offset = sheetCommonObj.drowSubItem(ctx, x, y, w, h, offset,hasNext);
                     offset += 1;
                 }
                 arguments[2] = x + offset;
@@ -1376,6 +1327,9 @@ var gljOprObj = {
         };
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
             let recode = data[hitinfo.row];
+            if(hitinfo.x < hitinfo.cellRect.x+hitinfo.cellRect.width -15){
+                hitinfo.sheet.setTag(hitinfo.row,hitinfo.col,"locked")//通过这个来控制除了点击下拉框的三角形,点击其它地方不充许进入编辑状态,不然不好控制下拉框超出页面后调整滚动条
+            }
             if (recode && recode.hasOwnProperty('subList')) {
                 let hoffset = hitinfo.cellRect.x + 3;
                 if (hitinfo.x > hoffset && hitinfo.x < hoffset + 10) {
@@ -1393,8 +1347,6 @@ var gljOprObj = {
                 hitinfo.sheet.setTag(hitinfo.row,hitinfo.col,"");
                 sheetCommonObj.scrollSheetForOption(hitinfo.sheet,this.ctx,hitinfo.cellRect,hitinfo.row,comboboxOptions);//下拉框超出显示后自动调整滚动条
                 GC.Spread.Sheets.CellTypes.ComboBox.prototype.processMouseDown.apply(this, arguments);
-            }else {
-                hitinfo.sheet.setTag(hitinfo.row,hitinfo.col,"locked")//通过这个来控制除了点击下拉框的三角形,点击其它地方不充许进入编辑状态,不然不好控制下拉框超出页面后调整滚动条
             }
         };
         let cellType = new TreeNodeCellType();

+ 27 - 19
web/building_saas/main/js/views/main_tree_col.js

@@ -100,7 +100,18 @@ let MainTreeCol = {
             return node.data.subType != 201 && node.data.subType != 4 && node.data.subType != 5
         },
         commonUnitFee: function (node) {
-            return !(calcTools.isLeafBill(node) && !calcTools.isBill_DXFY(node) && !calcTools.isCalcBaseBill(node) && !calcTools.isInheritFrom(node, [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE]));
+            // 09-29 zhang
+            let Bills =projectObj.project.Bills;
+            // 当前属于分部分项、施工技术措施项目,综合单价只读。
+            if(Bills.isFBFX(node)||Bills.isTechMeasure(node)){
+                return true;
+            }
+            // 不属于分部分项、施工技术措施项目的部分,如果不是叶子清单,或有基数计算/定额/量价/人材机 只读
+            if(!calcTools.isLeafBill(node)||calcTools.isCalcBaseBill(node)||node.children.length > 0){
+                return true;
+            }
+            return false;
+            //return !(calcTools.isLeafBill(node) && !calcTools.isBill_DXFY(node) && !calcTools.isCalcBaseBill(node) && !calcTools.isInheritFrom(node, [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE]));
         },
         //根据节点、父节点类型判断是否可用计算基数
         calcBaseType: function (node) {
@@ -238,14 +249,18 @@ let MainTreeCol = {
         }
     },
     cellType: {
-        unit: function () {
-            //let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
-            let dynamicCombo = sheetCommonObj.getDynamicCombo(true);
+        unit: function (node,setting) {
+            let tips = "";
+            //在这里做要不要显示的判断
+             if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示
+                tips = node.data.itemCharacterText?node.data.itemCharacterText:'';
+             }
+             console.log(setting);
+            let dynamicCombo = sheetCommonObj.getTipsCombo(true,tips,setting);//sheetCommonObj.getDynamicCombo(true);
             dynamicCombo.itemHeight(10).items(['m', 'm2', 'm3', 'km', 't', 'kg', '台班', '工日', '昼夜', '元', '项', '处', '个', '件',
                 '根', '组', '系统', '台', '套', '株', '丛', '缸', '支', '只', '块', '座', '对', '份', '樘', '攒', '榀']).editable(true);
             return dynamicCombo;
         },
-
         units: function () {
             this.unit;
         },
@@ -481,10 +496,13 @@ let colSettingObj = {
                 switchTznrHtml(false);
             }
         }
-        projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {
-            projectID: projectObj.project.ID(),
-            main_tree_col: projectObj.project.projSetting.main_tree_col
-        });
+        //别人分享过来的项目,打开时,“显示特征”按钮应有效,不影响数据的修改
+        if(!projectReadOnly){
+            projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {
+                projectID: projectObj.project.ID(),
+                main_tree_col: projectObj.project.projSetting.main_tree_col
+            });
+        }
     },
     setVisible: function (field, visible) {
         let mainTreeCols = projectObj.project.projSetting.main_tree_col.cols;
@@ -530,26 +548,16 @@ let colSettingObj = {
 };
 
 function switchTznrHtml(show) {
-    if(projectReadOnly){
-        return;
-    }
     if(show){
-        /*$('#switchTznr').attr('data-original-title', '显示特征');
-        $('#switchTznr').find('i').removeClass('fa-eye-slash');
-        $('#switchTznr').find('i').addClass('fa-eye');*/
         $('#switchTznr').html('<i class="fa fa-eye" aria-hidden="true"></i> 显示特征');
     }
     else {
-       /* $('#switchTznr').attr('data-original-title', '隐藏特征');
-        $('#switchTznr').find('i').removeClass('fa-eye');
-        $('#switchTznr').find('i').addClass('fa-eye-slash');*/
         $('#switchTznr').html('<i class="fa fa-eye-slash" aria-hidden="true"></i> 隐藏特征');
     }
 }
 
 $('#switchTznr').click(function () {
     let me = colSettingObj;
-    //let cur = $(this).attr('data-original-title');
     let cur = $(this).text();
     if(cur.includes('显示特征')){
         switchTznrHtml(false);

+ 8 - 5
web/building_saas/main/js/views/project_glj_view.js

@@ -1202,8 +1202,8 @@ $(function () {
             changeUnitPriceId = $("#self-file").val();
             if(!changeUnitPriceId){
                 alert('单价文件不可为空');
-                return;
             }
+            submitFileChange(changeUnitPriceId,type);
         } else {
             // 从其他项目中复制
             changeUnitPriceId = $("#other-file").val();
@@ -1214,14 +1214,17 @@ $(function () {
                     $("#newUnitFileID").val(changeUnitPriceId);
                     $("#newUnitFileName").val(newName);
                 }else {
-                    let data = {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type};
-                    projectObj.project.projectGLJ.changeFile(data,function () {
-                        projectGljObject.changeFileCallback();
-                    })
+                    submitFileChange(changeUnitPriceId,type);
                 }
             });
         }
 
+        function submitFileChange(changeUnitPriceId,type)  {
+            let data = {project_id: scUrlUtil.GetQueryString('project'), change_id: changeUnitPriceId, type: type};
+            projectObj.project.projectGLJ.changeFile(data,function () {
+                projectGljObject.changeFileCallback();
+            })
+        }
     });
     // 单价文件选项切换
     $("input[name='change-type']").change(function () {

+ 45 - 20
web/building_saas/main/js/views/project_view.js

@@ -197,7 +197,7 @@ var projectObj = {
         return value;
     },
     checkSpreadEditingText: function (editingText, colSetting) {
-        if (colSetting.data.field === 'contain') {//colSetting.data.field === 'quantity'
+        if (colSetting.data.field === 'contain'||colSetting.data.field === 'feesIndex.common.unitFee'|| colSetting.data.field === 'feesIndex.common.totalFee') {//colSetting.data.field === 'quantity'
             return this.checkFormulaValidField(editingText, colSetting);
         }
         else if (colSetting.data.field === 'programID') {
@@ -448,17 +448,34 @@ var projectObj = {
             else if(fieldName ==='contain'){//编辑含量
                 project.Ration.updateContain(value,node);
             }
-            else if (fieldName === 'quantity' || fieldName === 'marketUnitFee' || fieldName === 'feesIndex.common.unitFee' || fieldName === 'programID' ||
+            else if (fieldName === 'quantity' || fieldName === 'marketUnitFee' || fieldName === 'feesIndex.common.unitFee'||fieldName === 'feesIndex.common.totalFee' || fieldName === 'programID' ||
                 fieldName === 'subType' || fieldName === 'calcBase' || fieldName === 'isSubcontract'){
                 if (fieldName === 'quantity') {
                     quantityEditObj.checkingAndUpdate(editingText,node);
                    // project.quantity_detail.editMainTreeNodeQuantity(value,node,fieldName,editingText);
                     return;
-                }
-                else if (fieldName === 'marketUnitFee' || fieldName === 'feesIndex.common.unitFee') {
-                    if (value) {value = parseFloat(value).toDecimal(decimalObj.decimal("unitPrice", node))};
-                }
-                else if (fieldName === 'calcBase') {
+                } else if (fieldName === 'marketUnitFee' || fieldName === 'feesIndex.common.unitFee'||fieldName === 'feesIndex.common.totalFee') {
+                    if(isNaN(value)){//说明输入的是无效的字符
+                        //value == null && editingText!=null && editingText!=""
+                        alert("当前输入的数据类型不正确,请重新输入。");
+                        projectObj.mainController.refreshTreeNode([node]);
+                        return
+                    }
+                    if (value) {
+                        if(fieldName === 'feesIndex.common.unitFee')  value = parseFloat(value).toDecimal(decimalObj.decimal("unitPrice", node));
+                        if(fieldName === 'feesIndex.common.totalFee'){//修改了综合合价后,反算综合单价,然后再由计算程序算个综合合价出来
+                            let unitfee = 0;
+                            if(node.data.quantity){//如果工程量为0或空,综合合单直接填到综合单价
+                                let t_quantity = scMathUtil.roundForObj(node.data.quantity,getDecimal("quantity",node));
+                                value = scMathUtil.roundForObj(value,getDecimal("unitPrice", node));
+                                unitfee = scMathUtil.roundForObj(value/t_quantity,getDecimal("totalPrice", node));
+                            }else {
+                                unitfee = scMathUtil.roundForObj(value,getDecimal("totalPrice", node));
+                            }
+                            calcTools.setFieldValue(node, 'feesIndex.common.unitFee', unitfee);
+                        }
+                    }
+                } else if (fieldName === 'calcBase') {
                     //zhong
                     if(value === undefined ||value === null || value.toString().trim() === ''){
                         value = '';
@@ -482,20 +499,17 @@ var projectObj = {
 
                 project.calcProgram.calcAndSave(node);
                 gljOprObj.showRationGLJSheetData();
-            }
-            else if (node.sourceType === project.Bills.getSourceType()&&fieldName === 'unit'){//修改清单单位的时候清单工程量要重新4舍5入
+            } else if (node.sourceType === project.Bills.getSourceType()&&fieldName === 'unit'){//修改清单单位的时候清单工程量要重新4舍5入
                 node.data[fieldName] = value;
                 node.changed = true;
                 if(node.data.quantity){
                     node.data.quantity =scMathUtil.roundForObj(node.data.quantity,getDecimal("quantity",node));
                 }
                 project.calcProgram.calcAndSave(node);
-            }
-            else {
+            } else {
                 if (node.sourceType === project.Bills.getSourceType()) {
                     project.Bills.updateField(node.source, fieldName, value, false);
-                }
-                else if (node.sourceType === project.Ration.getSourceType()) {
+                } else if (node.sourceType === project.Ration.getSourceType()) {
                     project.Ration.updateField(node.source, fieldName, value);
                 }
                 if (colSetting.data.wordWrap) {
@@ -503,11 +517,9 @@ var projectObj = {
                 }
                 projectObj.mainController.refreshTreeNode([node]);
             }
-        }
-        else if(value==null && fieldName ==='feeRate'){
+        } else if(value==null && fieldName ==='feeRate'){
             project.FeeRate.cleanFeeRateID(node);
-        }
-        else {
+        } else {
             projectObj.mainController.refreshTreeNode([node], false);
         }
     },
@@ -568,7 +580,7 @@ var projectObj = {
         let code = node.data.code ? node.data.code : '';
         if(node.sourceType == ModuleNames.bills){//当清单是“分部分项工程”、“措施项目工程”时,要展开清单规则节点
             if(BILLS.isFXorBX(node)||(node.data.type == billType.BILL && BILLS.isMeasure(node))){//是分项或补项,是清单并且属于措施项目节点
-                if(billsLibObj.stdBillsTree === null){
+              /*  if(billsLibObj.stdBillsTree === null){
                     billsLibObj.doAfterLoadBills = function () {
                         this.locateAtBills(code);
                         this.doAfterLoadBills = null;
@@ -577,7 +589,18 @@ var projectObj = {
                 else {
                     billsLibObj.locateAtBills(code);
                 }
-                if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();
+                if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();*/
+                if(!billsGuidance.bills.tree){
+                    doAfterLoadGuidance = function () {
+                        billsGuidance.locateAtBills(code);
+                        doAfterLoadGuidance = null;
+                    }
+                } else {
+                    billsGuidance.locateAtBills(code);
+                }
+                if(!$("#zy").is(":visible"))  {
+                    $('#stdBillsGuidanceTab').click();
+                }
             }
         }
         if(node.sourceType == ModuleNames.ration){ //在定额编码中双击,如果右侧定额库没有展开,则自动展开。
@@ -2777,7 +2800,7 @@ function disableTools(){
     $('#upMove').addClass('disabled');
     $('#downMove').addClass('disabled');
     $('#ZLFB_btn').addClass('disabled');
-    $('#switchTznr').addClass('disabled');
+    //$('#switchTznr').addClass('disabled');
     $('#uploadLj').addClass('disabled');
     $('#uploadGld').addClass('disabled');
     $('a[name="lockBills"]').addClass('disabled');
@@ -2790,6 +2813,8 @@ function disableTools(){
     //呈现选项
     $('#display-setting').find('input').prop('disabled', 'disabled');
     $('#recColSetting').remove();
+    //项目属性恢复默认系统设置
+    $('#property_default').addClass('disabled');
     //项目属性确定
     $('#property_ok').addClass('disabled');
     //特征及内容

+ 5 - 2
web/building_saas/main/js/views/side_tools.js

@@ -12,10 +12,12 @@ sideResizeEles.farElement = $('.main-side');
 sideResizeEles.farSpread = $('.main-side');
 sideResizeEles.nav = null;
 slideResize(sideResizeEles, {min: 250, max: $('#zaojiashu').width()-260}, 'width', function(){
+    adaptiveTzjnrWidth();
     pageCCOprObj.resizeWidth();
     projectObj.refreshMainSpread();
     refreshSubSpread();
     if(sideResizeEles.id === 'stdBillsGuidanceTab'){
+        billsGuidance.setColumnWidthByRate(billsGuidance.elfItem.workBook, $('#zy').width(), billsGuidance.elfItem.headers)
         billsGuidance.refreshWorkBook();
     }
     else if(sideResizeEles.id === 'stdRationTab'){
@@ -86,8 +88,8 @@ var sideToolsObj = {
         if (show) {
             if(id === 'stdBillsGuidanceTab'){
                 //billsGuidance.refreshInsertRation();
-                sideResizeEles.nearElement.css('width', '72%');
-                sideResizeEles.farElement.css('width', '28%');
+                sideResizeEles.nearElement.css('width', '66.666667%');
+                sideResizeEles.farElement.css('width', '33.333333%');
             }
             else {
                 sideResizeEles.nearElement.css('width', '66.666667%');
@@ -119,6 +121,7 @@ var sideToolsObj = {
             sideResizeEles.farElement.css('width', '0%');
             tabPanel.hide();
         }
+        adaptiveTzjnrWidth();
         autoFlashHeight();
         pageCCOprObj.resizeWidth();
         billsGuidance.refreshWorkBook();

+ 76 - 13
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -8,6 +8,9 @@
  * @version
  */
 
+//清单指引/精灵获取完清单数据后的回调函数
+let doAfterLoadGuidance = null;
+
 const billsGuidance = (function () {
     let currentLib = null;
     //库类型
@@ -33,7 +36,7 @@ const billsGuidance = (function () {
             headRowHeight: [40],
             defaultRowHeight: 21,
             cols: [{
-                width: 160,
+                width: 140,
                 readOnly: true,
                 head: {
                     titleNames: ["项目编码"],
@@ -50,7 +53,7 @@ const billsGuidance = (function () {
                     font: "Arial"
                 }
             }, {
-                width: 220,
+                width: 190,
                 readOnly: true,
                 head: {
                     titleNames: ["项目名称"],
@@ -70,7 +73,6 @@ const billsGuidance = (function () {
                {
                 width: 45,
                 readOnly: true,
-                showHint: true,
                  head: {
                      titleNames: ["计量单位"],
                      spanCols: [1],
@@ -89,8 +91,8 @@ const billsGuidance = (function () {
             ]
         },
         headers: [
-            {name: '项目编码', dataCode: 'code', width: 160, vAlign: 'center', hAlign: 'left', formatter: '@'},
-            {name: '项目名称', dataCode: 'name', width: 220, vAlign: 'center', hAlign: 'left', formatter: '@'},
+            {name: '项目编码', dataCode: 'code', width: 140, vAlign: 'center', hAlign: 'left', formatter: '@'},
+            {name: '项目名称', dataCode: 'name', width: 190, vAlign: 'center', hAlign: 'left', formatter: '@'},
             {name: '单位', dataCode: 'unit', width: 45, vAlign: 'center', hAlign: 'center', formatter: '@'},
         ],
         events: {
@@ -126,11 +128,11 @@ const billsGuidance = (function () {
                         } else {
                             ConfirmModal.stdBillsUnit.check(node.data, function (std) {
                                 canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
-                                if(canAdd !== null || canAdd !== false){
+                               /* if(canAdd !== null || canAdd !== false){
                                     //插入选中的定额
                                     let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
                                     insertRations(addRationDatas);
-                                }
+                                }*/
                                 if(canAdd === false && $.bootstrapLoading.isLoading()){
                                     $.bootstrapLoading.end();
                                 }
@@ -143,11 +145,11 @@ const billsGuidance = (function () {
                     }
                     else {
                         let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, node);
-                        if(insert){
+                        /*if(insert){
                             //插入选中的定额
                             let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
                             insertRations(addRationDatas);
-                        }
+                        }*/
                     }
                 }
                 else {
@@ -317,8 +319,8 @@ const billsGuidance = (function () {
             ]
         },
         headers: [
-            {name: '施工工序', dataCode: 'name', width: 250, vAlign: 'center', hAlign: 'center', formatter: '@'},
-            {name: '选项', dataCode: 'options', width: 250, vAlign: 'center', hAlign: 'left', formatter: '@'},
+            {name: '施工工序', dataCode: 'name', width: 250, rateWidth: 0.5, vAlign: 'center', hAlign: 'center', formatter: '@'},
+            {name: '选项', dataCode: 'options', width: 250, rateWidth: 0.5,  vAlign: 'center', hAlign: 'left', formatter: '@'},
         ],
         events: {
             CellClick: function (sender, args) {
@@ -398,6 +400,27 @@ const billsGuidance = (function () {
             workBook.bind(Events[event], events[event]);
         }
     }
+    //根据宽度比例设置列宽
+    //@param {Object}workBook {Number}workBookWidth {Array}headers @return {void}
+    function setColumnWidthByRate(workBook, workBookWidth, headers) {
+        if(workBook){
+            const sheet = workBook.getActiveSheet();
+            sheet.suspendEvent();
+            sheet.suspendPaint();
+            for(let col = 0; col < headers.length; col++){
+                if(headers[col]['rateWidth'] !== undefined && headers[col]['rateWidth'] !== null && headers[col]['rateWidth'] !== ''){
+                    sheet.setColumnWidth(col, workBookWidth * headers[col]['rateWidth'], GC.Spread.Sheets.SheetArea.colHeader)
+                }
+                else {
+                    if(headers[col]['headerWidth'] !== undefined && headers[col]['headerWidth'] !== null && headers[col]['headerWidth'] !== ''){
+                        sheet.setColumnWidth(col, headers[col]['headerWidth'], GC.Spread.Sheets.SheetArea.colHeader)
+                    }
+                }
+            }
+            sheet.resumeEvent();
+            sheet.resumePaint();
+        }
+    }
     //建表
     //@param {Object}module @return {void}
     function buildSheet(module) {
@@ -425,6 +448,10 @@ const billsGuidance = (function () {
             }
             setOptions(module.workBook, options);
             buildHeader(module.workBook.getActiveSheet(), module.headers);
+            if(module === elfItem){
+                console.log($('#zy').width());
+                setColumnWidthByRate(elfItem.workBook, $('#zy').width(), elfItem.headers)
+            }
             bindEvent(module.workBook, module.events);
         }
     }
@@ -449,7 +476,7 @@ const billsGuidance = (function () {
     //@param {Object}module {Object}sheet {Object}treeSetting {Array}datas
     function initTree(module, sheet, treeSetting, datas){
         module.tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
-        module.controller = TREE_SHEET_CONTROLLER.createNew(module.tree, sheet, treeSetting);
+        module.controller = TREE_SHEET_CONTROLLER.createNew(module.tree, sheet, treeSetting, false);
         module.tree.loadDatas(datas);
         if(module === bills){
             initExpandStat();
@@ -917,6 +944,24 @@ const billsGuidance = (function () {
             }
         });
     }
+    //根据编码定位至清单精灵库中
+    //
+    function locateAtBills(code) {
+        let nineCode = code.substring(0, 9);
+        let items = bills.tree.items;
+        let locateBills = _.find(items, function(item){
+            return item.data.code === nineCode;
+        });
+        if(locateBills){
+            expandSearchNodes([locateBills]);
+            sessionStorage.setItem('stdBillsGuidanceExpState', bills.tree.getExpState(bills.tree.items));
+        }
+        let sheet = bills.workBook.getActiveSheet();
+        let locateRow = locateBills ? locateBills.serialNo() : 0;
+        sheet.setActiveCell(locateRow, 0);
+        billsInitSel(locateRow);
+        sheet.showRow(locateRow, GC.Spread.Sheets.VerticalPosition.center);
+    }
     //初始选择清单指引库
     //@param {Number}libID @return {void}
     function libInitSel(libID){
@@ -955,6 +1000,9 @@ const billsGuidance = (function () {
             setTagForHint(bills.tree.items);
             //默认初始节点
             billsInitSel(0);
+            if(doAfterLoadGuidance){
+                doAfterLoadGuidance();
+            }
             $.bootstrapLoading.end();
         }, function () {
             $.bootstrapLoading.end();
@@ -1148,6 +1196,21 @@ const billsGuidance = (function () {
             }
             if(bills.tree.selected.children.length === 0){
                 let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, bills.tree.selected);
+                /*if(insert){
+                    //插入选中的定额
+                    let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
+                    insertRations(addRationDatas);
+                }*/
+            }
+        });
+        //插入清单和定额
+        $('#guidanceInsertBillsAndRation').click(function () {
+            //插入清单
+            if(!bills.tree || !bills.tree.selected){
+                return;
+            }
+            if(bills.tree.selected.children.length === 0){
+                let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, bills.tree.selected);
                 if(insert){
                     //插入选中的定额
                     let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
@@ -1246,7 +1309,7 @@ const billsGuidance = (function () {
         }
     }
 
-    return {initViews, bindBtn, refreshWorkBook, refreshInsertRation, bills};
+    return {initViews, bindBtn, refreshWorkBook, refreshInsertRation, setColumnWidthByRate, locateAtBills, bills, elfItem};
 })();
 
 $(document).ready(function(){

+ 37 - 10
web/building_saas/main/js/views/sub_view.js

@@ -118,13 +118,35 @@ $("#linkZMHS").click(function(){        // 子目换算
 
     gljOprObj.activeTab='#linkZMHS';
 });
-
-tabZMHS
+//特征及内容各模块宽度自适应
+function adaptiveTzjnrWidth() {
+    if(gljOprObj.activeTab !== '#linkTZJNR'){
+        return;
+    }
+    //排版规则工具条宽度
+    const typeSettingWidth = 30;
+    let tzjnrWidth = $('#tzjnrCon').width() + 30;
+    //let tzjnrWidth = $(window).width() - $('.main-nav').width() - $('.main-side').width();
+    if($('#add-rule').is(':visible')){
+        $('#jobDiv').css('width', tzjnrWidth / 3);
+        $('#itemDiv').css('width', tzjnrWidth / 3);
+        $('#add-rule').css('width', tzjnrWidth / 3);
+    } else{
+        $('#jobDiv').css('width', tzjnrWidth / 2);
+        $('#itemDiv').css('width', tzjnrWidth / 2 - typeSettingWidth);
+        $('#openTypeSetting').css('width', typeSettingWidth);
+    }
+    pageCCOprObj.resizeWidth();
+    refreshSubSpread();
+}
 //特征及内容
 $("#linkTZJNR").click(function () {
+    gljOprObj.activeTab='#linkTZJNR';
     $("#subItems").children().hide();
     $("#tzjnrCon").show();
-    $("#add-rule").show();
+    adaptiveTzjnrWidth();
+    pageCCOprObj.resizeWidth();
+    //$("#add-rule").show();
     $("#add-rule p").not(":first").css('margin-bottom', 4);
     pageCCOprObj.active = true;
     refreshSubSpread();
@@ -134,13 +156,18 @@ $("#linkTZJNR").click(function () {
     }
     pageCCOprObj.mainActiveCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];
     pageCCOprObj.setCacheAndShow(selectedNode);
-   /* if(selectedNode && selectedNode.sourceType === projectObj.project.Bills.getSourceType()){
-        pageCCOprObj.setCacheAndShow(selectedNode);
-    }
-    else{
-        pageCCOprObj.clearData();
-    }*/
-    gljOprObj.activeTab='#linkTZJNR';
+});
+//打开排版规则
+$('#openTypeSetting').click(function () {
+    $('#add-rule').show();
+    $(this).hide();
+    adaptiveTzjnrWidth();
+});
+//关闭排版规则
+$('#closeTypeSetting').click(function () {
+    $('#add-rule').hide();
+    $('#openTypeSetting').show();
+    adaptiveTzjnrWidth();
 });
 
 //应用到选中清单、应用到所有,添加位置列如果隐藏了,则重新显示

+ 3 - 0
web/building_saas/pm/js/pm_newMain.js

@@ -292,6 +292,9 @@ const projTreeObj = {
                         $('#share').modal('show');
                         $('#allowCopy').prop('checked', false);
                         $('#allowCopyHint').hide();
+                        setTimeout(function () {
+                            $('#sharePhone').focus();
+                        }, 200);
                     }
                 },
                 "spr3": '--------',

+ 2 - 2
web/common/html/header.html

@@ -58,11 +58,11 @@
                     <a class="dropdown-item" href="#">关于</a>
                 </div>
             </li>
-            <li class="nav-item">
+          <!--  <li class="nav-item">
                 <a class="nav-link <% if (unreadCount > 0) { %>new-msg<% } %>" id="notify-info" data-toggle="modal" data-target="#msg" href="javacript:void(0);">
                     <i class="fa fa-envelope-o" aria-hidden="true"></i>&nbsp;<span id="unread-num"><%= unreadCount %></span>
                 </a>
-            </li>
+            </li>-->
         </ul>
     </div>
 </nav>