Form.cshtml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. @using Lottomat.Util
  2. @{
  3. ViewBag.Title = "Form";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <script type="text/javascript">
  7. var moduleColumnId = request('moduleColumnId');
  8. var moduleId = request('moduleId');
  9. $(function () {
  10. initControl();
  11. })
  12. var dataJson = top.Form.columnJson;
  13. //初始化控件
  14. function initControl() {
  15. if (!!moduleColumnId) {
  16. $.each(dataJson, function (i) {
  17. var row = dataJson[i];
  18. if (row.ModuleColumnId == moduleColumnId) {
  19. $("#form1").SetWebControls(row);
  20. }
  21. });
  22. } else {
  23. $("#ModuleId").val(moduleId);
  24. }
  25. }
  26. //保存表单
  27. function AcceptClick(callback) {
  28. if (!$('#form1').Validform()) {
  29. return false;
  30. }
  31. var data = $("#form1").GetWebControls(moduleColumnId);
  32. data["ParentId"] = 0;
  33. callback(data);
  34. dialogClose();
  35. }
  36. </script>
  37. <div style="margin-top: 10px; margin-right: 30px;">
  38. <input id="ModuleColumnId" type="hidden" value="@CommonHelper.GetGuid().ToString()" />
  39. <input id="ModuleId" type="hidden" />
  40. <table class="form">
  41. <tr>
  42. <th class="formTitle">编号<font face="宋体">*</font></th>
  43. <td class="formValue">
  44. <input id="EnCode" type="text" class="form-control" placeholder="请输入编号" isvalid="yes" checkexpession="NotNull" />
  45. </td>
  46. </tr>
  47. <tr>
  48. <th class="formTitle">名称<font face="宋体">*</font></th>
  49. <td class="formValue">
  50. <input id="FullName" type="text" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" />
  51. </td>
  52. </tr>
  53. <tr>
  54. <th class="formTitle">排序<font face="宋体">*</font></th>
  55. <td class="formValue">
  56. <input id="SortCode" type="text" class="form-control" placeholder="请输入排序" isvalid="yes" checkexpession="Num" />
  57. </td>
  58. </tr>
  59. <tr>
  60. <th class="formTitle">描述</th>
  61. <td class="formValue">
  62. <input id="Description" type="text" class="form-control" />
  63. </td>
  64. </tr>
  65. </table>
  66. </div>