list.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script class="include" system="" path="inc/" file="head">include()</script>
  5. <link rel="stylesheet" href="../script/lib/layui/admin/modules/plugin/formselects/formselects.css" media="all" />
  6. </head>
  7. <body>
  8. <style id="addstyle">
  9. </style>
  10. <style>
  11. .layui-table-cell .layui-select,.layui-table-cell .layui-input
  12. {
  13. height: 25px;
  14. }
  15. .layui-table-cell {
  16. height: auto;
  17. }
  18. .table th,.table td {
  19. min-width: 60px;
  20. }
  21. #table_2,#table_1 {
  22. /*overflow: auto;*/
  23. }
  24. .layui-btn-xs
  25. {
  26. margin-top:1px;
  27. }
  28. .dever-emoji img {
  29. width:16px;
  30. }
  31. .layui-tab-title {
  32. height: 100%;
  33. white-space: inherit;
  34. }
  35. .layui-form-item .layui-input-inline {
  36. display: block;
  37. float: none;
  38. left: -3px;
  39. margin: 0px 0px 0px 0px;
  40. }
  41. .chart {
  42. width: 100%;
  43. height:300px;
  44. }
  45. .table-header-fixed {
  46. top: -1px;
  47. position: sticky;
  48. z-index: 999;
  49. }
  50. .goods_table {
  51. width: 100%;
  52. }
  53. .goods_table th
  54. {
  55. text-align: center;
  56. }
  57. .goods_table td
  58. {
  59. text-align: center;
  60. }
  61. .layui-table-tool-temp{
  62. display: none;
  63. }
  64. </style>
  65. <div id="load_style" style="display:none;">
  66. </div>
  67. <span id="dever-name" style="display:none;"></span>
  68. <div class="topbar">
  69. <div class="banner dever-layout" style="display:none;">
  70. <a target="_blank"><img src="#"></a>
  71. <span>项目名称</span>
  72. </div>
  73. </div>
  74. <div id="content_1" style="display:none;"></div>
  75. <div id="content_2">
  76. <div class="layui-fluid">
  77. <div class="layui-card" id="stat_data_card">
  78. <div class="layui-card-header">数据概览</div>
  79. <div class="layui-card-body">
  80. <div class="layui-carousel layadmin-carousel layadmin-backlog">
  81. <div carousel-item>
  82. <ul class="layui-row layui-col-space10" id="stat_data">
  83. <li class="layui-col-xs3">
  84. <a class="layadmin-backlog-body">
  85. <h3>待审评论</h3>
  86. <p><cite>66</cite></p>
  87. </a>
  88. </li>
  89. </ul>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="layui-card">
  95. <input type="hidden" name="url1" id="url" value=""/>
  96. <form id="form1" name="form1" method="get" target="f1">
  97. <input type="hidden" name="l" id="l" value="msg"/>
  98. <input type="hidden" name="project" id="project" value="msg"/>
  99. <input type="hidden" name="table" id="tables" value="msg"/>
  100. <input type="hidden" name="menu" id="menu" value="msg"/>
  101. <input type="hidden" name="menu_id" id="menu_id" value="msg"/>
  102. <input type="hidden" name="search_option_state" id="search_option_state" value="msg"/>
  103. <input type="hidden" name="function" id="function" value="msg"/>
  104. <input type="hidden" name="method" id="method" value="search"/>
  105. <div id="search_param"></div>
  106. <iframe id="f1" name="f1" style="display:none;"></iframe>
  107. <div class="layui-card-header" style="display: none;"><span id="list-project">网站设置</span> > <span id="list-name"></span></div>
  108. <div class="layui-card-body" id="search_content">
  109. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  110. <div class="layui-form-item">
  111. <div id="search"></div>
  112. </div>
  113. </div>
  114. </div>
  115. <div class="layui-card-body">
  116. <div style="padding-bottom: 10px;">
  117. <a class="layui-btn layuiadmin-btn-list" data-type="add" id="list-parent" style="display:none;">返回上一页</a>
  118. <a class="layui-btn layuiadmin-btn-list" data-type="add" id="list-add">新增</a>
  119. <span id="list-button"></span>
  120. </div>
  121. <div class="dever_desc" id="info"></div>
  122. <div id="table_1" style="display:none;"></div>
  123. <div id="table_2">
  124. <div id="chart" class="chart"></div>
  125. <table class="table layui-table layui-table-body" id="table">
  126. <thead id="list-thead">
  127. <tr>
  128. <th>Company</th>
  129. </tr>
  130. </thead>
  131. <tbody id="list-tbody">
  132. <tr>
  133. <th></th>
  134. </tr>
  135. </tbody>
  136. </table>
  137. <div id="mul"></div>
  138. <div id="page" style="display:none"></div>
  139. <div class="dever_desc" id="desc"></div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </form>
  145. <form id="form2" name="form2" method="get" style="display: none;"></form>
  146. <div id="struct" style="display:none;"></div>
  147. </div>
  148. </div>
  149. </div>
  150. <script class="include" system="" path="inc/" file="script">include()</script>
  151. <script id="list-thead-data">
  152. config.table = {};
  153. config.table.limit = 20;
  154. config.table.cols = [];
  155. </script>
  156. <script id="list-tbody-data">
  157. config.table.data = [];
  158. </script>
  159. <script>
  160. layui.config({
  161. base: '../script/lib/layui/admin/' //静态资源所在路径
  162. }).extend({
  163. formSelects: 'plugin/formselects/formselects',
  164. index: 'lib/index' //主入口模块
  165. }).use(['index', 'contlist', 'table', 'form', 'formSelects', 'console'], function(){
  166. var table = layui.table;
  167. var form = layui.form;
  168. var formSelects = layui.formSelects;
  169. if ($('#content_2').css('display') != 'none') {
  170. var bw = document.body.scrollWidth;
  171. var sw = $('#content_2').width();
  172. if (sw > 0 && bw > sw) {
  173. $('body').css({'width' : 'fit-content'});
  174. }
  175. } else {
  176. //$('#table_1').css({'overflow' : 'auto'});
  177. //$('#table_2').css({'overflow' : 'auto'});
  178. }
  179. if (config.table.cols.length > 0) {
  180. table.render({
  181. elem: '#table'
  182. ,page: false
  183. ,limit:config.table.limit
  184. //,toolbar:'default'
  185. //,defaultToolbar:["filter","exports","print"]
  186. ,cols: config.table.cols
  187. ,data: config.table.data
  188. ,done:function(res, curr, count) {
  189. $('#page').show();
  190. let headerTop = $('.layui-table-header').offset().top; //获取表格头到文档顶部的距离
  191. $(window).scroll(function () {
  192. if (count > 3 && (headerTop - $(window).scrollTop()) < 0) { //超过了
  193. $('.layui-table-header').addClass('table-header-fixed'); //添加样式,固定住表头
  194. } else { //没超过
  195. $('.layui-table-header').removeClass('table-header-fixed'); //移除样式
  196. }
  197. });
  198. }
  199. });
  200. } else {
  201. $('#page').show();
  202. var count = $('#list-tbody tr').length;
  203. let headerTop = $('#list-thead').offset().top; //获取表格头到文档顶部的距离
  204. $(window).scroll(function () {
  205. if (count > 3 && (headerTop - $(window).scrollTop()) < 100) { //超过了
  206. $('#list-thead').addClass('table-header-fixed'); //添加样式,固定住表头
  207. /*
  208. $('#list-thead th').each(function (k, v) {
  209. var width = $('#list-tbody td').eq(k).width() + 0.9;
  210. //$(v).width(width + 1);
  211. $(v).css({'min-width': width});
  212. });*/
  213. } else { //没超过
  214. $('#list-thead').removeClass('table-header-fixed'); //移除样式
  215. }
  216. });
  217. }
  218. init();
  219. if ($('.dever-manage').length) {
  220. $('.dever-manage').click(function()
  221. {
  222. showMsg('数据结构', $(this), '#struct');
  223. })
  224. }
  225. //滚动body,header跟随滚动
  226. $('.layui-table-body').on('scroll', function(e) {
  227. var leftPx = $(e.target).scrollLeft(); //获取表格body,滚动条距离左边的长度
  228. var left = 'translateX(-' + leftPx + 'px)';
  229. $('.layui-table-header .layui-table').css('transform', left); //设置表格header的内容反向(-)移动
  230. });
  231. });
  232. </script>
  233. </body>
  234. </html>