$(function(){setBookGird();var a=[{key:"libcode",condition:"code",value:vLibcode}];commonSetParaInit(null,"record",null,a);enterEvent("keyword",serachBookList);$("#bookDataGridList").datagrid({onSelect:onSelectBookDataGridList});$("#keyword").textbox("textbox").focus();$(".easyui-panel").panel("resize")});function onSelectBookDataGridList(a,b){setJsonData(null,b)}function serachBookList(e){var b=0;var d=$("#bookDataGridList").datagrid("getSelected");if(d){b=$("#bookDataGridList").datagrid("getRowIndex",d)}var a=base_path+"acq/bookcase/page.do";var c={};if(getValue("keyword").length==0&&!e){return openMessageDlg("检索值不能为空")}cleanJsonData("record");clearGridData("bookDataGridList");c.rows=10;c.page=1;if(e){c.serno=e}else{c[""+getValue("index")+""]=getValue("keyword")}$("#bookDataGridList").datagrid({url:a,queryParams:c,onLoadSuccess:function(f){$("#bookDataGridList").datagrid("selectRow",b)},method:"post"})}function addBookRecord(){cleanJsonData("record");clearGridData("bookDataGridList");$("#title").textbox("textbox").focus()}function saveBookRecord(){var a=getJsonData(null,"record");if(!a){openMessageDlg("记录异常");return}if(!a.title){openMessageDlg("题名不能为空!");return}if(!a.price){openMessageDlg("价格不能为空!");return}if(!a.classno){openMessageDlg("分类号不能为空!");return}if(!a.isbn){openMessageDlg("ISBN不能为空!");return}if(!a.author){openMessageDlg("著者不能为空!");return}var c=getValue("serno");var b=base_path+"acq/bookcase/insert.do";if(c>0){b=base_path+"acq/bookcase/update.do"}$.post(b,a,function(d){if(d.status=="0"){openMessageDlg(d.message);var e=d.rows[0];serachBookList(e.serno)}else{openMessageDlg(d.message)}},"json")}function deleteBookRecord(){var a=$("#bookDataGridList").datagrid("getSelected");if(!a){return openMessageDlg("请先选择一条记录,进行删除")}openConfirmDlg("您确定要删除记录号为["+a.serno+"]的数据吗?",null,deleteBookRecordResult,null)}function deleteBookRecordResult(){var b=0;var d=$("#bookDataGridList").datagrid("getSelected");if(d){b=$("#bookDataGridList").datagrid("getRowIndex",d)}var a=base_path+"acq/bookcase/delete.do";var c={};c.pk=d.serno;$.post(a,c,function(e){if(e.status=="0"){cleanJsonData("record");$("#bookDataGridList").datagrid("deleteRow",b);openMessageDlg(e.message)}else{openMessageDlg(e.message)}},"json")}function setBookGird(){var a=$(window).height();var b=a-260;$(".datagrid-div").css("height",b+"px");$("#bookDataGridList").datagrid("resize")};