table1.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. * Created by 30947 on 2018/7/20.
  3. */
  4. $(function(){
  5. getHt();
  6. table();
  7. })
  8. //获取div的高度
  9. function getHt(){
  10. var all_height=$(window).height();
  11. var div_height=all_height-80;
  12. $("#car_control").css("height",div_height+"px");
  13. }
  14. //表格部分
  15. function table(){
  16. $('#table').bootstrapTable({
  17. method: "get",
  18. url: "json/case.json",
  19. striped: true,
  20. singleSelect: false,
  21. dataType: "json",
  22. pagination: true, //分页
  23. pageSize: 10,
  24. pageNumber: 1,
  25. search: false, //显示搜索框
  26. contentType: "application/x-www-form-urlencoded",
  27. queryParams: null,
  28. //sidePagination: "server", //服务端请求
  29. columns: [
  30. {
  31. title: "",
  32. field: 'ch',
  33. align: 'center',
  34. width:'30px',
  35. valign: 'middle',
  36. formatter:function(val,row){
  37. return '<div class="cliclRed"></div>';
  38. }
  39. }
  40. ,
  41. {
  42. title: "事项名称",
  43. field: 'name',
  44. align: 'center',
  45. valign: 'middle'
  46. },
  47. {
  48. title: '负责部门',
  49. field: 'part',
  50. align: 'center',
  51. valign: 'middle'
  52. },
  53. {
  54. title: '操作',
  55. field: 'opear',
  56. width:'250px',
  57. align: 'center',
  58. formatter: function (value, row) {
  59. var e = '<a href="javascript:void(0)" class="table_edit" title="咨询" onclick="edit(\'' + row.id + '\')">编辑</a> ';
  60. var c = '<a href="javascript:void(0)" class="table_del" title="删除" onclick="del(\'' + row.id + '\')">删除</a> ';
  61. return e+c ;
  62. }
  63. }
  64. ]
  65. });
  66. }
  67. function add(){
  68. layer.open({
  69. type: 2,
  70. skin: 'demo-class',
  71. title: '详情页面',
  72. fix: true,
  73. shadeClose: true,
  74. area: ['1000px', '500px'],
  75. content: 'tail_sm.html',
  76. });
  77. //加载层-默认风格
  78. //layer.load(1);
  79. //此处演示关闭
  80. // setTimeout(function(){
  81. // layer.closeAll('loading');
  82. // }, 2000);
  83. }
  84. function edit(){
  85. layer.open({
  86. type: 2,
  87. skin: 'layui-layer-lan',
  88. title: '详情页面',
  89. fix: true,
  90. shadeClose: true,
  91. area: ['1100px', '600px'],
  92. content: 'tail_more.html',
  93. });
  94. //加载层-默认风格
  95. //layer.load(1);
  96. //此处演示关闭
  97. // setTimeout(function(){
  98. // layer.closeAll('loading');
  99. // }, 2000);
  100. }
  101. function openList(){
  102. $(".find_expend").show();
  103. $("#open").hide();
  104. }
  105. function closeList(){
  106. $(".find_expend").hide();
  107. $("#open").show();
  108. }