add.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('新增数据')" />
  5. </head>
  6. <body class="white-bg">
  7. <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  8. <form class="form-horizontal m" id="form-modelEntity-add">
  9. <input type="hidden" id="projectId" name="projectId" th:value="${modelProject.id}">
  10. <div class="form-group">
  11. <label class="col-sm-3 control-label is-required">表名称:</label>
  12. <div class="col-sm-8">
  13. <input id="entityName" name="entityName" placeholder="商品表" class="form-control" type="text" required>
  14. </div>
  15. </div>
  16. <div class="form-group">
  17. <label class="col-sm-3 control-label is-required">表逻辑名:</label>
  18. <div class="col-sm-8">
  19. <input id="entityCode" name="entityCode" placeholder="m_product" class="form-control" type="text" required>
  20. </div>
  21. </div>
  22. <div class="form-group">
  23. <label class="col-sm-3 control-label">描述:</label>
  24. <div class="col-sm-8">
  25. <textarea id="remark" name="remark" class="form-control"></textarea>
  26. </div>
  27. </div>
  28. </form>
  29. </div>
  30. <th:block th:include="include :: footer" />
  31. <script th:inline="javascript">
  32. var prefix = ctx + "model/modelEntity"
  33. $("#form-modelEntity-add").validate({
  34. onkeyup: false,
  35. rules:{
  36. entityCode:{
  37. maxlength: 50,
  38. remote: {
  39. url: prefix + "/checkEntityCodeUnique",
  40. type: "post",
  41. dataType: "json",
  42. data: {
  43. "projectId":$("#projectId").val(),
  44. "entityCode": function() {
  45. return $.common.trim($("#entityCode").val());
  46. }
  47. },
  48. dataFilter: function(data, type) {
  49. return $.validate.unique(data);
  50. }
  51. }
  52. },
  53. entityName:{
  54. maxlength: 25
  55. },
  56. remark:{
  57. maxlength: 100
  58. },
  59. },
  60. messages: {
  61. "entityCode": {
  62. remote: "数据表已经存在"
  63. },
  64. },
  65. focusCleanup: true
  66. });
  67. function submitHandler() {
  68. if ($.validate.form()) {
  69. $.operate.save(prefix + "/add", $('#form-modelEntity-add').serialize());
  70. }
  71. }
  72. </script>
  73. </body>
  74. </html>