提交修改

master
dsh 1 year ago
parent 02ead4b8eb
commit d0379bf9b5

@ -13,12 +13,15 @@
padding: 0; padding: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color:#f1eded;
} }
/* 设置内容区域自动填充剩余高度 */ /* 设置内容区域自动填充剩余高度 */
#content { #content {
flex-grow: 1; flex-grow: 1;
padding-bottom: 70px; //padding-bottom: 70px;
display: flex;
height: 100%;
} }
/* 页脚样式 */ /* 页脚样式 */
@ -38,7 +41,7 @@
#search_form { #search_form {
position: absolute; position: absolute;
top: 50px; top: 92px;
right: 50px; right: 50px;
display: flex; display: flex;
} }
@ -68,13 +71,30 @@
position: absolute; position: absolute;
right: 0; right: 0;
} }
#ID-tree-demo-onlyIconControl{
width: 15%;
//padding: 27px;
box-sizing: border-box;
padding-top: 74px;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
background-color: #c4c4c4;
}
.layui-tree-txt {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 175px;
}
</style> </style>
</head> </head>
<body class="layui-bg-gray" style=""> <body class="layui-bg-gray" style="">
<div id="content"> <div id="content">
<div class="layui-container" style="padding-top: 7px"> <div id="ID-tree-demo-onlyIconControl"></div>
<div class="layui-container" style="padding-top: 7px;margin:0;width:100%;">
<div> <div>
<blockquote class="layui-elem-quote"> <blockquote class="layui-elem-quote" style="margin-top: -7px;border:none;background-color:#c4c4c4;">
<h2>知识库查询</h2> <h2>知识库查询</h2>
</blockquote> </blockquote>
<br> <br>
@ -129,8 +149,56 @@
</div> </div>
</div> </div>
<script th:src="@{/home/lib/layui.js}"></script> <script th:src="@{/home/lib/layui.js}"></script>
<script th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript"> <script type="text/javascript">
layui.use(function(){
var tree = layui.tree;
var layer = layui.layer;
// 数据
var data = [];
$.ajax({
type: "get",
url: "/getTree",
data: {},
success: function(res) {
//初始展开根节点
var processedData = res.map(function(node) {
node.spread = false;
return node;
});
processedData[0].spread = true;
processedData[1].spread = true;
// AJAX 请求成功后渲染树组件
renderTree(processedData);
}
});
// 渲染树组件的函数
function renderTree(data) {
tree.render({
elem: '#ID-tree-demo-onlyIconControl',
data: data,
customName: {
id: 'id',
title: 'categoryname',
children: 'children'
},
onlyIconControl: true, // 是否仅允许节点左侧图标控制展开收缩
click: function(obj){
queryParams(obj)
}
});
// 添加 title 效果
$('#ID-tree-demo-onlyIconControl').on('mouseenter', '.layui-tree-main', function() {
this.title = this.innerText;
});
}
});
function queryParams(data) {
setTimeout(function() {
window.location.href = "/home?categoryid=" + data.data.id;
}, 100); // 延迟 100 毫秒执行跳转
};
function queryList(){ function queryList(){
var kname = $("#kname").val(); var kname = $("#kname").val();
if (kname){ if (kname){

@ -1,7 +1,7 @@
<div th:fragment="search_page"> <div th:fragment="search_page">
<head> <head>
<style> <style>
.pag {text-align:center} .pag {text-align: right;padding-right: 81px;}
.pag .num{color: red;} .pag .num{color: red;}
</style> </style>
</head> </head>

Loading…
Cancel
Save