增加模型库模型下载入口

This commit is contained in:
zhangshun
2026-06-01 14:34:44 +08:00
parent 5b6d29f0f6
commit b1ef3deb03
4 changed files with 59 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import { renderPagination } from "../../../components/pagination";
import { getCurrentUser } from "../../../services/authState";
import type { DictionaryResponse, ModelItem, ModelListResponse } from "../../../types";
import { confirmDialog, formDialog, notify, notifyError } from "../../../ui/dialogs";
import { downloadFileFromUrl } from "../../../utils/fileDownload";
import { escapeHtml, modelNameFromFile } from "../../../utils/format";
import { appState } from "../appState";
@@ -192,6 +193,10 @@ function bindModelGridActions(grid: HTMLDivElement) {
notify("导入场景数据已输出");
break;
}
case "download":
if (!model) return;
await downloadFileFromUrl(model.file_url, model.original_filename || model.name);
break;
case "delete":
await deleteModel(id);
break;
@@ -293,6 +298,7 @@ function renderModelCard(item: ModelItem) {
${thumb}
<div class="thumb-actions">
<button data-action="preview" data-id="${item.id}">预览</button>
<button data-action="download" data-id="${item.id}">下载</button>
${canWrite ? `<button data-action="edit" data-id="${item.id}">编辑</button>` : ""}
<button data-action="import" data-id="${item.id}">导入</button>
${canWrite ? `<button data-action="delete" data-id="${item.id}">删除</button>` : ""}