|
|
|
@ -29,8 +29,8 @@
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
<form class="layui-form" action="">
|
|
|
|
|
<body class="layui-form">
|
|
|
|
|
|
|
|
|
|
<div class="layui-card">
|
|
|
|
|
<div class="layui-card-body">
|
|
|
|
|
<div class="layui-form-item layui-inline">
|
|
|
|
@ -68,7 +68,7 @@
|
|
|
|
|
<table class="layui-table" id="myTable"></table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script src="../../../component/layui/layui.js"></script>
|
|
|
|
@ -84,6 +84,8 @@
|
|
|
|
|
var form = layui.form;
|
|
|
|
|
var laytpl = layui.laytpl;
|
|
|
|
|
|
|
|
|
|
var xmSelectData = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
@ -143,6 +145,7 @@
|
|
|
|
|
async: false,
|
|
|
|
|
url: '/QingLong/zbdc/getKmFeiLeiTree?km_code=xxty',
|
|
|
|
|
success: function (res) {
|
|
|
|
|
xmSelectData = res.data;
|
|
|
|
|
fenleiSelect.update({
|
|
|
|
|
data: res.data
|
|
|
|
|
});
|
|
|
|
@ -150,6 +153,46 @@
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function findNodeAndParents(levelName) {
|
|
|
|
|
function search(node, path) {
|
|
|
|
|
const newPath = [...path, node.level_name];
|
|
|
|
|
if (node.level_name === levelName) {
|
|
|
|
|
return newPath;
|
|
|
|
|
}
|
|
|
|
|
if (node.children) {
|
|
|
|
|
for (const child of node.children) {
|
|
|
|
|
const result = search(child, newPath);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
for (const root of xmSelectData) {
|
|
|
|
|
const result = search(root, []);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
form.on('submit(user-query)', function () {
|
|
|
|
|
|
|
|
|
|
var selectArr = fenleiSelect.getValue();
|
|
|
|
|
console.log(selectArr[0].level_name);
|
|
|
|
|
|
|
|
|
|
const levelName = "少儿(趣味)田径";
|
|
|
|
|
const result = findNodeAndParents(levelName);
|
|
|
|
|
console.log(result.join(','));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 阻止表单的默认提交行为
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table.render({
|
|
|
|
|