Form.cshtml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. @{
  2. ViewBag.Title = "区域管理";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script>
  6. var keyValue = request('keyValue');
  7. var parentId = request('parentId');
  8. $(function () {
  9. initControl();
  10. })
  11. //初始化控件
  12. function initControl() {
  13. //获取表单
  14. if (!!keyValue) {
  15. $.SetForm({
  16. url: "../../SystemManage/Area/GetFormJson",
  17. param: { keyValue: keyValue },
  18. success: function (data) {
  19. $("#form1").SetWebControls(data);
  20. }
  21. });
  22. } else {
  23. $("#ParentId").val(parentId);
  24. }
  25. }
  26. //保存表单
  27. function AcceptClick() {
  28. if (!$('#form1').Validform()) {
  29. return false;
  30. }
  31. var postData = $("#form1").GetWebControls(keyValue);
  32. if (postData["ParentId"] == "") {
  33. postData["ParentId"] = 0;
  34. }
  35. $.SaveForm({
  36. url: "../../SystemManage/Area/SaveForm?keyValue=" + keyValue,
  37. param: postData,
  38. loading: "正在保存数据...",
  39. success: function () {
  40. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  41. }
  42. })
  43. }
  44. </script>
  45. <div style="margin-top: 20px; margin-right: 30px;">
  46. <table class="form">
  47. <tr>
  48. <td class="formTitle">编号<font face="宋体">*</font></td>
  49. <td class="formValue">
  50. <input id="ParentId" type="hidden" />
  51. <input id="AreaCode" type="text" class="form-control" placeholder="请输入编号" isvalid="yes" checkexpession="NotNull" />
  52. </td>
  53. </tr>
  54. <tr>
  55. <td class="formTitle">名称<font face="宋体">*</font></td>
  56. <td class="formValue">
  57. <input id="AreaName" type="text" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" />
  58. </td>
  59. </tr>
  60. <tr>
  61. <th class="formTitle">排序<font face="宋体">*</font></th>
  62. <td class="formValue">
  63. <input id="SortCode" type="text" class="form-control" isvalid="yes" checkexpession="Num" />
  64. </td>
  65. </tr>
  66. <tr>
  67. <th class="formTitle" valign="top" style="padding-top: 4px;">备注
  68. </th>
  69. <td class="formValue">
  70. <textarea id="Description" class="form-control" style="height: 70px;"></textarea>
  71. </td>
  72. </tr>
  73. </table>
  74. </div>