Form.cshtml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. $("#ParentId").ComboBoxTree({
  15. url: "../../SystemManage/DataItem/GetTreeJson",
  16. description: "==请选择==",
  17. height: "230px"
  18. });
  19. //获取表单
  20. if (!!keyValue) {
  21. $.SetForm({
  22. url: "../../SystemManage/DataItem/GetFormJson",
  23. param: { keyValue: keyValue },
  24. success: function (data) {
  25. $("#form1").SetWebControls(data);
  26. }
  27. });
  28. } else {
  29. $("#ParentId").ComboBoxTreeSetValue(parentId);
  30. }
  31. }
  32. //保存表单
  33. function AcceptClick() {
  34. if (!$('#form1').Validform()) {
  35. return false;
  36. }
  37. var postData = $("#form1").GetWebControls(keyValue);
  38. if (postData["ParentId"] == "") {
  39. postData["ParentId"] = 0;
  40. }
  41. $.SaveForm({
  42. url: "../../SystemManage/DataItem/SaveForm?keyValue=" + keyValue,
  43. param: postData,
  44. loading: "正在保存数据...",
  45. success: function () {
  46. top.DataItemSort.$("#gridTable").resetSelection();
  47. top.DataItemSort.$("#gridTable").trigger("reloadGrid");
  48. }
  49. })
  50. }
  51. </script>
  52. <div style="margin-top: 20px; margin-right: 30px;">
  53. <table class="form">
  54. <tr>
  55. <th class="formTitle">上级</th>
  56. <td class="formValue">
  57. <div id="ParentId" type="selectTree" class="ui-select"></div>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td class="formTitle">名称<font face="宋体">*</font></td>
  62. <td class="formValue">
  63. <input id="ItemName" type="text" onblur="$.ExistField(this.id,'../../SystemManage/DataItem/ExistItemName')" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" />
  64. </td>
  65. </tr>
  66. <tr>
  67. <td class="formTitle">编号<font face="宋体">*</font></td>
  68. <td class="formValue">
  69. <input id="ItemCode" type="text" onblur="$.ExistField(this.id,'../../SystemManage/DataItem/ExistItemCode')" class="form-control" placeholder="请输入编号" isvalid="yes" checkexpession="NotNull" />
  70. </td>
  71. </tr>
  72. <tr>
  73. <th class="formTitle">排序<font face="宋体">*</font></th>
  74. <td class="formValue">
  75. <input id="SortCode" type="text" class="form-control" isvalid="yes" checkexpession="Num" />
  76. </td>
  77. </tr>
  78. <tr>
  79. <th class="formTitle" style="height: 37px;"></th>
  80. <td class="formValue">
  81. <div class="checkbox">
  82. <label>
  83. <input id="IsTree" type="checkbox" />
  84. 树型
  85. </label>
  86. <label>
  87. <input id="EnabledMark" type="checkbox" checked="checked" />
  88. 有效
  89. </label>
  90. </div>
  91. </td>
  92. </tr>
  93. <tr>
  94. <th class="formTitle" valign="top" style="padding-top: 4px;">备注
  95. </th>
  96. <td class="formValue">
  97. <textarea id="Description" class="form-control" style="height: 70px;"></textarea>
  98. </td>
  99. </tr>
  100. </table>
  101. </div>