var onCloseCallFunName=undefined;var VPAGEFIN="circulation";var mytimeout=60*1000;var handleStatau=true;var hldFlds=[{code:"barcode",name:"条码号"},{code:"title",name:"题名"},{code:"author",name:"作者"},{code:"isbn",name:"ISBN"},{code:"callno",name:"索书号"},{code:"bellib",name:"所属馆"},{code:"curlib",name:"所在馆"},{code:"bellocal",name:"所属地点"},{code:"curlocal",name:"所在地点"},{code:"price",name:"价格"},{code:"publish",name:"出版社"},{code:"attachment",name:"附件"},{code:"currency",name:"币种"},{code:"status",name:"流通状态"},{code:"mediatype",name:"图书类型"},{code:"data",name:"预留字段"},{code:"uid",name:"图书硬件号"},];var cirContorller=function(){};_myPage.prototype.initPageByParam();_myPage.prototype.initPageByParam=function(){cirContorller.prototype.init();cirContorller.prototype.bind()};cirContorller.prototype.bind=function(){enterEvent("keyword",searchRdrRecord);enterEvent("barcode",searchHoldRecord);circurlationHandler(vType);$("#cirDataGridList").datagrid({onClickRow:onClickEditorRow,})};function searchDataByType(a){handleStatau=false;cleanJsonData("record");$("#cirDataGridList").datagrid("loadData",[]);$(".book-list").html("");if(a=="rdr"){vCirHandlerTip="读者";$(".loan-box").show();$("#barcode").next().hide();$(".loan-barcode-tip").hide();$("#keyword").textbox("textbox").focus().select()}else{vCirHandlerTip="馆藏";$(".loan-box").hide();getFocusBarCode()}$(".cir-handler-title").html(vCirHandlerTip.substr(0,1));$("#cirAppTitle").panel("setTitle",vCirHandlerTip+"查询")}function onClickEditorRow(a,b){if(vType=="cardrenew"){$("#barcode").next().show();$(".loan-barcode-tip").show();setValue("barcode",b.barcode);$("#barcode").textbox("textbox").focus()}}function circurlationHandler(a){handleStatau=true;vType=a;cleanJsonData("record");$("#cirDataGridList").datagrid("loadData",[]);$(".book-list").html("");var b;if(a=="loan"){b="借出";$(".loan-box").show();$("#barcode").next().hide();$(".loan-barcode-tip").hide();$("#keyword").textbox("textbox").focus().select()}else{if(a=="return"){b="还回";$(".loan-box").hide();getFocusBarCode()}else{if(a=="cardrenew"){b="续借";$(".loan-box").show();$("#barcode").next().hide();$(".loan-barcode-tip").hide();$("#keyword").textbox("textbox").focus().select()}}}$(".cir-handler-title").html(b.substr(0,1));$("#cirAppTitle").panel("setTitle",b+"处理")}function getFocusBarCode(){$("#barcode").next().show();$(".loan-barcode-tip").show();$("#barcode").textbox("textbox").focus().select()}cirContorller.prototype.init=function(){$(".showSplit").hide();$("#photourl").attr("src","images/bg.png");var a=$(window).height();var c=$(".loan-table-input").width();var d=a-40;$(".cir-circulation").css("height",d+"px");var b=$("#cirlayout").layout("panel","south");b.panel("resize",{height:(d-240)+"px"});$(".easyui-layout").layout("resize");getLayWHByResize("cirlayoutSouthApp");$(".easyui-panel").panel("resize")};function searchRdrRecord(c){var d={};cleanJsonData("record");$("#cirDataGridList").datagrid("loadData",[]);var b=serverAcsUrl+"reader/getBaseInfo";var a=getValue("keyword");if(!c){if(!a){return openMessageDlg("读者证号不能为空!")}d.rdrno=a}else{if(c=="cirReturn"){return}d.rdrno=a}$.messager.progress({title:"消息提示",msg:"正在处理数据,请稍等..."});$.ajax({type:"post",url:b,data:d,timeout:mytimeout,dataType:"json",error:function(e,g,f){$.messager.progress("close");openMessageDlg("连接异常,数据返回有误!")},success:function(e){$.messager.progress("close");if(e.status=="0"){var f=e.rows[0];setJsonData(null,f);if(handleStatau){getFocusBarCode()}if(parseFloat(f.feeamount)<=0){$("#feeamount").html(f.remark)}getHoldings(f)}else{openMessageDlg(e.message)}}})}function getHoldings(c){var a=c.loandata;if(a){var b=a.split(",");getHoldinfoByHolds(b,0)}}function getHoldinfoByHolds(b,a){if(b.length<=a){return}addCirGridData(b[a],a);a++;getHoldinfoByHolds(b,a)}function addCirGridData(f,b){var e="";e+="";var d=f.split("#");var a=[{code:"barcode",name:"条码号"},{code:"title",name:"题名"},{code:"lenddate",name:"借出日期"},{code:"returndate",name:"应还日期"},];var f={};for(var c=0;c";e+="";e+=g[hldFlds[d].code];e+="";e+=" "}}$(".book-list").html(e);if(handleStatau){if(vType=="loan"){cirLoan()}else{if(vType=="return"){cirReturn()}else{if(vType=="cardrenew"){cirRenew()}}}}}else{openMessageDlg(f.message)}}})}function cirLoan(){var a=$("#barcode").val();var c=$("#keyword").val();var d={};var b=serverAcsUrl+"cir/loanBook";d.barcode=a;d.rdrno=c;if(d.barcode&&d.rdrno){$.messager.progress({title:"消息提示",msg:"正在处理数据,请稍等..."});$.ajax({type:"post",url:b,data:d,timeout:mytimeout,dataType:"json",error:function(e,g,f){$.messager.progress("close");openMessageDlg("连接异常,数据返回有误!")},success:function(g){$.messager.progress("close");if(g.status=="0"){var h=g.rows[0];var e="color: #ee7621;";var f='
';f+="[借出]-";f+="{"+h.returndate+"(还)}-";f+="{"+h.rdrno+":"+$("#name").html()+"}-";f+="{"+h.barcode+"-"+h.title+"}";f+="
";var h={};h.note='
'+f+"
";$("#cirResultDataGridList").datagrid("insertRow",{index:0,row:h});searchRdrRecord(c)}else{openMessageDlg(g.message)}}})}}function cirReturn(){var a=$("#barcode").val();var c={};var b=serverAcsUrl+"cir/returnBook";c.barcode=a;if(c.barcode){$.messager.progress({title:"消息提示",msg:"正在处理数据,请稍等..."});$.ajax({type:"post",url:b,data:c,timeout:mytimeout,dataType:"json",error:function(d,f,e){$.messager.progress("close");openMessageDlg("连接异常,数据返回有误!")},success:function(f){$.messager.progress("close");if(f.status=="0"){var g=f.rows[0];var e='
';e+="[还回]-";e+="{"+g.barcode+":"+g.curlib+"}-";if(g.rdrno){e+="{"+g.rdrno+"}-"}e+="{"+g.title+"-"+g.price+"}";e+="
";$("#barcode").focus().select();var d="color: #00CD66;";var g={};g.note='
'+e+"
";$("#cirResultDataGridList").datagrid("insertRow",{index:0,row:g});searchRdrRecord("cirReturn")}else{openMessageDlg(f.message)}}})}}function cirRenew(){var a=$("#barcode").val();var c=$("#keyword").val();var d={};var b=serverAcsUrl+"cir/renewBook";d.barcode=a;d.rdrno=c;if(d.barcode&&d.rdrno){$.messager.progress({title:"消息提示",msg:"正在处理数据,请稍等..."});$.ajax({type:"post",url:b,data:d,timeout:mytimeout,dataType:"json",error:function(e,g,f){$.messager.progress("close");openMessageDlg("连接异常,数据返回有误!")},success:function(f){$.messager.progress("close");var e="color: #ff66d5;";$("#barcode").focus().select();var g={};g.note='
[续借]-{'+a+"}-"+f.message+"
";$("#cirResultDataGridList").datagrid("insertRow",{index:0,row:g});searchRdrRecord(c)}})}}function onResizeByNorth(b,a){if(a!=150){setLayWHByResize("cirlayoutSouthApp","north",b,a)}};