var isSaveFmtDesign=false;var eidtorGridObject=undefined;var eidtorGridIndex=undefined;var toolbar=[{text:"新增",iconCls:"e-icon fa fa-plus",handler:function(){addFormatDesignGridRow()}},"-",{text:"删除",iconCls:"e-icon fa fa-remove",handler:function(){removeitEidtorGridRow()}},"-",{text:"上移",iconCls:"e-icon fa fa-arrow-up",handler:function(){moveUpEidtorGridRow()}},"-",{text:"下移",iconCls:"e-icon fa fa-arrow-down",handler:function(){moveDownEidtorGridRow()}}];function moveUpEidtorGridRow(){myGridSortRow("up")}function moveDownEidtorGridRow(){myGridSortRow("down")}function myGridSortRow(c){if(endEidtorGridEditing()){eidtorGridObject.datagrid("acceptChanges")}var d=eidtorGridObject.datagrid("getRows");var a=d.length;var b=eidtorGridObject.datagrid("getSelected");var e=eidtorGridObject.datagrid("getRowIndex",b);if(c=="up"){if(e==0){$.messager.alert("提示","顶行无法上移!","warning")}else{eidtorGridObject.datagrid("deleteRow",e);e--;eidtorGridObject.datagrid("insertRow",{index:e,row:b});eidtorGridObject.datagrid("selectRow",e)}}else{if(c=="down"){if(e==a-1){$.messager.alert("提示","底行无法下移!","warning")}else{eidtorGridObject.datagrid("deleteRow",e);e++;eidtorGridObject.datagrid("insertRow",{index:e,row:b});eidtorGridObject.datagrid("selectRow",e)}}}}function addFormatDesignGridRow(){var a={};appendEidtorGridRow(a)}function onClickEditorRow(a,b){isSaveFmtDesign=true;if(eidtorGridIndex!=a){if(endEidtorGridEditing()){eidtorGridObject.datagrid("selectRow",a).datagrid("beginEdit",a);eidtorGridIndex=a}else{eidtorGridObject.datagrid("selectRow",eidtorGridIndex)}}}function endEidtorGridEditing(){if(eidtorGridIndex==undefined){return true}if(eidtorGridObject.datagrid("validateRow",eidtorGridIndex)){handlerEidtorGrid();eidtorGridObject.datagrid("endEdit",eidtorGridIndex);eidtorGridIndex=undefined;return true}else{return false}}function acceptEidtorGrid(){isSaveFmtDesign=false;if(endEidtorGridEditing()){eidtorGridObject.datagrid("acceptChanges")}}function appendEidtorGridRow(b,a){isSaveFmtDesign=true;if(endEidtorGridEditing()){eidtorGridObject.datagrid("appendRow",b);eidtorGridIndex=eidtorGridObject.datagrid("getRows").length-1;eidtorGridObject.datagrid("selectRow",eidtorGridIndex).datagrid("beginEdit",eidtorGridIndex);if(!a){appendRestulFun()}}}function appendRestulFun(){var a=eidtorGridObject.datagrid("getRows")}function removeitEidtorGridRow(){if(eidtorGridIndex==undefined){return}eidtorGridObject.datagrid("cancelEdit",eidtorGridIndex).datagrid("deleteRow",eidtorGridIndex);eidtorGridIndex=undefined}function rejectEidtorGrid(){if(endEidtorGridEditing()){eidtorGridObject.datagrid("rejectChanges")}}function getEidtorGridChanges(){var a=eidtorGridObject.datagrid("getChanges");console.log(a)}function handlerEidtorGrid(){}function addFormatDesignMessage(){if(isSaveFmtDesign){$.messager.confirm("提示消息","您有修改过的数据未保存,您确定要执行当前操作吗?",function(a){if(a){addFormatDesignRecord();isSaveFmtDesign=false}})}else{addFormatDesignRecord()}};