var eidtorGridObject=undefined;var eidtorGridIndex=undefined;var _perCheckItemList;var _perCheckDetailObj=function(){};var _row;var _configData;var initJson;var _initdata;var autoSelect=true;var locToolbar=[{text:"新增",iconCls:"e-icon fa fa-plus",handler:function(){var a={};appendEidtorGridRow(a)}},"-",{text:"删除",iconCls:"e-icon fa fa-remove",handler:function(){removeitEidtorGridRow()}}];$(function(){_initdata=mystorage.get("per_init_data");_configData=mystorage.get("per_config");initJson=[{code:"finsources",key:"finsources"},{code:"mediatype",key:"mediatype"},{code:"binding",key:"binding"},{code:"docsources",key:"docsources"},{code:"ncy,orderncy",key:"ncy"},{code:"frequency",key:"frequency"},{code:"pertype",key:"pertype"},{code:"ordertype",key:"perordertype"},{code:"status",key:"percheckstatus"},{code:"operid",key:"operid"},{code:"bookseller",key:"bookseller",condition:"libcode",value:vLibcode},{code:"libcode,hldlibcode",key:"libcode",condition:"code",value:vLibcode},{code:"location",key:"location",condition:"libcode",value:vLibcode},{code:"doctype",key:"doctype",condition:"libcode",value:vLibcode}];$("#rerFrequencyNum").combobox({data:_initdata.rows[0].frequency,valueField:"code",textField:"frequency",onLoadSuccess:function(){}});$("#frequency").combobox({onSelect:function(a){if(a!=null&&!autoSelect){setValue("rerFrequencyNum",a.code);setValue("issuenum",$("#rerFrequencyNum").combobox("getText"));_bibPVG.prototype.perRate("",$("#rerFrequencyNum").combobox("getText"))}},onClick:function(b,a){autoSelect=false}});initJson.forEach(function(a,b,c){if(_initdata.rows[0][a.key]){_myPage.prototype.setData(_initdata.rows[0][a.key],a)}});$(".easyui-panel").panel("resize");_perCheckDetailObj.prototype.search();_perCheckDetailObj.prototype.initGrid();_bibPVG.prototype.rateFocus("orderprice","");setPrintItemList()});_perCheckDetailObj.prototype.initGrid=function(){var b=[{field:"libcode",title:"分馆名称",width:"33%",formatter:onShowLibName,editor:{type:"combobox",options:{valueField:"code",textField:"name",panelHeight:"160px",required:true,editable:false,data:$("#libcode").combobox("getData"),onChange:function(f,e){if(f!=undefined&&f!=e){if(eidtorGridIndex!=undefined){var g=eidtorGridObject.datagrid("getEditor",{index:eidtorGridIndex,field:"location"});var c={key:"location",condition:"libcode",value:f};var d=base_path+"par/common/getInitData.do";$.post(d,c,function(h){try{$(g.target).combobox("loadData",h.rows)}catch(i){}},"json")}}}}}},{field:"location",title:"馆藏地点",width:"33%",formatter:onShowLocationNameByMyStorage,editor:{type:"combobox",options:{valueField:"code",textField:"name",panelHeight:"160px",groupField:"group",required:true,editable:false,data:_initdata.rows[0].location}}},{field:"copies",title:"数量",width:"34%",editor:{type:"numberbox",options:{required:true}}}];_perCheckDetailObj.prototype.initGridByParam(b,"订购分配");var a=JSON.parse(_configData.rows[0].paramjson);if(a.spehld){_perCheckDetailObj.prototype.initSepGridByParam("虚拟馆藏列表");$("#fen-pei").tabs("enableTab",1)}else{$("#fen-pei").tabs("disableTab",1)}};_perCheckDetailObj.prototype.initGridByParam=function(a,b){eidtorGridObject=$("#location_eidtorgrid");eidtorGridObject.datagrid({iconCls:"e-icon fa fa-table",toolbar:locToolbar,fitColumns:true,singleSelect:true,border:true,nowrap:false,striped:true,fit:true,onClickRow:onClickEditorRow,columns:[a]})};_perCheckDetailObj.prototype.initSepGridByParam=function(b){var a=[{field:"libcode",title:"分馆名称",width:"30%",formatter:onShowLibName},{field:"loccode",title:"馆藏地点",formatter:onShowLocationNameByMyStorage,width:"30%"},{field:"barcode",title:"条码号",width:"20%"},{field:"volinfo",title:"卷册说明",width:"20%"}];$("#spehold_eidtorgrid").datagrid({iconCls:"e-icon fa fa-table",fitColumns:true,singleSelect:true,border:true,nowrap:false,striped:true,fit:true,columns:[a]});setDataToLocGrid()};function setDataToLocGrid(){var a=base_path+"per/detailcheck/listBarcode.do";var b={};if(parseInt(_id)>0){b.id=_id;$("#spehold_eidtorgrid").datagrid({url:a,queryParams:b,onLoadSuccess:function(c){},method:"post"})}}_perCheckDetailObj.prototype.search=function(){_row=null;cleanJsonData("record");var a=base_path+"per/check/get.do";var b={};if(parseInt(_id)>0){a=base_path+"per/detailcheck/get.do";b.pk=_id}else{if(parseInt(_checkId)>0){b.pk=_checkId}}$.post(a,b,function(c){if(c.status=="0"){_perCheckDetailObj.prototype.set(c)}else{openMessageDlg(c.message)}},"json")};_perCheckDetailObj.prototype.set=function(b){var c=b.rows[0];if(parseInt(_id)>0){_row=c;if(_flag=="add"){_perCheckDetailObj.prototype.addCheckDetail(c)}else{setJsonData(null,c)}var a=c.allocation;if(a){_perCheckDetailObj.prototype.setDataToEidtGird(a)}else{clearGridData("location_eidtorgrid")}if(c.status=="0"){setValue("copies",_copies);setValue("status","1")}}else{clearGridData("location_eidtorgrid");_bibPVG.prototype.setVPG(b.rows[0],"");setTextShowStatus(false);setValue("orderno",c.orderno);_perCheckDetailObj.prototype.setTextByConifg()}};_perCheckDetailObj.prototype.addCheckDetail=function(a){setJsonData(null,a);if(a.issue){setValue("issue","增"+a.issue)}if(a.totalissue){setValue("issue","增"+a.totalissue)}setValue("id",0)};_perCheckDetailObj.prototype.setDataToEidtGird=function(e){clearGridData("location_eidtorgrid");if(e.length>0){var f=e.split(",");for(var d=0;d0){var d=f.code.split(",");for(var b=0;b0){for(var c=0;c0&&d!=b.copies){return openMessageDlg("分配数量合计必须和记到册数相同!")}}b.allocation=e;var f=_row;if(_row&&((b.volume&&f.volume!=b.volume)||(b.issue&&f.issue!=b.issue)||(b.totalissue&&f.totalissue!=b.totalissue)||(b.expectdate&&f.expectdate!=b.expectdate))){openConfirmDlg("您确定要更新该期后的所有的记到记录?",null,_perCheckDetailObj.prototype.saveUpdateCheckDetaile,_perCheckDetailObj.prototype.saveCancleCheckDetaile)}else{b.updateFlag=0;_perCheckDetailObj.prototype.saveResult(b)}};_perCheckDetailObj.prototype.saveUpdateCheckDetaile=function(){var a=getJsonData(null,"record");a.updateFlag=1;_perCheckDetailObj.prototype.saveResult(a)};_perCheckDetailObj.prototype.saveCancleCheckDetaile=function(){var a=getJsonData(null,"record");a.updateFlag=0;_perCheckDetailObj.prototype.saveResult(a)};_perCheckDetailObj.prototype.saveResult=function(b){var a=getValue("id");var c=base_path+"per/detailcheck/insert.do";if(a>0){c=base_path+"per/detailcheck/check.do"}if(_sortfld){b.sortfld=_sortfld}onHnadlerSvaeBntScreen("saveOrderBibBnt",true);$.post(c,b,function(e){setPrintItemList(1);onHnadlerSvaeBntScreen("saveOrderBibBnt",false);if(e.status=="0"){var d=e.rows[0];parent.checkPerDetailSaveResult(e,d.checkid)}else{openMessageDlg(e.message)}},"json")};function setPrintItemList(e){_perCheckItemList=mystorage.get("perCheckItemList");if(!_perCheckItemList){_perCheckItemList=[]}if(e){var a=$("#spehold_eidtorgrid").datagrid("getRows");for(var d=0;d0){var c=false;for(var b=0;b<_perCheckItemList.length;b++){if(_perCheckItemList[b].barcode==a[d].barcode){c=true;break}}if(!c){_perCheckItemList.push({barcode:a[d].barcode,volinfo:a[d].volinfo})}}else{_perCheckItemList.push({barcode:a[d].barcode,volinfo:a[d].volinfo})}}mystorage.set("perCheckItemList",_perCheckItemList)}}function setTextShowStatus(a){}function onShowLocationNameByMyStorage(b,c){var d=_initdata.rows[0].location;if(b){for(var a=0;a