Add files via upload

This commit is contained in:
公明
2026-07-10 19:46:14 +08:00
committed by GitHub
parent 46a9b42fde
commit 823fb47a81
21 changed files with 717 additions and 212 deletions
+6 -2
View File
@@ -210,6 +210,7 @@ function renderKnowledgeItemsByCategories(categoriesWithItems) {
html += '</div>';
container.innerHTML = html;
if (typeof rbacAfterDynamicRender === 'function') rbacAfterDynamicRender(container);
}
// 渲染知识项列表(向后兼容,用于按项分页的旧代码)
@@ -260,6 +261,7 @@ function renderKnowledgeItems(items) {
html += '</div>';
container.innerHTML = html;
if (typeof rbacAfterDynamicRender === 'function') rbacAfterDynamicRender(container);
}
// 渲染分页控件(按分类分页)
@@ -350,13 +352,13 @@ function renderKnowledgeItemCard(item) {
<div class="knowledge-item-card-title-row">
<h4 class="knowledge-item-card-title" title="${escapeHtml(item.title)}">${escapeHtml(item.title)}</h4>
<div class="knowledge-item-card-actions">
<button class="knowledge-item-action-btn" onclick="editKnowledgeItem('${item.id}')" title="编辑">
<button class="knowledge-item-action-btn" data-require-permission="knowledge:write" onclick="editKnowledgeItem('${item.id}')" title="编辑">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<button class="knowledge-item-action-btn knowledge-item-delete-btn" onclick="deleteKnowledgeItem('${item.id}')" title="删除">
<button class="knowledge-item-action-btn knowledge-item-delete-btn" data-require-permission="knowledge:delete" onclick="deleteKnowledgeItem('${item.id}')" title="删除">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
@@ -941,6 +943,7 @@ async function rebuildKnowledgeIndexFull() {
// 显示添加知识项模态框
function showAddKnowledgeItemModal() {
if (typeof requirePermission === 'function' && !requirePermission('knowledge:write')) return;
currentEditingItemId = null;
document.getElementById('knowledge-item-modal-title').textContent = '添加知识';
document.getElementById('knowledge-item-category').value = '';
@@ -979,6 +982,7 @@ async function editKnowledgeItem(id) {
// 保存知识项
async function saveKnowledgeItem() {
if (typeof requirePermission === 'function' && !requirePermission('knowledge:write')) return;
// 防止重复提交
if (isSavingKnowledgeItem) {
showNotification('正在保存中,请勿重复点击...', 'warning');