report-wv.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <link rel='stylesheet' href='../luckysheet/dist/plugins/plugins.css' />
  9. <link rel='stylesheet' href='../luckysheet/dist/plugins/css/pluginsCss.css' />
  10. <link rel='stylesheet' href='../luckysheet/dist/css/luckysheet.css' />
  11. <link rel='stylesheet' href='../luckysheet/dist/assets/iconfont/iconfont.css' />
  12. <link rel="stylesheet" href="../dist/css/layui.css">
  13. <style>
  14. .la-btn{
  15. position: absolute;
  16. bottom: 35px;
  17. width: 96%;
  18. padding:0 2%;
  19. }
  20. .btn{
  21. width:100%;
  22. }
  23. .layui-laypage-em{
  24. background-color: #1e9fff !important;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:100%;height:90%;left: 0px;top: 0px;">
  30. </div>
  31. <table id="demo" lay-filter="test"></table>
  32. <div class="la-btn">
  33. <button id="recordBtn" type="button" class="layui-btn layui-btn-normal layui-btn-sm btn">运行记录</button>
  34. </div>
  35. <script src="../jquery.min.js"></script>
  36. <script src="../dist/layui.js"></script>
  37. <script src="../luckysheet/dist/luckysheet.umd.js"></script>
  38. <script src="../luckysheet/dist/plugins/js/plugin.js"></script>
  39. <!-- uni 的 SDK -->
  40. <script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.3/index.js"></script>
  41. <script>
  42. document.addEventListener('UniAppJSBridgeReady', function() {
  43. uni.getEnv(function(res) {
  44. console.log('当前环境:' + JSON.stringify(res));
  45. const id = window.location.search.split('?id=')[1]
  46. $.ajax({
  47. url: "http://192.168.0.40:8081/reportTable/getReportTableById/" + id,
  48. type: 'GET',
  49. success: function(res) {
  50. if (res.code === 200) {
  51. const tableData = JSON.parse(res.data.reportTableData)
  52. const option = tableData.option
  53. if (option) {
  54. option.allowEdit = false
  55. tableData.showtoolbar = false
  56. tableData.option.enableAddRow = false
  57. tableData.option.enableAddBackTop = false
  58. let data = tableData.option.showtoolbarConfig
  59. for (let item in data) {
  60. data[item] = false
  61. }
  62. luckysheet.create(option)
  63. }
  64. }
  65. }
  66. })
  67. $('#recordBtn').on('click', () => {
  68. layui.use('table', function() {
  69. var table = layui.table;
  70. var layer = layui.layer;
  71. layer.open({
  72. type: 1,
  73. title: '运行记录',
  74. content: $('#demo'),
  75. offset: ['180px', '45px'],
  76. end: function() {
  77. $('#demo').hide();
  78. $('.layui-table-view').hide()
  79. },
  80. cancel: function(index, layero) {
  81. $('.layui-layer-content').hide()
  82. }
  83. });
  84. var tableReload = table.render({
  85. elem: '#demo',
  86. width: 300,
  87. page: {
  88. elem: '#demo',
  89. layout: ['prev', 'page', 'next', 'count']
  90. },
  91. url: 'http://192.168.0.40:8081/reportTable/getAutoChReportTable',
  92. where: {
  93. autoTableId: id
  94. },
  95. text: {
  96. none: '暂无数据' //默认:无数据。
  97. },
  98. cols: [
  99. [{
  100. field: 'reportTableName',
  101. title: null,
  102. width: 300
  103. }]
  104. ],
  105. parseData: function(res) {
  106. return {
  107. "code": 0,
  108. "msg": res.msg,
  109. "count": res.data.count,
  110. "data": res.data.reportTableList
  111. };
  112. }
  113. });
  114. //触发行单击事件
  115. table.on('row(test)', function(obj) {
  116. const id = obj.data.id
  117. const title = obj.data.reportTableName
  118. uni.navigateTo({
  119. url: `/pages/reportForm/report-detail/recordDetail?id=${id}&title=${title}`
  120. })
  121. });
  122. $('th').hide()
  123. });
  124. })
  125. });
  126. });
  127. </script>
  128. </body>
  129. </html>