var vLibcode=mystorage.get("libcode");var vAccount=mystorage.get("account");var vLibname=mystorage.get("libname");var vUsername=mystorage.get("username");var vCompletecode=mystorage.get("completecode");var vLowerlibcode=mystorage.get("lowerlibcode");var vPageNameFlag;var _fmtGridDataRows;var _fmtLibCodeGridDataRows;var _fmtGridDataAllValues;var _myOperatorData;var _myLocationData;var bindTableMenu;$(function(){_myPage.prototype.onLoadInitByFmtGridDataAllValues()});function getLibName(a){$(".use-lib-name").html(a);$(".account").html("["+vAccount+"]"+vUsername);$(".libname").html(vLibname)}function setGridHeight(){var b=$(window).height();var c=40;var d=b-40;var a=$('[item-type="search"]');if(a.length>0){d=d-40}$(".datagrid-div").css("height",d+"px");$("#datagrid-single").datagrid("resize");$(".easyui-panel").panel("resize")}function getValue(a){var g;if(!a){return}var b=$("#"+a);if(!b){return}var e=b.attr("class");if(!e||e.indexOf("easyui-validatebox")>=0){var f=b.attr("type");if(f=="checkbox"){if(b.prop("checked")){return"1"}else{return"0"}}g=b.val();if(!g){g=b.text()}if(!g){g=b.html()}return g}if(e.indexOf("easyui-textbox")>=0){g=b.textbox("getValue")}else{if(e.indexOf("easyui-datagrid")>=0){if(a=="editBibGrid"){return JSON.stringify(b.datagrid("getData"))}if(e.indexOf("edit-grid-data")>=0){return JSON.stringify(b.datagrid("getRows"))}g="";var j=b.datagrid("getChecked");for(var d=0;d=0){g=b.combobox("getValue")}else{if(e.indexOf("easyui-numberbox")>=0){g=b.numberbox("getValue");if(!g){g="0"}}else{if(e!=undefined&&e.indexOf("easyui-datebox")>=0){g=b.datebox("getValue").replace(new RegExp("-","g"),"")}else{if(e.indexOf("easyui-timespinner")>=0){g=b.timespinner("getValue").replace(new RegExp(":","g"),"")}else{if(e.indexOf("my-html")>=0){g=b.html();var c=b[0].attributes["data-type"];var h=b[0].attributes["data-fld"];if(c&&c.value=="date"&&g){g=g.replace(new RegExp("-","g"),"")}if(c&&c.value=="select"&&g){if(h&&h.value&&_fmtGridDataRows&&_fmtGridDataRows.rows&&_fmtGridDataRows.rows[0][h.value]){var j=_fmtGridDataRows.rows[0][h.value];for(var d=0;d=0){var k=c.attr("type");if(k=="checkbox"){if(l=="1"){c.prop("checked",true)}else{c.prop("checked",false)}}else{c.val(l)}return}if(j.indexOf("easyui-textbox")>=0){c.textbox("setValue",l)}else{if(j.indexOf("easyui-datagrid")>=0){if(a=="editBibGrid"){var n={};try{n.data=JSON.parse(l)}catch(h){n.data=[]}c.datagrid(n);return}if(j.indexOf("edit-grid-data")>=0){var o=[];try{o=JSON.parse(l)}catch(h){o=[]}c.datagrid("loadData",o);return}c.datagrid("uncheckAll");if(!l||l.length<2){return}setTimeout(function(){var s=c.datagrid("getData").rows;try{var r=l.split(",");for(var q=0;q=0){if(!l){l=""}c.combobox("setValue",l)}else{if(j.indexOf("easyui-numberbox")>=0){c.numberbox("setValue",l)}else{if(j.indexOf("easyui-datebox")>=0){if(l){var b=l.toString();if(b.length==8){b=b.substr(0,4)+"-"+b.substr(4,2)+"-"+b.substr(6,2);c.datebox("setValue",b)}}else{c.datebox("setValue","")}}else{if(j.indexOf("easyui-timespinner")>=0){if(l){var g=l;if(g.length==4){g=g.substr(0,2)+":"+g.substr(2,2);c.timespinner("setValue",g)}}else{c.timespinner("setValue","")}}else{if(j.indexOf("my-html")>=0){var f=c[0].attributes["data-type"];var m=c[0].attributes["data-fld"];if(f&&f.value=="date"){l=fmtStringToDate(l)}if(f&&f.value=="select"){if(m&&m.value&&_fmtGridDataRows&&_fmtGridDataRows.rows&&_fmtGridDataRows.rows[0][m.value]){var o=_fmtGridDataRows.rows[0][m.value];for(var d=0;d$$$1')}return b}function focusItem(b){var a=$('[item-type="record"]');itemArrLength=a.length;a.each(function(c,d){var e=d.className;if(e!=undefined&&e.indexOf("easyui-textbox")>-1){$("#"+d.id).textbox("textbox").keydown(function(f){if(f.keyCode==13){a.each(function(g,h){if(c==g-1){$("#"+h.id).textbox("textbox").focus();return false}else{if(itemArrLength-1==c){b()}}})}})}})}function enterEvent(b,a){if(null!=a&&undefined!=a){var c=$("#"+b);if(c[0]&&c[0].className){var d=c[0].className;if(d!=undefined&&d.indexOf("easyui-textbox")>-1){c.textbox("textbox").keydown(function(f){if(f.keyCode==13){a()}})}else{if(d.indexOf("easyui-numberbox")>=0){c.numberbox().next("span").find("input").keydown(function(f){if(f.keyCode==13){a()}})}}}}}function common_init_param(e,d){if(d.element.className.indexOf("easyui-combobox")>=0){if(d.flagArr&&!d.initnum){for(var b=0;b0){var a="auto";if(e.length>10){a="200px"}c.combobox({data:e,valueField:"code",textField:"name",groupField:"group",panelHeight:a,loadFilter:function(f){if(d.nolimit){var h="不限";if(d.nolimit.value.length>0){h=d.nolimit.value}var g={};g.code="";g.name=h;f.splice(0,0,g)}return f},onLoadSuccess:function(){if(d.initselect){var h=$(this).combobox("getData");if(h.length>0){if(!d.initselect.value){var g=!h[0].code?h[0].text:h[0].code;$(this).combobox("select",g)}else{$(this).combobox("select",d.initselect.value)}}}else{if(d.elementId=="sysid"){var h=$(this).combobox("getData");if(h.length==1){var f={};f.key="template";f.condition="sysid";f.value=h[0].code;initPageDataSingleElement("page_template",f)}}}}})}}}else{$("#"+d.elementId).combobox({data:e,valueField:"code",textField:"name",groupField:"group",loadFilter:function(f){if(d.nolimit){var h="不限";if(d.nolimit.value.length>0){h=d.nolimit.value}var g={};g.code="";g.name=h;f.splice(0,0,g)}return f},onLoadSuccess:function(){if(d.initselect){var f=$(this).combobox("getData");if(f.length>0){$(this).combobox("select",d.initselect.value)}}}})}}else{$("#"+d.elementId).datagrid({data:e,fitColumns:true,fit:true,columns:[[{field:"ck",checkbox:true,width:20},{field:"code",align:"center",width:80,title:"代码"},{field:"name",align:"center",width:100,title:"名称"}]]})}}function commonSetParaInit(b,h,g,d){var f=null;var a=null;if(b){a=b.split(",")}if(g){selector=$('[init-type="init-data"]')}else{selector=$('[item-type="'+h+'"]')}var c={};var e=[];selector.each(function(r,n){if(n.className.indexOf("easyui-combobox")<0&&n.className.indexOf("easyui-datagrid")<0){return true}var p=n.id;var v=n.attributes["init-num"];var w=n.attributes["no-limit"];var t=n.attributes["init-select"];var s=p;if(b&&!v){for(var o=0;o10){f="200px"}if(b.className.indexOf("easyui-combobox")>-1){$("#"+d).combobox({data:g.rows,valueField:"code",textField:"name",groupField:"group",panelHeight:f,onLoadSuccess:function(){var h=$(this).combobox("getData");if(h.length>0){$(this).combobox("select",h[0].code)}if(c){c()}}})}else{$("#"+d).datagrid({data:g,fitColumns:true,fit:true,columns:[[{field:"ck",checkbox:true,width:20},{field:"code",align:"center",width:80,title:"代码"},{field:"name",align:"center",width:100,title:"名称"}]]})}},"json")}function initNextSelectCombobox(b,a){$("#"+b).combobox({onSelect:function(f){if(f!=null){for(var c=0;c=0){try{var d=JSON.parse(h);setJsonData(a,d)}catch(g){}}var c=$("#"+f);if(c.attr("spe-field")){try{setSpeFields(h,f);return true}catch(i){}}if(a!=undefined&&a.length>0&&a!=null){f=a+f}setValue(f,h)})}function setJsonDataByJs(f,i){for(var g in i){var a=g;var h=i[g];if(json_data_type.indexOf(a+",")>=0){try{var j=JSON.parse(h);setJsonData(f,j)}catch(c){}}var b=$("#"+a);if(b.attr("spe-field")){try{setSpeFields(h,a);return true}catch(d){}}if(f!=undefined&&f.length>0&&f!=null){a=f+a}setValue(a,h)}}function getJsonData(b,d){if(json_data_type.indexOf(d+",")<0){return null}if(b!=undefined&&b.length>0&&b!=null){d=b+d}var c={};var a=$('[item-type="'+d+'"]');a.each(function(f,h){var l=h.id;if(h.attributes["spe-field"]){try{c[h.id]=getSpeFields(l);return true}catch(k){}}if(!l){return true}var j=getValue(l);var g=h.id;if(b!=undefined&&b.length>0&&b!=null){g=g.replace(b,"")}var i=getJsonData(b,g);if(i!=null){j=JSON.stringify(i)}if(j==undefined||j==null){return true}c[g]=j});return c}function getCurDateYMD(){var a=new Date();var d=a.getFullYear();var e=a.getMonth()+1;var c=a.getDate();if(e>=1&&e<=9){e="0"+e}if(c>=0&&c<=9){c="0"+c}var b=d+""+e+""+c;return b}function getAddYMD(i,a,h){var b=new Date();if(i){b.setMonth(b.getFullYear()+i)}if(a){b.setMonth(b.getMonth()+a)}if(h){b.setMonth(b.getDate()+h)}var f=b.getFullYear();var g=b.getMonth()+1;var e=b.getDate();if(g>=1&&g<=9){g="0"+g}if(e>=0&&e<=9){e="0"+e}var c=f+""+g+""+e;return c}function showCurTime(){var d=new Date();var f=d.getFullYear();var g=d.getMonth()+1;var c=d.getDate();var a=d.getHours();var e=d.getMinutes();var h=d.getSeconds();var b=f+"年"+formatDigital(g)+"月"+formatDigital(c)+"日 "+formatDigital(a)+":"+formatDigital(e)+":"+formatDigital(h)+"";return b}function addDate(f,h){if(h==undefined||h==""){h=1}var c=new Date(f);c.setDate(c.getDate()+h);var e=c.getMonth()+1;var b=c.getDate();var g="'"+e+"'";var a="'"+b+"'";if(g.length==3){e="0"+e}if(a.length==3){b="0"+b}var d=c.getFullYear()+""+e+""+b;return d}function addOne(b){if(!b){return}var d=b.split(/[^0-9]/);var e=d[d.length-1];if(e!=null&&e.length>0){var f=e.length;var a=parseInt(e)+1;var c=a.toString();f=Math.min(f,c.length);return b.substring(0,b.length-f)+c}else{return null}}function getDataDirect(a,c){var d=a.split(/[$]([A-Za-z0-9])/g);for(var b=0;b<=d.length;b++){if(c==d[b]){return d[b+1]}}return""}function clearGridData(d){if(d.indexOf(",")>-1){var a=d.split(",");for(var c=0;c0){var b=$("#"+a[c]).datagrid("getRows");if(b.length>0){$("#"+a[c]).datagrid("loadData",[])}}}}else{var b=$("#"+d).datagrid("getRows");if(b.length>0){$("#"+d).datagrid("loadData",[])}}}function deleteGridData(d){if(d.indexOf(",")>-1){var a=d.split(",");for(var c=0;c0){var b=$("#"+a[c]).datagrid("getRows");if(b.length>0){for(var c=0;c=0;c--){$("#"+d).datagrid("deleteRow",c)}}}function onShowFmtDate(a,b){if(!a){return a}return fmtStringToDate(a)}function fmtStringToDate(a){if(!a){return a}a=a.toString();if(a!=undefined&&a.length==8){return a.substr(0,4)+"-"+a.substr(4,2)+"-"+a.substr(6,2)}return a}function onShowFmtTime(a,b){if(!a){return a}return fmtStringToTime(a)}function fmtStringToTime(a){a=a.toString();if(a.length==5){a="0"+a}if(a!=undefined&&a.length==6){return a.substr(0,2)+":"+a.substr(2,2)+":"+a.substr(4,2)}return a}function onShowDateStamp(b,c){if(b){var a=new Date();a.setTime(b);return a.getFullYear()+"-"+formatDigital((a.getMonth()+1))+"-"+formatDigital(a.getDate())+" "+formatDigital(a.getHours())+":"+formatDigital(a.getMinutes())+":"+formatDigital(a.getSeconds())}return b}function formatDigital(a){if(a<10){return"0"+a}return a}function AutoResizeImage(c,b,a){$(".rdr-image img").jqthumb({width:c,height:b})}function get_init_datas(d,a,e){var b=base_path+"par/common/getInitDatas.do";var c={};c.params=JSON.stringify(d);$.post(b,c,function(f){if(f.status=="0"){d.forEach(function(g,h,k){if(f.rows[0][g.key]){var j=a[g.key];if(!j&&g.code){j=a[g.code]}if(!j){return true}e(f.rows[0][g.key],j)}});if(getValue("page_type")){getPageConfig("page_type",callSetParaResult)}}},"json")}function getJsonDataByTypeHandler(){var d={};var a=$('[item-type="export_record"]');var f=0;a.each(function(o,n){var e=n.id;var p=$(this).attr("class");var l=n.attributes["link-combobox"];var j=n.attributes["handler-type"];var q=n.attributes["table-type"];if(j){if(getValue(e).length>0){if(p.indexOf("easyui-numberbox")>=0&&getValue(e)==0){}else{if(l){d["limit["+f+"].condition"]=getValue(l.value)}else{if(q){d["limit["+f+"].condition"]=q.value+"."+e.replace("export_beg_","").replace("export_end_","").replace("export_","")}else{d["limit["+f+"].condition"]=e.replace("export_beg_","").replace("export_end_","").replace("export_","")}}d["limit["+f+"].typeHandler"]=j.value;d["limit["+f+"].value"]=getValue(e);f++}}}var q=n.attributes["param-verify"];if(q){if(getValue(e).length==0){d["limit["+f+"].condition"]=e;d["limit["+f+"].typeHandler"]=j.value;var r=$("#"+e).datagrid("getRows");var k="";for(var m=0;m-1){return true}return false}function getSqlConditionInByLibcode(){var a=mystorage.get("lowerlibcode");return getSqlConditionLimitIn(a)}function getSqlConditionLimitIn(d){var b="";var a=d.split(",");for(var c=0;c").appendTo("body");bindTableMenu.menu({onClick:function(f){if(f.iconCls=="fa fa-check"){b.datagrid("hideColumn",f.name);bindTableMenu.menu("setIcon",{target:f.target,iconCls:"icon-empty"})}else{b.datagrid("showColumn",f.name);bindTableMenu.menu("setIcon",{target:f.target,iconCls:"fa fa-check"})}}});var a=b.datagrid("getColumnFields");for(var d=0;d0){d.splice(a,0,",");a-=4}return d.join("")+b};