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.
 
 
 
 
 
 

208 lines
6.4 KiB

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<script src="/js/guid.js"></script>
<script type="text/javascript" src="../js/notice/xm-select.js"></script>
<script type="text/javascript" src="../js/load_realmlist.js"></script>
<!--#include file="/widget/head.html"-->
</head>
<body class="layui-layout-body" layadmin-themealias="default">
<div id="wrapper" class="layui-fluid">
<!--#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">
<div class="layui-card-header">
<h2>服务器配置查询</h2>
</div>
<div class=" layui-form layui-row layui-col-space10">
<div class="layui-col-md10">
<div class="col-md-1">
<label for="path">区域:</label>
</div>
<div class="form-group col-md-2">
<select class="layui-select" id="path" lay-search="" lay-filter="path-filter"></select>
</div>
<div class="col-md-1">
<label for="subPath">进程:</label>
</div>
<div class="form-group col-md-2">
<select class="form-control" id="subPath" lay-search="" lay-filter="subpath-filter"></select>
</div>
<div class="col-md-1">
<label for="fileName">文件名:</label>
</div>
<div class="form-group col-md-3">
<select class="form-control" id="fileName" lay-search="" lay-filter="file-filter"></select>
</div>
<button type="button" class=" layui-btn " id="sele">查询</button>
</div>
</div>
<div class="layui-card-body layui-col-md10">
<pre id='preId' class="layui-code" style="white-space: pre-line;"></pre>
<div id="dataTableDiv">
<table class="layui-table" id="dataTable"></table>
</div>
</div>
</div>
</div>
</div>
<!--#include file="/widget/tail.html"-->
<script type="text/javascript">
var patchs;
var subPatchs;
var fileList;
var form = layui.form;
$("#sele").click(function () {
LoadContext(tempPath, tempSbuPath, tempFile);
});
function LoadContext(patch, subpatch, fileName) {
var loadIndex = layer.load(0);
let timeout = true;
setTimeout(() => {
layer.close(loadIndex)
if (timeout) {
layer.msg("request timeout");
}
}, 5000);
$.get(Page.SvrIp + "/api/select_server_cfg",
{
token: cookie.get("token"),
fileName: fileName,
path: patch,
subPatch: subpatch,
},
function (data) {
timeout = false;
layer.close(loadIndex)
if (patch == '') {
patchs = data.paths;
InitPatchs()
}
if (subpatch == '') {
subPatchs = data.subPatch;
InitSubPatchs()
}
if (fileName == '') {
fileList = data.fileList;
if (fileList != undefined) {
InitFileList();
}
}
if (data.code == 0) {
$("#preId").show();
if (data.context != undefined) {
document.getElementById('preId').innerHTML = data.context;
}
} else {
layer.alert('输入错误,请检查', {icon: 2});
$("#preId").val('');
}
}
);
}
function InitPatchs() {
let str = ""
for (const key in patchs) {
let op = patchs[key];
str += '<option value="' + op + '">' + op + '</option>'
if (key == 0) {
tempPath = op;
}
}
$("#path").html('');
$("#path").append(str);
//InitSubPatchs();
form.render()
}
function InitSubPatchs() {
let str = ""
for (const key in subPatchs) {
let op = subPatchs[key];
str += '<option value="' + op + '">' + op + '</option>'
if (key == 0) {
tempSbuPath = op;
}
}
$("#subPath").html('');
$("#subPath").append(str);
layui.form.render()
}
function InitFileList() {
let str = ""
for (const key in fileList) {
let op = fileList[key];
str += '<option value="' + op + '">' + op + '</option>'
if (key == 0) {
tempFile = op;
}
}
$("#fileName").html('');
$("#fileName").append(str);
layui.form.render()
}
let tempPath;
let tempSbuPath;
let tempFile;
layui.use(function () {
// select 事件
form.on('select(path-filter)', function (data) {
var elem = data.elem; // 获得 select 原始 DOM 对象
var value = data.value; // 获得被选中的值
tempPath = value;
var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象
LoadContext(value, '', '');
});
form.on('select(subpath-filter)', function (data) {
var elem = data.elem; // 获得 select 原始 DOM 对象
var value = data.value; // 获得被选中的值
tempSbuPath = value;
var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象
LoadContext(tempPath, value, '');
});
form.on('select(file-filter)', function (data) {
var elem = data.elem; // 获得 select 原始 DOM 对象
var value = data.value; // 获得被选中的值
tempFile = value;
var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象
LoadContext(tempPath, tempSbuPath, value);
});
});
$(function () {
LoadContext('', '', '');
});
</script>
<script src="../js/coupon.js"></script>
</div>
</body>
</html>