Form.cshtml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. @using Lottomat.Util
  2. @{
  3. ViewBag.Title = "Form";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <script type="text/javascript">
  7. var parentId = request('parentId');
  8. var moduleButtonId = request('moduleButtonId');
  9. var moduleId = request('moduleId');
  10. $(function () {
  11. initControl();
  12. })
  13. var dataJson = top.Form.buttonJson;
  14. //初始化控件
  15. function initControl() {
  16. //上级
  17. $("#ParentId").ComboBoxTree({
  18. url: "../../AuthorizeManage/ModuleButton/ListToTreeJson",
  19. param: { moduleButtonJson: JSON.stringify(dataJson) },
  20. method: "post",
  21. description: "==请选择==",
  22. height: "150px"
  23. });
  24. if (!!moduleButtonId) {
  25. $.each(dataJson, function (i) {
  26. var row = dataJson[i];
  27. if (row.ModuleButtonId == moduleButtonId) {
  28. $("#form1").SetWebControls(row);
  29. }
  30. });
  31. } else {
  32. $("#ModuleId").val(moduleId);
  33. if (!!parentId) {
  34. $("#ParentId").ComboBoxTreeSetValue(parentId);
  35. } else {
  36. $("#ParentId").ComboBoxTreeSetValue(0);
  37. }
  38. }
  39. }
  40. //保存表单
  41. function AcceptClick(callback) {
  42. if (!$('#form1').Validform()) {
  43. return false;
  44. }
  45. var data = $("#form1").GetWebControls(moduleButtonId);
  46. if (data["ParentId"] == "") {
  47. data["ParentId"] = 0;
  48. }
  49. callback(data);
  50. dialogClose();
  51. }
  52. </script>
  53. <div style="margin-top: 10px; margin-right: 30px;">
  54. <input id="ModuleButtonId" type="hidden" value="@CommonHelper.GetGuid().ToString()" />
  55. <input id="ModuleId" type="hidden" />
  56. <table class="form">
  57. <tr>
  58. <th class="formTitle">上级</th>
  59. <td class="formValue">
  60. <div id="ParentId" type="selectTree" class="ui-select">
  61. </div>
  62. </td>
  63. </tr>
  64. <tr>
  65. <th class="formTitle">编号<font face="宋体">*</font></th>
  66. <td class="formValue">
  67. <input id="EnCode" type="text" class="form-control" placeholder="请输入编号" isvalid="yes" checkexpession="NotNull" />
  68. </td>
  69. </tr>
  70. <tr>
  71. <th class="formTitle">名称<font face="宋体">*</font></th>
  72. <td class="formValue">
  73. <input id="FullName" type="text" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" />
  74. </td>
  75. </tr>
  76. <tr>
  77. <th class="formTitle">排序<font face="宋体">*</font></th>
  78. <td class="formValue">
  79. <input id="SortCode" type="text" class="form-control" placeholder="请输入排序" isvalid="yes" checkexpession="Num" />
  80. </td>
  81. </tr>
  82. <tr>
  83. <th class="formTitle">地址</th>
  84. <td class="formValue">
  85. <input id="ActionAddress" type="text" class="form-control" />
  86. </td>
  87. </tr>
  88. </table>
  89. </div>