You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

190 lines
5.5 KiB

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<!--#include file="/widget/head.html"-->
</head>
<body class="layui-layout-body" layadmin-themealias="default">
<div id="wrapper">
<!--#include file="/widget/nav.html"-->
<div id="page-wrapper" class="layui-body layadmin-tabsbody-item layui-show layui-fluid layui-row layui-col-space15">
<div class="layui-card" id="card-page-wrapper">
<div class="row">
<div class="container" style="margin-left: 15px" id="filter">
<div class="layui-form">
<div class="layui-col-md3">
<label for="select">表名字</label><select id="select" lay-search lay-filter ></select>
</div>
<div class="layui-col-md3">
<label for="subKey">字段名</label> <select id="subKey" lay-search lay-filter></select>
</div>
<div class="layui-col-md3">
<label for="value">字段值</label>
<input type="text" name="value" id="value" placeholder="查询值" lay-affix="clear" class="layui-input">
</div>
<div class="layui-col-md3">
<button name="byf" class="layui-btn" lay-submit lay-filter="demo-table-search" onclick="Search()" style="margin-top: 25px">
立刻查询
</button>
</div>
</div>
</div>
</div>
<div class="row table-responsive" id="form" style="width:90%">
<table class="table table-striped table-bordered table-hover inline" id="hero_table">
</table>
<div id="test1"></div>
</div>
</div>
</div>
</div>
<script id="btn" type="text/template">
</script>
<!--#include file="/widget/tail.html"-->
<script type="text/javascript">
var m_limit = 0;
var herotable;
var exchange_data;
var form = layui.form
var columns=[];
function Search() {
Select_data(1, 20, 0)
}
function ini_page(data) {
layui.laypage.render({
elem: 'test1',
count: data.count,
limits: [10, 20, 30, 40, 50, 80, 100],
limit: 20,
layout: ["count", "prev", "page", "next", "limit", "skip"],
jump: function (obj, first) {
if (!first) {
Select_data(obj.curr, obj.limit, 0);
}
}
});
}
function inihero_table(data, limit) {
var fds = new Array();
debugger
if (data == undefined) {
return;
}
if (data.length > 0) {
head = data[0];
var keys = Object.keys(head)
columns=[];
for (i = 0; i < keys.length; i++) {
fds.push({field: keys[i], title: keys[i], width: 120, sort: true})
columns.push( keys[i])
}
ReloadSubKey();
}
m_limit = limit;
herotable = layui.table.render({
elem: '#hero_table',
page: true,
data: data,
// width: 1300,
// height: 1100,
autoSort: true,
limit: limit,
cols: [fds],
// skin: 'line', // 表格风格
even: true,
});
}
function getLocalTime(nS) {
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
}
function Select_data(page, limit, first) {
debugger
$.ajax({
type: "GET",
url: Page.SvrIp + "/api/select_game_data",
data: {
token: cookie.get("token"),
page: page,
limit: limit,
name: $("#select").val(),
targetKey: $("#subKey").val(),
targetValue: $("#value").val(),
},
dataType: "json",
beforeSend: function () {
layer.load(1, {shade: [0.8, '#393D49']});
},
complete: function () {
layer.closeAll('loading');
},
success: function (d) {
debugger;
exchange_data = d.data; //JSON.parse(d.data);
inihero_table(exchange_data, limit);
if (first === 1) {
ini_page(d);
}
}
});
}
$(function () {
initPage('游戏数值查询');
Select_data(1, 20, 1);
Load_Tablesist();
});
var tableList;
function Load_Tablesist() {
$.get(Page.SvrIp + "/api/select_game_table",
{token: cookie.get("token")}
, function (d) {
tableList = d.data;
var html="";
for (const tableListKey in tableList) {
html+='<option value="' + tableList[tableListKey] + '">' + tableList[tableListKey] + '</option>';
}
$('#select').html(html);
form.render();
});
}
function ReloadSubKey(){
var html="";
$('#subKey').html('')
for (const tableListKey in columns) {
html+='<option value="' + columns[tableListKey] + '">' + columns[tableListKey] + '</option>';
}
$('#subKey').html(html);
form.render();
}
</script>
<script src="../js/coupon.js"></script>
</body>
</html>