123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <!DOCTYPE html>
- <html lang="zh">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <link rel='stylesheet' href='../luckysheet/dist/plugins/plugins.css' />
- <link rel='stylesheet' href='../luckysheet/dist/plugins/css/pluginsCss.css' />
- <link rel='stylesheet' href='../luckysheet/dist/css/luckysheet.css' />
- <link rel='stylesheet' href='../luckysheet/dist/assets/iconfont/iconfont.css' />
- <link rel="stylesheet" href="../dist/css/layui.css">
- <style>
- .la-btn {
- position: absolute;
- left: 50%;
- bottom: 35px;
- transform: translate(-50%);
- padding: 0 2%;
- }
- .btn {
- width: 100%;
- }
- .layui-laypage-em {
- background-color: #1e9fff !important;
- }
- </style>
- </head>
- <body>
- <div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:100%;height:90%;left: 0px;top: 0px;">
- </div>
- <table id="demo" lay-filter="test"></table>
- <div class="la-btn">
- <button id="recordBtn" type="button" class="layui-btn layui-btn-normal layui-btn-sm btn">运行记录</button>
- </div>
- <script src="../jquery.min.js"></script>
- <script src="../dist/layui.js"></script>
- <script src="../luckysheet/dist/luckysheet.umd.js"></script>
- <script src="../luckysheet/dist/plugins/js/plugin.js"></script>
- <!-- uni 的 SDK -->
- <script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.3/index.js"></script>
- <script>
- document.addEventListener('UniAppJSBridgeReady', function() {
- uni.getEnv(function(res) {
- console.log('当前环境:' + JSON.stringify(res));
- const id = window.location.search.split('?id=')[1]
- $.ajax({
- url: "http://192.168.0.40:8081/reportTable/getReportTableById/" + id,
- type: 'GET',
- success: function(res) {
- if (res.code === 200) {
- const tableData = JSON.parse(res.data.reportTableData)
- const option = tableData.option
- console.log(tableData)
- if (option) {
- option.allowEdit = false
- tableData.showtoolbar = false
- tableData.option.enableAddRow = false
- tableData.option.enableAddBackTop = false
- let data = tableData.option.showtoolbarConfig
- for (let item in data) {
- data[item] = false
- }
- option.data = tableData.data
- luckysheet.create(option)
- printExcel()
- }
- } else {
- layer.msg(res.msg);
- }
- }
- })
- function printExcel(){
- luckysheet.hideGridLines()
- let imgSrc = luckysheet.getScreenshot();
- luckysheet.showGridLines();
- console.log(imgSrc);
- $.ajax({
- url: "" ,
- type: 'GET',
- success: function(res) {
-
- }
- })
- }
- $('#recordBtn').on('click', () => {
- layui.use('table', function() {
- var table = layui.table;
- var layer = layui.layer;
- layer.open({
- type: 1,
- title: '运行记录',
- content: $('#demo'),
- offset: ['180px', '45px'],
- end: function() {
- $('#demo').hide();
- $('.layui-table-view').hide()
- },
- cancel: function(index, layero) {
- $('.layui-layer-content').hide()
- }
- });
- var tableReload = table.render({
- elem: '#demo',
- width: 300,
- page: {
- elem: '#demo',
- layout: ['prev', 'page', 'next', 'count']
- },
- url: 'http://192.168.0.40:8081/reportTable/getAutoChReportTable',
- where: {
- autoTableId: id
- },
- text: {
- none: '暂无数据' //默认:无数据。
- },
- cols: [
- [{
- field: 'reportTableName',
- title: null,
- width: 300
- }]
- ],
- parseData: function(res) {
- return {
- "code": 0,
- "msg": res.msg,
- "count": res.data.count,
- "data": res.data.reportTableList
- };
- }
- });
- //触发行单击事件
- table.on('row(test)', function(obj) {
- const id = obj.data.id
- const title = obj.data.reportTableName
- uni.navigateTo({
- url: `/pages/reportForm/report-detail/recordDetail?id=${id}&title=${title}`
- })
- });
- $('th').hide()
- });
- })
- });
- });
- </script>
- </body>
- </html>
|