list.html 7.9 KB

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