var bibController=function(){};var initJson;var selectEditBibId=0;var selectCenterBibId=0;var tabGrid_title="(采编)";var noEditBibGridByCode=false;$(function(){bibController.prototype.init();bibController.prototype.bind()});bibController.prototype.bind=function(){};bibController.prototype.init=function(){initJson=[{code:"page_sysid",key:"sysid",condition:"type",value:"0",linkage:[{code:"page_template",key:"template",condition:"sysid"}]},{code:"page_ctrlno",key:"ctrlno",condition:"libcode",value:vLibcode},{code:"page_z3950",key:"z3950",condition:"libcode",value:vLibcode},{code:"page_editmodel",key:"editmodel"},{code:"page_finsources",key:"finsources"},{code:"page_mediatype",key:"mediatype"},{code:"page_binding",key:"binding"},{code:"page_docsources",key:"docsources"},{code:"page_ncy,orderbib_ncy",key:"ncy"},{code:"page_bookseller",key:"bookseller",condition:"libcode",value:vLibcode},{code:"page_location",key:"location",condition:"libcode",value:vLibcode},{code:"page_doctype",key:"doctype",condition:"libcode",value:vLibcode},{code:"page_libcode",key:"libcode",condition:"code",value:vLibcode},{code:"operid",key:"operid"}];_myPage.prototype.getLoadData(initJson)};_myPage.prototype.getLoadSuccess=function(a,b){if(vType=="0"||vType=="cata"||vType=="order"||vType=="check"||vType=="tobookcheck"||vType=="com"){mystorage.set("cat_init_data",a)}else{if(vType=="1"){mystorage.set("per_init_data",a)}}_fmtGridDataRows=a};bibController.prototype.search=function(b,a){if(!_setConfig.prototype.check()){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){if(a){clearGridData("editBibGrid,centerDataGridDetail,acqDataGridList,centerDataGridList,orderDataGridList,checkDataGridList,holdDataGridList")}else{clearGridData("editBibGrid,acqDataGridList,centerDataGridList,orderDataGridList,checkDataGridList,holdDataGridList")}};bibController.prototype.searchOk=function(b,a){bibController.prototype.clear(1);selectEditBibId=0;selectCenterBibId=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){if($("#bibindextitle").length>0&&!$(".add-condtion").is(":hidden")){if(getValue("keyword").length==0&&getValue("titlekey").length==0||getValue("authorkey").length==0){return openMessageDlg("组合检索至少有一项检索值不能为空!")}}else{return openMessageDlg("检索值不能为空")}}bibController.prototype.searchPost(c,b,a)};bibController.prototype.searchPost=function(f,d,a){var c=0;var e=$("#acqDataGridList").datagrid("getSelected");if(e){c=$("#acqDataGridList").datagrid("getRowIndex",e)}if(a){c=0}var b=base_path+"lib/biblios/page.do";$("#acqDataGridList").datagrid({url:b,queryParams:f,onLoadSuccess:function(g){if(g.status=="0"){$("#tabsGrid").tabs("select",0);bibGlobalController.prototype.onLoadGridSuccess("acqDataGridList",g,c);bibCenterController.prototype.search(g)}else{if(g.status=="9006"){openMessageDlg(g.message)}}},method:"post"})};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(){_linkbuttonObj.prototype.status(false);selectEditBibId=0;if(!_setConfig.prototype.check()){return}var b=cataConfigData.template;if(b){var a=base_path+"par/template/getTemplate.do?pk="+b;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;bibGlobalController.prototype.setDataToEditBibGrid("editBibGrid",e);bibController.prototype.addAttrCtrlNO()}}else{openMessageDlg(f.message)}},"json")}};bibController.prototype.addAttrCtrlNO=function(){var b=cataConfigData.editmodel;if(b=="marc"){$(".showEditbib-tip").html("");var d=cataConfigData.ctrlno;if(d){var a=base_path+"par/ctrlno/get.do?pk="+d;var c={};$.post(a,c,function(e){if(e.status=="0"){if(e.total>0){$("#editBibGrid").datagrid("insertRow",{index:1,row:{field:"001",indicator:"",data:e.rows[0].currentctrlno}})}}else{openMessageDlg(e.message)}},"json")}}};bibController.prototype.initEditGridView=function(){if(!$("#editBibGrid").attr("class")){initEidtBiBModel(cataConfigData.editmodel)}};bibController.prototype.save=function(g){if(!_setConfig.prototype.check()){return}accept();var h={};var c=base_path+"lib/biblios/saveMarcRecord.do";var e=$("#editBibGrid").datagrid("getRows");if(e.length>0){if(!g){if(cataConfigData.choose&&cataConfigData.choose=="1"){pinyinController.prototype.pyfun(e);return}}var f=0;for(var d=0;d0){h.id=selectEditBibId;a="update"}h.sysid=cataConfigData.sysid;if(cataConfigData.choose){h.choose=cataConfigData.choose}$.post(c,h,function(i){if(i.status=="0"){openMessageDlg(i.message);isUpdateData=false;selectEditBibId=i.rows[0].id;bibController.prototype.saveAfterSerach(a)}else{openMessageDlg(i.message)}},"json")}};bibController.prototype.saveAfterSerach=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(!_setConfig.prototype.check()){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+"lib/biblios/delete.do";var e={};e.id=selectEditBibId;$.post(c,e,function(f){if(f.status=="0"){$("#acqDataGridList").datagrid("deleteRow",a);bibController.prototype.saveAfterSerach("delete");openMessageDlg(f.message)}else{openMessageDlg(f.message)}},"json")}})};bibController.prototype.accept=function(){if(!_setConfig.prototype.check()){return}if(selectEditBibId>0){var d=$("#acqDataGridList").datagrid("getSelected");var b=$("#acqDataGridList").datagrid("getRowIndex",d);if(!d.classno){return openMessageDlg("你要进行审校操作书目信息没有分类号,请完善书目信息才能进行审校操作!")}var a=base_path+"lib/biblios/update.do";var c={};c.id=selectEditBibId;c.status="1";$.post(a,c,function(e){if(e.status=="0"){$(".showEditbib-tip").html("");$("#acqDataGridList").datagrid("deleteRow",b);bibController.prototype.clear();$(".showBibGrid-tip").html("书目记录号【"+selectEditBibId+"】");bibGlobalController.prototype.loadEidtGridByPost(selectEditBibId,"centerDataGridDetail");selectEditBibId=0;openMessageDlg(e.message)}else{openMessageDlg(e.message)}},"json")}};bibController.prototype.paste=function(){if(!_setConfig.prototype.check()){return}$("#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")}};var bibCenterController=function(){};bibCenterController.prototype.search=function(a){var b=base_path+"lib/biblios/page.do";var e=bibGlobalController.prototype.getSearchCondtion();if(e.value){e["limit[0].value"]="1";var c=0;var d=$("#centerDataGridList").datagrid("getSelected");if(d){c=$("#centerDataGridList").datagrid("getRowIndex",d)}$("#centerDataGridList").datagrid({url:b,queryParams:e,onLoadSuccess:function(f){if(a&&a.total==0){$("#tabsGrid").tabs("select",1)}bibGlobalController.prototype.onLoadGridSuccess("centerDataGridList",f,c)},method:"post"})}};bibCenterController.prototype.initCenterGridDetail=function(d,c){var b=$("#centerDataGridDetail");if(!b.attr("class")){$("#showBibGridToolBar").show();var a=[{field:"ck",checkbox:true,width:"4%"},{field:"field",title:"字段名",width:"8%"},{field:"indicator",title:"指示符",width:"8%",formatter:onShowTextWidth},{field:"data",title:"字段内容",width:"80%",formatter:onShowDataValidator}];b.datagrid({iconCls:"e-icon fa fa-table",fit:true,fitColumns:true,border:false,nowrap:false,striped:true,toolbar:"#showBibGridToolBar",columns:[a]})}if(d){bibGlobalController.prototype.setDataToEditBibGrid(d,c)}};function copyFLdToLeftScreen(a){bibCenterController.prototype.copy(a)}bibCenterController.prototype.copy=function(e){var d=$("#centerDataGridDetail").datagrid("getSelections");if(e){d=e}if(d.length>0){for(var c=0;c0){selectEditBibId=0;clearGridData("editBibGrid");for(var b=0;b0){for(var b=0;b-1){d.push(c[b])}}}if(e.length>0){for(var b=0;bg.field){return 1}if(h.field0&&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+"lib/biblios/getMarcRecordForEdit.do";var c={};c.id=d;$.post(a,c,function(f){if(f.status=="0"){var e=f.rows;if(b=="centerDataGridDetail"){bibCenterController.prototype.initCenterGridDetail(b,e)}else{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");if(b=="centerDataGridDetail"){bibCenterController.prototype.selectCheckCenterGrid()}}})};bibGlobalController.prototype.loadGridData=function(f,c){if(f>0){var b=0;var e=$("#"+c+"DataGridList").datagrid("getSelected");if(e){b=$("#"+c+"DataGridList").datagrid("getRowIndex",e)}var a=base_path+"acq/"+c+"/page.do";if(c=="hold"){a=base_path+"hld/holding/page.do"}var d={};d.bibid=f;d.rows=10;d.page=1;d.orderBy=" id desc ";$("#"+c+"DataGridList").datagrid({url:a,queryParams:d,onLoadSuccess:function(g){bibGlobalController.prototype.onLoadGridSuccess(c+"DataGridList",g,b)},method:"post"})}else{deleteGridData(""+c+"DataGridList")}};bibGlobalController.prototype.getSearchCondtion=function(d,b){var e={};e.rows=10;e.page=1;e.orderBy=" id desc ";var c=0;if(vType=="cata"||vType=="order"||vType=="check"||vType=="tobookcheck"||vType=="com"){e["limit["+c+"].condition"]="status";e["limit["+c+"].value"]="0";c++}e["limit["+c+"].condition"]="sysid";e["limit["+c+"].value"]=cataConfigData.sysid;c++;e.condition=getValue("bibindex");e.value=getValue("keyword");var f=$("#libcodeSelect");if(f.length>0&&getValue("libcodeSelect").length>0){e["limit["+c+"].condition"]="libcode";e["limit["+c+"].value"]=getValue("libcodeSelect");c++}var a=$("#orderbatchno");if(a.length>0&&getValue("orderbatchno").length>0){e["limit["+c+"].condition"]="ORDBATCHNO";e["limit["+c+"].value"]=getValue("orderbatchno");c++}if($("#titlekey").length>0){if(getValue("titlekey").length>0){e["limit["+c+"].condition"]=getValue("bibindextitle");e["limit["+c+"].typeHandler"]=getValue("titlehandler");e["limit["+c+"].value"]=getValue("titlekey");c++}if(getValue("authorkey").length>0){e["limit["+c+"].condition"]=getValue("bibindexauthor");e["limit["+c+"].typeHandler"]=getValue("authorhandler");e["limit["+c+"].value"]=getValue("authorkey");c++}}if(d){e.condition=d;e.value=b}return e};