From 172b2c1698ae0bca0436e54513a37f81c4c8b30c Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期三, 19 三月 2025 11:39:09 +0800
Subject: [PATCH] doc docx

---
 src/views/project/yw/dataManage/graph/AddGraph.vue |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/views/project/yw/dataManage/graph/AddGraph.vue b/src/views/project/yw/dataManage/graph/AddGraph.vue
index 19189c0..c04a523 100644
--- a/src/views/project/yw/dataManage/graph/AddGraph.vue
+++ b/src/views/project/yw/dataManage/graph/AddGraph.vue
@@ -81,7 +81,7 @@
 		DocumentRecognition: '1',
 	},
 	// allowType: '.pdf,.doc,.docx,.txt,.md,.pptx,.ppt',
-	allowType: 'md',
+	allowType: 'md,.doc,.docx',
 	limit: 5,
 	size: 5,
 	categoryFormRules: {
@@ -116,6 +116,18 @@
 		}
 	});
 };
+
+const groupTypeMap = {
+	md: 'markdown',
+	doc: 'doc',
+	docx: 'docx',
+};
+
+const getFileSuffix = (name: string): string => {
+	if (!name) return '';
+	const suffix = name.split('.').pop() as string;
+	return suffix;
+};
 //纭
 const onSubmit = async () => {
 	const valid = await categoryFormRef.value.validate().catch(() => {});
@@ -123,7 +135,8 @@
 	const group_id = route.query.group_id;
 	if (group_id == null || group_id == '' || group_id == undefined) return;
 	const group_name = state.fileInfo?.name;
-	const group_type = 'markdown';
+	const suffix = getFileSuffix(state.fileInfo?.name);
+	const group_type = groupTypeMap[suffix] ?? '';
 	const group_time = moment(state.fileInfo?.lastModifiedDate).format('YYYY-MM-DD HH:mm:ss');
 	const group_size = convertFileSize(state.fileInfo?.size);
 	const data = new FormData();

--
Gitblit v1.9.3