add.html 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. </head>
  12. <body>
  13. <form class="layui-form" lay-filter="edit">
  14. <input type="hidden" name="id" value="">
  15. <div class="mainBox">
  16. <div class="main-container">
  17. <div class="layui-form-item">
  18. <label class="layui-form-label layui-required">角色名称:</label>
  19. <div class="layui-input-block">
  20. <input type="text" value="" name="name" lay-verify="required"
  21. autocomplete="off" placeholder="请输入角色名称" class="layui-input">
  22. </div>
  23. </div>
  24. <div class="layui-form-item">
  25. <label class="layui-form-label layui-required">角色标识:</label>
  26. <div class="layui-input-block">
  27. <input type="text" value="" name="code" lay-verify="required"
  28. autocomplete="off" placeholder="请输入角色标识" class="layui-input">
  29. </div>
  30. </div>
  31. <div class="layui-form-item">
  32. <label class="layui-form-label">角色排序:</label>
  33. <div class="layui-input-block">
  34. <input type="text" value="" name="sort"
  35. autocomplete="off" placeholder="请输入角色排序" class="layui-input">
  36. </div>
  37. </div>
  38. <div class="layui-form-item">
  39. <label class="layui-form-label">角色描述:</label>
  40. <div class="layui-input-block">
  41. <input type="text" value="" name="remark"
  42. autocomplete="off" placeholder="请输入角色介绍" class="layui-input">
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="bottom">
  48. <div class="button-container">
  49. <button type="submit" class="pear-btn pear-btn-primary"
  50. lay-submit="" lay-filter="save">提 交</button>
  51. <button type="button" class="pear-btn"
  52. onclick="parent.layer.closeAll();">关 闭</button>
  53. </div>
  54. </div>
  55. </form>
  56. <script src="../../../component/layui/layui.js"></script>
  57. <script src="../../../component/pear/pear.js"></script>
  58. <script src="../../../component/js/xm-select.js"></script>
  59. <script>
  60. layui.use(['request', 'form', 'popup'], function () {
  61. var $ = layui.jquery,
  62. request = layui.request,
  63. form = layui.form;
  64. var MODULE_PATH = "/system/role/v1/";
  65. layer.ready(function() {
  66. var id = request.getQueryString("id");
  67. if (id) {
  68. request.httpGet('/system/role/v1/' + id, function (result) {
  69. form.val('edit', result.data);
  70. });
  71. }
  72. });
  73. form.on('submit(save)', function (data) {
  74. request.http({
  75. url: MODULE_PATH,
  76. type: data.field.id ? 'put' : 'post',
  77. data: data.field,
  78. success: function (res) {
  79. if (res.success) {
  80. parent.layui.popup.success(res.msg, function () {
  81. parent.layer.close(parent.layer.getFrameIndex(window.name));
  82. parent.refresh();
  83. })
  84. } else {
  85. parent.layui.popup.failure(res.msg);
  86. }
  87. }
  88. });
  89. return false;
  90. });
  91. })
  92. </script>
  93. </body>
  94. </html>