zhongzewei 7 years ago
parent
commit
395d223b88

+ 7 - 3
web/building_saas/main/js/models/bills.js

@@ -770,9 +770,6 @@ var Bills = {
                 }
                 controller.m_delete(mainNodes);//删除树节点
                 me.tree.m_delete(idTreeNodes);
-                //test
-                addRuleUseToBills(getAddRuleSetting(), )
-                //test
                 $.bootstrapLoading.end();
                 //重新计算
                 project.installation_fee.calcInstallationFee(function (isChange) {
@@ -782,6 +779,13 @@ var Bills = {
                     }
                     gljOprObj.refreshView();
                 });
+                //添加内容为定额子目时,根据特征及内容添加规则刷新清单
+                if(updateData['ration']){
+                    let addRuleSetting = getAddRuleSetting();
+                    if(addRuleSetting && addRuleSetting.addContent === '5'){
+                        addRuleUseToBills(getAddRuleSetting(), projectObj.project.mainTree.items);
+                    }
+                }
             }, function () {
                 $.bootstrapLoading.end();
             });

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

@@ -1087,7 +1087,7 @@ let pageCCOprObj = {
      * @return {void}
      */
     setCharacterBySetting: function(node, setting, callback = null, oprObj = null, usedToAll = null) {
-        if(!node){
+        if(!node || node.sourceType !== projectObj.project.Bills.getSourceType()){
             return;
         }
         let self = this;

+ 41 - 5
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -102,11 +102,47 @@ const billsGuidance = (function () {
                 }
                 if(node.children.length === 0){
                     //插入清单
-                    let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, node);
-                    if(insert){
-                        //插入选中的定额
-                        let addRationDatas = getInsertRationData(getCheckedRows());
-                        insertRations(addRationDatas);
+                    if (/\//.test(node.data.unit)) {
+                        let canAdd = true;
+                        $.bootstrapLoading.start();
+                        let existB = projectObj.project.Bills.sameStdCodeBillsData(node.data.code);
+                        if (existB) {
+                            let std = JSON.parse(JSON.stringify(node.data));
+                            std.unit = existB.unit;
+                            canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
+                            if(canAdd !== null || canAdd !== false){
+                                //插入选中的定额
+                                let addRationDatas = getInsertRationData(getCheckedRows());
+                                insertRations(addRationDatas);
+                            }
+                            if(canAdd === false && $.bootstrapLoading.isLoading()){
+                                $.bootstrapLoading.end();
+                            }
+                        } else {
+                            ConfirmModal.stdBillsUnit.check(node.data, function (std) {
+                                canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
+                                if(canAdd !== null || canAdd !== false){
+                                    //插入选中的定额
+                                    let addRationDatas = getInsertRationData(getCheckedRows());
+                                    insertRations(addRationDatas);
+                                }
+                                if(canAdd === false && $.bootstrapLoading.isLoading()){
+                                    $.bootstrapLoading.end();
+                                }
+                            }, function () {
+                                if($.bootstrapLoading.isLoading()){
+                                    $.bootstrapLoading.end();
+                                }
+                            });
+                        }
+                    }
+                    else {
+                        let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, node);
+                        if(insert){
+                            //插入选中的定额
+                            let addRationDatas = getInsertRationData(getCheckedRows());
+                            insertRations(addRationDatas);
+                        }
                     }
                 }
                 else {

+ 61 - 10
web/building_saas/pm/js/pm_newMain.js

@@ -2891,11 +2891,67 @@ function bindEvents_file_table(jqS, usedObj, targetBody, type){
         let orgDispName = $(jqS + ' div:eq(0)')[0].childNodes[0].textContent;
         let postFix = '';
         let orgName = orgDispName;
+        let hintText = $(jqS).find('span');
+        let fileDiv = $(jqS + ' div:eq(0)');
+        let renameDiv = $(jqS + ' div:eq(1)');
         $(jqS + ' input').val(orgName);
-        $(jqS + ' div:eq(0)').hide();
-        $(jqS + ' div:eq(1)').show();
+        fileDiv.hide();
+        renameDiv.show();
+        $(jqS).find('input:eq(0)').focus();
+        $(jqS).find('input:eq(0)').blur(function () {
+            fileDiv.show();
+            renameDiv.hide();
+            hintText.hide();
+        });
         //确认重命名
-        $(jqS + ' .btn-success').on('click', function () {
+        //回车键
+        $(jqS).find('input:eq(0)').keypress(function (e) {
+            if(e.keyCode === 13){
+                let attrId = $(jqS).attr('id');
+                let id = attrId.slice(5, attrId.length);
+                let newName = $(jqS + ' input').val().trim();
+                if(newName !== orgName){
+                    if(hasThisFileName(fileObjs, newName)){
+                        hintText.show();
+                        //$(jqS + ' input').val(orgName);
+                        return;
+                    }
+                    if(newName.trim().length === 0){
+                        alert('文件名不可为空!');
+                        $(jqS + ' input').val(orgName);
+                        return;
+                    }
+                    //ajax
+                    let updateObj = Object.create(null);
+                    updateObj.fileType = type;
+                    updateObj.updateType = 'update';
+                    updateObj.updateData = Object.create(null);
+                    if(type === fileType.unitPriceFile){
+                        updateObj.updateData.id = parseInt(id);
+                        //updateObj.updateData.id = id;
+                    }
+                    else if(type === fileType.feeRateFile){
+                        updateObj.updateData.ID = id;
+                    }
+                    updateObj.updateData.name = newName;
+                    a_updateFiles([updateObj], function () {
+                        let newDispName = newName + postFix;
+                        fileDiv[0].childNodes[0].textContent = newDispName;
+                        fileDiv.show();
+                        renameDiv.hide();
+                        //refresh tender
+                        refreshTenderFile(getTendersByFile(type, id, projTreeObj.tree.selected), type, newName);
+                    });
+                }
+                let newDispName = newName + postFix;
+                fileDiv[0].childNodes[0].textContent = newDispName;
+                fileDiv.show();
+                renameDiv.hide();
+                hintText.hide();
+            }
+        });
+
+        /*$(jqS + ' .btn-success').on('click', function () {
             let attrId = $(jqS).attr('id');
             let id = attrId.slice(5, attrId.length);
             let newName = $(jqS + ' input').val().trim();
@@ -2942,7 +2998,7 @@ function bindEvents_file_table(jqS, usedObj, targetBody, type){
             $(jqS + ' div:eq(0)').show();
             $(jqS + ' div:eq(1)').hide();
             $(jqS).find('span:eq(2)').hide();
-        });
+        });*/
     });
     //悬浮框显示使用该文件的单位工程
     $($(jqS)[0].nextSibling).popover({
@@ -2978,12 +3034,7 @@ function set_file_table(target, poj_tenders, fileList, type){
         let hoverHtml = '<p style="display: none; height: 14px;"><a class="btn btn-sm" href="javascript:void(0);" data-toggle="modal" data-target="#del-wj">删除</a><a class="btn btn-sm" href="javascript:void(0);">重命名</a></p></div>';
         let renHtml = '<div class="input-group" style="display: none;">'
             + '<input class="form-control form-control-sm" value="">'
-            + '<span class="input-group-btn">'
-            + '<button class="btn btn-success btn-sm" type="button"><i class="fa fa-check"></i></button>'
-            + '</span>'
-            + '<span class="input-group-btn">'
-            + '<button class="btn btn-secondary btn-sm" type="button"><i class="fa fa-remove"></i></button>'
-            + '</span>'
+
             + '</div>'
             + '<span class="form-text text-danger" style="display: none">本建设项目已存在该文件名,请重新输入!' +
             '</span></td>';