main
HuangHai 3 weeks ago
parent bed8cbc4e0
commit 5c4fe533c1

@ -48,6 +48,20 @@
margin-right: 5px;
}
#treeTable th:nth-child(4), #treeTable td:nth-child(4) {
width: 220px;
min-width: 220px;
max-width: 220px;
text-align: center;
border-right: 1px solid #ddd; /* 确保右侧边框闭合 */
}
#treeTable td:nth-child(4) {
display: flex;
justify-content: center;
gap: 5px;
min-height: 36px; /* 确保空单元格也有高度 */
}
</style>
</head>
<body>
@ -57,6 +71,7 @@
<th>知识点</th>
<th>先修知识</th>
<th>相关知识</th>
<th>维护</th>
</tr>
</thead>
<tbody id="treeBody"></tbody>
@ -113,16 +128,18 @@
// 修改后的维护按钮显示逻辑
const isThirdLevel = node.parent_id && allNodes.find(n => n.id === node.parent_id)?.parent_id;
html += '<td>' + (node.prerequisite && node.prerequisite.length > 0 ?
node.prerequisite.map(p => p.title).join(', ') : '') +
(isThirdLevel ? '<button class="layui-btn layui-btn-sm" onclick="prerequisiteUpdate(\'' + node.id + '\')">维护</button>' : '') + '</td>';
html += '<td>' + (node.related || '') +
(isThirdLevel ? '<button class="layui-btn layui-btn-sm layui-btn-normal" onclick="relatedUpdate(\'' + node.id + '\')">维护</button>' : '') + '</td>';
node.prerequisite.map(p => p.title).join(', ') : '') + '</td>';
html += '<td>' + (node.related || '') + '</td>';
html += '<td>' + (isThirdLevel ?
'<button class="layui-btn layui-btn-sm" onclick="prerequisiteUpdate(\'' + node.id + '\')">先修知识</button> ' +
'<button class="layui-btn layui-btn-sm layui-btn-normal" onclick="relatedUpdate(\'' + node.id + '\')">相关知识</button>' : '') + '</td>';
html += '</tr>';
if (node.open && node.children && node.children.length > 0) {
buildRows(node.children, level + 1);
}
}
}
buildRows(treeData);
$("#treeBody").html(html);
}

Loading…
Cancel
Save