Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js =================================================================== diff -u -r18612 -r18846 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 18612) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 18846) @@ -1830,7 +1830,15 @@ allowBlank: true, allowDecimals :false, minValue: 0, - maxValue: 9999 + maxValue: 9999, + listeners: { + specialkey: function(field, event, eOpts) { + if (event.getKey() === event.TAB) { + //阻止按Tab,因为这里的CellEditing按了tab会有bug + event.stopEvent(); + } + } + } } },{ header : "加急数量", @@ -1923,7 +1931,15 @@ allowBlank: true, allowDecimals :false, minValue: 0, - maxValue: 9999 + maxValue: 9999, + listeners: { + specialkey: function(field, event, eOpts) { + if (event.getKey() === event.TAB) { + //阻止按Tab,因为这里的CellEditing按了tab会有bug + event.stopEvent(); + } + } + } } },{ header : "加急数量", @@ -2055,9 +2071,8 @@ return true; } } - }, - afteredit:function(editor, context, eOpts){ + edit:function(editor, context, eOpts){ var record = context.record; var isDiposableGoods = record.get("diposable"); var totalPrice; @@ -2104,10 +2119,17 @@ } //重新设置一次性物品的总价格 setDisposableGoodTotalAmount(rightTemplateStore); - //var total = sumTotal(context.grid.getStore()); //o.grid.setTitle("器械包申请单(总计金额:"+roundValue(total)+")"); - } + }, + afteredit : function (editor, context) { + //编辑之后定位到下一个物品的那行 + var record = context.record; + if (!top.Ext4.isEmpty(record.get('count'))){ + var nextEditRow = getNextEditRow(record, context.rowIdx); + editor.startEditByPosition(nextEditRow); + } + } } }); Ext4.apply(this, { @@ -2117,7 +2139,59 @@ } }); - /** + /** + * 当前编辑的节点不是整包清洗 + */ + function isNotApplyEntireTousse(node) { + if (!top.Ext4.isEmpty(node)){ + var tousseType = node.get('tousseType'); + return '消毒物品' === tousseType && '否' === node.get('isApplyEntireTousse') || '器械' === tousseType && true === node.get('isLast'); + } + return false; + } + + /** + * 当前编辑的节点时候整包清洗 + */ + function isApplyEntireTousse(node) { + return !top.Ext4.isEmpty(node) && '是' === node.data.isApplyEntireTousse && node.data.children.length > 0; + } + + /** + * 编辑数量后根据当前行数定位到下一个要定位的行数 + * @param record 当前编辑的数据 + * @param nowRow 当前的行数 + * @returns {{row: *, column: number}} + */ + function getNextEditRow(record, nowRow) { + var tousseType = record.get('tousseType'); + if ('一次性物品' === tousseType){ + return {row: nowRow + 1, column: 7}; + } + var nextSibling = record.nextSibling; + //如果下一个节点为空则证明当前证明是非整包清洗的最后一个节点,所以要用record.parentNode.nextSibling才能获得下一个节点 + nextSibling = top.Ext4.isEmpty(nextSibling) ? record.parentNode.nextSibling : nextSibling; + //如果还是为空,则表示当前节点是最后一个物品并且不是非整包清洗的物品 + if (top.Ext4.isEmpty(nextSibling)){ + return {row: nowRow + 1, column: 7}; + } + //器械包->非整包清洗 或者 非整包清洗(最后一个节点)->非整包清洗,则要往下两个节点 + if ('器械包' === tousseType && isNotApplyEntireTousse(nextSibling) || isNotApplyEntireTousse(record) && isNotApplyEntireTousse(nextSibling) ){ + return {row: nowRow + 2, column: 4}; + } + //整包清洗->器械包 或者 整包清洗->整包清洗,则要往下整包清洗节点的数量+1个节点 + if (isApplyEntireTousse(record) && '器械包' === nextSibling.get('tousseType') || isApplyEntireTousse(record) && isApplyEntireTousse(nextSibling)){ + var len = record.data.children.length; + return {row: nowRow + len + 1, column: 4}; + } + // 整包清洗->非整包清洗,则要往下整包清洗节点的数量+2个节点 + if (isApplyEntireTousse(record) && isNotApplyEntireTousse(nextSibling)){ + var len = record.data.children.length; + return {row: nowRow + len + 2, column: 4}; + } + return {row: nowRow + 1, column: 4}; + } + /** * 重新计算总价格并重新设置最小单位的数量 * @param record 该行的数据 * @param context