feat:导出文件命名+旧图标隐藏
This commit is contained in:
@@ -923,41 +923,8 @@ class Api {
|
||||
downloadExport = async (recordId: number): Promise<void> => {
|
||||
const configStore = useConfigStoreHook()
|
||||
const baseURL = configStore.config.apiBaseUrl || ''
|
||||
const url = `${baseURL}/api/export/${recordId}/download`
|
||||
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('下载失败')
|
||||
}
|
||||
|
||||
// 获取文件名从 Content-Disposition 头
|
||||
const contentDisposition = response.headers.get('Content-Disposition')
|
||||
let fileName = 'download'
|
||||
if (contentDisposition) {
|
||||
const match = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/)
|
||||
if (match) {
|
||||
fileName = match[1].replace(/['"]/g, '')
|
||||
}
|
||||
}
|
||||
|
||||
// 创建 Blob 并下载
|
||||
const blob = await response.blob()
|
||||
const downloadUrl = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = downloadUrl
|
||||
link.download = fileName
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
window.URL.revokeObjectURL(downloadUrl)
|
||||
} catch (error) {
|
||||
console.error('下载失败:', error)
|
||||
throw error
|
||||
}
|
||||
// 直接使用 window.location.href 跳转下载,浏览器会自动处理文件名
|
||||
window.location.href = `${baseURL}/export/${recordId}/download`
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -971,7 +938,7 @@ class Api {
|
||||
}> => {
|
||||
const configStore = useConfigStoreHook()
|
||||
const baseURL = configStore.config.apiBaseUrl || ''
|
||||
const url = `${baseURL}/api/export/${recordId}/preview`
|
||||
const url = `${baseURL}/export/${recordId}/preview`
|
||||
|
||||
const response = await request<{
|
||||
content?: string
|
||||
@@ -996,7 +963,7 @@ class Api {
|
||||
}> => {
|
||||
const configStore = useConfigStoreHook()
|
||||
const baseURL = configStore.config.apiBaseUrl || ''
|
||||
const url = `${baseURL}/api/export/${recordId}/share`
|
||||
const url = `${baseURL}/export/${recordId}/share`
|
||||
|
||||
const response = await request<{
|
||||
share_url: string
|
||||
@@ -1012,7 +979,7 @@ class Api {
|
||||
deleteExport = async (recordId: number): Promise<boolean> => {
|
||||
const configStore = useConfigStoreHook()
|
||||
const baseURL = configStore.config.apiBaseUrl || ''
|
||||
const url = `${baseURL}/api/export/${recordId}`
|
||||
const url = `${baseURL}/export/${recordId}`
|
||||
|
||||
try {
|
||||
await request({
|
||||
|
||||
@@ -244,7 +244,12 @@ async function handleSearch() {
|
||||
currentGenerationId.value = response.generation_id || ''
|
||||
// 从 response.data 中获取 task_id(REST API 格式)
|
||||
currentTaskID.value = response.data?.task_id || response.task_id || ''
|
||||
console.log('📋 直接格式: generation_id:', currentGenerationId.value, 'TaskID:', currentTaskID.value)
|
||||
console.log(
|
||||
'📋 直接格式: generation_id:',
|
||||
currentGenerationId.value,
|
||||
'TaskID:',
|
||||
currentTaskID.value
|
||||
)
|
||||
} else {
|
||||
outlineData = response
|
||||
currentGenerationId.value = ''
|
||||
@@ -602,7 +607,7 @@ defineExpose({
|
||||
/>
|
||||
</el-button>
|
||||
</div>
|
||||
<AssignmentButton v-if="planReady" @click="openAgentAllocationDialog" />
|
||||
<!-- <AssignmentButton v-if="planReady" @click="openAgentAllocationDialog" /> -->
|
||||
<!-- 设置按钮 -->
|
||||
<el-button class="setting-button" circle title="设置" @click="openSettingsPanel">
|
||||
<el-icon size="18px"><Setting /></el-icon>
|
||||
|
||||
@@ -124,7 +124,9 @@ const agentsStore = useAgentsStore()
|
||||
<!-- 数据空间 -->
|
||||
<div class="text-[12px]">
|
||||
<span class="text-[var(--color-text)] font-bold">数据空间</span>
|
||||
<div class="text-[var(--color-text-secondary)] mt-1">归属于{{ item.Classification }}数据空间</div>
|
||||
<div class="text-[var(--color-text-secondary)] mt-1">
|
||||
归属于{{ item.Classification }}数据空间
|
||||
</div>
|
||||
</div>
|
||||
<!-- 分割线 -->
|
||||
<div class="h-[1px] w-full bg-[var(--color-border-default)] my-[8px]"></div>
|
||||
@@ -158,8 +160,6 @@ const agentsStore = useAgentsStore()
|
||||
v-if="index1 !== taskProcess.filter(i => i.AgentName === item.Name).length - 1"
|
||||
class="h-[1px] w-full bg-[var(--color-border-default)] my-[8px]"
|
||||
></div>
|
||||
|
||||
<AssignmentButton />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
@@ -80,8 +80,18 @@
|
||||
:title="previewData?.file_name || '文件预览'"
|
||||
width="80%"
|
||||
:close-on-click-modal="true"
|
||||
:show-close="false"
|
||||
class="preview-dialog"
|
||||
>
|
||||
<!-- 自定义关闭按钮 -->
|
||||
<template #header>
|
||||
<div class="dialog-header">
|
||||
<span class="dialog-title">{{ previewData?.file_name || '文件预览' }}</span>
|
||||
<button class="dialog-close-btn" @click="previewVisible = false">
|
||||
<SvgIcon icon-class="close" size="18px" />
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<div class="preview-content">
|
||||
<div v-if="previewLoading" class="preview-loading">
|
||||
<el-icon class="is-loading"><Loading /></el-icon>
|
||||
@@ -1079,8 +1089,44 @@ onMounted(() => {
|
||||
|
||||
// 预览弹窗样式
|
||||
.preview-dialog {
|
||||
.el-dialog__header {
|
||||
padding: 16px 20px 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.el-dialog__body {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.dialog-close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 4px;
|
||||
color: var(--color-text-regular);
|
||||
transition: transform 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -201,7 +201,7 @@ function handleCancel() {
|
||||
</div>
|
||||
</div>
|
||||
<!-- 按钮点击不会冒泡到卡片 -->
|
||||
<BranchButton :step="step" />
|
||||
<!-- <BranchButton :step="step" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -366,7 +366,7 @@ defineExpose({
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BranchButton v-if="planReady" @click="openPlanModification" />
|
||||
<!-- <BranchButton v-if="planReady" @click="openPlanModification" /> -->
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -263,7 +263,7 @@ const downloadFile = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
window.location.href = `${apiBaseUrl}/api/export/${parsed.recordId}/download`
|
||||
window.location.href = `${apiBaseUrl}/export/${parsed.recordId}/download`
|
||||
} catch (e) {
|
||||
console.error('下载失败:', e)
|
||||
ElMessage.error('下载失败')
|
||||
|
||||
Reference in New Issue
Block a user