123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826 |
- <!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>报表详情</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;
- }
- .model {
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.3);
- position: fixed;
- z-index: 9999;
- }
- .table-box {
- width: 300px;
- height: 300px;
- background: #ffffff;
- margin: auto;
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- padding: 10px;
- overflow-y: auto;
- }
- .head {
- display: flex;
- justify-content: flex-end;
- font-size: 20px;
- font-weight: bold;
- color: #000000;
- }
- .cel {
- cursor: pointer;
- }
- #table {
- width: 100%;
- margin-top: 20px;
- font-size: 18px;
- }
- #table tr {
- width: 100%;
- height: 30px;
- }
- #table td {
- border-bottom: 1px solid #000000;
- border-top: 1px solid #000000;
- padding: 5px;
- }
- .layui-layer-title {
- text-align: center;
- font-size: 16px;
- padding: 0 81px;
- }
- .layui-layer {
- top: 70 !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="model" style="display: none;">
- <div class="table-box">
- <div class="head"> -->
- <!-- <div>运行记录</div> -->
- <!-- <div class="cel">×</div>
- </div>
- <table id="table">
- <tr>
- <th>
- 运行内容
- </th>
- </tr>
- </table>
- </div>
- </div> -->
- <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>
- <script src="./plugins/exceljs.min.js"></script>
- <script src="./plugins/excelopput.js"></script>
- <script src="./plugins/echarts.js"></script>
- <!-- <script src="./echarts.js"></script> -->
- <script src="./cqcyCode.js"></script>
- <script src="./canvertChart.js"></script>
- <!-- uni 的 SDK -->
- <script src="./wvIP.js"></script>
- <script src="./plugins/axios.min.js"></script>
- <script type="text/javascript" src="../luckysheet/dist/plugins/js/uni-webview-js0.0.3_index.js"></script>
- <Script>
- function GetQueryString(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
- var context = "";
- if (r != null)
- context = decodeURIComponent(r[2]);
- reg = null;
- r = null;
- return context == null || context == "" || context == "undefined" ? "" : context;
- }
- </Script>
- <script>
- $(function() {
- document.addEventListener('UniAppJSBridgeReady', function() {
- uni.getEnv(function(res) {
- console.log('当前环境:' + JSON.stringify(res));
- window.sessionName = 'device_report_index'
- sessionStorage.removeItem(window.sessionName)
- const id = GetQueryString('id')
- const baseUrl = "http://192.168.0.12:8081"
- // const baseUrl = window.location.origin
- axios.defaults.baseURL = baseUrl
- var reportTableName
- axios.get('/reportTable/getReportTableById?id=' + id)
- .then(res => {
- console.log(res, 'res');
- const data = res.data
- if (data.code === 200) {
- // 报表数据
- let tableData = JSON.parse(data.data.reportTableData)
- let option = tableData.option
- // 基础数据项值
- let baseItem = tableData.baseItem
- // 数据项
- let reportTableItemList = data.data.reportTableItemList
- let reportChartList = data.data.reportChartList
- // 报表类型
- let reportTableType = data.data.reportTableType
- //报表名
- reportTableName = data.data.reportTableName
- let luckysheetOption = {
- container: 'luckysheet', // 设定 DOM 容器的 id
- title: '报表模板', // 设定表格名称
- lang: 'zh', // 设定表格语言
- showinfobar: false, // 是否显示顶部信息栏
- showtoolbar: false, // 是否显示工具栏
- showtoolbarConfig: {
- paintFormat: true, //格式刷
- moreFormats: true, // 单元格格式
- font: true, // 字体
- fontSize: true, // 字号大小
- bold: true, // 粗体 (Ctrl+B)
- italic: true, // 斜体 (Ctrl+I)
- strikethrough: true, // 删除线 (Alt+Shift+5)
- underline: true, // 下划线 (Alt+Shift+6)
- textColor: true, // 文本颜色
- fillColor: true, // 单元格颜色
- border: true, // 边框
- mergeCell: true, // 合并单元格
- horizontalAlignMode: true, // 水平对齐方式
- verticalAlignMode: true, // 垂直对齐方式
- function: true, // 公式
- // image: true
- // chart: true
- },
- showsheetbar: false, // 是否显示底部 sheet 页按钮
- sheetFormulaBar: false, // 是否显示公式
- row: 120, // 是否显示底部 sheet 页按钮
- data: [{
- "name": "统计报表", //工作表名称
- }],
- cellRightClickConfig: { // 自定义配置单元格右击菜单
- copy: true, // 复制
- copyAs: false, // 复制为
- paste: true, // 粘贴
- insertRow: true, // 插入行
- insertColumn: true, // 插入列
- deleteRow: true, // 删除选中行
- deleteColumn: true, // 删除选中列
- deleteCell: false, // 删除单元格
- hideRow: false, // 隐藏选中行和显示选中行
- hideColumn: false, // 隐藏选中列和显示选中列
- rowHeight: true, // 行高
- columnWidth: true, // 列宽
- clear: false, // 清除内容
- matrix: false, // 矩阵操作选区
- sort: false, // 排序选区
- filter: false, // 筛选选区
- chart: true, // 图表生成
- image: false, // 插入图片
- link: false, // 插入链接
- data: false, // 数据验证
- cellFormat: false // 设置单元格格式
- },
- plugins: ['chart']
- }
- if (!option) {
- option = JSON.parse(JSON.stringify(luckysheetOption))
- }
- option.data = tableData.data
- // 设置工作表保护
- // option.data[0].config.authority = {
- // sheet: 1, // 如果为 1 或 true,则该工作表受到保护;如果为 0 或 false,则该工作表不受保护。
- // hintText: '该工作表受到保护,无法操作', // 弹窗提示的文字
- // }
- // 关闭右键菜单
- option.cellRightClickConfig.chart = false
- option.cellRightClickConfig.columnWidth = false
- option.cellRightClickConfig.rowHeight = false
- option.cellRightClickConfig.deleteColumn = false
- option.cellRightClickConfig.deleteRow = false
- option.cellRightClickConfig.insertColumn = false
- option.cellRightClickConfig.insertRow = false
- // 关闭工具栏
- option.showtoolbar = false
- option.enableAddRow = false
- option.showtoolbarConfig = {
- bold: false,
- border: false,
- fillColor: false,
- font: false,
- fontSize: false,
- function: false,
- horizontalAlignMode: false,
- italic: false,
- mergeCell: false,
- moreFormats: false,
- paintFormat: false,
- strikethrough: false,
- textColor: false,
- underline: false,
- verticalAlignMode: false
- }
- // 钩子函数
- option.hook = {
- workbookCreateAfter() {
- // // 图表操作
- // let arr = [];
- // for (let i in reportChartList) {
- // const item = insertEChartInfo(reportChartList[
- // i]);
- // arr.push(item)
- // }
- // // 绘制基础数据项
- // drawBaseInfo(baseItem)
- // // 绘制数据值
- // drawTableData(reportTableItemList,
- // reportTableType, data.data)
- // luckysheet.setRangeShow('BH1')
- // setTimeout(function() {
- // convertChart(tableData)
- // }, 3000)
- // printExcel()
- // //转换Excel并下载
- // setTimeout(function() {
- // exportSheetExcel(luckysheet
- // .getAllSheets(), arr,
- // reportTableName)
- // }, 800)
- }
- }
- luckysheet.create(option)
- } else {
- }
- })
- function printExcel() {
- let currentSelected = luckysheet.getRange()
- luckysheet.hideGridLines()
- // 如果当前选中区只是一个单元格,则认为选取无效。
- if (currentSelected[0] != null &&
- (currentSelected[0].row[1] - currentSelected[0].row[0] >= 1 ||
- currentSelected[0].column[1] - currentSelected[0].column[0] >= 1)) {
- // 生成base64图片
- //let imgSrc = luckysheet.getScreenshot();
- setTimeout(() => {
- luckysheet.getScreenshotNew((imgSrc) => {
- // console.info('printImg', imgSrc)
- // top.document.write(`<img src='${imgSrc}'/>`)
- luckysheet.showGridLines();
- })
- }, 200)
- } else {
- // 获取打印区域的行列
- let RowColumn = getPrintSheetArea();
- // 因需要打印左边的边框,需重新设置第一列
- //RowColumn.column[0] = 0;
- // 进行选区操作
- // luckysheet.setRangeShow(RowColumn);
- const cellData = handelCell(luckysheet.getAllSheets()[0].celldata)
- let {
- minR,
- maxR,
- minC,
- maxC
- } = cellData
- var urlType = GetQueryString('printArea')
- if (urlType) {
- if (urlType === '1') {
- luckysheet.setRangeShow({
- row: [0, maxR],
- column: [0, maxC]
- });
- } else {
-
- luckysheet.setRangeShow(GetQueryString('printAreaValue'))
- }
- } else {
- luckysheet.setRangeShow({
- row: [0, maxR],
- column: [0, maxC]
- });
- }
- // let imgSrc = luckysheet.getScreenshot(); // 生成base64图片
- // console.log(imgSrc);
- setTimeout(() => {
- luckysheet.getScreenshotNew((imgSrc) => {
- // console.info('printImg', imgSrc)
- // top.document.write(`<img src='${imgSrc}'/>`)
- luckysheet.showGridLines();
- })
- }, 800)
- }
- }
- function handelCell(data) {
- let minR = data[0].r
- let maxR = data[data.length - 1].r
- let minC = data[0].c
- let cData = data.map(item => {
- return item.c
- })
- let maxC = cData.sort(function(a, b) {
- return b - a;
- })[0];
- return {
- minR,
- maxR,
- minC,
- maxC
- }
- }
- function getPrintSheetArea() {
- const sheetData = luckysheet.getSheetData();
- let objRowColumn = {
- row: [0, 0], //行
- column: [0, 0], //列
- };
- // * item是行、index是行索引、it是一行里的一格、itemIndex是这一格在这一行里的列索引
- sheetData.forEach((item, index) => {
- //行数
- item.forEach((it, itemIndex) => {
- if (it !== null && it.v) {
- // console.log(index, it)
- if (objRowColumn.row[1] < index) {
- objRowColumn.row[1] = index; //row第二位
- }
- if (objRowColumn.column[1] < itemIndex) {
- objRowColumn.column[1] =
- itemIndex; //column第二位
- }
- }
- });
- });
- return objRowColumn;
- }
- /** 绘制表格数据 */
- function drawTableData(tableItemList, type, tableInfo) {
- if (!tableItemList || tableItemList.length == 0) {
- updateLocalExcelContent()
- return
- }
- // 事件驱动报表
- if (type == 2 || type == 4) {
- tableItemList.forEach((tableItem, i) => {
- if (i == 0) {
- let valueTimeList = tableItem.valueTimeList ? tableItem
- .valueTimeList.split(',') : []
- valueTimeList = withDateFormatLength(valueTimeList)
- let xAxis = tableItem.xaxis
- let yAxis = tableItem.yaxis - 1
- if (valueTimeList.length == 0) {
- luckysheet.setCellValue(xAxis, yAxis, '')
- } else {
- valueTimeList.forEach((v, j) => {
- luckysheet.setCellValue(xAxis + j, yAxis,
- v)
- })
- }
- }
- let valueList = tableItem.valueList ? tableItem.valueList
- .split(',') : []
- let xAxis = tableItem.xaxis
- let yAxis = tableItem.yaxis
- if (valueList.length == 0) {
- luckysheet.setCellValue(xAxis, yAxis, '')
- } else {
- valueList.forEach((v, j) => {
- luckysheet.setCellValue(xAxis + j, yAxis,
- v)
- })
- }
- })
- updateLocalExcelContent()
- return
- }
- // 设备报表
- if (type == 5 || type == 6) {
- tableItemList.forEach((tableItem, i) => {
- let standby = tableItem.standby ? JSON.parse(tableItem
- .standby) : {}
- let dataIndex = standby.index != null ? standby.index : -1
- let valueList = tableItem.valueList ? tableItem.valueList
- .split(',') : []
- let xAxis = tableItem.xaxis
- let yAxis = tableItem.yaxis
- // 序号、时间处理
- if (tableItem.timeItemType == 0) { // 序号、开始时间
- let valueIndexList = tableItem.valueIndexList ? tableItem
- .valueIndexList.split(',') : []
- deviceReportUpdateData('${index}', valueIndexList, false)
- let valueTimeList = tableItem.valueTimeList ? tableItem
- .valueTimeList.split(',') : []
- valueTimeList = withDateFormatLength(valueTimeList)
- deviceReportUpdateData('${startTime}', valueTimeList,
- false)
- }
- if (tableItem.timeItemType == 1) { // 结束时间
- let valueTimeList = tableItem.valueTimeList ? tableItem
- .valueTimeList.split(',') : []
- valueTimeList = withDateFormatLength(valueTimeList)
- deviceReportUpdateData('${stopTime}', valueTimeList,
- tableInfo.isGenCountTime == 1)
- }
- if (valueList.length == 0) {
- luckysheet.setCellValue(xAxis, yAxis, '')
- } else {
- valueList.forEach((v, j) => {
- luckysheet.setCellValue(xAxis + j, yAxis, v)
- })
- }
- })
- updateLocalExcelContent()
- return
- }
- // 其余报表信息
- tableItemList.forEach((tableItem, i) => {
- // let standby = tableItem.standby ? JSON.parse(tableItem.standby) :
- // {}
- // let dataIndex = standby.index != null ? standby.index : -1
- let valueList = tableItem.valueList ? tableItem.valueList.split(
- ',') : []
- // let val = (dataIndex == -1 || (dataIndex + 1) > valueList
- // .length) ?
- // cqcyCode['invalidData'] : valueList[dataIndex]
- let xAxis = tableItem.xaxis
- let yAxis = tableItem.yaxis
- if (valueList.length == 0) {
- luckysheet.setCellValue(xAxis, yAxis, '')
- } else {
- valueList.forEach((v, j) => {
- luckysheet.setCellValue(xAxis + j, yAxis, v)
- })
- }
- })
- updateLocalExcelContent()
- }
- /** 设备报表时间特殊处理 */
- function deviceReportUpdateData(field, dataList, hasCalc) {
- let indexPos = sessionStorage.getItem(window.sessionName)
- if (indexPos) {
- let pos = indexPos.split(',')
- if (field == '${index}') {
- let yAxis = parseInt(pos[0])
- let xAxis = parseInt(pos[1])
- dataList.forEach((v, j) => {
- luckysheet.setCellValue(yAxis + j, xAxis, j + 1)
- })
- } else if (field == '${startTime}') {
- let yAxis = parseInt(pos[0])
- let xAxis = parseInt(pos[1]) + 1
- dataList.forEach((v, j) => {
- luckysheet.setCellValue(yAxis + j, xAxis, v)
- })
- } else if (field == '${stopTime}') {
- let yAxis = parseInt(pos[0])
- let xAxis = parseInt(pos[1]) + 2
- dataList.forEach((v, j) => {
- luckysheet.setCellValue(yAxis + j, xAxis, v)
- if (hasCalc) {
- let startDate = luckysheet.getCellValue(yAxis + j,
- xAxis - 1)
- let minutes = calculateMinutes(startDate, v)
- luckysheet.setCellValue(yAxis + j, xAxis + 1,
- minutes)
- }
- })
- }
- return
- }
- let option = luckysheet.getAllSheets()[0]
- option.celldata.map(item => {
- if (item.v.v) {
- item.v.v = String(item.v.v).trim()
- // 替换${xxx}内部数据
- if (item.v.v.match(/\${([^}]+)}/g)) {
- if (item.v.v.indexOf(field) > -1) {
- let yAxis = item.r
- let xAxis = item.c
- if (field == '${index}') {
- sessionStorage.setItem(window.sessionName,
- yAxis + ',' + xAxis)
- dataList.forEach((v, j) => {
- luckysheet.setCellValue(yAxis + j,
- xAxis, j + 1)
- })
- } else {
- dataList.forEach((v, j) => {
- luckysheet.setCellValue(yAxis + j,
- xAxis, v)
- if (hasCalc) {
- let startDate = luckysheet
- .getCellValue(yAxis + j,
- xAxis - 1)
- let minutes = calculateMinutes(
- startDate, v)
- luckysheet.setCellValue(yAxis +
- j, xAxis + 1, minutes)
- }
- })
- }
- }
- }
- }
- })
- }
- /** 删除不合理数据值 */
- function updateLocalExcelContent() {
- let option = luckysheet.getAllSheets()[0]
- option.celldata.map(item => {
- if (item.v.v) {
- item.v.v = String(item.v.v).trim()
- // 替换${xxx}内部数据
- if (item.v.v.match(/\${([^}]+)}/g)) {
- luckysheet.setCellValue(item.r, item.c, '')
- }
- }
- })
- }
- /** 计算分钟数 */
- function calculateMinutes(time1, time2) {
- // 将时间字符串转换为Date对象
- let date1 = new Date(time1);
- let date2 = new Date(time2);
- // 计算时间差(以毫秒为单位)
- let diffInMilliseconds = Math.abs(date2.getTime() - date1.getTime());
- // 将时间差转换为分钟
- let minutes = Math.floor(diffInMilliseconds / 1000 / 60);
- return minutes;
- }
- /** 绘制基础数据项布局信息 */
- function drawBaseInfo(baseData) {
- if (!baseData) return
- let option = luckysheet.getAllSheets()[0]
- option.celldata.map(item => {
- if (item.v.v) {
- item.v.v = String(item.v.v).trim()
- if (item.v.v.match(/\${([^}]+)}/g)) { // 替换${xxx}内部数据
- if (item.v.v.indexOf('${currDate}') > -1) {
- let val = item.v.v
- val = val.replace('${currDate}', baseData.currDate)
- luckysheet.setCellValue(item.r, item.c, val)
- }
- if (item.v.v.indexOf('${currDateTime}') > -1) {
- let val = item.v.v
- val = val.replace('${currDateTime}', baseData
- .currDateTime)
- luckysheet.setCellValue(item.r, item.c, val)
- }
- if (item.v.v.indexOf('${userName}') > -1) {
- let val = item.v.v
- val = val.replace('${userName}', baseData.userName)
- luckysheet.setCellValue(item.r, item.c, val)
- }
- if (item.v.v.indexOf('${winUserName}') > -1) {
- let val = item.v.v
- val = val.replace('${winUserName}', baseData
- .winUserName)
- luckysheet.setCellValue(item.r, item.c, val)
- }
- }
- }
- })
- }
- function withDateFormatLength(listDate) {
- if (!listDate || listDate.length == 0) {
- return []
- }
- let arr = []
- listDate.forEach((date) => {
- arr.push(date.substring(0, 19))
- })
- return arr
- }
- /** 向 Excel 插入图表 */
- function insertEChartInfo(chart) {
- let _self = this
- let info = JSON.parse(chart.standby)
- let reportChartItemList = chart.reportChartItemList
- let chartType = chart.chartType
- // 系列
- let series = info.option.series
- for (let i in series) {
- let temp = series[i]
- temp.data = []
- for (let j in reportChartItemList) {
- let _name = reportChartItemList[j].describe ?
- reportChartItemList[j].describe : reportChartItemList[j]
- .itemName
- if (chartType == 'pie') {
- info.option.legend = null
- info.option.tooltip = {
- trigger: 'item',
- formatter: '{b0}<br /> <b>{c0}</b>'
- }
- temp.name = _name
- let names = reportChartItemList[i].valueTimeList ?
- reportChartItemList[i].valueTimeList.split(',') : [];
- names = withDateFormatLength(names);
- let vals = reportChartItemList[i].valueList ?
- reportChartItemList[i].valueList.split(',') : [];
- names.forEach((name, j) => {
- temp.data.push({
- 'name': name,
- 'value': vals[j]
- })
- })
- } else {
- let _t = []
- let t = reportChartItemList[i].valueList ?
- reportChartItemList[i].valueList.split(',') : []
- t.forEach((temp) => {
- _t.push(parseFloat(temp))
- })
- temp.data = _t
- }
- }
- }
- if (chartType != 'pie') {
- // x 轴
- let xAxis = info.option.xAxis
- let legend = info.option.legend
- // xAxis.data = []
- legend.data = []
- let axisLabel = {};
- axisLabel.rotate = 20;
- xAxis.axisLabel = axisLabel
- let times = (reportChartItemList[0].valueTimeList) ? reportChartItemList[
- 0].valueTimeList.split(",") : []
- xAxis.data = (reportChartItemList && reportChartItemList.length > 0) ?
- withDateFormatLength(times) : []
- // xAxis.data = xAxis.data.slice(0, 7)
- for (let i in reportChartItemList) {
- let name = reportChartItemList[i].describe ? reportChartItemList[i]
- .describe : reportChartItemList[i].itemName
- // xAxis.data.push(name)
- legend.data.push(name)
- }
- }
- var images;
- const sheet = luckysheet.getLuckysheetfile()[0]
- let optionData = sheet.data
- try {
- let flag = false
- images = insertLuckysheetEChart({
- selector: '#luckysheet',
- info,
- sheet,
- optionData,
- echarts,
- luckysheet,
- $,
- _self,
- flag
- })
- } catch (e) {
- console.log(999, e == 'echarts is not defined')
- console.error(e)
- }
- return images;
- }
- $('#recordBtn').on('click', () => {
- $('.model').show()
- const token = window.localStorage.getItem('C_TOKEN')
- layui.use('table', function() {
- var table = layui.table;
- var layer = layui.layer;
- layer.open({
- type: 1,
- title: '运行记录',
- content: $('#demo'),
- offset: ['30px', '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: baseUrl+'/reportTable/getAutoChReportTable',
- headers: {
- token: token
- },
- 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>
|