From 43f102a2912cf2821fed03d36bfd92f9ba7afe01 Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期二, 29 十月 2024 15:41:09 +0800
Subject: [PATCH] 修改冗余的代码

---
 src/components/drawer/CustomDrawer.vue                    |   24 ++++++++++++------------
 src/views/project/ch/home/component/waterRight/bottom.vue |    4 +---
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/components/drawer/CustomDrawer.vue b/src/components/drawer/CustomDrawer.vue
index de14af5..6e4a38f 100644
--- a/src/components/drawer/CustomDrawer.vue
+++ b/src/components/drawer/CustomDrawer.vue
@@ -461,10 +461,10 @@
 					Children: 'Children',
 					ParentID: 'p_group_id',
 				});
-				state.customBusinessList = treeBusinessList; //涓氬姟鍦烘櫙鏁版嵁婧�
-				state.activeBusinessName = treeBusinessList[0].group_id; //榛樿閫変腑绗竴涓笟鍔″満鏅�
-				state.customBusinessChildList = treeBusinessList[0].Children; //榛樿閫変腑绗竴涓笟鍔″満鏅殑绗竴涓瓙鍦烘櫙鐨勬暟鎹簮
-				state.activeBusinessChildName = treeBusinessList[0].Children[0].group_id;
+				state.customBusinessList = treeBusinessList ?? []; //涓氬姟鍦烘櫙鏁版嵁婧�
+				state.activeBusinessName = treeBusinessList[0]?.group_id; //榛樿閫変腑绗竴涓笟鍔″満鏅�
+				state.customBusinessChildList = treeBusinessList[0]?.Children; //榛樿閫変腑绗竴涓笟鍔″満鏅殑绗竴涓瓙鍦烘櫙鐨勬暟鎹簮
+				state.activeBusinessChildName = treeBusinessList[0]?.Children[0]?.group_id;
 				break;
 			case '鍔炲叕鍔╂墜':
 				const treeOfficeList = convertListToTree(officeList, {
@@ -472,10 +472,10 @@
 					Children: 'Children',
 					ParentID: 'p_group_id',
 				});
-				state.customOfficeList = treeOfficeList; //鍔炲叕鍔╂墜鏁版嵁婧�
-				state.activeOfficeName = treeOfficeList[0].group_id; //榛樿閫変腑绗竴涓姙鍏姪鎵�
-				state.customOfficeChildList = treeOfficeList[0].Children; //榛樿閫変腑绗竴涓姙鍏姪鎵嬬殑绗竴涓瓙鍦烘櫙鐨勬暟鎹簮
-				state.activeOfficeChildName = treeOfficeList[0].Children[0].group_id; //榛樿閫変腑绗竴涓姙鍏姪鎵嬬殑绗竴涓瓙鍦烘櫙
+				state.customOfficeList = treeOfficeList ?? []; //鍔炲叕鍔╂墜鏁版嵁婧�
+				state.activeOfficeName = treeOfficeList[0]?.group_id; //榛樿閫変腑绗竴涓姙鍏姪鎵�
+				state.customOfficeChildList = treeOfficeList[0]?.Children; //榛樿閫変腑绗竴涓姙鍏姪鎵嬬殑绗竴涓瓙鍦烘櫙鐨勬暟鎹簮
+				state.activeOfficeChildName = treeOfficeList[0]?.Children[0]?.group_id; //榛樿閫変腑绗竴涓姙鍏姪鎵嬬殑绗竴涓瓙鍦烘櫙
 				break;
 			case '鐭ヨ瘑搴�':
 				const treeTagList = convertListToTree(selectTagList, {
@@ -483,10 +483,10 @@
 					Children: 'Children',
 					ParentID: 'p_group_id',
 				});
-				state.knowledgeBaseList = treeTagList; //鐭ヨ瘑搴撴暟鎹簮
-				state.activeKnowledgeName = treeTagList[0].group_id; //榛樿閫変腑绗竴涓煡璇嗗簱
-				state.customKnowledgeChildList = treeTagList[0].Children; //榛樿閫変腑绗竴涓煡璇嗗簱鐨勭涓�涓瓙鍦烘櫙鐨勬暟鎹簮
-				state.activeKnowledgeChildName = treeTagList[0].Children[0].group_id; //榛樿閫変腑绗竴涓煡璇嗗簱鐨勭涓�涓瓙鍦烘櫙
+				state.knowledgeBaseList = treeTagList ?? []; //鐭ヨ瘑搴撴暟鎹簮
+				state.activeKnowledgeName = treeTagList[0]?.group_id; //榛樿閫変腑绗竴涓煡璇嗗簱
+				state.customKnowledgeChildList = treeTagList[0]?.Children; //榛樿閫変腑绗竴涓煡璇嗗簱鐨勭涓�涓瓙鍦烘櫙鐨勬暟鎹簮
+				state.activeKnowledgeChildName = treeTagList[0]?.Children[0]?.group_id; //榛樿閫変腑绗竴涓煡璇嗗簱鐨勭涓�涓瓙鍦烘櫙
 				break;
 		}
 	} else {
diff --git a/src/views/project/ch/home/component/waterRight/bottom.vue b/src/views/project/ch/home/component/waterRight/bottom.vue
index 14b40ad..52f1e79 100644
--- a/src/views/project/ch/home/component/waterRight/bottom.vue
+++ b/src/views/project/ch/home/component/waterRight/bottom.vue
@@ -49,7 +49,6 @@
 
 <script setup lang="ts">
 import { computed, reactive, ref, watch } from 'vue';
-import { getSectionList } from '/@/api/ai/chat';
 import router from '/@/router';
 import { activeGroupType, sceneGroupList, sectionAList, topGroupId } from '/@/stores/chatRoom';
 let state = reactive({
@@ -98,9 +97,8 @@
 	return iconList.value[index % iconCount];
 };
 const getMainSectionList = async () => {
-	const res = await getSectionList();
 	let result = [];
-	sceneGroupList.value.forEach((sectionItem, index) => {
+	await sceneGroupList.value.forEach((sectionItem, index) => {
 		sectionItem.Icon = getIconByIndex(index);
 		if (activeGroupType.value == sectionItem.group_type) {
 			result.push(sectionItem);

--
Gitblit v1.9.3