var editIndex=undefined;var vField=undefined;var vEditmodel=undefined;var vLengFldList=undefined;var isUpdateData=false;var isNewRecord=false;var autoBulid905f=undefined;var simpleFieldComBoxData=[];var eidtMsgTipIsOpen=0;var marcEditGridColumns=[{field:"field",title:"字段名",width:"8%",editor:"text",formatter:onShowValidatorType},{field:"indicator",title:"指示符",width:"8%",editor:"text",formatter:onShowTextWidth},{field:"data",title:"字段内容",width:"84%",editor:"text",formatter:onShowDataValidator}];$(function(){$("#editBib_dlg").window("resize",{top:80,left:$(window).width()-510})});function initEidtBiBModel(a,c,b){initEidtGridView(a,c,b)}function initEidtGridView(b,d,c){var a=$("#editBibGrid");if(!a.attr("class")){$("#editBibGridToolBar").show();$("#editBibGrid").datagrid({iconCls:"e-icon fa fa-edit",singleSelect:true,fit:true,fitColumns:true,singleSelect:true,border:false,nowrap:false,striped:true,toolbar:"#editBibGridToolBar",onClickRow:onClickRow,onBeginEdit:onBeginEdit,columns:[marcEditGridColumns]})}if(!d){reLoadEditBibGridData(b,c)}else{handlerEidtBibModelFun(b)}}function handlerEidtBibModelFun(c,a){vEditmodel=c;var b=base_path+"par/common/getInitData.do";var d={key:"bibshow"};$.post(b,d,function(h){if(h.total>0){var g=h.rows;simpleFieldComBoxData=[];for(var e=0;e0){$("#centerDataGridDetail").datagrid("hideColumn","indicator")}if($("#favolumeup").length>0){$("#favolumeup").linkbutton("disable")}$("#z3950EditBibGrid").datagrid("hideColumn","indicator");$("#checkrepeatEditGrid").datagrid("hideColumn","indicator");f=j}else{if(c=="marc"){f=marcEditGridColumns;if($("#centerDataGridDetail").length>0){$("#centerDataGridDetail").datagrid("showColumn","indicator")}if($("#favolumeup").length>0){$("#favolumeup").linkbutton("enable")}$("#z3950EditBibGrid").datagrid("showColumn","indicator");$("#checkrepeatEditGrid").datagrid("showColumn","indicator")}}}$("#editBibGrid").datagrid({iconCls:"e-icon fa fa-edit",singleSelect:true,fit:true,fitColumns:true,singleSelect:true,border:false,nowrap:false,striped:true,toolbar:"#editBibGridToolBar",onClickRow:onClickRow,onBeginEdit:onBeginEdit,columns:[f]});if(a){$("#editBibGrid").datagrid("loadData",a)}else{if(cataConfigData.sysid){$("#editBibGrid").datagrid("loadData",[])}}}},"json")}function reLoadEditBibGridData(b,d){var a=base_path+"lib/biblios/convertMarcEditModel.do";var f={};var e=$("#editBibGrid").datagrid("getRows");if(e.length>0){for(var c=0;c重复性【NR不可重复 R可重复】";c+='';c+="";c+="";c+="";c+="";c+="";c+="";c+="";c+="";c+="";c+="";c+="";c+="";c+="";c+="";var f=EDITBIBMESSAGE[b].indicator1;var e=EDITBIBMESSAGE[b].indicator2;if(f!=null){c+="";c+="";c+="";c+="";c+="";c+="";c+="";var g=EDITBIBMESSAGE[b].listInd1;for(var a=0;a";c+="";c+="";c+="";c+="";c+="";c+=""}}else{c+="";c+="";c+="";c+="";c+="";c+="";c+=""}if(e!=null){c+="";c+="";c+="";c+="";c+="";c+="";c+="";var d=EDITBIBMESSAGE[b].listInd2;for(var a=0;a";c+="";c+="";c+="";c+="";c+="";c+=""}}else{c+="";c+="";c+="";c+="";c+="";c+="";c+=""}var k=EDITBIBMESSAGE[b].listSubfld;for(var a=0;a";c+="";c+="";c+="";c+="";c+="";c+=""}break}}c+="
字段指示符子字段描述重复性
"+EDITBIBMESSAGE[b].field+""+EDITBIBMESSAGE[b].hint+""+EDITBIBMESSAGE[b].repeat+"
第一位"+f+"
"+g[a].code+""+g[a].hint+"
第一位未定义
第二位"+e+"
"+d[a].code+""+d[a].hint+"
第二位未定义
$"+k[a].subfld+""+k[a].hint+""+k[a].repeat+"
";$(".message-div").html(c);$("#editBib_dlg").dialog("open")}}function lengthFldHnadlerMian(e){var g=$("#lengthflddlg").parent().is(":hidden");if(g){var a=$("#editBibGrid").datagrid("getRows")[e];setValue("lengthFldType",a.field);var d=undefined;for(var b=0;b';c+=""+d[b].name+"";c+=""+d[b].length+"";c+='';c+=""}else{c+="";c+=""+d[b].name+"";c+=""+d[b].length+"";c+='';c+=""}}$(".length-fld-text").html(c);for(var b=0;b=48&&l.which<=57)||(l.which>=65&&l.which<=90)||(l.which>=96&&l.which<=105)||(l.which==32)){var m=parseInt(this.attributes.indexPosition.value);var k=parseInt(d[m].length);var i=this.value;if(i.length>=k){l.returnValue=false;return false}}}})}$("#lengthflddlg").dialog("open");$("#"+d[0].field).focus().select()}}}function showLengthFldTip(b){if(vLengFldList){var c="";var d=vLengFldList[b].subfld;for(var a=0;a"+d[a].code+"|"+d[a].name+""}$(".length-fld-tip").html(c)}}function saveLengthFldValue(){var c=getValue("lengthFldType");if(vLengFldList){var g="$a";if(c=="HEA"){g=""}for(var b=0;bd){f=f.substr(0,d)}if(f.length=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)}else{if(d.field=="HEA"||d.field=="100"||d.field=="105"){var e=c.keyCode||c.which||c.charCode;if(e!=undefined){c.returnValue=false;lengthFldHnadlerMian(editIndex);return false}}}}}}})}function onEditorEnter(a,c){var b=$("#editBibGrid").datagrid("getRows")[a];enterAutoBuildFieldData(a,b,c)}function enterAutoBuildFieldData(g,b,c){accept();var h=b.field;var d=b.data;var e=[{orgfld:"010",orgcode:"a",tagfld:"210",tagcode:[{code:"a"},{code:"c"}]},{orgfld:"010",orgcode:"a",tagfld:"102",tagcode:[{code:"a"},{code:"b"}]},{orgfld:"200",orgcode:"d",tagfld:"510",tagcode:[{code:"a"}]},{orgfld:"225",orgcode:"a",tagfld:"410",tagcode:[{code:"12001 $a"}]},{orgfld:"225",orgcode:"a",tagfld:"461",tagcode:[{code:"12001 $a"}]},{orgfld:"225",orgcode:"i",tagfld:"462",tagcode:[{code:"12001 "}]},{orgfld:"690",orgcode:"a",tagfld:"606",tagcode:[{code:"a"}]},{orgfld:"606",orgcode:"a",tagfld:"690",tagcode:[{code:"a"}]},{orgfld:"690",orgcode:"a",tagfld:"905",tagcode:[{code:"f"}]},{orgfld:"ISBN"},{orgfld:"905"},];var a=true;for(var f=0;f0){$("#subjectGrid").datagrid("loadData",i.rows);$("#catsubjectdlg").dialog("setTitle",d);$("#subjectGrid").datagrid({title:"选中一条记录双击"+d});$("#catsubjectdlg").dialog("open")}else{onNextCellEditor(++c,a)}},"json")}function autoBuildSubject(c,e){$("#catsubjectdlg").dialog("close");var d=getValue("subjectfld");var b=parseInt(getValue("subjectindex"));var f=getValue("subjectcolfield");var a="$a"+e.subject+"";if(d!="606"){a="$a"+e.classno+""}insertGridRow(b,d,a,f)}function autoBuild210Fld(f,c,d,a){var b=base_path+"par/common/getInitData.do";var g={fmt:"entity",key:"institutional",condition:"code",value:d};try{$.post(b,g,function(m){if(m.total>0){var r=m.rows[0];var j="";if(vEditmodel=="marc"){if(f.index){var o=$("#editBibGrid").datagrid("getRows")[f.index];var h=getDataDirect(o.data,"a");if(!h||h.length==0){j="$a"+r.area+o.data}var q=getDataDirect(o.data,"c");if(!q||q.length==0){j=o.data+"$c"+r.name+""}updateGridRow(c,f.index,f.tagfld,j,a)}else{j="$a"+r.area+"$c"+r.name+"";insertGridRow(c,f.tagfld,j,a)}}else{var k=$("#editBibGrid").datagrid("getRows");var n=0;var p=0;for(var l=0;l0){var j=i.rows[0];var h="$aCN";if(vEditmodel=="marc"){if(j.area){h+="$b"+j.areacode+""}if(f.index){updateGridRow(c,f.index,f.tagfld,h,a)}else{insertGridRow(c,f.tagfld,h,a)}}}else{onNextCellEditor(++c,a)}},"json")}catch(e){}}function autoBuildComFld(g,d,f,c){if(vEditmodel=="marc"){if(f&&f.length>0){var b="";var a=g.tagcode;for(var e=0;e1&&!a[1]){var e="";var i="";var d=base_path+"cat/titlenum/getCurCallno.do";var c={};c.classno=a[0];c.bibid=selectEditBibId;$.post(d,c,function(l){if(l.status=="0"){var k=l.rows[0];if(l.total==0){i=rowBib.classno+"/1"}else{i=k.classno+"/"+k.titnum}e=j.replace(b,i);if(h.tagfld){insertGridRow(g,h.tagfld,"$f"+i,f)}else{updateGridRow(g,g,"905",e,f)}}else{if(l.status=="4002"){var k=l.rows[0];if(l.total==0){i=rowBib.classno+"/1"}else{i=k.classno+"/"+k.titnum}e=j.replace(b,i);if(h.tagfld){insertGridRow(g,h.tagfld,"$f"+i,f)}else{updateGridRow(g,g,"905",e,f)}}else{onNextCellEditor(++g,f)}}},"json")}else{onNextCellEditor(++g,f)}}function insertLengthDataGridRow(d,e,b,c){var a=d+1;$("#editBibGrid").datagrid("insertRow",{index:a,row:{field:e,indicator:e,data:b}})}function insertGridRow(d,e,b,c){var a=d+1;$("#editBibGrid").datagrid("insertRow",{index:a,row:{field:e,indicator:"",data:b}});onNextCellEditor(a,c)}function updateGridRow(f,e,d,b,c){var a=e;$("#editBibGrid").datagrid("updateRow",{index:a,row:{field:d,indicator:"",data:b}});onNextCellEditor(a,c)}function fldDataIsExistence(f){var e=$("#editBibGrid").datagrid("getRows");for(var d=0;d2){$(b.target).val($(b.target).val().substr(0,2))}b=$("#editBibGrid").datagrid("getEditor",{index:c,field:"field"});if(b!=undefined){if($(b.target).val().length>=3){showEditBibDlgMessage((b.target).val())}}}b=$("#editBibGrid").datagrid("getEditor",{index:c,field:g});if(b!=undefined){var f=$(b.target);var a=f.val().length;$(b.target).focus();if(f[0].selectionEnd&&a>0){var c=f.val().indexOf("#");if(c>0){f[0].selectionEnd=0;f[0].selectionStart=c}}}}catch(d){}}function onClickRow(b,c){onSelectCheckRepeatEditGrid(b,c);if(noEditBibGridByCode==true){return}var a=getValue("bibStatus");if(!a||a=="0"){if(editIndex!=b){if(endEditing()){$("#editBibGrid").datagrid("selectRow",b).datagrid("beginEdit",b);editIndex=b}else{$("#editBibGrid").datagrid("selectRow",editIndex)}onNextCellEditor(editIndex,"data")}}}function onSelectCheckRepeatEditGrid(b,f){if(cataConfigData.sysid){var e=[{field:"010",code:"a",index:"ISBN"},{field:"001",index:"CTRLNO"},{field:"200",code:"a",index:"TITLE"},{field:"701",code:"a",index:"AUTHOR"},{field:"702",code:"a",index:"AUTHOR"},{field:"690",code:"a",index:"CLASSNO"},{field:"606",code:"a",index:"SUBJECT"},{field:"690",code:"f",index:"CALLNO"}];var a=f.data;if(a.length>0){for(var d=0;d"+e[0]+""}a="";if(!d.test(e[0])){a="color:red;"}if(e[1]!=undefined){c+="
  • "+e[1]+"
  • "}c+="";return c}}return e}function onShowValidatorType(c,d,a){var b=/^[0-9]+.?[0-9]*$/;if(!b.test(c)){c=""+c+""}return c}function openEidtMsgTip(){$("#editBib_dlg").dialog("open");eidtMsgTipIsOpen=0}function closeEidtMsgTip(){$("#editBib_dlg").dialog("close");eidtMsgTipIsOpen=1};