Form.cshtml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. @using Lottomat.Utils.Date
  2. @{
  3. ViewBag.Title = "公告管理";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <link href="~/Content/scripts/plugins/simditor/css/simditor.css" rel="stylesheet" />
  7. <script src="~/Content/scripts/plugins/simditor/js/module.min.js"></script>
  8. <script src="~/Content/scripts/plugins/simditor/js/uploader.min.js"></script>
  9. <script src="~/Content/scripts/plugins/simditor/js/hotkeys.min.js"></script>
  10. <script src="~/Content/scripts/plugins/simditor/js/simditor.min.js"></script>
  11. <link href="~/Content/scripts/plugins/cxColor/css/jquery.cxcolor.css" rel="stylesheet" />
  12. <script src="~/Content/scripts/plugins/cxColor/js/jquery.cxcolor.js"></script>
  13. <script>
  14. var keyValue = request('keyValue');
  15. var editor = null;
  16. $(function () {
  17. editor = new Simditor({
  18. textarea: $('#NewsContent'),
  19. placeholder: '这里输入公告内容...',
  20. toolbar: ['title', 'bold', 'italic', 'underline', 'strikethrough', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent']
  21. });
  22. initControl();
  23. })
  24. //初始化控件
  25. function initControl() {
  26. //公告类别
  27. $("#CategoryId").ComboBox({
  28. param: { EnCode: "NoticeCategory" },
  29. url: "../../SystemManage/DataItemDetail/GetDataItemListJson",
  30. description: "==请选择==",
  31. id: "ItemDetailId",
  32. text: "ItemName",
  33. height: "230px"
  34. });
  35. //获取表单
  36. if (!!keyValue) {
  37. $.SetForm({
  38. url: "../../PublicInfoManage/Notice/GetFormJson",
  39. param: { keyValue: keyValue },
  40. success: function (data) {
  41. $("#form1").SetWebControls(data);
  42. editor.setValue(data.NewsContent);
  43. $("#FullHead").attr("color", data.FullHeadColor).css("color", data.FullHeadColor);
  44. }
  45. });
  46. }
  47. }
  48. //选择颜色-设置标题色彩
  49. function SelectColorEvent() {
  50. var mycolor = $("#select_color").cxColor();
  51. mycolor.show();
  52. $("#select_color").bind("change", function () {
  53. $("#FullHead").css("color", this.value).attr("color", this.value);
  54. });
  55. }
  56. //保存表单
  57. function AcceptClick() {
  58. if (!$('#form1').Validform()) {
  59. return false;
  60. }
  61. var postData = {
  62. FullHead: $("#FullHead").val(),
  63. FullHeadColor: $('#FullHead').attr('color'),
  64. Category: $("#CategoryId").attr('data-text'),
  65. CategoryId: $("#CategoryId").attr('data-value'),
  66. ReleaseTime: $("#ReleaseTime").val(),
  67. NewsContent: editor.getValue(),
  68. IsHot: $.IsChecked('IsHot'),
  69. IsStick: $.IsChecked('IsStick'),
  70. IsRecommend: $.IsChecked('IsRecommend')
  71. }
  72. $.SaveForm({
  73. url: "../../PublicInfoManage/Notice/SaveForm?keyValue=" + keyValue,
  74. param: postData,
  75. loading: "正在保存数据...",
  76. success: function () {
  77. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  78. }
  79. })
  80. }
  81. </script>
  82. <div style="margin-top: 20px; margin-right: 30px;">
  83. <table class="form" style="table-layout: auto;">
  84. <tr>
  85. <td class="formTitle">公告标题<font face="宋体">*</font></td>
  86. <td class="formValue" colspan="3">
  87. <input id="FullHead" type="text" class="form-control" style="color: #000000;" placeholder="请输入标题" isvalid="yes" checkexpession="NotNull" />
  88. <span id="select_color" class="input-button" style="width: 18px; margin-top: -9px; height: auto;" title="使用彩色标题" onclick="SelectColorEvent()">
  89. <img src="~/Content/images/large_tiles.png" /></span>
  90. </td>
  91. </tr>
  92. <tr>
  93. <td class="formTitle">公告类别<font face="宋体">*</font></td>
  94. <td class="formValue">
  95. <div id="CategoryId" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull" ></div>
  96. </td>
  97. <td class="formTitle">发布时间</td>
  98. <td class="formValue">
  99. <input id="ReleaseTime" readonly type="text" class="form-control" value="@DateTimeHelper.GetToday("yyyy/MM/dd HH:mm")" />
  100. </td>
  101. </tr>
  102. <tr>
  103. <td class="formTitle">信息来源</td>
  104. <td class="formValue">
  105. <input id="SourceName" type="text" class="form-control" />
  106. </td>
  107. <td class="formTitle">来源地址</td>
  108. <td class="formValue">
  109. <input id="SourceAddress" type="text" class="form-control" />
  110. </td>
  111. </tr>
  112. <tr>
  113. <td class="formTitle">公告属性</td>
  114. <td class="formValue" colspan="3">
  115. <div style="float: left; padding-top: 5px; padding-left: 15px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; -khtml-user-select: none; user-select: none;">
  116. <input id="IsStick" style="vertical-align: middle; margin-bottom: 2px;" type="checkbox">
  117. <label style="padding-left: 5px; cursor: pointer" for="IsStick">置顶</label>
  118. </div>
  119. </td>
  120. </tr>
  121. <tr>
  122. <th class="formTitle" valign="top" style="padding-top: 4px;">公告内容</th>
  123. <td class="formValue" colspan="3">
  124. <textarea id="NewsContent" class="form-control" rows="5"></textarea>
  125. </td>
  126. </tr>
  127. </table>
  128. </div>