contacts_book.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {extend name="../../base/view/common/base" /}
  2. {block name="style"}
  3. <style>
  4. .tree-left{width:200px; float:left; height:calc(100vh - 79px); overflow-y: auto; border:1px solid #eeeeee; border-right:0; background-color:#fbfbfb; padding:12px 12px 12px 5px;}
  5. .tree-left::-webkit-scrollbar {width: 0;}
  6. .tree-left h3{font-size:16px; height:30px; padding-left:10px; font-weight:800}
  7. </style>
  8. {/block}
  9. <!-- 主体 -->
  10. {block name="body"}
  11. <div class="p-page">
  12. <div class="tree-left">
  13. <h3>企业通讯录</h3>
  14. <div id="depament"></div>
  15. </div>
  16. <div class="body-table" style="margin-left:200px; overflow:hidden;">
  17. <form class="layui-form gg-form-bar border-t border-x" lay-filter="barsearchform">
  18. <div class="layui-input-inline" style="width:360px">
  19. <input type="text" name="keywords" placeholder="关键字,如:ID号/姓名/登录账号/手机号码/电子邮箱" class="layui-input" autocomplete="off" />
  20. </div>
  21. <div class="layui-input-inline" style="width:150px;">
  22. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
  23. <button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
  24. </div>
  25. </form>
  26. <table class="layui-hide" id="test" lay-filter="test"></table>
  27. </div>
  28. </div>
  29. <script type="text/html" id="thumb">
  30. <img src="{{d.thumb}}" width="30" height="30" />
  31. </script>
  32. {/block}
  33. <!-- /主体 -->
  34. <!-- 脚本 -->
  35. {block name="script"}
  36. <script>
  37. const moduleInit = ['tool','tablePlus'];
  38. function gouguInit() {
  39. var table = layui.tablePlus, tool = layui.tool,tree = layui.tree,form = layui.form;
  40. $.ajax({
  41. url: "/api/index/get_department_tree",
  42. type:'get',
  43. success:function(res){
  44. //仅节点左侧图标控制收缩
  45. tree.render({
  46. elem: '#depament',
  47. data: res.trees,
  48. onlyIconControl: true, //是否仅允许节点左侧图标控制展开收缩
  49. click: function(obj){
  50. //layer.msg(JSON.stringify(obj.data));
  51. $('#depament').find('.layui-tree-main').removeClass('on');
  52. $(obj.elem).find('.layui-tree-main').eq(0).addClass('on');
  53. layui.pageTable.reload({
  54. where: {did: obj.data.id}
  55. ,page:{curr:1}
  56. });
  57. $('[name="keywords"]').val('');
  58. layui.form.render('select');
  59. }
  60. });
  61. }
  62. })
  63. layui.pageTable = table.render({
  64. elem: '#test',
  65. title: '通讯录',
  66. url: "/home/index/contacts_book", //数据接口
  67. height: 'full-114',
  68. cols: [
  69. [{
  70. field: 'thumb',
  71. title: '头像',
  72. toolbar: '#thumb',
  73. align: 'center',
  74. width: 60
  75. }, {
  76. field: 'name',
  77. title: '用户姓名',
  78. align: 'center',
  79. width: 80
  80. },{
  81. field: 'mobile',
  82. title: '手机号码',
  83. align: 'center',
  84. width: 120
  85. },{
  86. field: 'email',
  87. title: '电子邮箱'
  88. },{
  89. field: 'sex',
  90. title: '性别',
  91. align: 'center',
  92. width: 60,
  93. templet: function (d) {
  94. var html = '未知';
  95. if(d.sex == 1){
  96. html = '男'
  97. }
  98. else if(d.sex == 2){
  99. html = '女'
  100. }
  101. return html;
  102. }
  103. },{
  104. field: 'department',
  105. title: '所在部门',
  106. width: 120
  107. },{
  108. field: 'departments',
  109. title: '次要部门',
  110. width: 200
  111. }, {
  112. field: 'position',
  113. title: '岗位职称',
  114. align: 'center',
  115. width: 100
  116. }, {
  117. field: 'entry_time',
  118. title: '入职日期',
  119. align: 'center',
  120. width: 100
  121. }
  122. ]
  123. ]
  124. });
  125. }
  126. </script>
  127. {/block}
  128. <!-- /脚本 -->