|
@@ -695,15 +695,16 @@ var projectObj = {
|
|
|
that.mainController.bind('refreshBaseActn', that.refreshBaseActn);
|
|
|
that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.beforeTreeSelectedChange, that.beforeMainTreeSelectedChange);
|
|
|
that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, that.treeSelectedChanged);
|
|
|
-
|
|
|
- //that.bindEnterKey(that.mainSpread, 'mainEnterKey', that.mainSpreadEnterKey);
|
|
|
+ if(!projectReadOnly){
|
|
|
+ that.bindEnterKey(that.mainSpread, 'mainEnterKey', that.mainSpreadEnterKey);
|
|
|
+ }
|
|
|
setTimeout(function () {
|
|
|
that.mainSpread.getActiveSheet().startEdit();//这两句需要挺多时间,而又需要在editend 事件前触发,而这些又不影响计算,所以这里用异步的方法
|
|
|
that.mainSpread.getActiveSheet().endEdit();
|
|
|
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.EditEnded, that.mainSpreadEditEnded);
|
|
|
},100);
|
|
|
- that.mainSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, that.amountAreaNumber);
|
|
|
+ that.mainSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, that.amountAreaNumber);//选中统计专用,节点相关操作在treeSelectedChanged里些
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.LeaveCell, that.mainSpreadLeaveCell);
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.EnterCell, that.mainSpreadEnterCell);
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.EditStarting, that.mainSpreadEditStarting);
|
|
@@ -754,28 +755,92 @@ var projectObj = {
|
|
|
}
|
|
|
//正常情况,焦点应该是在下一行的同一列
|
|
|
let newRow = orgRow + 1, newCol = orgCol;
|
|
|
+ //getColByField getVisible都不提出来,减少调用次数
|
|
|
if(selected){
|
|
|
//在分项/补项的编码单元格回车,焦点应跳动至本行的工程量单元格
|
|
|
if(orgField && orgField === 'code' && selected.sourceType === me.project.Bills.getSourceType() && [billType.FX, billType.BX].includes(selected.data.type)){
|
|
|
let quantityCol = colSettingObj.getColByField('quantity');
|
|
|
let quantityVisible = colSettingObj.getVisible('quantity');
|
|
|
- if(quantityCol && quantityVisible){
|
|
|
+ if(quantityCol !== null && quantityVisible !== false){
|
|
|
newRow = orgRow;
|
|
|
newCol = quantityCol;
|
|
|
}
|
|
|
}
|
|
|
- //在分项/补项的工程量单元格回车,如果其下有定额/量价/人材机,焦点应跳动至其下第一条定额/量价/人材机的工程量;
|
|
|
- //如果其下没有定额/量价/人材机,则自动在其下插入一条定额空行,在其后自动插入一条分项空行,焦点跳动至定额空行的编码单元格。
|
|
|
- if(orgField && orgField === 'quantity' && selected.sourceType === me.project.Bills.getSourceType() && [billType.FX, billType.BX].includes(selected.data.type)
|
|
|
- && selected.children.length === 0){
|
|
|
- me.project.Ration.addNewRation(null,rationType.ration, function () {
|
|
|
- newRow = sheet.getActiveRowIndex();
|
|
|
- newCol = sheet.getActiveColumnIndex();
|
|
|
- });
|
|
|
+ else if(orgField && orgField === 'quantity' && selected.sourceType === me.project.Bills.getSourceType() && [billType.FX, billType.BX].includes(selected.data.type)){
|
|
|
+ //在分项/补项的工程量单元格回车,如果其下有定额/量价/人材机,焦点应跳动至其下第一条定额/量价/人材机的工程量,如果是空行,则跳到至第一条定额xx的编码;
|
|
|
+ if(selected.children.length !== 0 && !(isDef(selected.children[0].data.code) && selected.children[0].data.code.toString().trim() !== '')){
|
|
|
+ let codeCol = colSettingObj.getColByField('code');
|
|
|
+ let codeVisible = colSettingObj.getVisible('code');
|
|
|
+ newRow = orgRow + 1;
|
|
|
+ if(codeCol !== null && codeVisible !== false){
|
|
|
+ newCol = codeCol;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果其下没有定额/量价/人材机,则自动在其下插入一条定额空行,在其后自动插入一条分项空行,焦点跳动至定额空行的编码单元格。
|
|
|
+ else if(selected.children.length === 0){
|
|
|
+ //在其后插入分项
|
|
|
+ if(!(projectInfoObj.projectInfo.property.lockBills && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected))){
|
|
|
+ ProjectController.addFX(me.project, me.mainController);
|
|
|
+ //将焦点行设置成原本的行,以插入定额
|
|
|
+ me.mainController.setTreeSelected(me.project.mainTree.items[orgRow]);
|
|
|
+ }
|
|
|
+ //插入定额
|
|
|
+ me.project.Ration.addNewRation(null, rationType.ration, function () {
|
|
|
+ newRow = sheet.getActiveRowIndex();
|
|
|
+ let codeCol = colSettingObj.getColByField('code');
|
|
|
+ let codeVisible = colSettingObj.getVisible('code');
|
|
|
+ if(codeCol !== null && codeVisible !== false){
|
|
|
+ newCol = codeCol;
|
|
|
+ }
|
|
|
+ sheet.setActiveCell(newRow, newCol);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
//在定额/量价/人材机的编码单元格回车,焦点应跳动至本行的工程量单元格
|
|
|
- if(orgField && orgField === 'code' && selected.sourceType === me.project.Ration.getSourceType() && []){
|
|
|
-
|
|
|
+ else if(orgField && orgField === 'code' && selected.sourceType === me.project.Ration.getSourceType()){
|
|
|
+ let quantityCol = colSettingObj.getColByField('quantity');
|
|
|
+ let quantityVisible = colSettingObj.getVisible('quantity');
|
|
|
+ if(quantityCol !== null && quantityVisible !== false){
|
|
|
+ newRow = orgRow;
|
|
|
+ newCol = quantityCol;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //在定额/量价/人材机的工程量单元格回车
|
|
|
+ else if(orgField && orgField === 'quantity' && selected.sourceType === me.project.Ration.getSourceType()){
|
|
|
+ let nextSibling = selected.nextSibling;
|
|
|
+ //如果其后有定额/量价/人材机(空行:编码为空不算),焦点应跳动至下一行定额/量价/人材机的工程量,不需处理
|
|
|
+
|
|
|
+ //如果其后没有定额/量价/人材机(空行也没有),则自动在其后插入一行定额空行,焦点跳动至定额空行的编码单元格
|
|
|
+ if(!nextSibling){
|
|
|
+ let codeCol = colSettingObj.getColByField('code');
|
|
|
+ let codeVisible = colSettingObj.getVisible('code');
|
|
|
+ me.project.Ration.addNewRation(null, rationType.ration, function () {
|
|
|
+ newRow = sheet.getActiveRowIndex();
|
|
|
+ if(codeCol !== null && codeVisible !== false){
|
|
|
+ newCol = codeCol;
|
|
|
+ }
|
|
|
+ sheet.setActiveCell(newRow, newCol);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //如果其后有定额空行,焦点跳动至定额空行的编码单元格
|
|
|
+ else if(nextSibling && !(isDef(nextSibling.data.code) && nextSibling.data.code.toString().trim() !== '')) {
|
|
|
+ let codeCol = colSettingObj.getColByField('code');
|
|
|
+ let codeVisible = colSettingObj.getVisible('code');
|
|
|
+ if(codeCol !== null && codeVisible !== false){
|
|
|
+ newRow = orgRow + 1;
|
|
|
+ newCol = codeCol;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //在清单的编码单元格回车,如果清单是叶子节点,焦点跳动至本行的工程量单元格
|
|
|
+ else if(orgField && orgField === 'code' && selected.sourceType === me.project.Bills.getSourceType()
|
|
|
+ && selected.data.type === billType.BILL && selected.source.children.length === 0){
|
|
|
+ let quantityCol = colSettingObj.getColByField('quantity');
|
|
|
+ let quantityVisible = colSettingObj.getVisible('quantity');
|
|
|
+ if(quantityCol && quantityVisible){
|
|
|
+ newRow = orgRow;
|
|
|
+ newCol = quantityCol;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -784,6 +849,8 @@ var projectObj = {
|
|
|
sheet.setActiveCell(newRow, newCol);
|
|
|
//触发表格事件
|
|
|
me.mainController.setTreeSelected(me.project.mainTree.items[newRow]);//SelectionChanged
|
|
|
+ me.mainSpreadLeaveCell({type: 'LeaveCell'}, {sheet: sheet, sheetName: sheet.name(), cancel: false, row: orgRow, col: orgCol});
|
|
|
+ me.mainSpreadEnterCell({type: 'EnterCell'}, {sheet: sheet, sheetName: sheet.name(), cancel: false, row: newRow, col: newCol});
|
|
|
|
|
|
},
|
|
|
//注册自定义回车键事件
|