Form.cshtml 4.8 KB

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