var pageGridObj;var initJson;$(function(){initJson=[{code:"finsources",key:"finsources"},{code:"mediatype",key:"mediatype"},{code:"binding",key:"binding"},{code:"docsources",key:"docsources"},{code:"ncy,orderncy",key:"ncy"},{code:"bookseller",key:"bookseller",condition:"libcode",value:vLibcode},{code:"location,loccode",key:"location",condition:"libcode",value:vLibcode},{code:"doctype",key:"doctype",condition:"libcode",value:vLibcode},{code:"libcodeSelect,libcode",key:"libcode",condition:"code",value:vLibcode},{code:"pertype",key:"pertype"},{code:"acqstatus",key:"acqstatus"},{code:"operid",key:"operid"},{code:"frequency",key:"frequency",fmt:"entity"},{code:"ordertype",key:"perordertype"}];_myPage.prototype.initData(initJson);pageGridObj=$("#"+vType+"DataGridList");initPageGirdHeight(300);enterEvent("keyword",searchRecord);pageGridObj.datagrid({onSelect:onSelectDataGridList});$("#keyword").textbox("textbox").focus();$(".easyui-panel").panel("resize");if($("#frequency").length>0){initRerFrequencyNum();$("#frequency").combobox({onSelect:function(a){if(a!=null){setValue("rerFrequencyNum",a.code);setValue("issuenum",$("#rerFrequencyNum").combobox("getText"));_bibPVG.prototype.setPerYearPrice("yearprice","","price")}}})}_bibPVG.prototype.perYearPrice("yearprice","","price")});function initRerFrequencyNum(){var a=base_path+"par/common/getInitData.do";var b={};b.key="frequency";b.fmt="entity";$.post(a,b,function(c){$("#rerFrequencyNum").combobox({data:c.rows,valueField:"code",textField:"frequency",onLoadSuccess:function(){}})},"json")}function initPageGirdHeight(b){var a=$(window).height();var c=a-b;$(".datagrid-div").css("height",c+"px");pageGridObj.datagrid("resize")}function onSelectDataGridList(a,b){setJsonData(null,b);if(b.bibid>0){getBibInfo(b.bibid);$("#bibid").textbox("textbox").attr("disabled",true)}}function getBibInfo(c){var a=base_path+"lib/biblios/get.do";var b={};b.id=c;$.post(a,b,function(d){if(d.status=="0"){var e=d.rows[0];setJsonData("show",e)}},"json")}function searchRecord(){var b=0;var d=pageGridObj.datagrid("getSelected");if(d){b=pageGridObj.datagrid("getRowIndex",d)}var a=base_path+"per/"+vType+"/page.do";var c={};if(getValue("keyword").length==0){return openMessageDlg("检索值不能为空")}cleanJsonData("record");cleanJsonData("showrecord");clearGridData(""+vType+"DataGridList");c.rows=10;c.page=1;c[""+getValue("index")+""]=getValue("keyword");pageGridObj.datagrid({url:a,queryParams:c,onLoadSuccess:function(e){pageGridObj.datagrid("selectRow",b)},method:"post"})}function insertRecord(){cleanJsonData("record");cleanJsonData("showrecord");clearGridData(""+vType+"DataGridList");if(vType=="check"){$("#copies").numberbox().next("span").find("input").focus()}else{$("#batchno").textbox("textbox").focus()}$("#bibid").textbox("textbox").attr("disabled",false)}function saveRecord(){var a=getJsonData(null,"record");if(!a){openMessageDlg("记录异常");return}if(!a.price){openMessageDlg("册价不能为空!");return}if(!a.bibid){openMessageDlg("书目记录不能为空!");return}var c=getValue("id");var b=base_path+"per/"+vType+"/insert.do";if(c>0){b=base_path+"per/"+vType+"/update.do"}savePerRecord(b,a)}function savePerRecord(b,a){var c=getValue("id");onHnadlerSvaeBntScreen(true);$.post(b,a,function(d){onHnadlerSvaeBntScreen(false);if(d.status=="0"){openMessageDlg(d.message);if(c==0||c==""||c.length==0){setValue("index","id");setValue("keyword",d.rows[0].id);searchRecord()}else{searchRecord()}}else{openMessageDlg(d.message)}},"json")}function deleteRecord(){var a=pageGridObj.datagrid("getSelected");if(!a){return openMessageDlg("请先选择一条信息,进行删除")}openConfirmDlg("您确定要删除记录号为["+a.id+"]的数据吗?",null,deleteRecordResult,null)}function deleteRecordResult(){var c=pageGridObj.datagrid("getSelected");var a=base_path+"per/"+vType+"/delete.do";var b={};b.pk=c.id;$.post(a,b,function(d){if(d.status=="0"){searchRecord();openMessageDlg(d.message)}else{openMessageDlg(d.message)}},"json")};