diff --git a/.env b/.env index b392991..65cd980 100644 --- a/.env +++ b/.env @@ -26,3 +26,9 @@ VITE_API_TIMEOUT = 120000 # 代理前缀 VITE_APP_BASE_API = /api/v1 + +# Dify 知识库代理前缀 +VITE_DIFY_API_BASE = /p30 + +# 文件服务代理前缀 +VITE_STORAGE_API_BASE = /storage diff --git a/.env.development b/.env.development index 5db78e4..3d5c7b1 100644 --- a/.env.development +++ b/.env.development @@ -10,8 +10,8 @@ VITE_APP_TITLE = FastapiAdmin VITE_API_URL = / # 代理目标:本机后端(若出现 ENOTFOUND,说明上面域名在当前网络/DNS 下不可解析,改用本地或可用地址) -# VITE_API_BASE_URL = http://127.0.0.1:8001 -VITE_API_BASE_URL = http://192.168.5.5:8011 +VITE_API_BASE_URL = http://192.168.5.37:8011 +# VITE_API_BASE_URL = http://192.168.5.5:8011 # VITE_API_BASE_URL = https://service.fastapiadmin.com # 是否删除控制台输出 @@ -23,3 +23,6 @@ VITE_APP_WS_ENDPOINT = ws://127.0.0.1:8001 # Dify 知识库后端代理目标地址 VITE_DIFY_API_BASE_URL = https://p30-dify.ngsk.tech:7001/ + +# 文件服务后端代理目标地址 +VITE_STORAGE_API_BASE_URL = http://192.168.5.119:9000/ diff --git a/src/api/module_report/review.ts b/src/api/module_report/review.ts index 88cc9f7..f822021 100644 --- a/src/api/module_report/review.ts +++ b/src/api/module_report/review.ts @@ -143,6 +143,8 @@ export interface ReviewTaskItem { template_id?: number; template_name?: string; file_id: number; + /** 文件记录对象 */ + file?: import("@/api/common/file").FileInfo; /** 文档访问地址,可直接用于预览/下载 */ file_url?: string; original_name?: string; diff --git a/src/utils/file.ts b/src/utils/file.ts new file mode 100644 index 0000000..376c239 --- /dev/null +++ b/src/utils/file.ts @@ -0,0 +1,6 @@ +export function getFileUrl(filePath: string) { + if (!filePath) { + return ''; + } + return window.location.origin + "/storage/" + filePath; +} \ No newline at end of file diff --git a/src/views/module_report/report-review/components/TaskDetailDialog.vue b/src/views/module_report/report-review/components/TaskDetailDialog.vue index a73f136..ecf0131 100644 --- a/src/views/module_report/report-review/components/TaskDetailDialog.vue +++ b/src/views/module_report/report-review/components/TaskDetailDialog.vue @@ -68,7 +68,7 @@ @@ -78,6 +78,7 @@ import { ref } from "vue"; import { View } from "@element-plus/icons-vue"; import type { ReviewTaskItem } from "@/api/module_report/review"; import DocPreviewDialog from "./DocPreviewDialog.vue"; +import { getFileUrl } from "@/utils/file"; defineOptions({ name: "TaskDetailDialog" }); diff --git a/src/views/module_report/report-review/index.vue b/src/views/module_report/report-review/index.vue index 86e1ca5..18c2ec2 100644 --- a/src/views/module_report/report-review/index.vue +++ b/src/views/module_report/report-review/index.vue @@ -261,6 +261,7 @@ import ReviewFormDialog from "./components/ReviewFormDialog.vue"; import TaskDetailDialog from "./components/TaskDetailDialog.vue"; import DocPreviewDialog from "./components/DocPreviewDialog.vue"; import LogDrawer from "./components/LogDrawer.vue"; +import { getFileUrl } from "@/utils/file"; defineOptions({ name: "EnergyReportReviewList" }); @@ -430,7 +431,7 @@ function handleDetail(row: ReviewTaskItem) { function handlePreviewDoc(row: ReviewTaskItem) { if (!row.file_url) return; currentPreviewFile.value = { - url: row.file_url, + url: getFileUrl(row?.file?.bucket_name! + '/' + row?.file?.file_path! || ''), name: row.original_name || "审核文档", }; docPreviewVisible.value = true; diff --git a/src/views/module_report/report-review/result.vue b/src/views/module_report/report-review/result.vue index 985a046..e0107a9 100644 --- a/src/views/module_report/report-review/result.vue +++ b/src/views/module_report/report-review/result.vue @@ -28,7 +28,7 @@
@@ -149,6 +149,7 @@ import FaDocxPreview from "@/components/business/fa-docx-preview/index.vue"; import { ReviewTaskAPI } from "@/api/module_report/review"; import type { ReviewTaskItem } from "@/api/module_report/review"; import type { ReportType } from "@/api/module_report/report"; +import { getFileUrl } from "@/utils/file"; defineOptions({ name: "ReviewResultPage" }); diff --git a/src/views/module_report/template/detail.vue b/src/views/module_report/template/detail.vue index 5524645..f5b51d4 100644 --- a/src/views/module_report/template/detail.vue +++ b/src/views/module_report/template/detail.vue @@ -192,6 +192,7 @@ import type { import { RuleAPI } from "@/api/module_rule/rule"; import type { RuleItem } from "@/api/module_rule/rule"; import { extractPromptVariables } from "../promptVars"; +import { getFileUrl } from "@/utils/file"; const route = useRoute(); const router = useRouter(); @@ -249,7 +250,7 @@ async function loadTemplate() { const data = resp?.data?.data; if (data) { template.value = data; - docxSrc.value = data.file_url || ""; + docxSrc.value = getFileUrl(data.file?.bucket_name! + '/' + data.file?.file_path! || ""); } } catch (e) { template.value = null; diff --git a/src/views/module_report/template/edit.vue b/src/views/module_report/template/edit.vue index 1682a09..1b524db 100644 --- a/src/views/module_report/template/edit.vue +++ b/src/views/module_report/template/edit.vue @@ -276,6 +276,7 @@ import type { import { RuleAPI } from "@/api/module_rule/rule"; import type { RuleItem } from "@/api/module_rule/rule"; import { extractPromptVariables } from "../promptVars"; +import { getFileUrl } from "@/utils/file"; const route = useRoute(); const router = useRouter(); @@ -379,7 +380,7 @@ async function loadTemplate() { const data = resp?.data?.data; if (data) { template.value = data; - docxSrc.value = data.file_url || ""; + docxSrc.value = getFileUrl(data.file?.bucket_name! + '/' + data.file?.file_path! || ""); } } catch (e) { template.value = null;