var g_justs={};function initjust(i){var e={};e.getableid=getQueryString("tid");$.post("../queryGETable",{case:"gettablefieldjustinfo",geTable:JSON.stringify(e)},function(e){var s=myJSONParse(e);if(s.msg==="ok"){$(document).attr("title","[布局调整]"+s.tname+"");g_justs=s.justs;beginJust(s.fields);if(i){i()}}else{myModalMessage(s.msg)}})}function beginJust(i){g_justs.displayfields=g_justs.displayfields||[];g_justs.hidefields=g_justs.hidefields||[];for(var e in i){if(g_justs.displayfields.indexOf(e)<0&&g_justs.hidefields.indexOf(e)<0){if(i[e].display==="false"){g_justs.hidefields.push(e)}else{g_justs.displayfields.push(e)}}}var t="";g_justs.displayfields.forEach(function(e){if(i[e]){var s="";if(i[e].display==="false"){s='style="background-color:#f7f7f7;" title="系统隐藏的字段"'}else if(i[e].dirhide==="true"){s='style="background-color:#f0cbcb;" title="系统目录隐藏的字段"'}t+='<div class="cell_sp" ondrop="drop_handler(event)" ondragover="dragenter_handler(event)" ondragleave="dragleave_handler(event)"></div>';t+='<div class="cell_dt"><div id="'+e+'" '+s+' class="cell_content" draggable="true" dropable="false">'+i[e].name+"</div></div>"}else{g_justs.displayfields.remove(e)}});t+='<div class="cell_sp" ondrop="drop_handler(event)" ondragover="dragenter_handler(event)" ondragleave="dragleave_handler(event)"></div>';$("#myfields").html(t);t="";g_justs.hidefields.forEach(function(e){if(i[e]){var s="";if(i[e].display==="false"){s='style="background-color:#f7f7f7;" title="系统隐藏的字段"'}else if(i[e].dirhide==="true"){s='style="background-color:#f0cbcb;" title="系统目录隐藏的字段"'}t+='<div id="'+e+'" '+s+'  class="cell_content" draggable="true" dropable="false">'+i[e].name+"</div>"}else{g_justs.hidefields.remove(e)}});$("#myhidefields").html(t)}function saveJust(){var e=[];$("#myfields .cell_content").each(function(){e.push(this.id)});var s=[];$("#myhidefields .cell_content").each(function(){s.push(this.id)});g_justs.displayfields=e;g_justs.hidefields=s;$.ajaxSettings.async=false;$.post("../editGEFasion",{case:"edituserbilljust",Fasion:JSON.stringify(g_justs)},function(e){var s=myJSONParse(e);if(s.msg==="ok"){sendEventMsg("reloadbills");myMessage("保存完毕！")}else{myModalMessage(s.msg)}});$.ajaxSettings.async=true}function useSysJust(){Ewin.confirm({title:" 注意",message:"确定使用系统的默认排版吗？"}).on(function(e){if(!e){return}$.ajaxSettings.async=false;$.post("../editGEFasion",{case:"deluserbilljust",Fasion:JSON.stringify(g_justs)},function(e){var s=myJSONParse(e);if(s.msg==="ok"){sendEventMsg("reloadbills");myMessage("清理完毕！")}else{myModalMessage(s.msg)}});$.ajaxSettings.async=true})}function exitJust(){sendEventMsg("reloadbills");window.close()}