#set(title="添加通知") #@header() <body> <form id="addForm" method="post"> <input type="hidden" name="id" value="#(letter.id??)"> <table class="table"> <tbody> <tr> <td class="l" width="150px">发文标题 </td> <td><input type="text" class="form-control" name="title" value="#(letter.title??)" maxlength="20"></td> <td>发文类型 </td> <td><select class="form-control" name="type"> <option value="信息通知" #(letter.type??=='信息通知'?'selected':'')>信息通知</option> <option value="公文" #(letter.type??=='公文'?'selected':'')>公文</option> <option value="私文" #(letter.type??=='私文'?'selected':'')>私文</option> </select></td> </tr> <tr> <td>优先级</td> <td><select class="form-control" name="priority"> <option value="紧急" #(letter.priority??=='紧急'?'selected':'')>紧急</option> <option value="高" #(letter.priority??=='高'?'selected':'')>高</option> <option value="普通" #(letter.priority??=='普通'?'selected':'')>普通</option> </select></td> <td>发文署名</td> <td><input type="text" class="form-control" name="signature" value="#(letter.signature??)" maxlength="20"></td> </tr> <tr> <td style="vertical-align: top;">发文内容</td> <td colspan="3"><script id="editor" type="text/plain" name="content" style="width:100%;height:280px;text-align: left">#(letter.content??)</script></td> </tr> <tr> <td>通知对象</td> <td colspan="3"><div class="object"> <ul> <li onclick="choice_all(this)" id="all"><i class="fa fa-users"></i> 全部</li> <li onclick="choice()"><i class="fa fa-plus"></i> 添加</li> #for(x:userList??) #end </ul> </div></td> </tr> </tbody> </table> </form> #set(layer=true,util=true,ueditor=true,valida=true) #@op() #@js() <script> var object=[]; //获取通知对象名称 var ids=[]; //获取通知对象id var check_type=""; //是否选择全部对象 UE.getEditor('editor',{ serverUrl:'#(path)/admin/upload/', toolbars:[['FullScreen', 'Undo','Redo','forecolor','bold', 'italic','formatmatch', 'autotypeset','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify','insertorderedlist', 'insertunorderedlist', 'rowspacingtop', 'rowspacingbottom', 'lineheight','simpleupload','insertvideo','customstyle','paragraph','fontfamily', 'fontsize','inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols']] }); /** * 选择全部通知对象 */ function choice_all(obj){ $(obj).attr("class","active"); check_type="all"; } /** * 添加通知对象 */ function choice(){ $('#all').attr("class",""); check_type="choice"; openDialogDiy("添加通知对象", "#(path)/admin/letter/choice", "80%", "95%"); } /** * 获取通知对象 */ function getObject(list){ for(var i=0;i<list.length;i++){ object.push(list[i].name); ids.push(list[i].id); } //去除重复选择 var selected=unique(object); var str='<li onclick="choice_all(this)"><i class="fa fa-users"></i> 全部</li><li onclick="choice()"><i class="fa fa-plus"></i> 添加</li>'; for(var i=0;i<selected.length;i++){ str+='<li><span>'+selected[i]+'</span><a onclick="del(this)">X</a></li>'; } $("ul").html(str); } /** * 删除通知对象 */ function del(obj){ var val=$(obj).parent().find('span').text(); for(var i=0;i<object.length;i++){ if(val==object[i]){ object.splice(i,1); ids.splice(i,1); } } $(obj).parent().remove(); } var valida=$("#addForm").validate({ rules:{ title:{ required:true, minlength:2 }, content:{ required:true } } }); /** * 提交 */ $("#add").click(function() { valida.form(); if(valida.valid()){ var ext="&sendObject="+unique(object)+"&ids="+unique(ids)+"&check_type="+check_type; ajaxSubmit("#(path)/admin/letter/#(op)",$("#addForm").serialize()+ext); } }); </script> </body> </html>