var _bibId=0;var selectEditBibId=0;$(function(){setHoldGird();var b=[{key:"sysid",condition:"type",value:"0"},{key:"location",condition:"libcode",value:vLibcode},{key:"libcode",condition:"code",value:vLibcode},{key:"curlocation",condition:"libcode",value:vLibcode},{key:"curlibcode",condition:"code",value:vLibcode},{code:"finsources",key:"finsources"},{code:"doctype",key:"doctype"},{code:"mediatype",key:"mediatype"},{code:"bindtype",key:"binding"},{code:"docsources",key:"docsources"},];_myPage.prototype.initData(b);_myPage.prototype.onLoadAllLibDataNoLimit({code:"showlibcode",key:"libcode"});var a={key:"hldstatus"};initPageDataSingleElement("status",a,null);enterEvent("keyword",serachHold);$("#holdDataGridList").datagrid({rowStyler:rowStylerIsUpdateByLibcode,onSelect:onSelectHoldDataGridList});$("#keyword").textbox("textbox").focus();$(".easyui-panel").panel("resize")});function onSelectHoldDataGridList(a,b){if(!isUpdateByLibcode(b.libcode)){_linkbuttonObj.prototype.status(true);_myPage.prototype.reSetToComboxItem()}else{_linkbuttonObj.prototype.status(false);_myPage.prototype.reSetToComboxItem(vLibcode)}setJsonData(null,b);if(b.rdrid>0){getRdrInfo(b.rdrid)}if(b.bibid>0){getBibInfo(b.bibid)}}var _linkbuttonObj=function(){};_linkbuttonObj.prototype.status=function(a){if(a){$("#saveBibRecord").linkbutton({disabled:true});$("#deleteBibRecord").linkbutton({disabled:true})}else{$("#saveBibRecord").linkbutton({disabled:false});$("#deleteBibRecord").linkbutton({disabled:false})}};function getRdrInfo(c){var a=base_path+"cir/reader/get.do";var b={};b.pk=c;$.post(a,b,function(d){if(d.status=="0"){var e=d.rows[0];setJsonData("show",e)}},"json")}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 serachHoldById(c){var a=base_path+"hld/holding/get.do";var b={};b.pk=c;$.post(a,b,function(d){if(d.status=="0"){var e=d.rows[0];setJsonData(null,e)}},"json")}function setHoldGird(){var a=$(window).height();var b=a-(80+340);$(".datagrid-div").css("height",b+"px");$("#holdDataGridList").datagrid("resize")}function serachHold(){var b=0;var d=$("#holdDataGridList").datagrid("getSelected");if(d){b=$("#holdDataGridList").datagrid("getRowIndex",d)}var a=base_path+"hld/holding/listHoldingWithBibAndRdr.do";var c={};c=getJsonDataByTypeHandler();if(!c["limit[0].condition"]){return openMessageDlg("检索值不能为空!")}cleanJsonData("record");cleanJsonData("showrecord");clearGridData("holdDataGridList");c.rows=10;c.page=1;$("#holdDataGridList").datagrid({url:a,queryParams:c,onLoadSuccess:function(e){$("#holdDataGridList").datagrid("selectRow",b)},method:"post"})}function checkAllHoldData(){var a=base_path+"hld/holding/listByCheckAllData.do";var b={};$("#holdDataGridList").datagrid({url:a,queryParams:b,onLoadSuccess:function(c){$("#holdDataGridList").datagrid("selectRow",vSelectIndex)},method:"post"})}function addHoldRecord(){_linkbuttonObj.prototype.status(false);_myPage.prototype.reSetToComboxItem(vLibcode);cleanJsonData("record");cleanJsonData("showrecord");clearGridData("holdDataGridList");$("#barcode").textbox("textbox").focus()}function saveHoldRecord(){var a=getJsonData(null,"record");if(!a){openMessageDlg("记录异常");return}if(!a.barcode){openMessageDlg("条码号不能为空!");return}if(!a.price){openMessageDlg("流通单价不能为空!");return}if(!a.callno){openMessageDlg("索书号不能为空!");return}if(!a.bibid){openMessageDlg("书目记录不能为空!");return}var e=getValue("id");var c=base_path+"hld/holding/insert.do";if(e>0){c=base_path+"hld/holding/update.do";saveHoldingsRecord(c,a)}else{var b=base_path+"hld/holding/getCheckHoldBarcode.do";var d={};d.barcode=a.barcode;$.post(b,d,function(f){if(f.status=="0"){if(f.total==0){saveHoldingsRecord(c,a)}else{openMessageDlg("此条码号已存在!")}}else{openMessageDlg(f.message)}},"json")}}function saveHoldingsRecord(b,a){var c=getValue("id");$.post(b,a,function(d){if(d.status=="0"){openMessageDlg(d.message);if(c==0||c==""||c.length==0){setValue("index","id");setValue("keyword",d.rows[0].id);serachHold()}else{serachHold()}}else{openMessageDlg(d.message)}},"json")}function deleteHoldRecord(){var a=$("#holdDataGridList").datagrid("getSelected");if(!a){return openMessageDlg("请先选择一条馆藏信息,进行删除")}openConfirmDlg("您确定要删除条码号为["+a.barcode+"]的馆藏数据吗?",null,deleteHoldRecordResult,null)}function deleteHoldRecordResult(){var c=$("#holdDataGridList").datagrid("getSelected");var a=base_path+"hld/holding/delete.do";var b={};b.pk=c.id;$.post(a,b,function(d){if(d.status=="0"){serachHold();openMessageDlg(d.message)}else{openMessageDlg(d.message)}},"json")}function setCheckCallNoByHold(){_bibId=getValue("bibid");if(_bibId>0){setCheckCallNo()}else{return openMessageDlg("请先选择一条馆藏信息,进行获取索书号操作")}};