zhangweicheng 6 年 前
コミット
cdc369890a

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

@@ -529,7 +529,10 @@ var TREE_SHEET_HELPER = {
 
         if(isRationNode){
             TreeNodeCellType.prototype.createEditorElement = function (context) {
-                return document.createElement("div");
+                let div = document.createElement("div");
+                div.setAttribute("gcUIElement", "gcEditingInput");
+                $(div).attr("id", 'rationCheckBox');
+                return div;
             };
 
             TreeNodeCellType.prototype.activateEditor = function (editorContext, cellStyle, cellRect, context) {
@@ -551,6 +554,10 @@ var TREE_SHEET_HELPER = {
                 return $editor;
             };
 
+            TreeNodeCellType.prototype.deactivateEditor = function (editorContext, context) {
+                    console.log("hehe")
+            };
+
             TreeNodeCellType.prototype.updateEditor = function (editorContext, cellStyle, cellRect, context) {
                 let me = this;
                 $(editorContext).append(`<div><ul class="es-list" style="display: block;"></ul></div>`);//<li class="" data-value="" style=""> <br></li> //background-color:${cellStyle.backColor}
@@ -584,7 +591,7 @@ var TREE_SHEET_HELPER = {
                     });
                     if( $('#esInput').val()) setCursor( $("#esInput")[0], $('#esInput').val().length)
                 });
-
+                console.log("update")
             };
 
             TreeNodeCellType.prototype.processKeyDown = function (e, context){ //当用isReservedKey 不拦截编辑模式时的input框ctrl + c时,在非编辑模式的ctrl + c事件也需要自已处理,所以在这里再调用一下复制命令
@@ -599,7 +606,6 @@ var TREE_SHEET_HELPER = {
                  $('#esInput').val(value);
             };
             TreeNodeCellType.prototype.getEditorValue = function (editor, context) {
-                console.log($('#esInput').val());
                 return  $('#esInput').val()!==''? $('#esInput').val():null;
             };
 

+ 15 - 4
web/building_saas/main/js/models/bills.js

@@ -722,9 +722,9 @@ var Bills = {
             let updateRation = false;
             for(let m_node of mainNodes){
                 if(m_node.sourceType == project.Bills.getSourceType()){
-                    if(m_node.preSibling){
+                    if(m_node.preSibling && !gljUtil.isDef(mainTreeMap[m_node.preSibling.data.ID])){ //有前一节点,并且前一节点不在删除的列表中
                         billsUpdate[m_node.preSibling.data.ID] = {
-                            NextSiblingID:m_node.nextSibling?m_node.nextSibling.data.ID:-1
+                            NextSiblingID:getNotDeleteNextID(m_node.nextSibling,mainTreeMap)
                         };
                         updateBill=true;
                     }
@@ -738,9 +738,7 @@ var Bills = {
                 updateNodes.push(m_node);
                 controller.tree.getAllSubNode(m_node,updateNodes);
             }
-            console.log(mainNodes);
             let refNodes = mbzm_obj.deleteReferenceRation(mainNodes,updateNodes);//删除子目关联定额节点
-            console.log(mainNodes);
             for(let u_node of updateNodes){
                 if(u_node.sourceType == project.Bills.getSourceType()){
                     billsUpdate[u_node.data.ID] = true;
@@ -804,6 +802,19 @@ var Bills = {
             }, function () {
                 $.bootstrapLoading.end();
             });
+
+            function getNotDeleteNextID(nextNode,map) {
+                if(nextNode){
+                    if(gljUtil.isDef(map[nextNode.data.ID])){
+                        return getNotDeleteNextID(nextNode.nextSibling,map)
+                    } else {
+                        return nextNode.data.ID
+                    }
+                }else {
+                    return -1
+                }
+            }
+
         };
         bills.prototype.setNodeToMapAndArray=function (node,map,array) {
             let nodeID = node.getID();

+ 2 - 1
web/building_saas/main/js/models/ration.js

@@ -423,6 +423,7 @@ var Ration = {
                    }
                 }
                 project.projectGLJ.loadData(function () {
+                    mbzm_obj.nodeChanged = true;//子目模板关联刷新
                     gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected,"-111111111");//这里第二个参数是为了使改前和改后selectedID不一样,删除了的话下方的定额工料机不会刷新
                     project.calcProgram.calcNodesAndSave(refershNodes);
                     projectObj.mainController.refreshTreeNode(refershNodes, true);
@@ -439,7 +440,7 @@ var Ration = {
             let me = this;
             let project = projectObj.project, sheetController = projectObj.mainController;
             let engineering = projectInfoObj.projectInfo.property.engineering;
-            let selected = project.mainTree.selected, newSource = null, newNode = null,pre=null,br=null;
+            let selected = project.mainTree.selected, newSource = null, newNode = null,pre = null,br = null;
             let billItemID = null,serialNo=1,nextID=null;
             let needInstall = false;
             let newDatas = [];

+ 4 - 0
web/building_saas/main/js/views/mbzm_view.js

@@ -57,6 +57,9 @@ let mbzm_obj={
         this.sheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onSheetValueChange);
         this.spread.bind(GC.Spread.Sheets.Events.ButtonClicked, installationFeeObj.onPositionButtonClick);//共用一个位置选择器
         this.sheet.name('ration_template');
+        if(projectReadOnly){
+            disableSpread(this.spread);
+        }
     },
     refresh:function () {
         let total = $('#mbzmSpread').parent().height();
@@ -494,5 +497,6 @@ $('#next_mbzm').click(function () {
 });
 
 $('#apply_mbzm').click(function () {
+    if(projectReadOnly) return;
     mbzm_obj.applyTemplate();
 });

+ 7 - 1
web/building_saas/main/js/views/project_view.js

@@ -973,7 +973,6 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ColumnWidthChanged, that.onColumnWidthChanged);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardPasting, that.onClipboardPasting);
-
                 //let loadOtherStartTime = +new Date();
                 if(!projectReadOnly){
                     that.loadMainSpreadContextMenu();
@@ -1157,6 +1156,7 @@ var projectObj = {
             selector: '#billsSpread',
             selectableSubMenu: true,
             build: function ($trigger, e) {
+                projectObj.cusRationCombCheck(spread.getActiveSheet());
                 var target = SheetDataHelper.safeRightClickSelection($trigger, e, spread);
                 controller.setTreeSelected(controller.tree.items[target.row]);
                 return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
@@ -1993,6 +1993,12 @@ var projectObj = {
             if(field != null) projectObj.mainController.sheet.setSelection(newNode.serialNo(), colSettingObj.getColByField(field), 1, 1);  //自动定位到编号单元格
             projectObj.mainSpread.focus();
         }
+    },
+    cusRationCombCheck:function (sheet) {//检查自定义定额编号下拉框,右键的时候不自动消失,现手动结束编辑,并删除元素
+        if(sheet.isEditing()){
+            sheet.endEdit()
+        }
+        if($("#rationCheckBox").is(':visible'))  $("#rationCheckBox").parent().parent().remove();
     }