create.jsp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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="theme">主题</label>
  13. <input id="theme" type="color" class="form-control" name="theme" maxlength="50">
  14. </div>
  15. <div class="form-group">
  16. <label for="icon">图标</label>
  17. <input id="icon" type="text" class="form-control" name="icon" maxlength="20">
  18. </div>
  19. <div class="form-group">
  20. <label for="title">标题</label>
  21. <input id="title" type="text" class="form-control" name="title" maxlength="20">
  22. </div>
  23. <div class="form-group">
  24. <label for="name">名称</label>
  25. <input id="name" type="text" class="form-control" name="name" maxlength="20">
  26. </div>
  27. <div class="form-group">
  28. <label for="banner">背景图</label>
  29. <input id="banner" type="text" class="form-control" name="banner" maxlength="50">
  30. </div>
  31. <div class="form-group">
  32. <label for="description">描述</label>
  33. <input id="description" type="text" class="form-control" name="description" maxlength="300">
  34. </div>
  35. <div class="form-group">
  36. <label for="basepath">根目录</label>
  37. <input id="basepath" type="text" class="form-control" name="basepath" maxlength="100">
  38. </div>
  39. <div class="radio">
  40. <div class="radio radio-inline radio-success">
  41. <input id="status_1" type="radio" name="status" value="1" checked>
  42. <label for="status_1">正常 </label>
  43. </div>
  44. <div class="radio radio-inline">
  45. <input id="status_0" type="radio" name="status" value="-1">
  46. <label for="status_0">锁定 </label>
  47. </div>
  48. </div>
  49. <div class="form-group text-right dialog-buttons">
  50. <a class="waves-effect waves-button" href="javascript:;" onclick="createSubmit();">保存</a>
  51. <a class="waves-effect waves-button" href="javascript:;" onclick="createDialog.close();">取消</a>
  52. </div>
  53. </form>
  54. </div>
  55. <script>
  56. function createSubmit() {
  57. $.ajax({
  58. type: 'post',
  59. url: '${basePath}/manage/system/create',
  60. data: $('#createForm').serialize(),
  61. beforeSend: function() {
  62. if ($('#title').val() == '') {
  63. $('#title').focus();
  64. return false;
  65. }
  66. if ($('#name').val() == '') {
  67. $('#name').focus();
  68. return false;
  69. }
  70. },
  71. success: function(result) {
  72. if (result.code != 1) {
  73. if (result.data instanceof Array) {
  74. $.each(result.data, function(index, value) {
  75. $.confirm({
  76. theme: 'dark',
  77. animation: 'rotateX',
  78. closeAnimation: 'rotateX',
  79. title: false,
  80. content: value.errorMsg,
  81. buttons: {
  82. confirm: {
  83. text: '确认',
  84. btnClass: 'waves-effect waves-button waves-light'
  85. }
  86. }
  87. });
  88. });
  89. } else {
  90. $.confirm({
  91. theme: 'dark',
  92. animation: 'rotateX',
  93. closeAnimation: 'rotateX',
  94. title: false,
  95. content: result.data.errorMsg,
  96. buttons: {
  97. confirm: {
  98. text: '确认',
  99. btnClass: 'waves-effect waves-button waves-light'
  100. }
  101. }
  102. });
  103. }
  104. } else {
  105. createDialog.close();
  106. $table.bootstrapTable('refresh');
  107. }
  108. },
  109. error: function(XMLHttpRequest, textStatus, errorThrown) {
  110. $.confirm({
  111. theme: 'dark',
  112. animation: 'rotateX',
  113. closeAnimation: 'rotateX',
  114. title: false,
  115. content: textStatus,
  116. buttons: {
  117. confirm: {
  118. text: '确认',
  119. btnClass: 'waves-effect waves-button waves-light'
  120. }
  121. }
  122. });
  123. }
  124. });
  125. }
  126. </script>