roleform.html 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <div class="layui-form" lay-filter="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
  2. <div class="layui-form-item">
  3. <label class="layui-form-label">角色</label>
  4. <div class="layui-input-block">
  5. <script type="text/html" template>
  6. <select name="position">
  7. <option value="管理员" {{ d.params.role === '管理员' ? 'selected' : '' }}>管理员</option>
  8. <option value="超级管理员" {{ d.params.role === '超级管理员' ? 'selected' : '' }}>超级管理员</option>
  9. <option value="纠错员" {{ d.params.role === '纠错员' ? 'selected' : '' }}>纠错员</option>
  10. <option value="采购员" {{ d.params.role === '采购员' ? 'selected' : '' }}>采购员</option>
  11. <option value="推销员" {{ d.params.role === '推销员' ? 'selected' : '' }}>推销员</option>
  12. <option value="运营人员" {{ d.params.role === '运营人员' ? 'selected' : '' }}>运营人员</option>
  13. <option value="文章撰写员" {{ d.params.role === '文章撰写员' ? 'selected' : '' }}>文章撰写员</option>
  14. </select>
  15. </script>
  16. </div>
  17. </div>
  18. <script type="text/html" template>
  19. <div class="layui-form-item">
  20. <label class="layui-form-label">姓名</label>
  21. <div class="layui-input-block">
  22. <input type="text" name="name" value="{{ d.params.name || '' }}" required lay-verify="required" autocomplete="off" class="layui-input">
  23. </div>
  24. </div>
  25. <div class="layui-form-item">
  26. <label class="layui-form-label">用户名</label>
  27. <div class="layui-input-block">
  28. <input type="text" name="username" value="{{ d.params.username || '' }}" {{ typeof(d.params.username) == 'undefined' ? '' : 'readonly' }} required lay-verify="required" autocomplete="off" class="layui-input">
  29. </div>
  30. </div>
  31. </script>
  32. <div class="layui-form-item">
  33. <label class="layui-form-label">权限范围</label>
  34. <div class="layui-input-block">
  35. <div id="role-tree" class="layui-tree"></div>
  36. </div>
  37. </div>
  38. <div class="layui-form-item">
  39. <label class="layui-form-label"></label>
  40. <div class="layui-input-inline">
  41. <input type="button" lay-submit lay-filter="LAY-user-role-submit" value="确认" class="layui-btn">
  42. </div>
  43. </div>
  44. </div>
  45. <script>
  46. layui.use(['admin', 'form', 'tree'], function(){
  47. var $ = layui.$
  48. ,form = layui.form
  49. ,tree = layui.tree;
  50. $.ajax({
  51. url:"/login/getRoleTree",
  52. success:function (res) {
  53. var data = res;
  54. tree.render({
  55. elem: '#role-tree'
  56. ,data: data
  57. // ,spread: true
  58. ,showCheckbox: true //是否显示复选框
  59. ,id: 'demoId1'
  60. // ,isJump: true //是否允许点击节点时弹出新窗口跳转
  61. ,oncheck: function(obj){
  62. var data = obj.data; //获取当前点击的节点数据
  63. console.log(data)
  64. }
  65. });
  66. }
  67. })
  68. });
  69. </script>