var initJson;var tabsGridController=function(){};var selectCenterBibId=0;var checkrepeatFrame;vPageNameFlag="外部库维护";var bibController=function(){};var selectEditBibId=0;var noEditBibGridByCode=false;var cataConfigData;$(function(){bibController.prototype.init();bibController.prototype.bind();bibController.prototype.initEditGridView();renderControllerView.prototype.bibindex()});bibController.prototype.bind=function(){$("#tabsGrid").tabs({onSelect:tabsGridController.prototype.tabsGridSelect});enterEvent("keyword",bibController.prototype.search)};bibController.prototype.init=function(){initJson=[{code:"sysid",key:"sysid",condition:"type",value:vType}];bibController.prototype.initAcqGrid();_myPage.prototype.getLoadData(initJson);var a=$(window).height();var b=a-80;$(".bib-com-layout-div").css("height",b+"px");getLayWHByResize("bibComLayout")};bibController.prototype.initAcqGrid=function(){var a=$("#acqDataGridList");if(!a.attr("class")){a.datagrid({singleSelect:true,fit:true,fitColumns:true,pagination:true,striped:true,border:true,rowStyler:rowStylerIsUpdateByLibcode,onSelect:bibController.prototype.acqSelect,onHeaderContextMenu:function(c,b){c.preventDefault();if(!bindTableMenu){createColumnMenu(a)}bindTableMenu.menu("show",{left:c.pageX,top:c.pageY})},columns:[bibGridColumns]})}};bibController.prototype.acqSelect=function(a,b){bibController.prototype.setDataByGirdSelect(b.id)};tabsGridController.prototype.tabsGridSelect=function(b,a){tabsGridController.prototype.tools(b,a)};tabsGridController.prototype.tools=function(b,a){$("#tabsGrid").tabs("resize")};_myPage.prototype.getLoadSuccess=function(a,b){_fmtGridDataRows=a;_myPage.prototype.onLoadData(_fmtGridDataRows,initJson)};bibController.prototype.search=function(b,a){if(!initCatconfig()){return}if(isUpdateData){$.messager.confirm("提示消息","您有修改过的数据未保存,您确定要执行当前操作吗?",function(c){if(c){bibController.prototype.searchOk(b,a);isUpdateData=false}})}else{bibController.prototype.searchOk(b,a)}};bibController.prototype.clear=function(a){};bibController.prototype.searchOk=function(b,a){bibController.prototype.clear(1);selectEditBibId=0;$(".showBibGrid-tip").html("");var c=bibGlobalController.prototype.getSearchCondtion(b,a);if($("#keyword").length>0){$("#keyword").textbox("textbox").focus().select()}if(($("#keyword").length>0&&getValue("keyword").length==0)&&!a){return openMessageDlg("检索值不能为空")}bibController.prototype.searchPost(c,b,a)};bibController.prototype.searchPost=function(f,d,c){var b=0;var e=$("#acqDataGridList").datagrid("getSelected");if(e){b=$("#acqDataGridList").datagrid("getRowIndex",e)}if(c){b=0}var a=base_path+"bib/middle/page.do";bibController.prototype.searchPostBefore();$("#acqDataGridList").datagrid({url:a,queryParams:f,onLoadSuccess:function(g){if(g.status=="0"){bibController.prototype.searchPostAfter(g,b)}else{if(g.status=="9006"){openMessageDlg(g.message)}}},method:"post"})};bibController.prototype.searchPostBefore=function(){};bibController.prototype.searchPostAfter=function(b,a){updataGridBibFlag(b,"acqDataGridList");$("#tabsGrid").tabs("select",0);bibGlobalController.prototype.onLoadGridSuccess("acqDataGridList",b,a)};bibController.prototype.add=function(){if(isUpdateData){$.messager.confirm("提示消息","您有修改过的数据未保存,您确定要执行当前操作吗?",function(a){if(a){bibController.prototype.addOk();isUpdateData=false}})}else{bibController.prototype.addOk()}};bibController.prototype.addOk=function(){isUpdateData=true;selectEditBibId=0;if(!initCatconfig()){return}var b=cataConfigData.template;if(b){bibController.prototype.addOkBefore();var a=base_path+"par/template/getTemplate.do?pk=";var c={};$.post(a,c,function(f){if(f.status=="0"){if(f.total>0){var d=JSON.parse(f.rows[0].paramjson);var e=d.rows;bibController.prototype.addOkAfter(e)}}else{openMessageDlg(f.message)}},"json")}};bibController.prototype.addOkBefore=function(){};bibController.prototype.addOkAfter=function(a){bibGlobalController.prototype.setDataToEditBibGrid("editBibGrid",a);bibController.prototype.addAttrCtrlNO()};bibController.prototype.addAttrCtrlNO=function(){};bibController.prototype.initEditGridView=function(){if(!initCatconfig()){return}if(!$("#editBibGrid").attr("class")){handlerEidtBibModelFun("marc")}};bibController.prototype.save=function(g){if(!initCatconfig()){return}accept();var h={};var b=base_path+"bib/middle/saveMarcRecord.do";var e=$("#editBibGrid").datagrid("getRows");if(e.length>0){var f=0;for(var c=0;c0){h.id=selectEditBibId;d="update"}h.sysid=cataConfigData.sysid;bibController.prototype.savePosting(b,h,d)}};bibController.prototype.checkMarcRecord=function(a,d,c){var b=base_path+"bib/middle/checkMarcRecord.do";$.post(b,d,function(h){if(h.status=="0"){bibController.prototype.savePosting(a,d,c)}else{var g=h.rows;if(g.length>0){var f="";for(var e=0;e"+g[e]+""}$.messager.confirm("提示消息",f+"您确定要继续执行保存操作吗?",function(i){if(i){bibController.prototype.savePosting(a,d,c)}});$(".messager-icon").hide()}else{openMessageDlg(h.message)}}},"json")};bibController.prototype.savePosting=function(a,c,b){$.post(a,c,function(d){if(d.status=="0"){openMessageDlg(d.message);isUpdateData=false;selectEditBibId=d.rows[0].id;bibController.prototype.saveAftersearch(b)}else{openMessageDlg(d.message)}},"json")};bibController.prototype.saveAftersearch=function(a){if(a=="delete"){bibController.prototype.setDataByGirdSelect(0)}else{if((a=="add"||a=="update")&&selectEditBibId>0){bibController.prototype.search("ID",selectEditBibId)}else{bibController.prototype.search()}}};bibController.prototype.trash=function(){if(!initCatconfig()){return}var b=$("#acqDataGridList").datagrid("getSelected");if(!b){return openMessageDlg("请先选择一条书目信息,进行删除")}var a=$("#acqDataGridList").datagrid("getRowIndex",b);$.messager.confirm("提示消息","您确定要删除记录号为["+selectEditBibId+"]的书目数据吗?",function(d){if(d){var c=base_path+"bib/middle/delete.do";var e={};e.id=selectEditBibId;$.post(c,e,function(f){if(f.status=="0"){$("#acqDataGridList").datagrid("deleteRow",a);bibController.prototype.saveAftersearch("delete");openMessageDlg(f.message)}else{openMessageDlg(f.message)}},"json")}})};bibController.prototype.accept=function(){if(!initCatconfig()){return}if(selectEditBibId>0){var d=$("#acqDataGridList").datagrid("getSelected");var b=$("#acqDataGridList").datagrid("getRowIndex",d);if(!d.classno){return openMessageDlg("你要进行审校操作书目信息没有分类号,请完善书目信息才能进行审校操作!")}var a=base_path+"bib/middle/review.do";var c={};c.id=selectEditBibId;c.status="1";$.post(a,c,function(e){if(e.status=="0"){bibController.prototype.acceptAfter(b);openMessageDlg(e.message)}else{openMessageDlg(e.message)}},"json")}};bibController.prototype.acceptAfter=function(a){$(".showEditbib-tip").html("");$("#acqDataGridList").datagrid("deleteRow",a);bibController.prototype.clear();$(".showBibGrid-tip").html("书目记录号【"+selectEditBibId+"】");bibGlobalController.prototype.loadEidtGridByPost(selectEditBibId,"centerDataGridDetail");selectEditBibId=0};bibController.prototype.paste=function(){if(!initCatconfig()){return}bibController.prototype.pasteBefore()};bibController.prototype.pasteBefore=function(){$("#pasteMarcDlg").dialog("open")};bibController.prototype.pasteResult=function(){var f=getValue("nclmarc");if(!f){return openMessageDlg("数据区值不能为空。")}selectEditBibId=0;f=JSON.stringify(f);var h=f.split("\\n");var b=[{field:"HEA",indicator:"",data:"nam a2200000 a 4500"}];var a=/^[0-9 ]+.?[0-9 ]*$/;for(var c=0;c=2){var g=j[0];if(g&&g.length>2){if(a.test(g)){var e={};e.field=g.substr(0,3);e.indicator=g.substr(3,2);if(j[1]){e.data=j[1].replace(new RegExp(/\|/g,"gm"),"$")}b.push(e)}}}}bibGlobalController.prototype.setDataToEditBibGrid("editBibGrid",b);setValue("nclmarc","");$("#pasteMarcDlg").dialog("close")};bibController.prototype.set=function(){$("#pageconfig_setpara_dlg").dialog("open")};bibController.prototype.setDataByGirdSelect=function(a){selectEditBibId=a;if(a==0){$(".showEditbib-tip").html("");clearGridData("editBibGrid")}else{$(".showEditbib-tip").html("书目记录号【"+selectEditBibId+"】");bibGlobalController.prototype.loadEidtGridByPost(selectEditBibId,"editBibGrid")}};bibController.prototype.updateEditGridLeftTip=function(a){$(".showEditbib-tip").html(a)};var bibGlobalController=function(){};bibGlobalController.prototype.onLoadGridSuccess=function(c,b,a){if(b.total>0&&b.total>a){$("#"+c).datagrid("selectRow",a)}else{if(b.total>0){$("#"+c).datagrid("selectRow",0)}}};bibGlobalController.prototype.loadEidtGridByPost=function(d,b){var a=base_path+"bib/middle/getMarcRecordForEdit.do";var c={};c.id=d;$.post(a,c,function(f){if(f.status=="0"){var e=f.rows;bibGlobalController.prototype.setDataToEditBibGrid(b,e)}else{openMessageDlg(f.message)}},"json")};bibGlobalController.prototype.setDataToEditBibGrid=function(b,a){$("#"+b).datagrid({data:a,onLoadSuccess:function(c){$("#"+b).datagrid("resize")}})};bibGlobalController.prototype.loadGridData=function(b,j,h,g,c,k){if(b>0){var f=0;var l=$("#"+j+"DataGridList").datagrid("getSelected");if(l){f=$("#"+j+"DataGridList").datagrid("getRowIndex",l)}var a=base_path+"acq/"+j+"/list.do";if(h&&h==1){a=base_path+"per/"+j+"/list.do"}if(j=="hold"){a=base_path+"hld/holding/list.do"}var d={};d.rows=10;d.page=1;d.orderBy=" id desc ";var e=0;d["limit["+e+"].condition"]="bibid";d["limit["+e+"].value"]=b;e++;if($("#libcodeSelect").length>0){var i=getValue("libcodeSelect");if(i){d["limit["+e+"].condition"]="libcode";d["limit["+e+"].value"]=vLibcode;e++}else{d=getParamLibForNoLimitLib(d,e)}}$("#"+j+"DataGridList").datagrid({url:a,queryParams:d,onLoadSuccess:function(m){bibGlobalController.prototype.onLoadGridSuccess(j+"DataGridList",m,f);if(g&&k){bibGlobalController.prototype.updateTabsGridTitByIndex(g,c,k,m.total)}bibGlobalController.prototype.onLoadGridSuccessAfter(j,m)},method:"post"})}else{deleteGridData(""+j+"DataGridList")}};bibGlobalController.prototype.onLoadGridSuccessAfter=function(a,b){};bibGlobalController.prototype.updateTabsGridTitByIndex=function(d,b,e,a){var f=e+"列表"+addStyleHtml(a);var c=$("#"+d).tabs("getTab",b);$("#"+d).tabs("update",{tab:c,options:{title:f}})};bibGlobalController.prototype.getSearchCondtion=function(c,b){var d={};d.rows=10;d.page=1;d.orderBy=" id desc ";var a=0;d["limit["+a+"].condition"]="sysid";d["limit["+a+"].value"]=getValue("sysid");a++;d.condition=getValue("bibindex");d.value=getValue("keyword");if($("#searchhandler").length>0){d.typeHandler=getValue("searchhandler")}if(c){d.condition=c;d.value=b}return d};bibGlobalController.prototype.updateLayOutTitle=function(c,b,d){var a=$("#"+c).layout("panel",b);a.panel("setTitle",d)};bibGlobalController.prototype.updateDataGridTitle=function(a,b){$("#"+a).datagrid("getPanel").panel("setTitle",b)};function copyFLdToLeftScreen(a){bibGlobalController.prototype.copy(a)}bibGlobalController.prototype.copy=function(d){if(d){rows=d}if(rows.length>0){for(var c=0;c=48&&e.which<=57)||(e.which>=65&&e.which<=90)||(e.which>=96&&e.which<=122)||(e.which==32)){if(a.target.val().toString().length>=3&&a.field=="field"){e.returnValue=false;var d=false;if(isNewRecord){for(var c=0;c=2&&a.field=="indicator"){e.returnValue=false;onNextCellEditor(b,"data");return false}}}})}}a.target.bind("keydown",function(c){editIndex=b;var d=$("#editBibGrid").datagrid("getRows")[editIndex];if(c.ctrlKey){if(c.which==37){leftCellEditor(b,a.field)}if(c.which==38){onNextCellEditor(--b,a.field)}else{if(c.which==39){rightCellEditor(b,a.field)}else{if(c.which==40){onNextCellEditor(++b,a.field)}else{if(c.which==13){insertRow()}else{if(c.which==46||c.which==110){removeit()}}}}}}else{if(c.which==38){c.returnValue=false;onNextCellEditor(--b,a.field);return false}else{if(c.which==40){c.returnValue=false;onNextCellEditor(++b,a.field);return false}else{if(c.which==13){onEditorEnter(b,a.field)}}}}})};