btxtgxq-system-city/src/main/resources/static/route/community/list-tree.html

102 lines
3.8 KiB
HTML
Raw Normal View History

2021-06-15 18:23:48 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/servicecity/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="assets/js/vendor/zTree3/css/metroStyle/metroStyle.css"/>
<link rel="stylesheet" href="assets/layuiadmin/style/common.css" media="all">
2023-10-27 17:44:11 +08:00
<style>
.street {border: 1px solid #EEEEEE; padding: 10px; margin-bottom: 10px; text-align: center; cursor: pointer;}
.street.active {background-color: #1e9fff; color: #FFF;}
</style>
2021-06-15 18:23:48 +08:00
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row layui-col-space15">
2023-10-27 17:44:11 +08:00
<div class="layui-col-md2">
2021-06-15 18:23:48 +08:00
<div class="layui-card">
2023-10-27 17:44:11 +08:00
<div class="layui-card-body" id="streetContainer"></div>
</div>
</div>
<div class="layui-col-md10">
<div class="layui-card">
<div class="layui-card-body" id="listContainer">
<iframe id="listContent" frameborder="0" class="layadmin-iframe"></iframe>
2021-06-15 18:23:48 +08:00
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
var common;
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'ztree', 'common'], function() {
common = layui.common;
var $ = layui.$;
var $win = $(window);
var resizeTimeout = null;
2023-10-27 17:44:11 +08:00
var renderIFrame = function(areaId, areaName) {
$('#listContent').attr('src', top.restAjax.path('route/community/list.html?areaId={areaId}&areaName={areaName}', [areaId, encodeURI(areaName)]))
}
var renderStreet = function() {
top.restAjax.get(top.restAjax.path('api/dict/listztreedict?id={id}', ['9d179f05-3ea0-48f7-853c-d3b7124b791c']), {
isHide: 0
}, null, function(code, data) {
var divs = ''
$.each(data, function(index, item) {
divs += `<div class="street ${index === 0 ? 'active' : ''}" data-id="${item.id}">${item.name}</div>`;
});
var $streetContainer = $('#streetContainer');
$streetContainer.empty();
$streetContainer.append(divs);
renderIFrame(data[0].id, data[0].name);
}, function(code, data) {
top.DialogBox.msg(data.msg);
})
}
2021-06-15 18:23:48 +08:00
// 初始化大小
2023-10-27 17:44:11 +08:00
var initSize = function() {
$('#streetContainer').css({
height: $win.height() - 50,
2021-06-15 18:23:48 +08:00
overflow: 'auto'
});
2023-10-27 17:44:11 +08:00
$('#listContainer').css({
2021-06-15 18:23:48 +08:00
height: $win.height() - 50,
});
}
// 初始化树
initSize();
2023-10-27 17:44:11 +08:00
renderStreet();
$(document).on('click', '.street', function(e) {
var id = this.dataset.id;
var name = this.dataset.name;
$('.street').removeClass('active');
$(this).addClass('active');
renderIFrame(id, this.innerHTML);
})
2021-06-15 18:23:48 +08:00
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
initSize();
}, 500);
});
});
</script>
</body>
</html>