var eidtorGridObject=undefined;var eidtorGridIndex=undefined;var _orderPerObj=function(){};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(){_orderPerObj.prototype.batchno();_initdata=mystorage.get("per_init_data");_configData=mystorage.get("per_config");_frequency=mystorage.get("order_per_frequency");initJson=[{code:"finsources",key:"finsources"},{code:"binding",key:"binding"},{code:"docsources",key:"docsources"},{code:"ncy,orderncy",key:"ncy"},{code:"frequency",key:"frequency"},{code:"mediatype",key:"mediatype"},{code:"pertype",key:"pertype"},{code:"ordertype",key:"perordertype"},{code:"operid",key:"operid"},{code:"location",key:"location",condition:"libcode",value:vLibcode},{code:"bookseller",key:"bookseller",condition:"libcode",value:vLibcode},{code:"libcode",key:"libcode",condition:"code",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");_orderPerObj.prototype.search();_orderPerObj.prototype.initGrid();$("#ncy").combobox({onChange:function(b,a){_bibPVG.prototype.rate("")},onClick:function(b,a){autoSelect=false}});$("#orderncy").combobox({onChange:function(b,a){_bibPVG.prototype.rate("")},onClick:function(b,a){autoSelect=false}});enterEvent("issuenum",onissuenumPriceEnterFun);enterEvent("price",onPriceEnterFun);enterEvent("orderprice",onOrderPriceEnterFun);enterEvent("yearprice",onyearpriceEnterFun)});_bibPVG.prototype.rateResult=function(a){onOrderPriceEnterFun()};function onyearpriceEnterFun(){var a=getValue("issuenum");if(a>0){setValue("orderprice",parseFloat(getValue("yearprice")/a).toFixed(2))}else{setValue("orderprice",getValue("yearprice"))}}function onPriceEnterFun(){_bibPVG.prototype.rate("")}function onissuenumPriceEnterFun(){_bibPVG.prototype.rate("")}function onOrderPriceEnterFun(){var a=getValue("issuenum");if(a>0){setValue("yearprice",parseFloat(getValue("orderprice")*a).toFixed(2))}else{setValue("yearprice",getValue("orderprice"))}}_bibPVG.prototype.perRateResult=function(){_bibPVG.prototype.setPerYearPrice("yearprice","")};_orderPerObj.prototype.batchno=function(){if($("#batchno").length>0){var b={type:"2",page:"1",rows:"500"};var a=base_path+"par/batchno/page.do";$.post(a,b,function(h){var g=[];for(var e=0;e0){a=base_path+"per/order/get.do";b.pk=_id}else{if(parseInt(_bibId)>0){b.id=_bibId}}$.post(a,b,function(c){if(c.status=="0"){_orderPerObj.prototype.set(c)}else{openMessageDlg(c.message)}},"json")};_orderPerObj.prototype.set=function(e){var d=mystorage.get("acq_order_per_handler_type");var f=e.rows[0];if(parseInt(_id)>0){autoSelect=true;setJsonData(null,f);var c=f.allocation;if(c){_orderPerObj.prototype.setDataToEidtGird(c)}else{clearGridData("location_eidtorgrid")}$(".orderbib_tip").html("提示:请您确认当前订购记录号【"+_id+"】")}else{if(_bibId>0&&_type!=0&&d){autoSelect=true;d.id=null;setJsonData(null,d);var c=d.allocation;if(c){_orderPerObj.prototype.setDataToEidtGird(c)}else{clearGridData("location_eidtorgrid")}setValue("ordertype",_type);if(_type=="1"){var a=JSON.parse(_configData.rows[0].paramjson);setComTextVal(a)}setValue("id",_id);$(".orderbib_tip").html("提示:请您确认当前要订购的书目记录号【"+_bibId+"】")}else{clearGridData("location_eidtorgrid");_bibPVG.prototype.setVPG(e.rows[0],"");setTextShowStatus(false);setValue("orderno",f.orderno);_orderPerObj.prototype.setTextByConifg();setValue("ordertype","0");setValue("id",_id);autoSelect=false;for(var b=0;b<_initdata.rows[0].frequency.length;b++){if(_initdata.rows[0].frequency[b].name==_frequency){setValue("frequency",_initdata.rows[0].frequency[b].code);break}}$(".orderbib_tip").html("提示:请您确认当前要订购的书目记录号【"+_bibId+"】")}}bulidShelfno()};function setComTextVal(a){if(a.order_batchno){setValue("batchno",a.order_batchno);_bibPVG.prototype.getDataByBatchno(a.order_batchno)}if(a.orderyear){setValue("orderyear",a.orderyear)}var b=getCurDateYMD();setValue("paydate",b);setValue("orderdate",b)}function bulidShelfno(){var b=base_path+"per/shelfno/page.do";var a={};a.bibid=_bibId;if(getValue("libcode")){a.libcode=getValue("libcode")}$.post(b,a,function(c){if(c.status=="0"){var d=c.rows[0];if(d){setValue("shelfno",d.shelfno)}else{setValue("shelfno","")}}else{openMessageDlg(c.message)}},"json")}_orderPerObj.prototype.setDataToEidtGird=function(e){clearGridData("location_eidtorgrid");if(e.length>0){var f=JSON.parse(e);for(var d=0;d0){var g=b.code.split(",");for(var c=0;c0){var h=JSON.parse(e);for(var d=0;d0){for(var f=0;fn){n=c}}if(n>1){openMessageDlg("订购分配,分配列表的馆藏地点不能重复!");return}}g.allocation=JSON.stringify(a);if(h>0&&h!=g.copies){$.messager.confirm("提示消息","订购分配数量与复本数不符,确定要更新数量?",function(b){if(b){setValue("copies",h);g.copies=h;_orderPerObj.prototype.saveResult(g)}})}else{_orderPerObj.prototype.saveResult(g)}};_orderPerObj.prototype.saveResult=function(b){var a=getValue("id");var c=base_path+"per/order/insert.do";if(a>0){c=base_path+"per/order/update.do"}onHnadlerSvaeBntScreen("saveOrderBibBnt",true);$.post(c,b,function(e){onHnadlerSvaeBntScreen("saveOrderBibBnt",false);if(e.status=="0"){var d=e.rows[0];parent.orderPerSaveResult(e,d.bibid)}else{openMessageDlg(e.message)}},"json")};function setTextShowStatus(a){}function onShowLocationNameByMyStorage(b,c){var d=_initdata.rows[0].location;if(b){for(var a=0;a