var jsonFormatDesign={code:"I_BIBIMPORTDATA"+vBibType,title:"馆藏接收格式设计",gridtitle:"设置要接收的馆藏字段",othertitle:"缺省值填值提示",perviewtitle:"馆藏数据预览列表",width:"800",height:"600",top:80,left:180};var curPerviewIndex=1;var maxPerviewNum=undefined;$(function(){initBibImportDataPageElement();acceptShowData(true);perviewShowData(true);$("#checkhold").on("click",function(a){if($("#checkhold").get(0).checked){acceptShowData(false)}else{acceptShowData(true)}})});function acceptShowData(a){$("#bntFormatDesign").linkbutton({disabled:a});$("#acceptFormatDesignIndex").combobox({disabled:a})}function perviewShowData(a){$("#bntPerviewNextRecord").linkbutton({disabled:a});$("#bntPerviewPrevRecord").linkbutton({disabled:a})}function initBibImportDataPageElement(){setCurImportDataGridHeight(220)}function setCurImportDataGridHeight(b){var a=$(window).height();var c=a-b;$(".import-data-div").css("height",c+"px");$("#tabsGrid").tabs("resize");$(".easyui-panel").panel("resize")}function onPerviewData(c){$("#showPerviewOrgMarcData").html("");$("#showPerviewTagMarcData").html("");if(filelist){var a=getJsonData(null,"record");a.filename=filelist[0];if(c){curPerviewIndex=c}else{curPerviewIndex=1}a.index=curPerviewIndex;var b=base_path+"com/webuploader/perviewMarcData.do";$.post(b,a,function(d){if(d.status=="0"){setDataToPageShowPerview(d)}else{if(d.status=="9003"){maxPerviewNum="max";openMessageDlg(d.message)}else{openMessageDlg(d.message)}}},"json")}else{openMessageDlg("请检查您是否已上传文件")}}function onPerviewNextData(){if(maxPerviewNum){return openMessageDlg("已经是最后一条记录了")}if(curPerviewIndex<500){onPerviewData(curPerviewIndex+1)}else{openMessageDlg("只能预览前500条")}}function onPerviewPrevData(){if(curPerviewIndex>1){onPerviewData(curPerviewIndex-1);maxPerviewNum=undefined}else{openMessageDlg("已经是第一条了")}}function onAcceptData(a){$(".error-msg-result").html("");if(!a){errorcount=0;handlecount=0;successcount=0;if(getValue("catacode").length==0){return openMessageDlg("请选择数据的接收征订目录!")}$.messager.progress({title:"接收数据",msg:"正在处理数据,请稍等..."})}if(filelist){var c=getJsonData(null,"record");if(a){c=a}else{c.filename=filelist[0];c.page=1;c.rows=500}var b=base_path+"com/webuploader/insertMarcData.do";$.post(b,c,function(d){$.messager.progress("close");if(d.status=="0"){var e=d.rows[0];if(e){errorfile=e.errorfile;errorcount+=e.errorcount;handlecount+=e.handlecount;successcount+=e.successcount;if(e.nextfile){$.messager.progress({title:"接收数据",msg:"已处理["+handlecount+"]条数据,成功["+successcount+"]条,失败["+errorcount+"]条,请等待处理完成 ..."});c.errorfile=e.errorfile;c.filename=e.nextfile;onAcceptData(c)}else{$(".handlecount").html("已处理["+handlecount+"]条数据");$(".successcount").html("成功["+successcount+"]条");$(".errorcount").html("失败["+errorcount+"]条");$("#checkerrorfile").show();$("#acceptFileResultDlg").dialog("open")}}}else{openMessageDlg(d.message)}},"json").error(function(){$(".error-msg-result").html("处理数据中途错误,请查看错误文件!");$(".handlecount").html("已处理["+handlecount+"]条数据");$(".successcount").html("成功["+successcount+"]条");$(".errorcount").html("失败["+errorcount+"]条");$("#checkerrorfile").show();$("#acceptFileResultDlg").dialog("open");$.messager.progress("close")})}}function setDataToPageShowPerview(e){var f=e.rows[0];if(f){$("#importDataGridList").datagrid("loadData",[]);perviewShowData(false);var d=f.orgmarc.split(/[\n\r]/g);var c="
"+curPerviewIndex+"
";for(var b=0;b'+d[b].replace(/[$]([A-Za-z0-9])/g,'$$$1')+""}$("#showPerviewOrgMarcData").html(c);if(f.tagmarc){var a=f.tagmarc.split(/[\n\r]/g);c="
"+curPerviewIndex+"
";for(var b=0;b'+a[b].replace(/[$]([A-Za-z0-9])/g,'$$$1')+""}$("#showPerviewTagMarcData").html(c)}$("#importDataGridList").datagrid("loadData",f.hlds)}}function onResetAcceptFormatDesignPage(){$(".acceptTextTip").html("请选择接收的书目数据文件");setCurImportDataGridHeight(260);perviewShowData(true);curPerviewIndex=1;maxPerviewNum=undefined;$("#showPerviewOrgMarcData").html("");$("#showPerviewTagMarcData").html("");$("#importDataGridList").datagrid("loadData",[])}function uploadSuccessHandler(a,b){if(b.status==0){filelist=b.rows[0].filelist}else{openMessageDlg(b.message)}};