add.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="keywords" content="">
  8. <meta name="description" content="">
  9. <title>字典新增</title>
  10. <link rel="stylesheet" href="../../../component/pear/css/pear.css">
  11. <style>
  12. .layui-form {padding-right: 10px;}
  13. </style>
  14. </head>
  15. <body>
  16. <form class="layui-form" lay-filter="edit">
  17. <input type="hidden" name="id">
  18. <div class="main-container">
  19. <div class="layui-form-item">
  20. <label class="layui-form-label layui-required">字典名称:</label>
  21. <div class="layui-input-block">
  22. <input type="text" name="name" lay-verify="required"
  23. class="layui-input" placeholder="" autocomplete="off" >
  24. </div>
  25. </div>
  26. <div class="layui-form-item">
  27. <label class="layui-form-label layui-required">字典编码:</label>
  28. <div class="layui-input-block">
  29. <input type="text" name="type" lay-verify="required"
  30. class="layui-input" placeholder="" autocomplete="off">
  31. </div>
  32. </div>
  33. <div class="layui-form-item">
  34. <label class="layui-form-label layui-required">字典描述:</label>
  35. <div class="layui-input-block">
  36. <textarea name="remark" class="layui-textarea"></textarea>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="bottom">
  41. <div class="button-container">
  42. <button type="submit" class="pear-btn pear-btn-primary"
  43. lay-submit="" lay-filter="save">提 交</button>
  44. <button type="button" class="pear-btn"
  45. onclick="parent.layer.closeAll();">关 闭</button>
  46. </div>
  47. </div>
  48. </form>
  49. <script src="../../../component/layui/layui.js"></script>
  50. <script src="../../../component/pear/pear.js"></script>
  51. <script>
  52. layui.use(['request', 'form', 'popup', 'common'], function () {
  53. var $ = layui.jquery,
  54. request = layui.request,
  55. form = layui.form,
  56. popup = layui.popup;
  57. var MODULE_PATH = "/system/dict/v1/";
  58. layer.ready(function() {
  59. var id = request.getQueryString("id");
  60. if (id) {
  61. request.httpGet(MODULE_PATH + id, function (result) {
  62. form.val('edit', result.data);
  63. });
  64. }
  65. });
  66. form.on('submit(save)', function (data) {
  67. request.http({
  68. url: MODULE_PATH,
  69. type: data.field.id? 'put': 'post',
  70. data: data.field,
  71. success: function (result) {
  72. if (result.success) {
  73. parent.layui.popup.success(result.msg, function () {
  74. parent.layer.close(parent.layer.getFrameIndex(window.name));
  75. parent.refresh();
  76. })
  77. } else {
  78. parent.layui.popup.failure(result.msg);
  79. }
  80. }
  81. });
  82. return false;
  83. });
  84. })
  85. </script>
  86. </body>
  87. </html>