function uploadMsgdoc(){if($("#mymsgid").html()==="0"||$("#mymsgid").html()===""){submitnewmsg(false,false)}var e=$("#mymsgid").html();if(e==="0"||e===""){return}var t=$("#mymsgpid").html();var s="addFile?cmd=upload&pid="+t+"&oid="+e+"&type=3&cid=msgatt";$("#upoafile").fileinput("refresh",{uploadUrl:s});console.log(s);guploadtype="msgdoc";gtid=e;$("#myModalUploadFile").modal("show")}function uploadMsgdoc2(e){var t=$("#mymsgpid").html();var s="addFile?cmd=upload&pid="+t+"&oid="+e+"&type=3&cid=msgatt";$("#upoafile").fileinput("refresh",{uploadUrl:s});console.log(s);guploadtype="msgdoc2";gtid=e;$("#myModalUploadFile").modal("show")}function doMyInfo(e){$("#myMessage").load("getMsg",{fid:e.title,top:1});$("#myModalMessage").modal("show")}function delMsg(t,e){Ewin.confirm({title:" 注意",message:"确实要删除通知 "+e+" 吗？"}).on(function(e){if(!e){return}$.post("delMsg",{fid:t},function(e){var t=JSON.parse(e);if(t["msg"]!=="ok"){BootstrapDialog.show({draggable:true,title:"提示",message:t["msg"]})}else{$("#myModalMessage").modal("hide");loadmsgpad()}})})}function delMsgDoc2(s,t,e){Ewin.confirm({title:" 注意",message:"确实要删除附件 "+e+" 吗？"}).on(function(e){if(!e){return}$.post("delFile",{fid:t},function(e){var t=JSON.parse(e);if(t["msg"]!=="ok"){BootstrapDialog.show({draggable:true,title:"提示",message:t["msg"]})}else{$("#myMessage").load("getMsg",{fid:s,top:1})}})})}function displayeditmsg(e){$("#editmsgtitle").val(e);$("#editmsgcontent").val($("#mymsgallcontent").html())}function submiteditmsg(s){title=$("#editmsgtitle").val();content=$("#editmsgcontent").val();$.ajaxSettings.async=false;$.post("editMsg",{fid:s,title:title,content:content},function(e){var t=JSON.parse(e);if(t["msg"]!=="ok"){BootstrapDialog.show({draggable:true,title:"提示",message:t["msg"]})}else{$("#myMessage").load("getMsg",{fid:s,top:1});loadmsgpad()}});$.ajaxSettings.async=true}function getMsgDoc(e){$("#mymsgdoc").load("getMsgDoc",{oid:e})}function getMsgDoc2(e){$("#myMessage").load("getMsg",{fid:e,top:1})}var check={mymsgtitle:false};$("#mymsgtitle").change(function(){success("mymsgtitle");if($(this).val().length<2){fail("mymsgtitle","标题太短，不能少于2个字符")}});$("#mymsgsubmit").click(function(e){submitnewmsg(true,true)});function submitnewmsg(e,s){title=$("#mymsgtitle").val();content=$("#mymsgcontent").val();if(title===""||title===null){BootstrapDialog.show({draggable:true,title:"提示",message:"标题不能为空！！！"});return}var t=$("#mymsgid").html();$.ajaxSettings.async=false;$.post("addMsg",{fid:t,title:title,content:content},function(e){var t=JSON.parse(e);if(t["msg"]!=="ok"){BootstrapDialog.show({draggable:true,title:"提示",message:t["msg"]})}else{$("#mymsgid").html(t["fid"]);$("#mymsgpid").html(t["pid"]);if(s){document.getElementById("mymsgadd").click();refreshMessage();msgReset()}}});$.ajaxSettings.async=true}$("#mymsgreset").click(function(){msgReset()});function msgReset(){$("#newmessage input").val("");$("#newmessage textarea").val("");$("#newmessage input").slice(0,7).parent().parent().removeClass("has-error has-success");$("#newmessage .tips").hide();$("#newmessage .glyphicon-ok").hide();$("#newmessage .glyphicon-remove").hide();$("#mymsgdoc").html("");$("#mymsgid").html("0");check={mymsgtitle:false}}function refreshMessage(){$("#myMsg").load("getMsg",{fid:0,top:10});$("#oldmessagetable").bootstrapTable("refresh")}function refreshOldMessage(){$("#oldmessagetable").bootstrapTable({pagination:true,showRefresh:false,search:true,clickToSelect:false,striped:true,locale:"zh-CN",queryParams:function(e){var t={fid:0,top:0,mode:"all"};return t},url:"getMsg",columns:[{field:"mid",title:"Mid",hidden:true},{field:"num",title:"序号",align:"center",width:20,formatter:function(e,t,s){return s+1}},{field:"title",title:"标题",align:"center",formatter:function(e,t,s){return"<a href='javascript:;' title='"+t.mid+'\' onclick="doMyInfo(this);">'+e+"</a>"}},{field:"date",title:"日期",width:120,align:"center"}]});$("#oldmessagetable").bootstrapTable("hideColumn","mid")}function topmsg(){var e=document.getElementById("newmessage");var t=e.getAttribute("aria-expanded");if(t==="false"){window.location.hash="#mymsgadd"}else{window.location.hash="#"}}function initMsg(){$("#myMsg").load("getMsg",{fid:0,top:10})}