create.jsp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
  4. <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
  5. <%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
  6. <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
  7. <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
  8. <c:set var="basePath" value="${pageContext.request.contextPath}"/>
  9. <div id="createDialog" class="crudDialog">
  10. <form id="createForm" method="post">
  11. <div class="form-group">
  12. <label for="icon">图标</label>
  13. <input id="icon" type="text" class="form-control" name="icon" maxlength="20">
  14. </div>
  15. <div class="form-group">
  16. <label for="title">标题</label>
  17. <input id="title" type="text" class="form-control" name="title" maxlength="20">
  18. </div>
  19. <div class="form-group">
  20. <label for="name">名称</label>
  21. <input id="name" type="text" class="form-control" name="name" maxlength="20">
  22. </div>
  23. <div class="form-group">
  24. <label for="description">描述</label>
  25. <input id="description" type="text" class="form-control" name="description" maxlength="300">
  26. </div>
  27. <div class="form-group">
  28. <label for="basepath">根目录</label>
  29. <input id="basepath" type="text" class="form-control" name="basepath" maxlength="100">
  30. </div>
  31. <div class="radio">
  32. <div class="radio radio-inline radio-success">
  33. <input id="status_1" type="radio" name="status" value="1" checked>
  34. <label for="status_1"> 正常 </label>
  35. </div>
  36. <div class="radio radio-inline">
  37. <input id="status_0" type="radio" name="status" value="-1">
  38. <label for="status_0"> 锁定 </label>
  39. </div>
  40. </div>
  41. <div class="form-group text-right dialog-buttons">
  42. <a class="waves-effect waves-button" href="javascript:;" onclick="createSubmit();">保存</a>
  43. <a class="waves-effect waves-button" href="javascript:;" onclick="createDialog.close();">取消</a>
  44. </div>
  45. </form>
  46. </div>
  47. <script>
  48. function createSubmit() {
  49. $.ajax({
  50. type: 'post',
  51. url: '${basePath}/manage/system/create',
  52. data: $('#createForm').serialize(),
  53. beforeSend: function() {
  54. if ($('#title').val() == '') {
  55. $('#title').focus();
  56. return false;
  57. }
  58. if ($('#name').val() == '') {
  59. $('#name').focus();
  60. return false;
  61. }
  62. },
  63. success: function(result) {
  64. if (result.code != 1) {
  65. if (result.data instanceof Array) {
  66. $.each(result.data, function(index, value) {
  67. $.confirm({
  68. theme: 'dark',
  69. animation: 'rotateX',
  70. closeAnimation: 'rotateX',
  71. title: false,
  72. content: value.errorMsg,
  73. buttons: {
  74. confirm: {
  75. text: '确认',
  76. btnClass: 'waves-effect waves-button waves-light'
  77. }
  78. }
  79. });
  80. });
  81. } else {
  82. $.confirm({
  83. theme: 'dark',
  84. animation: 'rotateX',
  85. closeAnimation: 'rotateX',
  86. title: false,
  87. content: result.data.errorMsg,
  88. buttons: {
  89. confirm: {
  90. text: '确认',
  91. btnClass: 'waves-effect waves-button waves-light'
  92. }
  93. }
  94. });
  95. }
  96. } else {
  97. createDialog.close();
  98. $table.bootstrapTable('refresh');
  99. }
  100. },
  101. error: function(XMLHttpRequest, textStatus, errorThrown) {
  102. $.confirm({
  103. theme: 'dark',
  104. animation: 'rotateX',
  105. closeAnimation: 'rotateX',
  106. title: false,
  107. content: textStatus,
  108. buttons: {
  109. confirm: {
  110. text: '确认',
  111. btnClass: 'waves-effect waves-button waves-light'
  112. }
  113. }
  114. });
  115. }
  116. });
  117. }
  118. </script>