Преглед изворни кода

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

TonyKang пре 7 година
родитељ
комит
c0348501ca

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

@@ -109,12 +109,11 @@ var sheetCommonObj = {
             area.vAlign(GC.Spread.Sheets.VerticalAlign.center);
         }
     },
-    showData: function(sheet, setting, data,distTypeTree) {
+    showData: function(sheet, setting, data,distTypeTree,callback) {
         var me = this, ch = GC.Spread.Sheets.SheetArea.viewport;
         sheet.suspendPaint();
         sheet.suspendEvent();
         //sheet.addRows(row, 1);
-
         sheet.clear(0, 0, sheet.getRowCount(), sheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
         if(sheet.getRowCount()<data.length){
             data.length<30? sheet.setRowCount(30):sheet.setRowCount(data.length);
@@ -159,6 +158,7 @@ var sheetCommonObj = {
             }
         }
         this.lockCells(sheet,setting);
+        if(callback) callback();
         sheet.resumeEvent();
         sheet.resumePaint();
         //me.shieldAllCells(sheet);
@@ -468,6 +468,72 @@ var sheetCommonObj = {
         };*/
         sheet.setCellType(row, col,this.getSelectButton(header.headerWidth),GC.Spread.Sheets.SheetArea.viewport);
     },
+    getCusButtonCellType:function (callback,readOnly=false) {
+        var ns = GC.Spread.Sheets;
+        function CusButtonCellType() {
+        }
+        CusButtonCellType.prototype = new ns.CellTypes.Text();
+        CusButtonCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
+
+            if(!readOnly){
+                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
+                    var image = document.getElementById('f_btn'),imageMagin = 3;
+                    var imageHeight = 15;
+                    var imageWidth = 25;
+                    var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
+                    ctx.save();
+                    ctx.fillStyle = style.backColor;
+                    ctx.fillRect(x,y,w,h);
+                    ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
+                    ctx.beginPath();
+                    ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
+                    ctx.arc(imageX+imageWidth/2-4,imageY+imageHeight/2,1,0,360,false);
+                    ctx.arc(imageX+imageWidth/2+4,imageY+imageHeight/2,1,0,360,false);
+                    ctx.fillStyle="black";//填充颜色,默认是黑色
+                    ctx.fill();//画实心圆
+                    ctx.closePath();
+                    ctx.restore();
+                    w = w - imageWidth - imageMagin;
+                    //这里的左对齐的,当显示的字长度超过空白地方时,要改成右对齐
+                    if(style.hAlign == 0){
+                        if(value){
+                            let textWidth = ctx.measureText(value).width;
+                            let spaceWidth = w;
+                            if(spaceWidth<textWidth){
+                                style.hAlign = 2;
+                            }
+                        }
+                    }
+                }
+            }
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
+        };
+        CusButtonCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
+            return {
+                x: x,
+                y: y,
+                row: context.row,
+                col: context.col,
+                cellStyle: cellStyle,
+                cellRect: cellRect,
+                sheetArea: context.sheetArea
+            };
+        };
+
+        CusButtonCellType.prototype.processMouseDown = function (hitinfo) {
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
+                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
+                var imageWidth = 25;
+                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
+                    if(!readOnly){
+                        if(callback) callback(hitinfo)
+                    }
+                }
+            }
+        };
+        return new CusButtonCellType();
+    },
+
     getSelectButton(cellWidth=100){
 
         function moreButton() {

+ 10 - 27
web/building_saas/complementary_glj_lib/js/glj.js

@@ -503,7 +503,7 @@ let repositoryGljObj = {
     },
     onButtonClicked: function (sender, args) {
         let me = repositoryGljObj;
-        if(args.col === 6 && args.row < me.currentCache.length){
+        if(me.setting.header[args.col].dataCode === 'isComplementary' && args.row < me.currentCache.length){
             args.sheet.setValue(args.row, args.col, true);
         }
     },
@@ -1035,11 +1035,9 @@ let repositoryGljObj = {
             updateBasePrcArr = [] ,
             updateCount, resumeArr = [];
         if(endRow <= maxRow){
-            //updateItems = items;
             for(let i = 0; i < items.length; i++){
                 let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
                 if(updateObj && typeof updateObj.updateGlj !== 'undefined' && updateObj.updateGlj.length > 0){
-                    //updateArr = updateObj.updateGlj;
                     updateArr = updateArr.concat(updateObj.updateGlj);
                     if(typeof updateObj.updateBasePrcArr !== 'undefined'){
                         updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrcArr);
@@ -1052,36 +1050,24 @@ let repositoryGljObj = {
             for(let i = 0; i < updateCount; i++){
                 let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
                 if(updateObj && typeof updateObj.updateGlj !== 'undefined'){
-                    //updateArr = updateObj.updateGlj;
                     updateArr = updateArr.concat(updateObj.updateGlj);
                     if(typeof updateObj.updateBasePrcArr !== 'undefined'){
                         updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrcArr);
                     }
                 }
             }
-            if(info.cellRange.colCount === me.setting.header.length -1){
-                for(let i = updateCount ; i < items.length; i++){
-                    if(me.isValidObj(items[i])){
-                        items[i].component = [];
-                        //类型为混凝土、砂浆、配合比、机械时,基价只能组成物计算
-                        /* if(me.allowComponent.indexOf(items[i].gljType) !== -1){
-                         items[i].basePrice = 0;
-                         }*/
-                        addArr.push(items[i]);
-                    }
+            for(let i = updateCount ; i < items.length; i++){
+                if(me.isValidObj(items[i])){
+                    items[i].component = [];
+                    addArr.push(items[i]);
                 }
             }
         }
         else{
-            if(info.cellRange.colCount === me.setting.header.length -1){
-                for(let i = 0; i < items.length; i++){
-                    if(me.isValidObj(items[i])){
-                        items[i].component = [];
-                        /*if(me.allowComponent.indexOf(items[i].gljType) !== -1){
-                         items[i].basePrice = 0;
-                         }*/
-                        addArr.push(items[i]);
-                    }
+            for(let i = 0; i < items.length; i++){
+                if(me.isValidObj(items[i])){
+                    items[i].component = [];
+                    addArr.push(items[i]);
                 }
             }
         }
@@ -1163,10 +1149,7 @@ let repositoryGljObj = {
             me.showGljItems(me.complementaryGljList, me.gljCurTypeId);
             //getCurrentGlj
             let row = me.workBook.getSheet(0).getSelections()[0].row;
-            me.currentGlj = row < me.currentCache.length ? me.currentCache[row] : null;
-            me.currentComponent = me.currentGlj ?  me.getCurrentComponent(me.currentGlj.component) : [];
-            sheetOpr.cleanData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, -1);
-            sheetOpr.showData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, me.currentComponent);
+            me.initSel(row);
         }
         let errCaller = function (err) {
             alert('保存失败');

+ 1 - 1
web/building_saas/glj/html/project_glj.html

@@ -31,7 +31,7 @@
         </div>
         <div class="main-content col p-0" id="project-glj-main" style="overflow: hidden;">
             <div class="top-content" id="projectGljTop" style="overflow: hidden">
-                <div class="main-data-top" style="width: 100% " id="project_glj_sheet">
+                <div class="main-data-top" style="width: 100%; overflow: hidden" id="project_glj_sheet">
                 </div>
             </div>
             <div class="resize-y" id="projectGljResize"></div>

+ 0 - 1
web/building_saas/main/html/calc_program_manage.html

@@ -10,7 +10,6 @@
 
 <body>
     <div style="">
-        <img id="f_btn" src="/web/dest/css/img/feeRate_btn.jpg" alt="" style="display: none" />
     </div>
     <div class="toolsbar px-1" />
     <div class="container-fluid">

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

@@ -260,7 +260,7 @@
                                           <div class=" main-data-bottom ovf-hidden col-auto p-0" id="gljItemTab" style="width: 30px">
                                               <div class="rn-nav d-flex align-items-start flex-column gljSubTab">
                                                   <div id="zmhs_toogle">
-                                                      <div class="tn-nav d-flex align-items-start flex-column" data-toggle="tooltip" data-placement="left" title="" data-original-title="打开子目换算">
+                                                      <div class=" 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>
@@ -437,19 +437,48 @@
                                               </div>
                                           </div>
                                       </div>
-                                      <div class="container-fluid" id="qdjl" role="tabpanel">
-                                          <div class="row p-0" style="background: #efefef">
-                                              <div class="col-6 p-0">
-                                                  <div id="qdjlTools" style="width: calc(100% - 5px); border-bottom: solid 1px lightgrey">
-                                                      <a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary px-1 m-1">应用选项</a>
-                                                      <a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary px-1">应用单条</a>
+                                      <div class="main-data-bottom ovf-hidden" id="qdjl" style="float: left" >
+                                          <div class="p-0" style="background: #efefef">
+                                              <div class=" p-0">
+                                                  <div id="qdjlTools" style="width: calc(100% - 5px); border-bottom: solid 1px lightgrey;">
+                                                      <a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary px-1 ml-1">应用选项</a>
+                                                      <a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary px-1 ml-1">应用单条</a>
                                                   </div>
-                                                  <div class="main-data-bottom ovf-hidden" id="elfItems">
+                                                  <div class="ovf-hidden" id="elfItems">
                                                   </div>
                                               </div>
-                                              <div class="col-6 p-1">
-                                                  <!--<p class="mt-3"><a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary">应用选项</a></p>
-                                                  <p><a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary">应用单条</a></p>-->
+                                          </div>
+                                      </div>
+                                      <div class="main-data-bottom ovf-hidden" id="xmtzTextDiv">
+                                          <div class="resize-x main-data-bottom ovf-hidden" id="tzrgResize" style="display: none"></div>
+                                          <div class="item_spread main-data-bottom ovf-hidden " id="tzSubDiv" style="width: 99%;">
+                                              <div class="tab-content">
+                                                  <div class="tab-pane" id="xmtz_tab" style="margin-top:-2px">
+                                                      <div class="main-data-bottom" id="tzCharacterText" >
+                                                          项目特征 内容
+                                                      </div>
+                                                  </div>
+                                              </div>
+                                          </div>
+                                          <div class=" main-data-bottom ovf-hidden col-auto p-0" id="tzItemTab" style="width: 30px">
+                                              <div class="rn-nav d-flex align-items-start flex-column QDSubTab">
+                                                  <div id="tz_toogle">
+                                                      <div class=" 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>
+                                                  <!--<a  role="tab" class="zmhs-link nav-link">子目换算</a>-->
+                                                  <div id="tz_nav" style="display: none">
+                                                      <ul class="nav nav-tabs">
+                                                          <li class="nav-item" data-toggle="tooltip" data-placement="left" title="收起">
+                                                              <a data-toggle="tab" href="#rnc-close" role="tab" class="zmhs-link nav-link">收起<!--<i class="fa fa-arrow-right"></i>--></a>
+                                                          </li>
+                                                          <li class="nav-item" data-toggle="tooltip" data-placement="left" title="项目特征">
+                                                              <a data-toggle="tab" id="tz-nav" href="#xmtz_tab" role="tab" class="zmhs-link nav-link">特征<!--<i class="fa fa-info-circle"></i>--></a>
+                                                          </li>
+                                                      </ul>
+                                                  </div>
                                               </div>
                                           </div>
                                       </div>

+ 7 - 2
web/building_saas/main/js/controllers/material_controller.js

@@ -213,10 +213,15 @@ let MaterialController = {
         sheetCommonObj.showData(this.sheet, this.setting,this.datas);
         this.sheet.setRowCount(this.datas.length);
     },
-    showItemCharacterText:function (node) {
+    showItemCharacterText:function (node,eleID = 'itemCharacterText') {
         let text="";
         let selected = node?node:projectObj.project.mainTree.selected;
         let parent = selected.parent;
+        if(eleID != 'itemCharacterText'){//如果是清单精灵里显示的,parent就是本身
+            parent = selected
+        }
+
+
         if(selected&&parent){
             text = parent.data.itemCharacterText?parent.data.itemCharacterText.replace(/\n/g,"<br>"):"";
         }
@@ -228,7 +233,7 @@ let MaterialController = {
         }*/
         //$('#replaceM').css('margin-top',0);
         //this.toggleItemInit();
-        $("#itemCharacterText").html(text);
+        $("#"+eleID).html(text);
     },
     //初始化人材机和项目特征文本两个区域的宽度,改变窗口大小时调用此方法,实时刷新
     initItemWidth: function () {

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

@@ -179,7 +179,6 @@ ProjectController = {
     },
 
     addRation: function (project, sheetController, rationType, std) {
-        debugger;
         if (!project || !sheetController) { return; }
 
         let selected = project.mainTree.selected, newSource = null, newNode = null;

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

@@ -64,7 +64,7 @@ function getMainResizeEles() {
         min: 180,
         max: `$(window).height()-$('.header').height()-$('#headerToolsBar').height()-180-5`,
         notTopSpread: 0,
-        notBottomSpread: $('#bottom_div ul').height() + $('#qdjlTools').height(),
+        notBottomSpread: $('#bottom_div ul').height(),
         totalHeight: `$(window).height()-$('.header').height()-$('#headerToolsBar').height()-5`
     };
     return mainResizeEles;

+ 58 - 38
web/building_saas/main/js/models/calc_base.js

@@ -77,6 +77,7 @@ let cbTools = {
         if(this.isUnDef(exp) || exp === ''){
             return rst;
         }
+        let findChildNodes = [];//直接引用的节点,这些节点可能存在子节点,子节点才有公式,因此获取这些节点的子公式节点
         //获取表达式中的基数和行引用
         let figureF = cbParser.getFigureF(cbParser.getFigure(exp), cbParser.getUID(cbParser.getFIDArr(exp)));
         //首先提取出多处引用的进行排序
@@ -86,35 +87,32 @@ let cbTools = {
                 let bill = this.isDef(calcBase.baseFigures[figure.value]['fixedBill']) ? calcBase.baseFigures[figure.value]['fixedBill']['bill'] : null;
                 let figureMultiRef = calcBase.baseFigures[figure.value]['multiRef'];
                 if(this.isDef(figureMultiRef)){
-                    let findChildNodes = [];
                     for(let flag of figureMultiRef){
                         let refNode = this.findBill(flag) ? this.getNodeByID(this.findBill(flag).ID) : null;
-                        if(refNode){
+                        if(refNode && !ids.includes(refNode.data.ID)){
                             findChildNodes.push(refNode);
+                            ids.push(refNode.data.ID);
                         }
                     }
-                    let childrenNodes = calcTools.getChildrenFormulaNodes(node, formulaNodesArr, findChildNodes);
-                    for(let cNode of childrenNodes){
-                        ids.push(cNode.data.ID);
-                    }
-                    rst = rst.concat(childrenNodes);
-                }
-                else if(this.isDef(bill) && ids.indexOf(bill.ID) === -1){
+                } else if(this.isDef(bill) && ids.indexOf(bill.ID) === -1){
                     let node = this.getNodeByID(bill.ID);
-                    if(this.isDef(node)){
+                    if(this.isDef(node) && !ids.includes(node.data.ID)){
+                        findChildNodes.push(node);
                         ids.push(node.data.ID);
-                        rst.push(node);
                     }
                 }
-            }
-            else if(figure.type === 'id'){
+            } else if(figure.type === 'id'){
                 let node = this.getNodeByID(figure.value);
-                if(this.isDef(node) && ids.indexOf(node.data.ID) === -1){
+                if (this.isDef(node) && !ids.includes(node.data.ID)) {
+                    findChildNodes.push(node);
                     ids.push(node.data.ID);
-                    rst.push(node);
                 }
             }
         }
+        if (findChildNodes.length > 0) {
+            let childrenNodes = calcTools.getChildrenFormulaNodes(node, formulaNodesArr, findChildNodes);
+            rst = rst.concat(childrenNodes);
+        }
         return rst;
     },
     //需要用到计算基数的时候,先找出所有的固定清单,避免每个基数都要去遍历寻找清单
@@ -1385,27 +1383,10 @@ let cbAnalyzer = {
                             billsIDs.push(bills.ID);
                         }
                     }
-                }
-              /*  if(figure.value === '税前工程造价'){
-                    //税前工程造价算法在措施项目已排除自身,税前工程造价与措施项目无会造成循环的引用关系
-                    let subEngineering = cbTools.findBill(calcBase.fixedFlag.SUB_ENGINERRING),
-                        other = cbTools.findBill(calcBase.fixedFlag.OTHER),
-                        charge = cbTools.findBill(calcBase.fixedFlag.CHARGE);
-                    if(subEngineering){
-                        billsIDs.push(subEngineering.ID);
-                    }
-                    if(other){
-                        billsIDs.push(other.ID);
-                    }
-                    if(charge){
-                        billsIDs.push(charge.ID);
-                    }
-                }*/
-                else {
+                } else {
                     billsIDs = cbTools.isDef(baseFigures[figure.value]['fixedBill']) ? [baseFigures[figure.value]['fixedBill']['bill']['ID']] : [];
                 }
-            }
-            else if(figure.type === 'id'){
+            } else if(figure.type === 'id'){
                 let node = cbTools.getNodeByID(figure.value);
                 billsIDs = cbTools.isDef(node) ? [node.data.ID] : [];
             }
@@ -1427,6 +1408,9 @@ let cbAnalyzer = {
         }
         function isCycle(billIDs){
             stack = Array.from(new Set(stack.concat(billIDs)));
+            /*if (checkStack(stack, sIDs)) {
+                return true;
+            }*/
             for(let i = 0, len = billIDs.length; i < len; i++){
                 let block = cbTools.getStackBlock(billIDs[i]);
                 if(block.length > 0){
@@ -1513,9 +1497,9 @@ let cbParser = {
         let fidArr = exp.match(fidRex);
         return cbTools.isDef(fidArr) ? fidArr : [];
     },
-    //获取表达式中的中文式,没有{}需求时
+    //获取表达式中的中文式
     getCN: function(expr){
-        let rst = [];
+       /* let rst = [];
         let cnRex = /[^\u4e00-\u9fa5]/;
         let temp = expr.split(cnRex);
         //暂估材料费特殊处理:CN(CN)
@@ -1535,7 +1519,11 @@ let cbParser = {
                 rst.push(temp[i]);
             }
         }
-        return rst;
+        return rst;*/
+        let cnRex = /[\u4e00-\u9fa5]{1,}\({0,}[\u4e00-\u9fa5]{0,}\){0,}[\u4e00-\u9fa5]{0,}/g;
+        return _.filter(expr.match(cnRex), function (data) {
+            return data
+        });
     },
     //获取表达式中的基数
     getFigure: function(expr){
@@ -1629,7 +1617,7 @@ let cbParser = {
     },
     //将表达式转换为可编译的表达式
     toCompileExpr: function(v){
-        if(v === ''){
+        /*if(v === ''){
             return '$CBC.base(\'NONE\')';
         }
         //基数
@@ -1670,6 +1658,38 @@ let cbParser = {
             fExps[i].compileExp = '$CBC.ref(\'' + fExps[i].orgExp + '\')';
             v = v.replace(new RegExp(fExps[i].orgExp, 'g'), fExps[i].compileExp);
         }
+        return v;*/
+        if(v === ''){
+            return '$CBC.base(\'NONE\')';
+        }
+        //基数
+        let strs = _.uniq(this.getFigure(v));
+        let exps = [];
+        for(let i = 0, len = strs.length; i < len; i++){
+            let exp = Object.create(null);
+            exp.orgExp = `{${strs[i]}}`;
+            exps.push(exp);
+        }
+        for(let i = 0, len = exps.length;i < len; i++){
+            exps[i].compileExp = '$CBC.base(\'' + exps[i].orgExp + '\')';
+            let regStr = exps[i].orgExp.replace(/\(/g, '\\\(');
+            regStr = regStr.replace(/\)/g, '\\\)');
+            v = v.replace(new RegExp(regStr, 'g'), exps[i].compileExp);
+        }
+        //去{}
+        v = v.replace(/[{, },]/g, '');
+        //行引用
+        let fidArr = this.getFIDArr(v);
+        let fExps = [];
+        for(let i = 0, len = fidArr.length; i < len; i++){
+            let fExp = Object.create(null);
+            fExp.orgExp = fidArr[i];
+            fExps.push(fExp);
+        }
+        for(let i = 0, len = fExps.length; i < len; i++){
+            fExps[i].compileExp = '$CBC.ref(\'' + fExps[i].orgExp + '\')';
+            v = v.replace(new RegExp(fExps[i].orgExp, 'g'), fExps[i].compileExp);
+        }
         return v;
     }
 };

+ 18 - 4
web/building_saas/main/js/models/quantity_detail.js

@@ -801,7 +801,7 @@ var quantity_detail = {
             //value = scMathUtil.roundForObj(value,getDecimal("ration.quantity"));
             value = project.quantity_detail.autoTransformQuantity(value,node);//先转换再4舍5入
             value = scMathUtil.roundForObj(value,decimalObj.decimal("quantity",node));
-            if( quantityEXP!="GCLMXHJ" && oldQuantityEXP == node.data.quantityEXP && node.data.quantity == value){ //除了修改工程量明细表达式进来的操作,相当于什么都没改,不用做提交操作
+            if( quantityEXP!="MBGCL"&& quantityEXP!="GCLMXHJ" && oldQuantityEXP == node.data.quantityEXP && node.data.quantity == value){ //除了修改工程量明细表达式和模析子目进来的操作,相当于什么都没改,不用做提交操作
                 projectObj.mainController.refreshTreeNode([node]);//这里要再刷新一下,因为工程量要把手工输入的值刷新为转换后的值再显示
                 return;
             }
@@ -813,9 +813,18 @@ var quantity_detail = {
                 node.data.contain=0;
             }
             node.changed = true;
-            project.calcProgram.calcAndSave(node, function () {
+            let rationNodes = mbzm_obj.updateReferenceRationNodeQuantity(node);
+            rationNodes.push(node);
+            project.calcProgram.calcNodesAndSave(rationNodes, function () {
                 project.projectGLJ.calcQuantity();
-                if(project.Bills.isFBFX(node)) { //判断是否属于分部分项工程 ,是的话才需要做计取安装费计算
+                let calcInstall = false;
+                for(let t of rationNodes){
+                    if(project.Bills.isFBFX(t)){//判断是否属于分部分项工程 ,是的话才需要做计取安装费计算
+                        calcInstall = true;
+                        break;
+                    }
+                }
+                if(calcInstall == true) {
                     project.installation_fee.calcInstallationFee(function (isChange,rations) {
                         if(isChange){
                             project.calcProgram.calcNodesAndSave(rations);
@@ -823,7 +832,12 @@ var quantity_detail = {
                     });
                 }
             });
-            projectObj.mainController.refreshTreeNode(node.children);//刷新子工料机总消耗量
+            let childrenNodes = [];
+            for(let r of rationNodes){
+                childrenNodes = childrenNodes.concat(r.children)
+            }
+            if(childrenNodes.length > 0) projectObj.mainController.refreshTreeNode(childrenNodes);//刷新子工料机总消耗量
+            mbzm_obj.refreshSheetData();
             gljOprObj.refreshView();
         };
         quantity_detail.prototype.getDecimal=function (node) {

+ 10 - 6
web/building_saas/main/js/views/billsElf.js

@@ -212,8 +212,14 @@ const BillsElf = (function() {
     //刷新表
     //@return {void}
     function refreshWorkBook(){
-        if (elfItem.workBook) {
-            elfItem.workBook.refresh();
+        //计算内部的表格高度
+        if ($('#qdjl').is(':visible')) {
+            let totalHeight = $('#qdjl').height(),
+                elfToolsHeight = $('#qdjlTools').height();
+            $('#elfItems').height(totalHeight - elfToolsHeight);
+            if (elfItem.workBook) {
+                elfItem.workBook.refresh();
+            }
         }
     }
     //清空表数据
@@ -572,11 +578,9 @@ const BillsElf = (function() {
                 $editor.css("width", cellRect.width);
                 $editor.attr("gcUIElement", "gcEditingInput");
                 //编辑文本框距离浏览器的top
-                let top = $('.header').height() + $('#zaojiashu').find('.toolsbar').height() + $('#top_div').height() + $('#bottom_div_ul').height() + 1 + $('.resize-y').height();
-                let activeCellTop = $editor.parent().parent().css('top');
-                activeCellTop = parseFloat(activeCellTop.replace('px', ''));
+                let top = $('.header').height() + $('#zaojiashu').find('.toolsbar').height() + $('#top_div').height() + $('#bottom_div_ul').height() + $('#qdjlTools').height() + $('.resize-y').height();
                 let node = bills.selected.elf.tree.items[elfSheet.getActiveRowIndex()];
-                setOptionsDiv($editor, node, cellRect, cellStyle, top + activeCellTop);
+                setOptionsDiv($editor, node, cellRect, cellStyle, top + cellRect.y);
                 this.isEscKey = false;
             }
         }

+ 21 - 72
web/building_saas/main/js/views/calc_base_view.js

@@ -355,18 +355,15 @@ let calcBaseView = {
         }
         CalcBaseCellType.prototype = new ns.CellTypes.Text();
         CalcBaseCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            //  if(value!=null){
-            // ctx.fillText(value,x+3+ctx.measureText(value).width,y+h-3);
-            // ctx.fillText(value,x+w-3,y+h-3);
-            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-            // }
-            if(calcBaseView.editingCell && !projectReadOnly && calcBaseView.ifEdit(type, options.row)){
-                if(calcBaseView.editingCell.row==options.row&&calcBaseView.editingCell.col==options.col){
+            if(!projectReadOnly && calcBaseView.ifEdit(type, options.row)){
+                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
-                    var imageHeight = h-2*imageMagin;
-                    var imageWidth = w*2/(type=='bills'?7:20);
+                    var imageHeight = 15;
+                    var imageWidth = 25;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     ctx.save();
+                    ctx.fillStyle = style.backColor;
+                    ctx.fillRect(x,y,w,h);
                     ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
                     ctx.beginPath();
                     ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
@@ -376,8 +373,10 @@ let calcBaseView = {
                     ctx.fill();//画实心圆
                     ctx.closePath();
                     ctx.restore();
+                    w = w - imageWidth - imageMagin;
                 }
             }
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         CalcBaseCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
@@ -390,29 +389,18 @@ let calcBaseView = {
                 sheetArea: context.sheetArea
             };
         };
-        /*CalcBaseCellType.prototype.processMouseDown = function (hitinfo) {
-            let me=calcBaseView;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                var showSelectBtn = true;
-                if(hitinfo.sheet.name()!='calc_detail'){
-                    showSelectBtn=me.ifEdit(type, hitinfo.row);
-                }
-                if(showSelectBtn){
-                    me.editingCell={
-                        row:hitinfo.row,
-                        col:hitinfo.col
-                    }
-                    hitinfo.sheet.invalidateLayout();
-                    hitinfo.sheet.repaint();
-                }
-            }else if(hitinfo.row==me.editingCell.row){
+        CalcBaseCellType.prototype.processMouseDown = function (hitinfo) {
+            let me = calcBaseView;
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
                 var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageMagin=3;
-                var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                var imageWidth = hitinfo.cellRect.width*2/7;
+                var imageWidth = 25;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
                     if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
+                        let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+                        if(hitinfo.sheet.getParent() === projectObj.mainSpread){
+                            projectObj.mainController.setTreeSelected(node);
+                        }
+                        hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
                         calcBaseView.confirmBtn.attr('toggle', 'calcBase');
                         changeCalcBaseFeeRate('calcBase');
                         $('#tabCalcBase').tab('show');
@@ -421,65 +409,26 @@ let calcBaseView = {
                 }
             }
         };
-        CalcBaseCellType.prototype.processMouseLeave = function (hitinfo) {
-            if(!calcBaseView.pmLeave){
-                calcBaseView.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                calcBaseView.pmLeave = true;
-            }
-        };*/
         CalcBaseCellType.prototype.processMouseDown = function (hitinfo) {
             let me = calcBaseView;
-            if(me.editingCell && hitinfo.row==me.editingCell.row){
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
                 var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageMagin=3;
-                var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                var imageWidth = hitinfo.cellRect.width*2/7;
+                var imageWidth = 25;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
                     if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
                         hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
                         if(hitinfo.sheet.getParent() === projectObj.mainSpread){
-                            projectObj.project.mainTree.selected = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+                            let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+                            projectObj.mainController.setTreeSelected(node);
                         }
                         calcBaseView.confirmBtn.attr('toggle', 'calcBase');
                         changeCalcBaseFeeRate('calcBase');
                         $('#tabCalcBase').tab('show');
                         calcBaseView.initCalctor(type);
                     }
-                }else {//鼠标点击其它地方,消失
-                    hideButton(hitinfo);
-                }
-            }
-        };
-        CalcBaseCellType.prototype.processMouseEnter = function (hitinfo){
-            let me = calcBaseView;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                var showSelectBtn = true;
-                showSelectBtn=me.ifEdit(type, hitinfo.row);
-                if(showSelectBtn){
-                    me.editingCell={
-                        row:hitinfo.row,
-                        col:hitinfo.col
-                    };
-                    hitinfo.sheet.invalidateLayout();
-                    hitinfo.sheet.repaint();
                 }
             }
         };
-        CalcBaseCellType.prototype.processMouseLeave = function (hitinfo) {
-            hideButton(hitinfo);
-        };
-
-        function hideButton(hitinfo) {
-            if(!calcBaseView.pmLeave){
-                calcBaseView.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                calcBaseView.pmLeave = true;
-            }
-        }
         return new CalcBaseCellType();
     },
 };

+ 14 - 11
web/building_saas/main/js/views/glj_view.js

@@ -568,6 +568,7 @@ var gljOprObj = {
         this.detailSheet.getRange(-1, 0, -1, this.detailSetting.header.length).locked(true);//锁住工程量明细的所有列
     },
     showRationGLJData: function (node) {
+        let startTime = +new Date();
         let gljList = [];
         let ration_glj = projectObj.project.ration_glj;
         node = node ? node : projectObj.project.mainTree.selected;
@@ -584,24 +585,26 @@ var gljOprObj = {
         }
     },
     showRationGLJSheetData: function (init) {
+        let me = this;
         let selected = this.sheet.getSelections();
         this.combineWithProjectGlj(this.sheetData);
         this.sheet.setRowCount(0);
         this.sheetData = gljUtil.sortRationGLJ(this.sheetData);
         this.sumQuantity();//计算总消耗量
         this.addMixRatioToShow();//显示组成物信息
+        let itreeTime = +new Date();
         this.initRationTree(init,this.getUnitPriceCodeMap());
-        sheetCommonObj.showData(this.sheet, this.setting, this.sheetData);
-        if(this.mainTreeSelectedChange == true){
-            this.sheet.setSelection(0,1,1,1);//默认选中第一行,第二列(名称列)
-            this.mainTreeSelectedChange = false;
-        }else if(selected){//定位光标到之前的位置
-            this.sheet.setSelection(selected[0].row,selected[0].col,selected[0].rowCount,selected[0].colCount);
-        }
-        //初始选择
-        this.preGljSelection = null;
-        this.sheetInitSelection({row: this.sheet.getActiveRowIndex(), col: this.sheet.getActiveColumnIndex()});
-
+        sheetCommonObj.showData(this.sheet, this.setting, this.sheetData,null,function () {
+            if(me.mainTreeSelectedChange == true){
+                me.sheet.setSelection(0,1,1,1);//默认选中第一行,第二列(名称列)
+                me.mainTreeSelectedChange = false;
+            }else if(selected){//定位光标到之前的位置
+                me.sheet.setSelection(selected[0].row,selected[0].col,selected[0].rowCount,selected[0].colCount);
+            }
+            //初始选择
+            me.preGljSelection = null;
+            me.sheetInitSelection({row: me.sheet.getActiveRowIndex(), col: me.sheet.getActiveColumnIndex()});
+        });
     },
     getSelectedRationGlj:function () {
         let selected = this.sheet.getSelections()[0];

+ 74 - 10
web/building_saas/main/js/views/mbzm_view.js

@@ -17,7 +17,7 @@ let mbzm_obj={
             {headerName: "模板类别", headerWidth: 260, dataCode: "name", dataType: "String", hAlign: "left"},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center",getText:'forUnit'},
             {headerName: "系数", headerWidth: 65, dataCode: "coe", dataType: "Number",validator:"number"},
-            {headerName: "工程量", headerWidth: 65, dataCode: "quantity", dataType: "Number",validator:"number"},
+            {headerName: "工程量", headerWidth: 65, dataCode: "quantity", dataType: "Number",validator:"number",getText:'forQuantity'},//这里做成当系数不为0时,动态生成工程量,同步更新太麻烦
             {headerName: "关联类别", headerWidth: 100, dataCode: "type", dataType: "String"},
             {headerName: "清单位置", headerWidth: 200, dataCode: "position", hAlign: "left", dataType: "String",cellType:'selectButton',getText:'forPosition'},
         ],
@@ -34,6 +34,9 @@ let mbzm_obj={
             },
             forUnit:function (item) {//这里显示的单位是去掉定额单位前面的数字的结果
                return item.unit &&_.isString(item.unit)?item.unit.replace(/^\d+/,""):""
+            },
+            forQuantity:function (item) {
+                return mbzm_obj.getQuantity(item);
             }
         }
     },
@@ -68,7 +71,7 @@ let mbzm_obj={
         this.spread?this.spread.refresh():this.initSpread();
     },
     refreshSheetData:function () {
-        sheetCommonObj.showData(this.sheet, this.setting,this.datas);
+        if($('#mbzmSpread').is(':visible')) sheetCommonObj.showData(this.sheet, this.setting,this.datas);
     },
     showMBZMData:function(node){
         let selected = node?node:projectObj.project.mainTree.selected;
@@ -105,11 +108,8 @@ let mbzm_obj={
             me.refreshSheetData();
             return;
         }
-        if (dataCode === 'coe') {//默认为0,可输入数值,输入数值后,后面的工程量=混凝土子目工程量*系数。
-            let rationQuantity = selected.data.quantity;
-            rationQuantity = rationQuantity?scMathUtil.roundForObj(rationQuantity, getDecimal('ration.quantity')):0;
-            value = scMathUtil.roundForObj(value, getDecimal('process'));
-            recode["quantity"] = scMathUtil.roundForObj(rationQuantity * value, getDecimal('ration.quantity'))+"";
+        if (dataCode === 'coe') {//  //为了避免各种同步更新,后面的工程量改成实时动态计算,所以这里更新为0
+            recode["quantity"] = "0";
         }
         if (dataCode === 'quantity') {//定额默认显示为0,可输入数值,输入数值后,则清空前面的系数列
             value = scMathUtil.roundForObj(value, getDecimal('ration.quantity'))+"";
@@ -118,6 +118,21 @@ let mbzm_obj={
         recode[dataCode] = value;
         me.refreshSheetData();
     },
+    getQuantity:function(item){//当系数不为0的时候实时获取消耗量
+        if(item.coe && item.coe!="0"){
+            let selected = projectObj.project.mainTree.selected;
+            let rationQuantity = selected.data.quantity;
+            rationQuantity = rationQuantity?scMathUtil.roundForObj(rationQuantity, getDecimal('ration.quantity')):0;
+            let times = parseInt(selected.data.unit);
+            times = isNaN(times)?1:times;//工程量要乘以定额单位的倍数
+            let value = scMathUtil.roundForObj(item.coe, getDecimal('process'));
+            //为了避免各种同步更新这里改成实时动态计算带系数的工程量
+            return scMathUtil.roundForObj(rationQuantity * value*times, getDecimal('ration.quantity'))+"";
+        }else {
+            return item.quantity;
+        }
+
+    },
     updatePosition:function (recode) {
         let selection = this.sheet.getSelections()[0];
         let selectedItem =this.datas[selection.row];
@@ -134,7 +149,7 @@ let mbzm_obj={
         let rations = {update:[],create:[]},bills={update:[],create:[]};
         if(this.datas.length <= 0) return;
         for(let d of this.datas){
-            if(gljUtil.isDef(d.quantity)&& parseFloat(d.quantity)>0){
+            if((gljUtil.isDef(d.quantity)&& parseFloat(d.quantity)>0)||(d.coe && d.coe!="0")){
                 if(this.positionChecking(createLocation,d) == false){//清单位置检查
                     alert(`请选择${d.code}生成的清单位置`);
                     return;
@@ -211,7 +226,8 @@ let mbzm_obj={
         return validate
     },
     getNodeUpdateData:function(data,referenceRationID,type,rations,bills){
-        let quantity = this.getQuantity(data);//工程量要经过转换
+        let quantity = this.getQuantity(data);//取实时或手输工程量
+        quantity = this.transferToRationQuantity(data.unit,quantity);//工程量要经过转换
         let mainRation = projectObj.project.mainTree.getNodeByID(referenceRationID);
         let billsID="";
         //先检查要更新的定额是否已经存在
@@ -402,7 +418,7 @@ let mbzm_obj={
         }
         return{itemQuery:itemQuery,newData:newData,defaultLibID: rationLibObj.getDefaultStdRationLibID(),calQuantity:false,brUpdate:[],needInstall:needInstall}
     },
-    getQuantity:function (data) {//取最新的消耗量,需经过转换
+/*    getQuantity:function (data) {//取最新的消耗量,需经过转换
         if(data.unit){
             let times = parseInt(data.unit);
             if(!isNaN(times)){
@@ -410,6 +426,15 @@ let mbzm_obj={
             }
         }
         return data.quantity
+    },*/
+    transferToRationQuantity:function (unit,quantity) {
+        if(unit){
+            let times = parseInt(unit);
+            if(!isNaN(times)){
+                return scMathUtil.roundForObj(parseFloat(quantity)/times,getDecimal("ration.quantity"))+""
+            }
+        }
+        return quantity;
     },
     getExistRation:function (data,referenceRationID,type) {
         let temRation = null;
@@ -475,6 +500,45 @@ let mbzm_obj={
             }
         }
         return refNode;
+    },
+    updateReferenceRationNodeQuantity:function (node) {
+        let rationNodes = [],codeMap={};
+        let  template = projectObj.project.ration_template.getTemplateByRationID(node.data.ID);
+        if(template) {
+            for(let t of template.templateList){
+                if(t.coe && t.coe!="0"){
+                    codeMap[t.code] = t;
+                }
+            }
+            let times = parseInt(node.data.unit);
+            times = isNaN(times)?1:times;//工程量要乘以定额单位的倍数
+            let referenceRations = this.findReferenceRation(node.data.ID);
+            for(let r of  referenceRations ){
+                let t_tem = codeMap[r.code];
+                if(t_tem){
+                    let rationQuantity = node.data.quantity?scMathUtil.roundForObj(node.data.quantity, getDecimal('ration.quantity')):0;
+                    let t_quantity = scMathUtil.roundForObj(rationQuantity * parseFloat(t_tem.coe)*times, getDecimal('ration.quantity')); //这个也要同步更新
+                    let rnode =  projectObj.project.mainTree.findNode(r.ID);
+                    if(rnode && r.quantityEXP == "MBGCL"){//表达式是模板工程量的才要同步更新
+                        let t_times = parseInt(rnode.data.unit);
+                        t_times = isNaN(t_times)?1:t_times;//工程量要乘以定额单位的倍数
+                        rnode.data.quantity = scMathUtil.roundForObj(t_quantity/t_times,getDecimal('ration.quantity'));
+                        if(rnode.parent.data.quantity&&rnode.parent.data.quantity!=0&&rnode.parent.data.quantity!=""){
+                            var billQuantity = scMathUtil.roundForObj(rnode.parent.data.quantity,getDecimal("quantity",node.parent));
+                            rnode.data.contain = scMathUtil.roundForObj(rnode.data.quantity/billQuantity,getDecimal("process"));
+                        }else {
+                            rnode.data.contain=0;
+                        }
+                        rnode.change = true;
+                        rationNodes.push(rnode)
+                    }
+                }
+            }
+        }
+        return rationNodes;
+    },
+    findReferenceRation:function(rationID){
+        return _.filter(projectObj.project.Ration.datas,{'referenceRationID':rationID})
     }
 };
 

+ 12 - 84
web/building_saas/main/js/views/project_view.js

@@ -1935,18 +1935,15 @@ var projectObj = {
         }
         CommonTotalFeeCellType.prototype = new ns.CellTypes.Text();
         CommonTotalFeeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            //  if(value!=null){
-            // ctx.fillText(value,x+3+ctx.measureText(value).width,y+h-3);
-            // ctx.fillText(value,x+w-3,y+h-3);
-            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-            // }
-            if(calcBaseView.editingCell && !projectReadOnly && calcBaseView.ifEdit(type, options.row)){
-                if(calcBaseView.editingCell.row==options.row&&calcBaseView.editingCell.col==options.col){
+            if(!projectReadOnly && calcBaseView.ifEdit(type, options.row)){
+                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
-                    var imageHeight = h-2*imageMagin;
-                    var imageWidth = w*2/(type=='bills'?7:20);
+                    var imageHeight = 15;
+                    var imageWidth = 25;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     ctx.save();
+                    ctx.fillStyle = style.backColor;
+                    ctx.fillRect(x,y,w,h);
                     ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
                     ctx.beginPath();
                     ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
@@ -1956,8 +1953,10 @@ var projectObj = {
                     ctx.fill();//画实心圆
                     ctx.closePath();
                     ctx.restore();
+                    w = w - imageWidth - imageMagin;
                 }
             }
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         CommonTotalFeeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
@@ -1970,57 +1969,16 @@ var projectObj = {
                 sheetArea: context.sheetArea
             };
         };
-        /*CommonTotalFeeCellType.prototype.processMouseDown = function (hitinfo) {
-            let me=calcBaseView;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                var showSelectBtn = true;
-                if(hitinfo.sheet.name()!='calc_detail'){
-                    showSelectBtn=me.ifEdit(type, hitinfo.row);
-                }
-                if(showSelectBtn){
-                    me.editingCell={
-                        row:hitinfo.row,
-                        col:hitinfo.col
-                    }
-                    hitinfo.sheet.invalidateLayout();
-                    hitinfo.sheet.repaint();
-                }
-            }else if(hitinfo.row==me.editingCell.row){
-                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageMagin=3;
-                var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                var imageWidth = hitinfo.cellRect.width*2/7;
-                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
-                        calcBaseView.confirmBtn.attr('toggle', 'commonTotalFee');
-                        changeCalcBaseFeeRate('commonTotalFee');
-                        $('#tabCalcBase').tab('show');
-                        calcBaseView.initCalctor(type);
-                        feeRateObject.showSelectModal(hitinfo);
-                    }
-                }
-            }
-        };
-        CommonTotalFeeCellType.prototype.processMouseLeave = function (hitinfo) {
-            if(!calcBaseView.pmLeave){
-                calcBaseView.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                calcBaseView.pmLeave = true;
-            }
-        };*/
         CommonTotalFeeCellType.prototype.processMouseDown = function (hitinfo) {
             let me = calcBaseView;
-            if(me.editingCell && hitinfo.row==me.editingCell.row){
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
                 var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageMagin=3;
-                var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                var imageWidth = hitinfo.cellRect.width*2/7;
+                var imageWidth = 25;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
                     if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
                         if(hitinfo.sheet.getParent() === projectObj.mainSpread){
-                            projectObj.project.mainTree.selected = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+                            let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+                            projectObj.mainController.setTreeSelected(node);
                         }
                         hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
                         calcBaseView.confirmBtn.attr('toggle', 'commonTotalFee');
@@ -2029,39 +1987,9 @@ var projectObj = {
                         calcBaseView.initCalctor(type);
                         feeRateObject.showSelectModal(hitinfo);
                     }
-                }else {//鼠标点击其它地方,消失
-                    hideButton(hitinfo);
                 }
             }
         };
-        CommonTotalFeeCellType.prototype.processMouseEnter = function (hitinfo){
-            let me = calcBaseView;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                var showSelectBtn = true;
-                showSelectBtn=me.ifEdit(type, hitinfo.row);
-                if(showSelectBtn){
-                    me.editingCell={
-                        row:hitinfo.row,
-                        col:hitinfo.col
-                    };
-                    hitinfo.sheet.invalidateLayout();
-                    hitinfo.sheet.repaint();
-                }
-            }
-        };
-        CommonTotalFeeCellType.prototype.processMouseLeave = function (hitinfo) {
-            hideButton(hitinfo);
-        };
-
-        function hideButton(hitinfo) {
-            if(!calcBaseView.pmLeave){
-                calcBaseView.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                calcBaseView.pmLeave = true;
-            }
-        }
         return new CommonTotalFeeCellType();
     },
     selectColAndFocus :function (newNode,field = 'code') {//选中单元格并设置焦点

+ 29 - 75
web/building_saas/main/js/views/quantity_edit_view.js

@@ -54,7 +54,7 @@ let quantityEditObj = {
         $("#quantityEXPValue").val(strartString+value+endString);
         setCursor($("#quantityEXPValue")[0],startIndex+value.length);//设置回光标位置
     },
-    getQuantityEditCellType:function () {
+    getQuantityEditCellType:function () {//这个需配合整个表的selection change事件,当change的时候会repaint,按钮会显示
         var ns = GC.Spread.Sheets;
         function QuantityEditCellType() {
             var init=false;
@@ -62,17 +62,15 @@ let quantityEditObj = {
         }
         QuantityEditCellType.prototype = new ns.CellTypes.Text();
         QuantityEditCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            // if(value!=null){
-            // ctx.fillText(value,x+3+ctx.measureText(value).width,y+h-3);
-            // }
-            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-            if(quantityEditObj.editingCell && !projectReadOnly){
-                if(quantityEditObj.editingCell.row==options.row&&quantityEditObj.editingCell.col==options.col){
+            if(!projectReadOnly){
+                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
-                    var imageHeight = h-2*imageMagin;
-                    var imageWidth = w*2/7;
+                    var imageHeight = 15;
+                    var imageWidth = 25;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     ctx.save();
+                    ctx.fillStyle = style.backColor;
+                    ctx.fillRect(x,y,w,h);
                     ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
                     ctx.beginPath();
                     ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
@@ -82,9 +80,10 @@ let quantityEditObj = {
                     ctx.fill();//画实心圆
                     ctx.closePath();
                     ctx.restore();
+                    w = w - imageWidth - imageMagin;
                 }
             }
-
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         QuantityEditCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
@@ -99,71 +98,18 @@ let quantityEditObj = {
         };
 
         //2018 -09 -26  修改工程量这个输入控件,删除悬浮提示注释,还原时通过git 历史
-
         QuantityEditCellType.prototype.processMouseDown = function (hitinfo) {
             let me=quantityEditObj;
-            /*if(isDoubleClick(this) == true && !projectReadOnly){//如果是双击,直接显示 2019-1-17 需求更改,取消双击弹出
-                me.showSelectModal(hitinfo);
-                return ;
-            }*/
-           if(me.editingCell && hitinfo.row==me.editingCell.row){
-               if(me.editingCell.isBtn == false){//是第一次点击,刷新显示按钮
-                   me.editingCell.isBtn = true;
-                   hitinfo.sheet.invalidateLayout();
-                   hitinfo.sheet.repaint();
-               }else {
-                   var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                   var imageMagin=3;
-                   var imageHeight = hitinfo.cellRect.height-2*imageMagin;
-                   var imageWidth = hitinfo.cellRect.width*2/7;
-                   if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                       if(!projectReadOnly){
-                           me.showSelectModal(hitinfo);
-                       }
-                   }/*else {//点击其它地方,按钮消失
-                    hideButton(hitinfo)
-                    }*/
-               }
-            }
-        };
-        QuantityEditCellType.prototype.processMouseEnter = function (hitinfo) {
-            var me=quantityEditObj;
-            me.pmLeave = false;
-            if(me.editingCell==null){
-                me.editingCell={
-                    row:hitinfo.row,
-                    col:hitinfo.col,
-                    isBtn :false//鼠标刚进入的时候按钮还是没显示的状态
+            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
+                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
+                var imageWidth = 25;
+                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
+                    if(!projectReadOnly){
+                        me.showSelectModal(hitinfo);
+                    }
                 }
-               // hitinfo.sheet.invalidateLayout();
-                //hitinfo.sheet.repaint();
             }
         };
-        QuantityEditCellType.prototype.processMouseLeave = function (hitinfo) {
-            hideButton(hitinfo);
-        };
-
-        function hideButton(hitinfo) {
-            if(!quantityEditObj.pmLeave){//鼠标进入显示三个点按钮
-                quantityEditObj.editingCell=null;
-                hitinfo.sheet.invalidateLayout();
-                hitinfo.sheet.repaint();
-                quantityEditObj.pmLeave = true;
-            }
-        }
-
-        function isDoubleClick(quantityCell) {
-            let nowTime = +new Date();
-            if(quantityCell.clickTime !=0){
-                if(nowTime - quantityCell.clickTime < 280) {//判断为双击
-                    quantityCell.clickTime = 0;
-                    return true;
-                }
-            }
-            quantityCell.clickTime = nowTime;//计录点击时间
-            return false
-        }
-
         return new QuantityEditCellType();
     },
     showSelectModal:function (hitinfo) {
@@ -200,12 +146,20 @@ let quantityEditObj = {
         let value = me.evalQuantityExp(quantityEXP,node);
         if(value!=='evalError'){
             if(node.data.hasOwnProperty('isFromDetail')&&node.data.isFromDetail==1){
-                hintBox.infoBox('操作确认', '已有工程量明细,是否清空明细表?', 2, function () {
-                    node.data.isFromDetail=0;
-                    me.updateQuantityEXP(value,quantityEXP,node);
-                }, function () {
+                if(quantityEXP!="GCLMXHJ"){
+                    hintBox.infoBox('操作确认', '已有工程量明细,是否清空明细表?', 2, function () {
+                        node.data.isFromDetail=0;
+                        me.updateQuantityEXP(value,quantityEXP,node);
+                    }, function () {
+                        projectObj.mainController.refreshTreeNode([node]);
+                    },['确定','取消'],false);
+                }else {//表达式已经是工程量明细合计了,重新刷新就可
                     projectObj.mainController.refreshTreeNode([node]);
-                },['确定','取消'],false);
+                }
+                return true;
+            }
+            if(quantityEXP=="MBGCL") {
+                projectObj.mainController.refreshTreeNode([node]);
                 return true;
             }
             me.updateQuantityEXP(value,quantityEXP,node);

+ 94 - 2
web/building_saas/main/js/views/sub_view.js

@@ -11,6 +11,7 @@ let subSpread = null;
 let subObj = {
     TZJNRrePercent:null,
     showGljSubTab:false,
+    showQDSubTab:false,
     initSubSpread:function () {
         //清单精灵
         BillsElf.buildSheet();
@@ -134,10 +135,71 @@ let subObj = {
         $("#subSpread").addClass("ration_glj_spread");
         this.initItemWidth();
     },
+    //初始化清单精灵和项目特征文本两个区域的宽度,改变窗口大小时调用此方法,实时刷新
+    initTZItemWidth:function (){
+        //总宽度
+        let totalWidth = $('#subItems').width();
+        //人材机和项目特征文本比例
+        const openWidth = 30;//打开项目特征工具条
+        const tab_tem = (305+openWidth+10)/totalWidth;//tab显示框默认宽度:305(表格宽度) + 30(工具条宽度)+10(resize div 宽度)
+        //默认比例
+        let textPercent = tab_tem * 100 + '%',//'15%',
+            rcjPercent = (1 - tab_tem)* 100 + '%';//85
+        //文本没显示,则打开工具条固定30px转换百分比
+        if (!subObj.showQDSubTab) {
+            textPercent = openWidth / totalWidth;
+            rcjPercent = 1 - textPercent;
+            textPercent = textPercent * 100 + '%';
+            rcjPercent = rcjPercent * 100 + '%';
+        }
+        //设置特征及内容与排版规则的比例
+        $('#qdjl').css('width', rcjPercent);
+        $('#xmtzTextDiv').css('width', textPercent);
+        //打开了项目特征,则继续加载人材机表和项目特征文本具体比例
+        if (subObj.showQDSubTab === true) {
+            let jl_sideResizeEles = this.getJLSideResize();
+            SlideResize.loadHorizonWidth(jl_sideResizeEles.eleObj.module,
+                [jl_sideResizeEles.eleObj.resize], [jl_sideResizeEles.eleObj.left, jl_sideResizeEles.eleObj.right]);
+            $("#tzSubDiv").width( $('#xmtzTextDiv').width() - jl_sideResizeEles.eleObj.resize.width() - 30)
+        }
+    },
+    getJLSideResize:function () {
+        let jl_sideResizeEles = {};
+        jl_sideResizeEles.eleObj = {
+            module: 'qdjl',
+            resize: $('#tzrgResize'),
+            parent: $('#subItems'),
+            left: $('#qdjl'),
+            right: $('#tzSubDiv')
+        };
+        rg_sideResizeEles.limit = {
+            min: 100,
+            max: `$('#subItems').width()-100`
+        };
+        return jl_sideResizeEles;
+    },
+    initQDSubTab:function () {
+        if(!($('#linkQDJL').hasClass('active'))){
+            return;
+        }
+        if(this.showQDSubTab == true){
+            $("#tzSubDiv").show();
+            $("#tzrgResize").show();
+        } else {
+            $("#tzSubDiv").hide();
+            $("#tzrgResize").hide();
+        }
+        this.initTZItemWidth();
+    },
     showGljSubTabData:function () {
         this.initGljSubTab();
         zmhs_obj.showDatas();
         refreshSubSpread();
+    },
+    showQDSubTabData:function () {
+        this.initQDSubTab();
+        MaterialController.showItemCharacterText(null,"tzCharacterText");
+        refreshSubSpread();
     }
 };
 
@@ -275,7 +337,10 @@ function adaptiveTzjnrWidth() {
 $('#linkQDJL').click(function () {
     gljOprObj.activeTab='#linkQDJL';
     $("#subItems").children().hide();
+    subObj.showQDSubTabData();
     $('#qdjl').show();
+    $("#xmtzTextDiv").show();
+    $("#tzItemTab").show();
     let selectedNode = projectObj.mainController.tree.selected;
     BillsElf.billsSelElf(selectedNode.data.code);
     refreshSubSpread();
@@ -689,6 +754,10 @@ $('#linkGLJ').on('shown.bs.tab', function () {
     gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected, '111111');
 });
 
+$('#linkQDJL').on('shown.bs.tab', function () {
+    subObj.showQDSubTabData();
+});
+
 $('#linkZMHS').on('shown.bs.tab', function (e) {
     if(zmhs_obj.coeSpread == null || zmhs_obj.assSpread == null){
         zmhs_obj.initSpread();
@@ -719,11 +788,19 @@ $('#linkAZZJF').on('shown.bs.tab', function () {
 $('#zmhs_toogle').bind('click',function (){
    $("#zmhs_nav").show();
    if(subObj.showGljSubTab == false){
-       subObj.activeTab?$(subObj.activeTab).click():$("#xm-nav").click();
+       subObj.activeGLJItemTab?$(subObj.activeGLJItemTab).click():$("#xm-nav").click();
    }
     $("#zmhs_toogle").hide();
 });
 
+$('#tz_toogle').bind('click',function (){
+    $("#tz_nav").show();
+    if(subObj.showQDSubTab == false){
+        subObj.activeQDItemTab?$(subObj.activeQDItemTab).click():$("#tz-nav").click();
+    }
+    $("#tz_toogle").hide();
+});
+
 $('.gljSubTab ul li a').bind('click',function () {
     if(this.hash =="#rnc-close"){
         $("#zmhs_nav").hide();
@@ -732,7 +809,7 @@ $('.gljSubTab ul li a').bind('click',function () {
         subObj.showGljSubTab = false;
     } else {
         subObj.showGljSubTab = true;
-        subObj.activeTab =this;
+        subObj.activeGLJItemTab =this;
     }
 
     subObj.initGljSubTab();
@@ -744,6 +821,21 @@ $('.gljSubTab ul li a').bind('click',function () {
      }*/
 });
 
+$('.QDSubTab ul li a').bind('click',function () {
+    if(this.hash =="#rnc-close"){
+        $("#tz_nav").hide();
+        $("#tz_toogle").show();
+        closeTab(this);
+        subObj.showQDSubTab = false;
+    } else {
+        subObj.showQDSubTab = true;
+        subObj.activeQDItemTab =this;
+    }
+    subObj.initQDSubTab();
+    refreshSubSpread();
+});
+
+
 $('.gljSubTab ul li a').on('shown.bs.tab', function () {
     if(this.hash == "#rnc-xm"){
         //初始化项目特征表格位置,如果以后需要的话,showdata 统一移动至zmhs_obj中

+ 8 - 107
web/building_saas/pm/html/project-management.html

@@ -268,120 +268,17 @@
     </div>
 </div>
 <!--弹出新建单位工程-->
-<!--<div class="modal fade" id="add-tender-dialog" data-backdrop="static">
-    <div class="modal-dialog" role="document">
-        <div class="modal-content">
-            <div class="modal-header">
-                <h5 class="modal-title"><i class="fa fa-sticky-note-o"></i>新建单位工程</h5>
-                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
-                    <span aria-hidden="true">&times;</span>
-                </button>
-            </div>
-            <div class="modal-body">
-                <form>
-                    <div>
-                        <div class="input-group">
-                            <label style="margin-top: 8px;">建设项目</label>
-                            <input style="margin-left: 5px; border-radius: .25rem;" type="text" class="form-control" placeholder="输入建设项目名称" id="poj-name" autocomplete="off">
-                              <span class="input-group-btn">
-                                <button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"></button>
-                                <div class="dropdown-menu dropdown-menu-right" style="width:468px" id="poj-name-list">
-                                    <button class="dropdown-item" type="button">汽车生产车间1</button>
-                                    <button class="dropdown-item" type="button">汽车生产车间2</button>
-                                    <button class="dropdown-item" type="button">汽车生产车间3</button>
-                                </div>
-                              </span>
-                        </div>
-                    </div>
-                    <span class="form-text text-info" id="poj-name-info" style="display: none;">新建 “汽车生产车间5”</span>
-                    <div style="margin-top: 15px;">
-                        <div class="input-group">
-                            <label style="margin-top: 8px;">单项工程</label>
-                            <input style="margin-left: 5px; border-radius: .25rem;" type="text" class="form-control" placeholder="输入单项工程名称" id="eng-name" autocomplete="off">
-                              <span class="input-group-btn">
-                                <button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"></button>
-                                <div class="dropdown-menu dropdown-menu-right" style="width:468px" id="eng-name-list">
-                                    <button class="dropdown-item" type="button">左3号生产车间</button>
-                                    <button class="dropdown-item" type="button">左4号生产车间</button>
-                                </div>                              </span>
-                        </div>
-                    </div>
-                    <span class="form-text text-info" id="eng-name-info" style="display: none;">新建 “左2号生产车间2”</span>
-
-                    <div style="margin-top: 15px;" class="input-group">
-                        <label style="margin-top: 8px;">单位工程</label>
-                        <input style="margin-left: 5px; border-radius: .25rem;" type="text" class="form-control" placeholder="输入单位工程名称" id="tender-name" autocomplete="off">
-                    </div>
-                    <span class="form-text text-danger" id="tender-name-info" style="display: none;">已存在 “建筑工程1”</span>
-                    <div style="margin-top: 15px;" class="input-group">
-                        <label style="margin-top: 8px;">单价文件</label>
-                        <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="unit-price"><option value="">新建单价文件</option></select>
-                    </div>
-                    <div style="margin-top: 15px;" class="input-group">
-                        <label style="margin-top: 8px;">费率文件</label>
-                        <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="tender-fee-rate"><option value="">新建费率文件</option></select>
-                    </div>
-                    <div style="margin-top: 15px;" class="input-group">
-                        <label>计价方式</label>
-                        <div style="margin-left: 5px; border-radius: .25rem;"  class="row">
-                            <label class="custom-control custom-radio" style="margin-left: 20px;">
-                                <input name="valuation_type" checked id="radioBill" value="bill" type="radio" class="custom-control-input">
-                                <label class="custom-control-label" for="radioBill">清单计价</label>
-                            </label>
-                          &lt;!&ndash;  <label class="custom-control custom-radio" style="margin-left: 5px;">
-                                <input name="valuation_type" id="radioRation" value="ration" type="radio" class="custom-control-input">
-                                <label class="custom-control-label" for="radioRation">定额计价</label>
-                            </label>&ndash;&gt;
-                        </div>
-                    </div>
-                    <div style="margin-top: 15px;" class="input-group">
-                        <label style="margin-top: 8px;">计价规则</label>
-                        <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="valuation"></select>
-                    </div>
-                    <span class="form-text text-danger" id="valuation-info" style="display: none;">请选择计价规则</span>
-                    <div style="margin-top: 15px;" class="input-group">
-                        <label style="margin-top: 8px;">工程专业</label>
-                        <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="tender-engineering"></select>
-                    </div>
-                    <span class="form-text text-danger" id="engineering-info" style="display: none;">请选择工程专业</span>
-                    <div style="margin-top: 15px;" class="input-group">
-                        <label style="margin-top: 8px;">费用标准</label>
-                        <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="tender-feeStandard"></select>
-                    </div>
-                    <span class="form-text text-danger" id="feeStandard-info" style="display: none;">请选择费用标准</span>
-                    <div style="margin-top: 15px;" class="input-group" id="taxType_div">
-                        <label style="margin-top: 8px;">计税方式</label>
-                        <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="taxType">
-                            &lt;!&ndash;<option value="1">一般计税</option>
-                            <option value="2">简易计税</option>&ndash;&gt;
-                        </select>
-                    </div>
-                    <div style="margin-top: 15px;" class="input-group">
-                        <label style="margin-top: 8px;">计算程序</label>
-                        <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="tender-calcProgram"></select>
-                    </div>
-
-                    <span class="form-text text-danger" id="calcProgram-info" style="display: none;">请选择计算程序</span>
-                </form>
-            </div>
-            <div class="modal-footer">
-                <a href="javascript:void(0);" class="btn btn-primary" id="add-tender-confirm">确定</a>
-                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-            </div>
-        </div>
-    </div>
-</div>-->
 <div class="modal fade" id="add-tender-dialog" data-backdrop="static">
     <div class="modal-dialog" role="document">
         <div class="modal-content">
             <div class="modal-header">
-                <h5 class="modal-title">新建 <i class="fa fa-sticky-note-o"></i> 单位工程</h5>
+                <h5 class="modal-title"><i class="fa fa-sticky-note-o"></i>新建单位工程</h5>
                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                     <span aria-hidden="true">&times;</span>
                 </button>
             </div>
             <div class="modal-body">
-                <form>
+                <form id="firstStep">
                     <div class="form-group row">
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">建设项目</label>
                         <div class="col">
@@ -437,6 +334,8 @@
                             </select>
                         </div>
                     </div>
+                </form>
+                <form id="secondStep" style="display: none">
                     <div class="form-group row">
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计价方式</label>
                         <div class="col">
@@ -500,8 +399,10 @@
                 </form>
             </div>
             <div class="modal-footer">
-                <a href="javascript:void(0);" class="btn btn-primary" id="add-tender-confirm">确定</a>
-                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                <a href="javascript:void(0);" class="btn btn-primary" id="add-tender-next">下一步</a>
+                <a href="javascript:void(0);" class="btn btn-primary" id="add-tender-prev" style="display: none">上一步</a>
+                <a href="javascript:void(0);" class="btn btn-primary" style="display: none" id="add-tender-confirm">确定</a>
+                <button type="button" class="btn btn-secondary" data-dismiss="modal" id="add-tender-cancel" style="display: none;">取消</button>
             </div>
         </div>
     </div>

+ 80 - 53
web/building_saas/pm/js/pm_newMain.js

@@ -71,6 +71,10 @@ const projTreeObj = {
         header: [
             {name: '工程列表', dataCode: 'name', width: 300, vAlign: 'center', hAlign: 'left'},
             {name: '工程造价', dataCode: 'engineeringCost', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+            {name: '工程专业', dataCode: 'feeStandardName', width: 100, vAlign: 'center', hAlign: 'left'},
+            {name: '单价文件', dataCode: 'unitPriceFile', width: 140, vAlign: 'center', hAlign: 'left'},
+            {name: '费率文件', dataCode: 'feeRateFile', width: 140, vAlign: 'center', hAlign: 'left'},
+            {name: '创建日期', dataCode: 'createDateTime', width: 100, vAlign: 'center', hAlign: 'center'},
             {name: '分部分项合计', dataCode: 'subEngineering', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
             {name: '措施项目合计', dataCode: 'measure', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
             {name: '其他项目合计', dataCode: 'other', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
@@ -79,11 +83,7 @@ const projTreeObj = {
             {name: '税金', dataCode: 'tax', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
             {name: '占造价比例(%)', dataCode: 'rate', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
             {name: '建筑面积', dataCode: 'buildingArea', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
-            {name: '单方造价', dataCode: 'perCost', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
-            {name: '工程专业', dataCode: 'feeStandardName', width: 100, vAlign: 'center', hAlign: 'left'},
-            {name: '单价文件', dataCode: 'unitPriceFile', width: 140, vAlign: 'center', hAlign: 'left'},
-            {name: '费率文件', dataCode: 'feeRateFile', width: 140, vAlign: 'center', hAlign: 'left'},
-            {name: '创建日期', dataCode: 'createDateTime', width: 100, vAlign: 'center', hAlign: 'center'}
+            {name: '单方造价', dataCode: 'perCost', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'}
         ],
         //选中行颜色
         style: {
@@ -640,6 +640,9 @@ const projTreeObj = {
             }
         }
     },
+    cusButtonClick:async function(info){
+        projTreeObj.changeFileClick(null,info);
+    },
     onDragDropBlock : function (sender,args) {//拖动移动项目位置
         let selected = projTreeObj.tree.selected;
         let targetNode = projTreeObj.tree.items[args.toRow];
@@ -830,6 +833,17 @@ const projTreeObj = {
             }
         }
     },
+    openTender: function (ID, parent, timeoutTime) {
+        setTimeout(function () {
+            let newTab = window.open('about:blank');
+            BeforeOpenProject(ID, {'fullFolder': GetFullFolder(parent)}, function () {
+                let mainUrl = `/main?project=${ID}`;
+                CommonAjax.get(mainUrl, [], function () {
+                    newTab.location.replace(mainUrl); //不能后退
+                });
+            });
+        }, timeoutTime);
+    },
     getTreeNodeCell: function (tree) {
         let me = projTreeObj;
         let indent = 20;
@@ -966,27 +980,14 @@ const projTreeObj = {
                 ctx.drawImage(shareImg, x + 3, nowY - 7, shareImgWidth,shareImgHeight);
             }
             // Draw Text
-            //x = x + (node.depth() + 1) * indent +  node.depth() * levelIndent;
             x = x + (node.depth() + 1) * indent +  node.depth() * levelIndent + imgWidth + 3;
             w = w - (node.depth() + 1) * indent - node.depth() * levelIndent - imgWidth - 3;
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-          /*  if (node.data.shareInfo && node.data.shareInfo.length > 0) {//分享标记在文本后
-                let nowX = Math.floor(x) + w - 20;
-                let nowY = Math.floor((y + (y + h)) / 2);
-                ctx.drawImage(shareImg, nowX + 3, nowY - 7, shareImgWidth,shareImgHeight);
-            }*/
         };
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
             let node = tree.items[info.row];
-            let offset = -1;
-            let centerX = info.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
-            let text = context.sheet.getText(info.row, info.col);
-            let value = context.sheet.getValue(info.row, info.col);
-            let acStyle = context.sheet.getActualStyle(info.row, info.col),
-                zoom = context.sheet.zoom();
-            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: context.sheet, row: info.row, col: info.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
-            if(info.x > centerX + halfBoxLength && info.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength){
+            if (node && node.data.projType === projectType.tender) {
                 info.isReservedLocation = true;
             }
             return info;
@@ -1006,23 +1007,23 @@ const projTreeObj = {
                 return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
             }
             if(hitinfo.sheet.name() === "projectSheet"){//只有项目管理界面才执行
-                //单项文件,进入造价书界面
-                 if(node.data.projType === projectType.tender && withingClickArea()){
-                    let timeoutTime = 200;
-                    if($('.slide-sidebar').hasClass('open')){
-                        timeoutTime = 500;
+                if(node.data.projType === projectType.tender){
+                    let thisClick = Date.now(),
+                        open = false;
+                    if (this.preNode === node && this.preClick && thisClick - this.preClick <= 300) {
+                        open = true;
+                        let timeoutTime = 200;
+                        if($('.slide-sidebar').hasClass('open')){
+                            timeoutTime = 500;
+                        }
+                        projTreeObj.openTender(node.data.ID, node.parent, timeoutTime);
                     }
-                    setTimeout(function () {
-                        let newTab = window.open('about:blank');
-                        BeforeOpenProject(node.data.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
-                            let mainUrl = `/main?project=${node.data.ID}`;
-                            CommonAjax.get(mainUrl, [], function () {
-                                newTab.location.replace(mainUrl); //不能后退
-                            });
-                        });
-                    }, timeoutTime);
+                    this.preClick = open ? null : thisClick;
+                    this.preNode = open ? null : node;
+                }
+                if (!node || node.children.length === 0) {
+                    return;
                 }
-                if (!node || node.children.length === 0) { return; }
             }
             //统一改成方框外1像素内都有效
             if (hitinfo.x >= centerX - halfBoxLength - 2 && hitinfo.x <= centerX + halfBoxLength + 2 &&
@@ -1041,10 +1042,10 @@ const projTreeObj = {
         };
         TreeNodeCellType.prototype.processMouseMove = function (hitInfo) {
             let sheet = hitInfo.sheet;
-
             let div = sheet.getParent().getHost();
             let canvasId = div.id + "vp_vp";
             let canvas = $(`#${canvasId}`)[0];
+            let node = tree.items[hitInfo.row];
             //改变鼠标图案
             if (sheet && hitInfo.isReservedLocation) {
                 canvas.style.cursor='pointer';
@@ -1123,8 +1124,7 @@ const projTreeObj = {
                     me.setCellValue({row: i, col: j}, nodes[i],sheet,setting);
                     let dataCode = headers[j].dataCode;
                     if(nodes[i].data.projType == "Tender" && (dataCode=="feeRateFile" || dataCode == "unitPriceFile")) {
-                        sheet.setCellType(i, j,sheetCommonObj.getSelectButton(headers[j].width),GC.Spread.Sheets.SheetArea.viewport);
-                        sheet.getCell(i, j,GC.Spread.Sheets.SheetArea.viewport).locked(false);
+                        sheet.setCellType(i, j,sheetCommonObj.getCusButtonCellType(me.cusButtonClick,false),GC.Spread.Sheets.SheetArea.viewport);
                     }
                     //sheet.setValue(i, j, nodes[i]['data'][dataCode]);
                 }
@@ -1772,11 +1772,53 @@ $(document).ready(function() {
             setRegionOpts(regions);
             $('#regionDiv').show();
         }
+        //恢复到第一步状态
+        if (!$('#firstStep').is(':visible')) {
+            showFirstStep();
+        }
         setTimeout(function () {
             $('#tender-name')[0].focus();
         }, 300);
     });
 
+    //新建单位工程-下一步
+    $('#add-tender-next').click(function() {
+        let projName = $("#poj-name").val().trim();
+        if(projName === ''){
+            replaceClass($('#poj-name-info'), 'text-info', 'text-danger');
+            setDangerInfo($('#poj-name-info'), '请填写建设项目名称');
+            return false;
+        }
+        let engName = $("#eng-name").val().trim();
+        if(engName === ''){
+            replaceClass($('#eng-name-info'), 'text-info', 'text-danger');
+            setDangerInfo($('#eng-name-info'), '请填写单项工程名称');
+            return false;
+        }
+
+        let tenderName = $('#tender-name').val();
+        if (tenderName === '') {
+            setDangerInfo($('#tender-name-info'), '请填写单位工程名称');
+            return false;
+        }
+        $('#firstStep').hide();
+        $('#secondStep').show();
+        $(this).hide();
+        $('#add-tender-prev').show();
+        $('#add-tender-confirm').show();
+        $('#add-tender-cancel').show();
+    });
+    function showFirstStep() {
+        $('#secondStep').hide();
+        $('#firstStep').show();
+        $('#add-tender-prev').hide();
+        $('#add-tender-next').show();
+        $('#add-tender-confirm').hide();
+        $('#add-tender-cancel').hide();
+    }
+    //新建单位工程-上一步
+    $('#add-tender-prev').click(showFirstStep);
+
     // 新增单位工程
     $("#add-tender-confirm").click(function() {
         let suc = AddTender();
@@ -1785,26 +1827,11 @@ $(document).ready(function() {
         }
     });
 
-    // 新增文件夹按钮点击
-    /*$("#add-folder-btn").click(function() {
-        $("#add-folder-dialog").modal("show");
-        setTimeout(function () {
-            $('#folder-name')[0].focus();
-        }, 300);
-    });*/
-
     // 新增文件夹操作
     $("#add-folder-confirm").click(function() {
         AddFolder();
     });
 
-    // 删除按钮点击
-   /* $('#del-btn').click(function() {
-        if (projTreeObj.tree && projTreeObj.tree.selected) {
-            $('#del').modal('show');
-        }
-    });*/
-
     // 删除时文字替换
     $('#del').on('show.bs.modal', function() {
         let hasTenderChild = function (children) {
@@ -2435,7 +2462,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
                     }
                 });
                 callback();
-            })
+            });
         });
     }
 }

+ 16 - 12
web/building_saas/pm/js/pm_share.js

@@ -342,14 +342,7 @@ const pmShare = (function () {
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
             let node = tree.items[info.row];
-            let offset = -1;
-            let centerX = info.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
-            let text = context.sheet.getText(info.row, info.col);
-            let value = context.sheet.getValue(info.row, info.col);
-            let acStyle = context.sheet.getActualStyle(info.row, info.col),
-                zoom = context.sheet.zoom();
-            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: context.sheet, row: info.row, col: info.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
-            if(info.x > centerX + halfBoxLength && info.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength){
+            if (node && node.data.projType === projectType.tender) {
                 info.isReservedLocation = true;
             }
             return info;
@@ -369,17 +362,28 @@ const pmShare = (function () {
                 return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
             }
             //点击单位工程
-            if(node.data.projType === projectType.tender && withingClickArea()){
-                let newTab = window.open('about:blank');
+            if(node.data.projType === projectType.tender){
+                /*let newTab = window.open('about:blank');
                 //打开项目的实际ID
                 BeforeOpenProject(node.data.actualTreeInfo.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
                     let mainUrl = `/main?project=${node.data.actualTreeInfo.ID}`;
                     CommonAjax.get(mainUrl, [], function () {
                         newTab.location.href = mainUrl;
                     });
-                });
+                });*/
+                let thisClick = Date.now(),
+                    open = false;
+                if (this.preNode === node && this.preClick && thisClick - this.preClick <= 300) {
+                    open = true;
+                    projTreeObj.openTender(node.data.actualTreeInfo.ID, node.parent, 200);
+                }
+                this.preClick = open ? null : thisClick;
+                this.preNode = open ? null : node;
+
+            }
+            if (!node || node.children.length === 0) {
+                return;
             }
-            if (!node || node.children.length === 0) { return; }
             if (hitinfo.x >= centerX - halfBoxLength - 2 && hitinfo.x <= centerX + halfBoxLength + 2 &&
                 hitinfo.y >= centerY - halfBoxLength - 2 && hitinfo.y <= centerY + halfBoxLength + 2) {
                 node.setExpanded(!node.expanded);

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

@@ -1,3 +1,4 @@
+<img id="f_btn" src="/web/dest/css/img/feeRate_btn.jpg" alt="" style="display: none" />
 <nav class="navbar p-0 ">
     <% if(controller === 'boot' || controller === 'pm'){ %>
     <!--<a style="text-decoration: none" href="javascript:void(0);" class="header-logo">-->