var fieldComBoxData;var jsonGridColumns;var curPerviewIndex=1;var maxPerviewNum=undefined;$(function(){setCurImportDataGridHeight(350);var a=[{key:"rdrtype",condition:"libcode",value:vLibcode},{key:"libcode",condition:"code",value:vLibcode},{key:"rdrfld1",condition:"parentid",value:"1"},{key:"rdrfld2",condition:"parentid",value:"2"},{key:"rdrfld3",condition:"parentid",value:"3"},{key:"rdrfld4",condition:"parentid",value:"4"}];_myPage.prototype.initData(a);showRdrFldName();getReaderFldResult()});_myPage.prototype.onLoadSuccess=function(a,b){getReaderFldResult()};function getReaderFldResult(){fieldComBoxData=[{code:"libcode",name:"分馆代码",param:[{key:"libcode",condition:"code",value:vLibcode}]},{code:"rdrno",name:"读者证号"},{code:"name",name:"读者姓名"},{code:"idcard",name:"身份证号"},{code:"otherno",name:"其他编号"},{code:"password",name:"读者密码",param:[{key:"rdrdefpwd"}]},{code:"status",name:"读者状态",data:[{code:"0",name:"有效"},{code:"1",name:"挂失"},{code:"2",name:"暂停"},{code:"3",name:"验证"},{code:"4",name:"注销"}]},{code:"rdrtype",name:"读者类型",param:[{key:"rdrtype",condition:"libcode",value:vLibcode}]},{code:"rdrfld1",name:mystorage.get("rdr_fld1"),param:[{key:"rdrfld1",condition:"parentid",value:"1"}]},{code:"rdrfld2",name:mystorage.get("rdr_fld2"),param:[{key:"rdrfld2",condition:"parentid",value:"2"}]},{code:"rdrfld3",name:mystorage.get("rdr_fld3"),param:[{key:"rdrfld3",condition:"parentid",value:"3"}]},{code:"rdrfld4",name:mystorage.get("rdr_fld4"),param:[{key:"rdrfld4",condition:"parentid",value:"4"}]},{code:"birthday",name:"生日"},{code:"gender",name:"性别",data:[{code:"0",name:"男"},{code:"1",name:"女"}]},{code:"hobby",name:"爱好"},{code:"specialty",name:"特长"},{code:"telephone",name:"电话号码"},{code:"email",name:"email"},{code:"nation",name:"民族"},{code:"nativeplace",name:"籍贯"},{code:"address",name:"通讯地址"},{code:"unit",name:"工作单位"},{code:"createdate",name:"办证日期"},{code:"startdate",name:"起始日期"},{code:"enddate",name:"终止日期"},{code:"canceldate",name:"注销日期"},{code:"note",name:"备注"}];jsonGridColumns=[{field:"field",title:"字段名称",width:"80",formatter:onShowJosnComBoxData,editor:{type:"combobox",options:{valueField:"code",textField:"name",panelHeight:"200",required:true,editable:false,groupField:"group",data:fieldComBoxData,loadFilter:function(c){var b=[];for(var a=0;a0){var b="";for(var a=0;a'+c[a].code+"|"+c[a].name+""}$(".otherFormatDesignPanelBody").html(b)}}function onInitEidtorGridDefaultValue(a){var b=eidtorGridObject.datagrid("getEditor",{index:eidtorGridIndex,field:"defvalue"});$(b.target).textbox("setValue",a)}function showRdrFldName(){$(".show-rdrfld1").html(mystorage.get("rdr_fld1"));$(".show-rdrfld2").html(mystorage.get("rdr_fld2"));$(".show-rdrfld3").html(mystorage.get("rdr_fld3"));$(".show-rdrfld4").html(mystorage.get("rdr_fld4"))}function initFormatDesignGrid(){eidtorGridObject=$("#setFldHandlerGrid");eidtorGridObject.datagrid({iconCls:"e-icon fa fa-cog",fit:true,title:"设置要处理的字段",fitColumns:true,singleSelect:true,border:false,nowrap:false,striped:true,toolbar:toolbar,onClickRow:onClickEditorRow,columns:[jsonGridColumns]})}function onPerviewData(c){$("#showPerviewOrgMarcData").html("");$("#showPerviewTagMarcData").html("");var a=getCurPageRecord();if(!a){return openMessageDlg("请设置你要进行批处理的条件")}if(a){if(c){curPerviewIndex=c}else{curPerviewIndex=1}a.index=curPerviewIndex;var b=base_path+"com/handlebatch/previewReader.do";$.post(b,a,function(d){if(d.status=="0"){setDataToPageShowPerview(d)}else{if(d.status=="9003"){maxPerviewNum="max";openMessageDlg(d.message)}else{if(d.total>0){curPerviewIndex=d.total+1}openMessageDlg(d.message)}}},"json")}}function getCurPageRecord(){var b=getJsonDataByTypeHandler();if(!b["limit[0].condition"]){return openMessageDlg("请设置你要进行批处理的条件")}var c=getSqlConditionInByLibcode();if(c.length>0){b["limit[20].condition"]="libcode";b["limit[20].typeHandler"]="3";b["limit[20].value"]=c}b.opertype=getValue("opertype");if(b.opertype=="0"){acceptEidtorGrid();var a=eidtorGridObject.datagrid("getRows");if(a.length==0){return openMessageDlg("请设置你要批处理的字段")}for(var d=0;d";for(var d=0;d"+fieldComBoxData[d].name+":"+f[fieldComBoxData[d].code]+""}}$("#showPerviewOrgMarcData").html(e);if(h.newrecord){var g=h.newrecord;e="
"+curPerviewIndex+"
";for(var d=0;d"+fieldComBoxData[d].name+":"+g[fieldComBoxData[d].code]+""}}$("#showPerviewTagMarcData").html(e)}}}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 onHandlerBacth(a){var b=getCurPageRecord();if(!b){return openMessageDlg("请设置你要进行批处理的条件")}if(a){onBacthMianFun(a,b)}else{$.messager.confirm("提示消息","您确定要做批处理操作吗?",function(c){if(c){onBacthMianFun(a,b)}})}}function checkErrorFile(){var c=base_path+"com/webuploader/download.do?filename="+errorfile;var b=window.open(c)}function onBacthMianFun(a,c){$(".error-msg-result").html("");if(!a){errorcount=0;handlecount=0;successcount=0;$.messager.progress({title:"读者数据批处理",msg:"正在处理数据,请稍等..."})}if(a){c=a}else{c.rows=200;c.page=1}var b=base_path+"com/handlebatch/executeReader.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.nextpage&&e.nextpage>0){$.messager.progress({title:"读者数据批处理",msg:"已处理["+handlecount+"]条数据,成功["+successcount+"]条,失败["+errorcount+"]条,请等待处理完成 ..."});c.page=e.nextpage;onHandlerBacth(c)}else{$(".handlecount").html("已处理["+handlecount+"]条数据");$(".successcount").html("成功["+successcount+"]条");$(".errorcount").html("失败["+errorcount+"]条");$("#checkerrorfile").show();$("#acceptFileResultDlg").dialog("open")}}else{openMessageDlg(d.message)}}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 setCurImportDataGridHeight(b){var a=$(window).height();var c=a-b;$(".import-data-div").css("height",c+"px");$("#perviewlayout").layout("resize");$(".acceptTextTip").hide()};