sysBulletinEditHY.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <%@page language="java" pageEncoding="UTF-8"%>
  2. <%@include file="/commons/include/html_doctype.html"%>
  3. <%@page import="com.hotent.core.api.util.PropertyUtil"%>
  4. <html>
  5. <head>
  6. <title>编辑 公告</title>
  7. <%@include file="/commons/include/form.jsp"%>
  8. <f:link href="form.css" ></f:link>
  9. <link href="${ctx}/styles/default/css/hotent/dataRights.css" rel="stylesheet" />
  10. <script type="text/javascript" src="${ctx}/js/hotent/CustomValid.js"></script>
  11. <script type="text/javascript" src="${ctx}/js/hotent/platform/form/AttachMent.js" ></script>
  12. <script type="text/javascript" src="${ctx}/js/hotent/platform/system/HtmlUploadDialog.js" ></script>
  13. <script type="text/javascript" charset="utf-8" src="${ctx}/js/ueditor2/lang/zh-cn/zh-cn.js"></script>
  14. <script type="text/javascript" charset="utf-8" src="${ctx}/js/ueditor2/themes/default/css/ueditor.css"></script>
  15. <script type="text/javascript" charset="utf-8" src="${ctx}/js/ueditor2/form-setting/editor_config.js"></script>
  16. <script type="text/javascript" charset="utf-8" src="${ctx}/js/ueditor2/editor_api.js"></script>
  17. <script type="text/javascript" charset="utf-8" src="${ctx}/js/hotent/platform/system/SysDialog.js"></script>
  18. <script type="text/javascript" charset="utf-8" src="${ctx}/weixin/assets/js/handlebars.min.js"></script>
  19. <script type="text/javascript" src="${ctx}/js/hotent/platform/system/SysPlanScript.js"></script>
  20. <script type="text/javascript">
  21. var bulletinUeditor;
  22. $(function() {
  23. $("#publicationType").val("1");
  24. bulletinUeditor = new baidu.editor.ui.Editor({minFrameHeight:300,initialFrameWidth:'100%',lang:'zh_cn'});
  25. bulletinUeditor.render("txtHtml");
  26. var options={};
  27. if(showResponse){
  28. options.success=showResponse;
  29. }
  30. var frm=$('#sysBulletinForm').form();
  31. $("a.save").click(function() {
  32. frm.ajaxForm(options);
  33. if(frm.valid()){
  34. $('#content').val(bulletinUeditor.getContent());
  35. //当人员发布时检验人员
  36. if($("#publicationType").val() == 3){
  37. if($("input[name='participants']").val()==""||$("input[name='participants']").val()==null){
  38. var str = "<label class='error'>必填</label>";
  39. if($("input[name='participants']").parent().find(".error").length >0){
  40. return;
  41. }
  42. $("input[name='participants']").parent().append(str);
  43. return;
  44. }
  45. }
  46. $('#sysBulletinForm').submit();
  47. }
  48. });
  49. AttachMent.init("w");
  50. $("#templateList").change(function(){
  51. var temId = $(this).val();
  52. if(temId=="1"){
  53. return;
  54. }
  55. var temContent = bulletinUeditor.getContent();
  56. var url= __ctx + "/platform/system/sysBulletinTemplate/selector.ht?id="+temId;
  57. $.get(url, function(data) {
  58. var htmldata =data.sysbulletintemplate.template;
  59. var content = temContent+htmldata;
  60. bulletinUeditor.setContent(content);
  61. });
  62. });
  63. $("#sendWxInfo").click(function(){
  64. $("#trUser").toggle();
  65. });
  66. $("input[name='selectUser']").click(function(){
  67. var val=$(this).val();
  68. if(val==0){
  69. $("#usersContainer").hide();
  70. }
  71. else{
  72. $("#usersContainer").show();
  73. }
  74. });
  75. $("#btnSelectImg").click(function(){
  76. HtmlUploadDialog({max:1,callback:function(data){
  77. if(data.length==1){
  78. var fileId=data[0].fileId;
  79. var url=__ctx +"/platform/system/sysFile/file_"+fileId+".ht"
  80. $("#imgUrl").val(fileId);
  81. $("#columnImg").attr("src",url)
  82. }
  83. }});
  84. });
  85. });
  86. function showResponse(responseText) {
  87. var obj = new com.hotent.form.ResultMessage(responseText);
  88. if (obj.isSuccess()) {
  89. $.ligerDialog.confirm(obj.getMessage()+",是否继续操作","提示信息", function(rtn) {
  90. if(rtn){
  91. window.location.href = window.location.href;
  92. }else{
  93. window.location.href = "${returnUrl}";
  94. }
  95. });
  96. } else {
  97. $.ligerDialog.err("提示信息","发布公告出错!",obj.getMessage());
  98. }
  99. }
  100. //重置
  101. function reset(obj) {
  102. $("input[name='subject']").val("");
  103. $("#txtHtml").html("");
  104. //公告模板
  105. $("#templateList").val(1);
  106. //重置文件上传
  107. var fileObj = $(".cancel");
  108. AttachMent.delFile(fileObj);
  109. $("#isUrgentNo").attr('checked',true);
  110. $("#type").val(-1);
  111. //发布类型
  112. if($("#publicationType").val()== 2){
  113. $("#receiverOrgName").val("");
  114. $("#receiverOrgId").val("");
  115. $("#organization").hide();
  116. }
  117. if($("#publicationType").val()== 3){
  118. $("#participantIds").val("");
  119. $("#participants").val("");
  120. $("#personnel").hide();
  121. }
  122. $("#publicationType").val("1");
  123. $("#publicationTypeList").val(1);
  124. //重置内容
  125. bulletinUeditor.setContent("");
  126. }
  127. function selectUser(){
  128. UserDialog({callback:function(userIds,fullnames,emails,mobiles,rtn){
  129. var aryAccount=rtn.accounts.split(",");
  130. var aryFullname=rtn.fullnames.split(",");
  131. var aryObj=[];
  132. for(var i=0;i<aryAccount.length;i++){
  133. var obj={};
  134. obj.account=aryAccount[i];
  135. obj.name=aryFullname[i];
  136. aryObj.push(obj);
  137. }
  138. var compiler = Handlebars.compile($('#tpi-list-item').html());
  139. var html=compiler(aryObj);
  140. $("#spanUsers").html(html);
  141. }});
  142. }
  143. function removeUser(obj){
  144. var o=$(obj).parent();
  145. o.remove();
  146. }
  147. function selectRows(sel) {
  148. var organization = document.getElementById("organization");
  149. var personnel = document.getElementById("personnel");
  150. if (organization != null && personnel != null) {
  151. if (sel.value == 2) {
  152. $("#publicationType").val("2");
  153. organization.style.display = "table-row";
  154. personnel.style.display = "none";
  155. }else if(sel.value == 3){
  156. $("#publicationType").val("3");
  157. personnel.style.display = "table-row";
  158. organization.style.display = "none";
  159. }else{
  160. $("#publicationType").val("1");
  161. organization.style.display = "none";
  162. personnel.style.display = "none";
  163. }
  164. }
  165. }
  166. // 弹出组织框
  167. function showOrgDialog(){
  168. OrgDialog({callback:dlgOrgCallBack,ids:$("#receiverOrgId").val(),names:$("#receiverOrgName").val(),isSingle:false});
  169. };
  170. // 组织框返回数据
  171. function dlgOrgCallBack(orgIds, orgNames)
  172. {
  173. $("#receiverOrgName").val(orgNames);
  174. $("#receiverOrgId").val(orgIds);
  175. //$("#receiveType").val(retypes);
  176. }
  177. // 清空所选组织
  178. function reSetOrg(obj)
  179. {
  180. $("#receiverOrgName").val("");
  181. $("#receiverOrgId").val("");
  182. }
  183. function isUrgentClick(str){
  184. $("#isUrgent").val(str);
  185. }
  186. </script>
  187. <script type="text/x-handlebars-template" id="tpi-list-item">
  188. {{#each this}}
  189. <span class="owner-span" >{{name}}
  190. <a class="flootbutton" title="移除该项" onclick="removeUser(this)">x</a>
  191. <input type="hidden" name="account" value="{{account}}"/>
  192. </span>
  193. {{/each}}
  194. </script>
  195. </head>
  196. <body>
  197. <div class="panel">
  198. <c:if test="${!isAddByFlow}">
  199. <div class="panel-top">
  200. <div class="panel-toolbar">
  201. <div class="toolBar">
  202. <div class="group"><a class="link save" id="dataFormSave" href="javascript:;"><span></span>保存</a></div>
  203. <div class="l-bar-separator"></div>
  204. <div class="group"><a class="link back" href="listHY.ht"><span></span>返回</a>
  205. <div class="l-bar-separator"></div>
  206. <div class="group"><a class="link undo" onclick="reset(this)"><span></span>重置</a></div>
  207. <div class="l-bar-separator"></div>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. </c:if>
  213. <div class="panel-body">
  214. <c:if test="${!isAddByFlow}">
  215. <form id="sysBulletinForm" method="post" action="save.ht">
  216. </c:if>
  217. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  218. <tbody>
  219. <tr>
  220. <th width="20%">主题:<span class="required red">*</span></th>
  221. <td>
  222. <input type="text" name="subject" value="${sysBulletin.subject}" validate="{required:true,maxlength:128}" class="inputText" style="width: 50%;" />
  223. </td>
  224. </tr>
  225. <tr>
  226. <th width="15%">所属栏目: </th>
  227. <td>
  228. <select name="columnid" id="columnid" class="inputText" style="width: 250px;">
  229. <c:forEach items="${columnList}" var="columnList">
  230. <option value="${columnList.id}" <c:if test="${sysBulletin.columnid==columnList.id}">selected="selected"</c:if> >${columnList.name}</option>
  231. </c:forEach>
  232. </select>
  233. </td>
  234. </tr>
  235. <tr style="display:none">
  236. <th width="20%">标题图:</th>
  237. <td>
  238. <input type="hidden" id="imgUrl" name="imgUrl" value="${sysBulletin.imgUrl}">
  239. <c:choose>
  240. <c:when test="${empty sysBulletin.imgUrl}">
  241. <img id="columnImg" alt="" src="">
  242. </c:when>
  243. <c:otherwise>
  244. <img id="columnImg" alt="" src="${ctx }/platform/system/sysFile/file_${sysBulletin.imgUrl}.ht">
  245. </c:otherwise>
  246. </c:choose>
  247. <input id="btnSelectImg" type="button" value="选择">
  248. </td>
  249. </tr>
  250. <tr>
  251. <th width="15%">附件: </th>
  252. <td>
  253. <div name="div_attachment_container">
  254. <div class="attachement"></div>
  255. <textarea style="display: none" controltype="attachment"
  256. id="attachment" name="attachment" lablename="主表附件" validate="{}">${sysBulletin.attachment}</textarea>
  257. <a href="javascript:;" field="attachment" class="link selectFile"
  258. atype="select" onclick="AttachMent.addFile(this);">选择</a>
  259. </div>
  260. </td>
  261. </tr>
  262. <tr>
  263. <th width="15%">公告模板: </th>
  264. <td>
  265. <select name="templateList" id="templateList" class="inputText" style="width: 250px;">
  266. <option value="1" selected="selected">---请选择---</option>
  267. <c:forEach items="${templateList}" var="templateList">
  268. <option value="${templateList.id}" >${templateList.name}</option>
  269. </c:forEach>
  270. </select>
  271. </td>
  272. </tr>
  273. <tr>
  274. <th width="15%">是否紧急: </th>
  275. <td>
  276. <input type="hidden" id="isUrgent" name="isUrgent"/>
  277. <input type="radio" id="isUrgentYes" name="isUrgent" value="1" title="是" onclick="isUrgentClick(1)">是
  278. <input type="radio" id="isUrgentNo" name="isUrgent" value="2" title="否" checked="checked" onclick="isUrgentClick(2)">否
  279. </td>
  280. </tr>
  281. <tr>
  282. <th width="15%">通知类型: </th>
  283. <td>
  284. <c:choose>
  285. <c:when test="${empty dicList}">
  286. 请在数据字典定义一个nodeKey为gglx的分类
  287. </c:when>
  288. <c:otherwise>
  289. <select id="type" name="type" class="inputText">
  290. <c:forEach items="${dicList }" var="dic">
  291. <c:if test="${dic.itemValue == '0'}">
  292. <option value="${dic.itemValue }" <c:if test="${dic.itemValue eq sysBulletin.type}">selected="selected"</c:if>>${dic.itemName }</option>
  293. </c:if>
  294. </c:forEach>
  295. </select>
  296. </c:otherwise>
  297. </c:choose>
  298. </td>
  299. </tr>
  300. <tr>
  301. <th width="15%">发布类型: </th>
  302. <td>
  303. <input type="hidden" id="publicationType" name="publicationType"/>
  304. <select name="publicationTypeList" id="publicationTypeList" class="inputText" style="width: 250px;" onchange="selectRows(this)">
  305. <option value="1" selected="selected">广泛发布</option>
  306. <option value="2">组织发布</option>
  307. <option value="3">人员发布</option>
  308. </select>
  309. </td>
  310. </tr>
  311. <tr id="organization" style="display:none;">
  312. <th width="15%">组织发布: </th>
  313. <td>
  314. <input id="receiverOrgName" name="receiverOrgName"
  315. size="80" readonly="readonly" validate="{required:true}"
  316. value="${messageSend.receiverOrgName}" /> <a href="javascript:;"
  317. onclick="showOrgDialog()" class="link get">选择</a> <a
  318. href="javascript:;" onclick="reSetOrg()" class="link clean">清空</a>
  319. <input type="hidden" id="receiverOrgId" name="receiverOrgId"
  320. value="" class="inputText" />
  321. </td>
  322. </tr>
  323. <tr id="personnel" style="display: none;">
  324. <th style="width: 15%;">人员发布:</th>
  325. <td>
  326. <input type="hidden" name="participantIds" value="${participantIds}" />
  327. <input type="hidden" name="participants" value="${participants}" />
  328. <div id='participantDiv'></div>
  329. <a class="link add" onclick="chooseUser(this,'participantDiv','participantIds','participants','no');" ><span></span>选择</a>
  330. <a class="link reset" onclick="resetSelect('participantDiv','participantIds','participants');" ><span></span>重置</a>
  331. </td>
  332. </tr>
  333. <tr>
  334. <td align="right" nowrap="nowarp" style="width: 20%;"
  335. class="formTitle">内容</td>
  336. <td class="formInput">
  337. <div id="editor" position="center" style="overflow: hidden; height: 100%;">
  338. <textarea id="txtHtml" name="html">${sysBulletin.content}</textarea>
  339. <textarea id="content" name="content" style="display:none;"></textarea>
  340. </div>
  341. </td>
  342. </tr>
  343. <c:if test="${isSupportWeixin}">
  344. <tr>
  345. <td align="right" nowrap="nowarp" style="width: 20%;"
  346. class="formTitle">发送微信通知</td>
  347. <td class="formInput">
  348. <input type="checkbox" value="1" name="sendWxInfo" id="sendWxInfo">
  349. </td>
  350. </tr>
  351. <c:if test="${canSelect}">
  352. <tr id="trUser" style="display: none;">
  353. <td align="right" nowrap="nowarp" style="width: 20%;"
  354. class="formTitle">选择人员</td>
  355. <td class="formInput">
  356. <input type="radio" name="selectUser" value="0" id="selectUserAll" checked="checked" >
  357. <label for="selectUserAll" >所有人</label>
  358. <input type="radio" name="selectUser" value="1" id="selectUserSelect">
  359. <label for="selectUserSelect" >选择人员</label>
  360. <span id="usersContainer" style="display: none;">
  361. <span id="spanUsers" class="ht-input" style="width: initial;max-width: 260px;"></span>
  362. <a href="javascript:;" onclick="selectUser()" >选择</a>
  363. </span>
  364. </td>
  365. </tr>
  366. </c:if>
  367. </c:if>
  368. </tbody>
  369. </table>
  370. <input type="hidden" name="id" value="${sysBulletin.id}"/>
  371. <c:if test="${!isAddByFlow}">
  372. </form>
  373. </c:if>
  374. </div>
  375. </body>
  376. </html>