Просмотр исходного кода

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

zhangweicheng 7 лет назад
Родитель
Сommit
0df6c20a43

+ 2 - 2
modules/all_models/std_glj.js

@@ -27,8 +27,8 @@ const std_glj = new Schema({
     shortName: String,
     unit: String,
     adjCoe: Number,
-    materialType: String,
-    materialCoe: Number,
+    materialType: Number,   //三材类别
+    materialCoe: Number,    //三材系数
     component: [std_gljComponent]
 },{versionKey: false});
 

+ 3 - 0
modules/reports/rpt_component/helper/jpc_helper_discrete.js

@@ -71,6 +71,9 @@ let JpcDiscreteHelper = {
                     for (let j = 0; j < discreteArray[i][JV.PROP_DISCRETE_FIELDS].length; j++) {
                         let df = discreteArray[i][JV.PROP_DISCRETE_FIELDS][j];
                         let value = "";
+                        if (df[JV.PROP_DFT_VALUE]) {
+                            value = df[JV.PROP_DFT_VALUE];
+                        }
                         let item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, value, null);
                         //position
                         item[JV.PROP_AREA] = JpcAreaHelper.outputArea(df[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);

+ 34 - 0
modules/reports/util/rpt_construct_data_util.js

@@ -803,6 +803,7 @@ function setupFunc(obj, prop, ownRawObj) {
     obj[prop].getProperty = ext_getPropety;
     obj[prop].getFee = ext_getFee;
     obj[prop].getPropertyByForeignId = ext_getPropertyByForeignId;
+    obj[prop].getArrayValues = ext_getArrayValues;
     obj[prop].getArrayItemByKey = ext_getArrayItemByKey;
     obj[prop].getPropertyByFlag = ext_getPropertyByFlag;
     obj[prop].getBlank = ext_getBlank;
@@ -1055,6 +1056,39 @@ function ext_getFeeRate(fee_Ids){
     return rst;
 }
 
+function ext_getArrayValues(itemKey) {
+    let rst = [], parentObj = this;
+    let dtObj = parentObj["myOwnRawDataObj"];
+    let keysArr = itemKey.split(".");
+    for (let dataItem of dtObj.data) {
+        let itemArr = [];
+        if (keysArr.length <= 2) {
+            if (dataItem[keysArr[0]] instanceof Array) {
+                if (keysArr.length === 2) {
+                    for (let item of dataItem[keysArr[0]]) {
+                        itemArr.push(item[keysArr[1]]);
+                    }
+                } else {
+                    itemArr = itemArr.concat(dataItem[keysArr[0]]);
+                }
+            } else {
+                if (keysArr.length === 2) {
+                    let subProperty = dataItem[keysArr[0]][keysArr[1]];
+                    if (subProperty instanceof Array) {
+                        itemArr = itemArr.concat(subProperty);
+                    } else {
+                        itemArr.push(subProperty);
+                    }
+                } else {
+                    itemArr.push(dataItem[keysArr[0]]);
+                }
+            }
+        }
+        rst.push(itemArr);
+    }
+    return rst;
+}
+
 function ext_getArrayItemByKey(arrayKey, itemKey, itemKeyValue, itemRstKey){
     let rst = [], parentObj = this;
     let dtObj = parentObj["myOwnRawDataObj"];

+ 102 - 71
public/scHintBox.html

@@ -7,22 +7,21 @@
         3、有三个按钮的多分支选择询问框。
         4、输入文本值对话框。
 ----------------------------------------------------------------------------------------------------------------------->
-
-<div class="modal fade" id="hintBox" data-backdrop="static">
+<div class="modal fade" id="hintBox_form" data-backdrop="static">
     <div class="modal-dialog" role="document">
         <div class="modal-content">
-
             <div class="modal-header">
-                <h5 class="modal-title" id="hintBox_title">标题</h5>
+                <h5 id="hintBox_title" class="modal-title">标题</h5>
                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                     <span aria-hidden="true">&times;</span>
                 </button>
             </div>
 
             <div class="modal-body">
-                <div id = "hintBox_info" style="margin:5px 10px 10px 10px;">提示明细</div>
+                <div id = "hintBox_caption" style="margin:5px 10px 10px 10px;">提示明细</div>
                 <div style="margin:5px 10px 5px 10px;">
-                    <input type="text" class="form-control" value="" id="hintBox_value"/>
+                    <input id="hintBox_value" type="text" class="form-control" value="" />
+                    <p id="hintBox_error" style="margin-top:7px; color:red; display:none;">“xxx”已存在!</p>
                 </div>
             </div>
 
@@ -36,78 +35,110 @@
 </div>
 
 <script>
-    G_HINTBOX_VALUE = null;
-    hintBoxButtonType = {yes: 1, yesNo: 2, yesNoCancel: 3};
-    function speFont(str){
-        return `<span style='color:red;font-weight:bold;font-size:15px'> ${str} </span>`;
-    };
-
-    function hintBox(title, caption, btnType, doYes, doNo) {
-        $('#hintBox_title').text(title);
-        $('#hintBox_info').html(caption);
+    const hintBox = {
+        test: false,
+        value: null,
+        btnType: {yes: 1, yesNo: 2, yesNoCancel: 3},
+        init: function (){
+            // 事件类
+            $("#hintBox_value").unbind();
+            $("#hintBox_btn_yes").unbind();
+            $('#hintBox_btn_no').unbind();
+            $('#hintBox_btn_cancel').unbind();
+
+            $("#hintBox_value").keyup(
+                function (event) {
+                    hintBox.value = $('#hintBox_value').val();
+                    if (event.keyCode === 13) {
+                        $('#hintBox_btn_yes').click();
+                        return false;
+                    }
+                }
+            );
+            $('#hintBox_btn_cancel').click(
+                function () {
+                    if (!hintBox.test)
+                        $.bootstrapLoading.end();
+                    return;
+                }
+            );
+
+            // 显示类
+            $('#hintBox_caption').hide();
+            $('#hintBox_value').hide();
+            $('#hintBox_error').hide();
+            $('#hintBox_btn_yes').hide();
+            $('#hintBox_btn_no').hide();
+            $('#hintBox_btn_cancel').hide();
+        },
+        font: function(str){
+            return `<span style='color:red;font-weight:bold;font-size:15px'> ${str} </span>`;
+        },
+        error: function (err) {   // 注意:该方法只能用在valueBox()的doOK回调函数中。
+            $('#hintBox_error').text(err);
+            $('#hintBox_error').show(200);
+            $("#hintBox_value").focus();
+            $("#hintBox_value").select();
+        },
+        infoBox: function (title, caption, btnType, doYes, doNo) {
+            this.init();
+            $('#hintBox_title').text(title);
+            $('#hintBox_caption').html(caption);
+            $('#hintBox_caption').show();
+
+            switch (btnType) {
+                case this.btnType.yes:
+                    $('#hintBox_btn_yes').text('确定');
+                    $('#hintBox_btn_yes').show();
+                    break;
+                case this.btnType.yesNo:
+                    $('#hintBox_btn_yes').text('是');
+                    $('#hintBox_btn_no').text('否');
+                    $('#hintBox_btn_yes').show();
+                    $('#hintBox_btn_no').show();
+                    break;
+                case this.btnType.yesNoCancel:
+                    $('#hintBox_btn_yes').text('是');
+                    $('#hintBox_btn_no').text('否');
+                    $('#hintBox_btn_cancel').text('取消');
+                    $('#hintBox_btn_yes').show();
+                    $('#hintBox_btn_no').show();
+                    $('#hintBox_btn_cancel').show();
+                    break;
+            }
 
-        $('#hintBox_value').hide();
-        $('#hintBox_info').show();
-        $('#hintBox_btn_yes').show();
-        $('#hintBox_btn_yes').text('是');
-        $("#hintBox_btn_yes").unbind();
-        $('#hintBox_btn_no').show();
-        $('#hintBox_btn_no').text('否');
-        $('#hintBox_btn_no').unbind();
-        $('#hintBox_btn_cancel').show();
-        $('#hintBox_btn_cancel').text('取消');
-        $('#hintBox_btn_cancel').unbind();
+            if (doYes){
+                $('#hintBox_btn_yes').click(doYes);
+            }
 
-        switch (btnType) {
-            case hintBoxButtonType.yes:
-                $('#hintBox_btn_yes').text('确定');
-                $('#hintBox_btn_no').hide();
-                $('#hintBox_btn_cancel').hide();
-                break;
-            case hintBoxButtonType.yesNo:
-                $('#hintBox_btn_cancel').hide();
-                break;
-        }
+            if (doNo){
+                $('#hintBox_btn_no').click(doNo);
+            }
 
-        if (doYes){
-            $('#hintBox_btn_yes').click(doYes);
-        }
+            $("#hintBox_form").modal('show');
 
-        if (doNo){
-            $('#hintBox_btn_no').click(doNo);
-        }
+        },
+        valueBox: function (title, value, doOK) {
+            this.init();
+            $('#hintBox_title').text(title);
+            this.value = value;
+            $('#hintBox_value').show();
+            $('#hintBox_value').val(value);
+            $("#hintBox_value").focus();
+            $("#hintBox_value").select();
 
-        $('#hintBox_btn_cancel').click(
-            function () {return;}
-        );
+            $('#hintBox_btn_yes').text('确定');
+            $('#hintBox_btn_yes').show();
+            $('#hintBox_btn_yes').click(doOK);   // doOK不能给参数
 
-        $("#hintBox").modal({show:true});
+            $("#hintBox_form").modal('show');
+        }
     };
 
-    function hintBoxValue(title, value, doYes) {
-        $('#hintBox_title').text(title);
-
-        $('#hintBox_info').hide();
-        G_HINTBOX_VALUE = value;
-
-        $('#hintBox_value').show();
-        $('#hintBox_value').val(value);
-        $("#hintBox_value").unbind();
-        $("#hintBox_value").change(
-            function () {
-                G_HINTBOX_VALUE = $('#hintBox_value').val();
-            }
-        );
-
-        $('#hintBox_btn_yes').show();
-        $('#hintBox_btn_yes').text('确定');
-        $('#hintBox_btn_yes').unbind();
-        $('#hintBox_btn_yes').click(doYes);   // doYes不能给参数
-
-        $('#hintBox_btn_no').hide();
-        $('#hintBox_btn_cancel').hide();
-
-        $("#hintBox").modal({show:true});
-    };
+    $('#hintBox_form').on('hide.bs.modal', function() {
+        if (!hintBox.test)
+            $.bootstrapLoading.end();
+        return;
+    });
 </script>
 

+ 81 - 106
web/building_saas/complementary_glj_lib/js/glj.js

@@ -418,9 +418,9 @@ let repositoryGljObj = {
                                 if(me.currentGlj){
                                     me.currentGlj.component = [];
                                 }
-                                if(me.allowComponent.indexOf(rObj.gljType) !== -1){
+                               /* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
                                     rObj.basePrice = 0;
-                                }
+                                }*/
                                 if(me.componentGljType.indexOf(me.currentEditingGlj.gljType) !== -1 &&
                                     !(me.currentEditingGlj.gljType === 302 && rObj.gljType === 303) && !(me.currentEditingGlj.gljType === 303 && rObj.gljType === 302)){//修改了原本是组成物的工料机
                                     //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
@@ -506,9 +506,9 @@ let repositoryGljObj = {
                     me.addGljObj = null;
                     rObj.component = [];
                     //如果类型为混凝土、砂浆、配合比、机械台班时,添加时填写的单价清空
-                    if(me.allowComponent.indexOf(rObj.gljType) !== -1){
+                   /* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
                         rObj.basePrice = 0;
-                    }
+                    }*/
                     rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? parseFloat(rObj.basePrice) : 0;
                     addArr.push(rObj);
                 }
@@ -668,6 +668,7 @@ let repositoryGljObj = {
             let isExsit = false;
             for(let i = 0; i < me.distTypeTree.comboDatas.length; i++){
                 if(pasteObj.gljType === me.distTypeTree.comboDatas[i].text){
+                    pasteObj.gljType = me.distTypeTree.comboDatas[i].value;
                     isExsit = true;
                     reCalBasePrc = true;
                     //
@@ -685,9 +686,9 @@ let repositoryGljObj = {
                         }
                     }
                     tempObj.component = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.component : [];
-                    if(me.allowComponent.indexOf(tempObj.gljType) !== -1){
+                    /*if(me.allowComponent.indexOf(tempObj.gljType) !== -1){
                         tempObj.basePrice = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.basePrice : 0;
-                    }
+                    }*/
                     tempObj.gljType = me.distTypeTree.comboDatas[i].value;
                     tempObj.shortName = me.distTypeTree.distTypes[me.distTypeTree.prefix + tempObj.gljType].data.shortName;
                     break;
@@ -804,125 +805,99 @@ let repositoryGljObj = {
         }
     },
     onClipboardPasted: function(e, info) {
-      //  if(info.pasteData.text.trim().length > 0){
-            let me = repositoryGljObj;
-            let updateArr = [], addArr = [];
-            let items = sheetOpr.analyzePasteData(me.setting, info);
-            let beginRow = info.cellRange.row, endRow = info.cellRange.row + info.cellRange.rowCount - 1,//复制的起始行数和结束行数
-                maxRow = me.currentCache.length - 1,//当前数据最大行数
-                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);
-                         }
-                    }
-                    else{
-                        resumeArr.push(info.cellRange.row + i);
+        //  if(info.pasteData.text.trim().length > 0){
+        let me = repositoryGljObj;
+        let updateArr = [], addArr = [];
+        let items = sheetOpr.analyzePasteData(me.setting, info);
+        let beginRow = info.cellRange.row, endRow = info.cellRange.row + info.cellRange.rowCount - 1,//复制的起始行数和结束行数
+            maxRow = me.currentCache.length - 1,//当前数据最大行数
+            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);
                     }
                 }
             }
-            else if(beginRow <= maxRow && endRow > maxRow){
-                updateCount = maxRow - beginRow + 1;
-                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);
-                        }
-                    }
-                    else{
-                        resumeArr.push(info.cellRange.row + i);
+        }
+        else if(beginRow <= maxRow && endRow > maxRow){
+            updateCount = maxRow - beginRow + 1;
+            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]);
-                        }
-                        else{
-                            resumeArr.push(info.cellRange.row + i);
-                        }
+            }
+            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]);
                     }
                 }
-                else{
-                    for(let i = updateCount ; i < items.length; i++){
-                        resumeArr.push(info.cellRange.row + 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]);
                     }
                 }
             }
-            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]);
+        }
+        //repaint
+        for(let i = 0; i < info.cellRange.rowCount; i++){
+            resumeArr.push(info.cellRange.row + i);
+        }
+        if(resumeArr.length > 0){
+            let sheet = me.workBook.getActiveSheet();
+            sheet.suspendPaint();
+            for(let i = 0; i < resumeArr.length ; i++){
+                if(resumeArr[i] < me.currentCache.length){
+                    for(let col = 0; col < me.setting.header.length -1; col++){
+                        if(me.setting.header[col].dataCode === 'gljType'){
+                            let gljType = me.currentCache[resumeArr[i]][me.setting.header[col].dataCode];
+                            sheet.setValue(resumeArr[i], col, me.distTypeTree.distTypes["gljType" + gljType].data.fullName);
                         }
                         else{
-                            resumeArr.push(info.cellRange.row + i);
+                            sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]);
                         }
                     }
                 }
                 else{
-                    for(let i = 0; i < items.length; i++){
-                        resumeArr.push(info.cellRange.row + i);
+                    for(let col = 0; col < me.setting.header.length - 1; col++){
+                        sheet.setValue(resumeArr[i], col, '', GC.Spread.Sheets.SheetArea.viewport);
                     }
                 }
             }
-            //repaint
-            if(resumeArr.length > 0){
-                let sheet = me.workBook.getActiveSheet();
-                sheet.suspendPaint();
-                for(let i = 0; i < resumeArr.length ; i++){
-                    if(resumeArr[i] < me.currentCache.length){
-                        for(let col = 0; col < me.setting.header.length -1; col++){
-                            if(me.setting.header[col].dataCode === 'gljType'){
-                                let gljType = me.currentCache[resumeArr[i]][me.setting.header[col].dataCode];
-                                sheet.setValue(resumeArr[i], col, me.distTypeTree.distTypes["gljType" + gljType].data.fullName);
-                            }
-                            else{
-                                sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]);
-                            }
-                        }
-                    }
-                    else{
-                        for(let col = 0; col < me.setting.header.length - 1; col++){
-                            sheet.setValue(resumeArr[i], col, '', GC.Spread.Sheets.SheetArea.viewport);
-                        }
-                    }
-                }
-                sheet.resumePaint();
-            }
-            if (updateArr.length > 0 || addArr.length > 0) {
-                me.mixUpdateRequest(updateArr, addArr, []);
-            }
-            if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
-                me.updateRationBasePrcRq(updateBasePrcArr);
-            }
-       // }
-      /*  else{//解决bug: 从原本的sheet复制一行数据,会两次调用粘贴事件函数..,todo:找出原因
-            for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
-                for(let col = 0; col < 6; col++){
-                    info.sheet.setValue(info.cellRange.row + i, col, '');
-                }
-            }
-        }*/
+            sheet.resumePaint();
+        }
+        if (updateArr.length > 0 || addArr.length > 0) {
+            me.mixUpdateRequest(updateArr, addArr, []);
+        }
+        if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
+            me.updateRationBasePrcRq(updateBasePrcArr);
+        }
+        // }
     },
     updateRationBasePrcRq: function (basePrcArr) {
         CommonAjax.post('complementartGlj/api/updateRationBasePrc', {basePrcArr: basePrcArr}, function (rstData) {

+ 76 - 67
web/building_saas/css/main.css

@@ -8,10 +8,10 @@ body {
     font-size: 0.9rem
 }
 .btn.disabled, .btn:disabled {
-  color:#999
+    color:#999
 }
 .btn-link:focus, .btn-link:hover{
-  text-decoration: none
+    text-decoration: none
 }
 /*自定义css*/
 .header {
@@ -28,14 +28,14 @@ body {
     line-height: inherit
 }
 .header .header-logo sup{
-  font-size:10px;
-  top:-1.2em
+    font-size:10px;
+    top:-1.2em
 }
 .top-msg{
-  position: fixed;
-  top:0;
-  width:100%;
-  z-index: 999
+    position: fixed;
+    top:0;
+    width:100%;
+    z-index: 999
 }
 .main {
     position: relative;
@@ -61,38 +61,38 @@ body {
     text-decoration: none;
 }
 .main-nav .nav a.active {
-    border: 1px solid #ff6501;
+    border: 2px solid #ff6501;
     border-right: 1px solid #fff;
     background: #fff;
     color: #333
 }
 .main-nav .nav-tabs{
-  border-bottom: none
+    border-bottom: none
 }
 .poj-manage .col-auto{
-  background:#f7f7f9
+    background:#f7f7f9
 }
 .poj-cate {
-  width:58px
+    width:58px
 }
 .poj-cate .nav-pills .nav-link{
-  border-radius: 0;
-  font-size: 24px;
-  color: #007bff
+    border-radius: 0;
+    font-size: 24px;
+    color: #007bff
 }
 .poj-cate .nav-pills .nav-link:hover{
-  color:#0056b3
+    color:#0056b3
 }
 .poj-cate .nav-pills .nav-link.active, .nav-pills .show > .nav-link{
-  background-color: #6c757d;
-  color:#fff
+    background-color: #6c757d;
+    color:#fff
 }
 .pm-side{
-  position: fixed;
-  left:0
+    position: fixed;
+    left:0
 }
 .pm-content{
-  padding-left:58px
+    padding-left:58px
 }
 .content {
     border-left: 1px solid #ccc;
@@ -100,11 +100,12 @@ body {
     background: #fff
 }
 .toolsbar,.toolsbar-f {
-  border-bottom: 1px solid #ccc
+    border-bottom: 1px solid #ccc
 }
 .tools-btn {
     height: 30px;
     line-height: 30px;
+    background:#fff
 }
 .toolsbar .tools-btn.btn:hover,.toolsbar-f .tools-btn.btn:hover {
     background: #f7f7f9;
@@ -114,23 +115,23 @@ body {
     overflow-y: hidden;
 }
 .main-data-top,.main-data-full{
-  overflow: hidden;
-  width:100%
+    overflow: hidden;
+    width:100%
 }
 .main-content.col-lg-8{
-  width:66.666667%
+    width:66.666667%
 }
 .main-content.col-lg-12{
-  width:100%
+    width:100%
 }
 .main-side.col-lg-4{
-  width: 33.333333%;
+    width: 33.333333%;
 }
 .main-side.col-lg-0{
-  width:0%;
+    width:0%;
 }
 .sidebar-bottom,.sidebar-bottom .col-lg-6,.sidebar-bottom .col-lg-12 {
-  height:300px
+    height:300px
 }
 .top-content, .fluid-content {
     overflow: auto;
@@ -145,8 +146,16 @@ body {
     border-radius: 0;
     padding: 0.2em 0.5em
 }
+.bottom-tools {
+    height: 30px;
+    line-height: 30px;
+    background:#F1F1F1;
+    bottom:30px;
+    left:30px;
+    z-index: 999
+}
 .side-tabs .nav-tabs .nav-item {
-  z-index: 999
+    z-index: 999
 }
 .side-tabs .nav-tabs {
     border-bottom: none;
@@ -159,7 +168,7 @@ body {
     z-index: 999
 }
 .bottom-content .nav-tabs .nav-link.active {
-    border:1px solid #ff6501;
+    border:2px solid #ff6501;
     border-bottom: 1px solid #fff
 }
 .side-tabs .nav-tabs .nav-link.active {
@@ -274,82 +283,82 @@ body {
     overflow: auto;
 }
 .print-toolsbar{
-  padding:5px
+    padding:5px
 }
 .print-toolsbar .panel {
-  display:inline-block;
-  vertical-align:top;
-  background:#f7f7f9
+    display:inline-block;
+    vertical-align:top;
+    background:#f7f7f9
 }
 .print-toolsbar .panel .panel-foot{
-  text-align: center;
-  font-size: 12px
+    text-align: center;
+    font-size: 12px
 }
 .print-list {
-  border-right:1px solid #ccc
+    border-right:1px solid #ccc
 }
 .print-list .form-list {
-  overflow: auto
+    overflow: auto
 }
 .print-list .list-tools{
-  height:50px;
-  padding:10px 0;
-  border-bottom:1px solid #f2f2f2
+    height:50px;
+    padding:10px 0;
+    border-bottom:1px solid #f2f2f2
 }
 .pageContainer {
-  background: #ededed;
-  text-align: center
+    background: #ededed;
+    text-align: center
 }
 .pageContainer .page{
-  border:9px solid transparent;
-  display: inline-block;
+    border:9px solid transparent;
+    display: inline-block;
 }
 .pageContainer .page img{
-  width:inherit;
-  height: inherit;
+    width:inherit;
+    height: inherit;
 }
 .modal-auto-height {
-  height: 400px;
-  overflow-y: auto;
+    height: 400px;
+    overflow-y: auto;
 }
 .modal-toolbar + .modal-auto-height{
-  height:369px
+    height:369px
 }
 .modal-fixed-height {
-  height: 400px;
-  overflow-y: hidden;
+    height: 400px;
+    overflow-y: hidden;
 }
 .sidebar-tools-bar {
-  background:#fff
+    background:#fff
 }
 .side-search-box{
-  background:#fff;
-  border-bottom:1px solid #ddd
+    background:#fff;
+    border-bottom:1px solid #ddd
 }
 .navbar-crumb span{
-  max-width: 200px
+    max-width: 200px
 }
 .dropdown-item{
-  color:#007bff
+    color:#007bff
 }
 .dropdown-item:hover{
-  color:#0056b3
+    color:#0056b3
 }
 .dropdown-item.disabled, .dropdown-item:disabled{
-  pointer-events:none
+    pointer-events:none
 }
 .tools-symbol{
-  width:450px
+    width:450px
 }
 .tools-symbol p{
-  margin: 0
+    margin: 0
 }
 .tools-symbol a.btn{
-  font-size: .95rem;
-  width:26px;
-  padding: 0;
-  height:26px;
+    font-size: .95rem;
+    width:26px;
+    padding: 0;
+    height:26px;
 }
 .custom-file-input:lang(zh) ~ .custom-file-label::after {
     content: "浏览";
-}
+}

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

@@ -25,13 +25,6 @@
             </div>
         </div>
     </div>
-
-    <script>
-        !function loadHintBox(){
-            $("body").append('<div id = "div_hintBox"></div>');
-            $("#div_hintBox").load("../../../../public/scHintBox.html");
-        }();
-    </script>
 </body>
 
 

+ 29 - 2
web/building_saas/main/html/main.html

@@ -142,9 +142,29 @@
                                           <textarea class="form-control" rows="8" readonly=""></textarea>
                                       </div>
                                       <div id="tzjnrCon" class="main-data-bottom">
-                                          <div class="main-data-bottom ovf-hidden" style="width: 33%; float: left;" id="jobSpread">
+                                          <div style="width: 33%; float: left;">
+                                              <div class="main-data-bottom ovf-hidden" id="jobSpread">
+                                              </div>
+                                              <!--工具栏-->
+                                            <!--  <div class="bottom-tools btn-group position-absolute">
+                                                  <a href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="插入"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
+                                                  <a href="javascript:void(0);" class="btn btn-sm " data-toggle="tooltip" data-placement="bottom" title="" data-original-title="添加"><i class="fa fa-plus" aria-hidden="true"></i></a>
+                                                  <a href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
+                                                  <a href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
+                                                  <a href="javascript:void(0);" 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="main-data-bottom ovf-hidden" style="width: 33%; float: left;" id="itemSpread">
+                                          <div style="width: 33%; float: left;">
+                                              <div class="main-data-bottom ovf-hidden"  id="itemSpread">
+                                              </div>
+                                              <!--工具栏-->
+                                             <!-- <div class="bottom-tools btn-group position-absolute">
+                                                  <a href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="插入"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
+                                                  <a href="javascript:void(0);" class="btn btn-sm " data-toggle="tooltip" data-placement="bottom" title="" data-original-title="添加"><i class="fa fa-plus" aria-hidden="true"></i></a>
+                                                  <a href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
+                                                  <a href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
+                                                  <a href="javascript:void(0);" 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 id="add-rule" style="width: 33%;float: left;background: #EFEFEF; height: 100%;display: none; padding-left: 8px;">
                                               <p style="text-align: center">添加规则</p>
@@ -1224,6 +1244,13 @@
            // autoFlashHeight();
         </script>
 
+        <script>
+            !function loadHintBox(){
+                $("body").append('<div id = "hintBox_container"></div>');
+                $("#hintBox_container").load("../../../../public/scHintBox.html");
+            }();
+        </script>
+
         <SCRIPT type="text/javascript">
             <!--
 //            var zNodes =[

+ 15 - 13
web/building_saas/main/js/models/calc_program.js

@@ -755,7 +755,7 @@ let analyzer = {
         let expr = me.standard(dispExpr);
         let invalidChars = /[^0-9\u4e00-\u9fa5\+\-\*\/\(\)\.\[\]FL%]/g;
         if (invalidChars.test(expr)){
-            alert('表达式中含有无效的字符!');
+            hintBox.infoBox('系数提示','表达式中含有无效的字符!',1);
             return false;
         };
 
@@ -764,26 +764,26 @@ let analyzer = {
         let pattBase = new RegExp(/\[[\u4E00-\u9FA5]+\]/gi);
         let arrBase = expr.match(pattBase);
         if (arrCn && !arrBase){
-            alert('定额基数必须用中括号[]括起来!');
+            hintBox.infoBox('系统提示', '定额基数必须用中括号[]括起来!', 1);
             return false;
         };
         if (arrCn && arrBase && (arrCn.length != arrBase.length)){
             for (let cn of arrCn){
                 let tempBase = `[${cn}]`;
                   if (!arrBase.includes(tempBase)){
-                      alert(`定额基数“${cn}”必须用中括号[]括起来!`);
+                      hintBox.infoBox('系统提示', `定额基数“${cn}”必须用中括号[]括起来!`, 1);
                       return false;
                   }
             };
             // 这里要加一个保险。因为上面的 for 循环在“主材费 + [主材费]” 情况下有Bug
-            alert('定额基数必须用中括号[]括起来!');
+            hintBox.infoBox('系统提示', '定额基数必须用中括号[]括起来!', 1);
             return false;
         };
         if (arrBase){
             for (let base of arrBase){
                 let baseName = base.slice(1, -1);
                 if (!rationCalcBases[baseName]){
-                    alert('定额基数 [' + baseName + '] 末定义!');
+                    hintBox.infoBox('系统提示', '定额基数 [' + baseName + '] 末定义!', 1);
                     return false;
                 }
             };
@@ -793,14 +793,15 @@ let analyzer = {
         for (let F of arrF){
             let num = F.slice(1);
             if (num > template.calcItems.length){
-                alert('表达式中 “F'+ num +'” 行号引用错误!');
+                let s = hintBox.font('F'+num);
+                hintBox.infoBox('系统提示', `表达式中 “${s}” 行号引用错误!`, 1);
                 return false;
             };
         };
 
         let expression = me.getExpression(expr, template);
         if (me.isCycleCalc(expression, itemID, template)){
-            alert('表达式中有循环计算!');
+            hintBox.infoBox('系统提示', '表达式中有循环计算!', 1);
             return false;
         }
 
@@ -944,11 +945,12 @@ let analyzer = {
     },
     fieldNameIsUsed: function(template, fieldName){
         let fieldNameEn = projectObj.project.calcProgram.compiledFeeTypeMaps[fieldName];
-        for (let item of template.calcItems){
-              if (item.fieldName == fieldNameEn){
-                  return true;
-              }
-        };
+        for (var i = 0; i < template.calcItems.length; i++) {
+            if (template.calcItems[i].fieldName == fieldNameEn){
+                template.fieldNameTempUsed = i;
+                return true;
+            }
+        }
         return false;
     }
 };
@@ -972,7 +974,7 @@ let executeObj = {
             return calcTools.marketPriceToBase(me.treeNode, baseName)
         else{
             if (!rationCalcBases[baseName]){
-                alert('定额基数“' + baseName + '”末定义,计算错误。 (模板 ' + me.template.ID + ',规则 ' + me.tempCalcItem.ID +')');
+                hintBox.infoBox('系统提示', '定额基数“' + baseName + '”末定义,计算错误。 (模板 ' + me.template.ID + ',规则 ' + me.tempCalcItem.ID +')', 1);
                 return 0;
             }
             else

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

@@ -201,6 +201,15 @@ const supplyText = {
     JDYG: '甲定乙供'
 };
 
+//三材类别
+const materialType = {
+    1: '钢材',
+    2: '钢筋',
+    3: '木材',
+    4: '水泥',
+    5: '标准砖'
+};
+
 //清单固定行
 const fixedFlag = {
     // 分部分项工程

+ 38 - 38
web/building_saas/main/js/views/calc_program_manage.js

@@ -115,20 +115,23 @@ let calcProgramManage = {
                 return;
             }
 
-            if (analyzer.fieldNameIsUsed(me.getSelectionInfo().template, args.newValue)){
+            let template = me.getSelectionInfo().template;
+            if (analyzer.fieldNameIsUsed(template, args.newValue)){
                 let sheet = me.detailSpread.getActiveSheet();
                 sheet.suspendEvent();
                 sheet.setValue(args.row, args.col, args.oldValue);
                 sheet.resumeEvent();
                 $.bootstrapLoading.end();
-                alert(`“${args.newValue}” 已被其它行使用,不允许重复选择!`);
+                let s = hintBox.font(template.fieldNameTempUsed + 1);
+                hintBox.infoBox('系统提示', `“${args.newValue}” 已被第 ${s} 行使用,不允许重复选择!`, 1);
+                delete template.fieldNameTempUsed;
                 return;
             }
 
             curCalcItem.fieldName = projectObj.project.calcProgram.compiledFeeTypeMaps[args.newValue];
         }
         else if (dataCode == 'dispExprUser'){  // 除非直接改单元格,弹窗不会走这里
-            alert('用户修改dispExprUser值,触发onDetailEditEnded事件。');
+            hintBox.infoBox('系统提示', '用户直接在sheet中修改了dispExprUser值,触发onDetailEditEnded事件。', 1);
         };
 
         curCalcItem[dataCode] = args.newValue;
@@ -210,36 +213,39 @@ let calcProgramManage = {
                         let template = calcProgramManage.getSelectionInfo().template;
                         let idx = calcProgramManage.mainSpread.getActiveSheet().getActiveRowIndex();
 
-                        let newName = prompt("请输入新的模板名称:", template.name);
-                        if (!newName || (newName && newName == template.name)) {
-                            $.bootstrapLoading.end();
-                            return;
-                        };
+                        let newName = '';
+                        hintBox.valueBox('请输入新的模板名称:', template.name, function () {
+                            newName = hintBox.value;
 
-                        while (analyzer.templateNameIsExist(newName)){
-                            alert(`“${newName}”已存在,请重新输入!`);
-                            newName = prompt("请输入新的模板名称:", template.name);
-                        };
+                            if (!newName){
+                                hintBox.error(`名称不能为空!`);
+                                return false;
+                            };
 
-                        if (!newName || (newName && newName == template.name)) {
-                            $.bootstrapLoading.end();
-                            return;
-                        };
+                            if (newName == template.name) {
+                                $.bootstrapLoading.end();
+                                return;
+                            }
 
-                        template.name = newName;
+                            if (analyzer.templateNameIsExist(newName)){
+                                hintBox.error(`“${newName}” 已存在,请重新输入!`);
+                                return false;
+                            };
 
-                        let data = {
-                            'projectID': projectObj.project.ID(),
-                            'ID': template.ID,
-                            'name': template.name
-                        };
-                        calcProgramManage.updateTemplate(data, function (rst) {
-                            if (rst){
-                                projectObj.project.calcProgram.compileTemplateMaps();
-                                sheetCommonObj.showData(calcProgramManage.mainSpread.getSheet(0), calcProgramManage.mainSetting, calcProgramManage.datas);
-                            }
+                            template.name = newName;
+                            let data = {
+                                'projectID': projectObj.project.ID(),
+                                'ID': template.ID,
+                                'name': template.name
+                            };
+                            calcProgramManage.updateTemplate(data, function (rst) {
+                                if (rst){
+                                    projectObj.project.calcProgram.compileTemplateMaps();
+                                    sheetCommonObj.showData(calcProgramManage.mainSpread.getSheet(0), calcProgramManage.mainSetting, calcProgramManage.datas);
+                                    $.bootstrapLoading.end();
+                                }
+                            });
                         });
-                        $.bootstrapLoading.end();
                     }
                 },
                 "spr1": '--------',
@@ -256,7 +262,7 @@ let calcProgramManage = {
                         let template = calcProgramManage.getSelectionInfo().template;
                         if (analyzer.templateIsUsed(template.ID)) {
                             $.bootstrapLoading.end();
-                            alert(`计算模板“${template.name}”已被使用,不允许删除!`);
+                            hintBox.infoBox('系统提示', `计算模板“${template.name}”已被使用,不允许删除!`, 1);
                             return;
                         }
                         let data = {
@@ -322,13 +328,6 @@ let calcProgramManage = {
                     name: '删除行',
                     icon: 'fa-remove',
                     callback: function () {
-                        // function cbYes() {alert('你点击了yes按键');};
-                        // function cbNo() {alert('你点击了no按键');}
-                        // function cbOK() {alert(`你输入的值为:${G_HINTBOX_VALUE}`);};
-                        //
-                        // // hintBox('操作确认', '确定要删除当前节点吗?', 2, cbYes, cbNo);
-                        // hintBoxValue('请输入新名称:', '我的模板1', cbOK);
-                        // return;
                         $.bootstrapLoading.start();
                         let template = calcProgramManage.getSelectionInfo().template;
                         let idx = calcProgramManage.detailSpread.getActiveSheet().getActiveRowIndex();
@@ -336,13 +335,14 @@ let calcProgramManage = {
 
                         if (item.fieldName == 'common'){
                             $.bootstrapLoading.end();
-                            alert(`费用类别为“工程造价”的行不允许删除!`);
+                            hintBox.infoBox('系统提示', `费用类别为“工程造价”的行不允许删除!`, 1);
                             return;
                         };
 
                         if (analyzer.calcItemIsUsed(template, item)){
                             $.bootstrapLoading.end();
-                            alert(`第 ${idx + 1} 行“${item.name}”已被第 ${item.tempUsed + 1} 行引用,不允许删除!`);
+                            let s = hintBox.font(item.tempUsed + 1);
+                            hintBox.infoBox('系统提示', `第 ${idx + 1} 行“${item.name}”已被第 ${s} 行引用,不允许删除!`, 1);
                             delete item.tempUsed;
                             return;
                         };

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

@@ -144,7 +144,7 @@ let labourCoeView = {
             me.sheet.suspendEvent();
             cell.value(oValue);  // 屏蔽事件,否则这句会导致死循环
             me.sheet.resumeEvent();
-            alert('当前输入的数据类型不正确,请重新输入。');
+            hintBox.infoBox('系统提示', '当前输入的数据类型不正确,请重新输入。', 1);
         }
     }
 };