文件上传页面功能基本集成完成
This commit is contained in:
@@ -310,9 +310,15 @@
|
||||
columns: [
|
||||
{ title: '数据集名称', key: 'name' },
|
||||
{ title: '类型', key: 'type' },
|
||||
{ title: '大小', key: 'size' },
|
||||
{ title: '样本数', key: 'count' },
|
||||
{ title: '描述', key: 'description' },
|
||||
{ title: '存储位置', key: 'storage_type', render: (val) => {
|
||||
if (val === 'local') return '<span class="px-2 py-1 rounded text-xs bg-blue-100 text-blue-700">本地存储</span>';
|
||||
if (val === 'minio') return '<span class="px-2 py-1 rounded text-xs bg-orange-100 text-orange-700">MinIO</span>';
|
||||
if (val === 'cloud') return '<span class="px-2 py-1 rounded text-xs bg-green-100 text-green-700">云存储</span>';
|
||||
return '<span class="px-2 py-1 rounded text-xs bg-gray-100 text-gray-700">' + (val || '-') + '</span>';
|
||||
}},
|
||||
{ title: '大小', key: 'size', render: (val) => (val && val !== '0 B' && val !== '0') ? val : '-' },
|
||||
{ title: '数据条数', key: 'count', render: (val) => val || 0 },
|
||||
{ title: '描述', key: 'description', render: (val) => val || '-' },
|
||||
{ title: '创建时间', key: 'create_time', render: (val) => val ? new Date(val).toLocaleString('zh-CN') : '-' }
|
||||
],
|
||||
actions: ['preview', 'download', 'delete']
|
||||
@@ -484,6 +490,24 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 编辑数据集
|
||||
function editItem(api, id) {
|
||||
if (api === 'dataset-manage') {
|
||||
// 跳转到数据集创建页面进行编辑
|
||||
window.location.href = `dataset-create.html?id=${id}`;
|
||||
} else {
|
||||
showMessage('提示', '编辑功能开发中...', 'info');
|
||||
}
|
||||
}
|
||||
|
||||
// 下载数据集(打包下载)
|
||||
function downloadDataset(datasetId) {
|
||||
const protocol = window.location.protocol;
|
||||
const hostname = window.location.hostname;
|
||||
const baseUrl = `${protocol}//${hostname}:8080`;
|
||||
window.open(`${baseUrl}/api/dataset-manage/download/${datasetId}`, '_blank');
|
||||
}
|
||||
|
||||
// 渲染表格页面
|
||||
function renderTablePage(config, data) {
|
||||
const createButton = config.hasCreate ? `
|
||||
@@ -521,12 +545,23 @@
|
||||
`).join('')}
|
||||
<td class="px-4 py-4 text-sm">
|
||||
<div class="flex space-x-2">
|
||||
${config.actions.map(action => `
|
||||
<button onclick="${action === 'delete' ? `deleteItem('${config.api}', ${item.id})` : `showMessage('提示', '${actionLabels[action] || action}功能开发中...', 'info')`}"
|
||||
class="${action === 'delete' ? 'text-danger hover:text-danger/80' : 'text-primary hover:text-primary/80'}">
|
||||
${actionLabels[action] || action}
|
||||
</button>
|
||||
`).join('')}
|
||||
${config.actions.map(action => {
|
||||
let onclick = '';
|
||||
let btnClass = 'text-primary hover:text-primary/80';
|
||||
if (action === 'delete') {
|
||||
onclick = `deleteItem('${config.api}', ${item.id})`;
|
||||
btnClass = 'text-danger hover:text-danger/80';
|
||||
} else if (action === 'edit') {
|
||||
onclick = `editItem('${config.api}', ${item.id})`;
|
||||
} else if (action === 'preview' && config.api === 'dataset-manage') {
|
||||
onclick = `window.location.href = 'dataset-preview.html?id=${item.id}'`;
|
||||
} else if (action === 'download' && config.api === 'dataset-manage') {
|
||||
onclick = `downloadDataset('${item.id}')`;
|
||||
} else {
|
||||
onclick = `showMessage('提示', '${actionLabels[action] || action}功能开发中...', 'info')`;
|
||||
}
|
||||
return `<button onclick="${onclick}" class="${btnClass}">${actionLabels[action] || action}</button>`;
|
||||
}).join('')}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user