diff --git a/manifest.json b/manifest.json index ac8d7df..5e14c85 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "渠道应用开发部知识库", - "version": "2.0.8", + "version": "2.0.9", "description": "通过关键词快速搜索内部文档", "permissions": ["storage"], "host_permissions": [ diff --git a/pages/upload-history.html b/pages/upload-history.html index d4a60e7..164de1e 100644 --- a/pages/upload-history.html +++ b/pages/upload-history.html @@ -65,12 +65,30 @@ .pagination button:hover:not(.active) { background: #dce4f7; } - .page-size { + + /* 新增:底部操作栏 */ + .bottom-bar { + display: flex; + justify-content: space-between; + align-items: center; margin-top: 10px; - text-align: right; font-size: 14px; } - .page-size select { + + .bottom-bar .left-actions button { + padding: 6px 12px; + background-color: #3662f4; + border: none; + color: white; + border-radius: 4px; + cursor: pointer; + } + + .bottom-bar .left-actions button:hover { + background-color: #d32f2f; + } + + .bottom-bar .right-select select { padding: 4px 8px; font-size: 14px; } @@ -79,10 +97,12 @@

上传记录

+ - + + @@ -94,13 +114,18 @@ -
- 每页显示 - 条记录 +
+
+ +
+
+ 每页显示 + 条记录 +
diff --git a/readme.md b/readme.md index e338aac..eeb3853 100644 --- a/readme.md +++ b/readme.md @@ -1,15 +1,16 @@ ## 修订记录 -| 时间 | 版本 | 修订人 | 说明 | -|------------|--------|---------|---------------------| -| 2025.06.02 | V2.0.0 | Luke.Ye | 完成插件配置化改造 | -| 2025.06.03 | V2.0.1 | Luke.Ye | 完成llm token过期时间的配置化 | -| 2025.06.03 | V2.0.2 | Luke.Ye | 支持LLM工作区配置化 | -| 2025.06.06 | V2.0.3 | Luke.Ye | 添加跳转页面权限校验 | -| 2025.06.09 | V2.0.4 | Luke.Ye | 优化es搜索展示页面 | -| 2025.06.10 | V2.0.5 | Luke.Ye | 移除自动请求智能助手逻辑 | -| 2025.06.16 | V2.0.6 | Luke.Ye | 添加上传文件到对象存储功能 | -| 2025.06.17 | V2.0.7 | Luke.Ye | 完成上传记录展示 | -| 2025.06.19 | V2.0.8 | Luke.Ye | 对象存储上传优化,适配后端新接口 | +| 时间 | 版本 | 修订人 | 说明 | +|------------|--------|---------|------------------------------| +| 2025.06.02 | V2.0.0 | Luke.Ye | 完成插件配置化改造 | +| 2025.06.03 | V2.0.1 | Luke.Ye | 完成llm token过期时间的配置化 | +| 2025.06.03 | V2.0.2 | Luke.Ye | 支持LLM工作区配置化 | +| 2025.06.06 | V2.0.3 | Luke.Ye | 添加跳转页面权限校验 | +| 2025.06.09 | V2.0.4 | Luke.Ye | 优化es搜索展示页面 | +| 2025.06.10 | V2.0.5 | Luke.Ye | 移除自动请求智能助手逻辑 | +| 2025.06.16 | V2.0.6 | Luke.Ye | 添加上传文件到对象存储功能 | +| 2025.06.17 | V2.0.7 | Luke.Ye | 完成上传记录展示 | +| 2025.06.19 | V2.0.8 | Luke.Ye | 对象存储上传优化,适配后端新接口 | +| 2025.06.20 | V2.0.8 | Luke.Ye | 上传记录页面支持删除历史记录(会同时清空对象存储和ES) | diff --git a/scripts/upload-history.js b/scripts/upload-history.js index f368e3b..2611927 100644 --- a/scripts/upload-history.js +++ b/scripts/upload-history.js @@ -1,8 +1,11 @@ const API_HISTORY = "http://app.wisdompulse.cn/api/v1/doc/fetch-os-upload-history"; +const API_DELETE = "http://app.wisdompulse.cn/api/v1/doc/batch-delete-os-upload"; // 假设后端支持 recordId 数组删除 const tableBody = document.getElementById("historyTableBody"); const pagination = document.getElementById("pagination"); const pageSizeSelect = document.getElementById("pageSizeSelect"); +const deleteBtn = document.getElementById("deleteSelectedBtn"); +const selectAllCheckbox = document.getElementById("selectAll"); let currentPage = 1; let total = 0; @@ -25,20 +28,28 @@ function renderTable(records) { tableBody.innerHTML = ""; if (!records.length) { const tr = document.createElement("tr"); - tr.innerHTML = ``; + tr.innerHTML = ``; tableBody.appendChild(tr); return; } - records.forEach(rec => { + records.forEach((rec) => { const tr = document.createElement("tr"); tr.innerHTML = ` - - - - `; + + + + + `; tableBody.appendChild(tr); }); + + // 全选功能 + selectAllCheckbox.checked = false; + selectAllCheckbox.onclick = () => { + const checkboxes = document.querySelectorAll(".recordCheckbox"); + checkboxes.forEach(cb => cb.checked = selectAllCheckbox.checked); + }; } function renderPagination(totalCount, current, size) { @@ -59,6 +70,38 @@ function renderPagination(totalCount, current, size) { } } +deleteBtn.onclick = () => { + const selected = Array.from(document.querySelectorAll(".recordCheckbox:checked")); + if (!selected.length) { + alert("请选择要删除的记录"); + return; + } + + const recordIds = selected.map(cb => parseInt(cb.getAttribute("data-id"))); + + if (!confirm("删除后文件将无法访问或检索,是否确认删除?")) return; + + fetch(API_DELETE, { + method: "DELETE", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ recordIds }) + }) + .then(res => { + if (!res.ok) throw new Error("删除失败"); + return res.json(); + }) + .then(() => { + alert("删除成功"); + loadUploadHistory(currentPage, pageSize); + }) + .catch(err => { + console.error("删除出错:", err); + alert("删除失败,请稍后重试"); + }); +}; + pageSizeSelect.addEventListener("change", () => { pageSize = parseInt(pageSizeSelect.value); currentPage = 1;
文件名文件名 上传时间 有效期
暂无记录暂无记录${rec.fileName}${rec.uploadTime}${rec.daysRemaining}${rec.fileName}${rec.uploadTime}${rec.daysRemaining}