From 5d7b63225ca327aee2650fd6d36c3a7fc8f11cf1 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期一, 28 十月 2024 15:40:51 +0800
Subject: [PATCH] Merge branch 'test' of http://47.103.154.90:83/r/WI/Web.V1.0 into test

---
 src/views/project/ch/home/component/waterRight/top.vue    |   16 ---
 src/views/types/metrics/index.ts                          |   16 ---
 src/views/project/ch/home/component/waterRight/center.vue |   96 +++++++++++++----------
 src/components/drawer/CustomDrawer.vue                    |   55 ++++++-------
 src/views/project/ch/home/component/waterRight/bottom.vue |   27 ++++--
 5 files changed, 99 insertions(+), 111 deletions(-)

diff --git a/src/components/drawer/CustomDrawer.vue b/src/components/drawer/CustomDrawer.vue
index 7421410..de14af5 100644
--- a/src/components/drawer/CustomDrawer.vue
+++ b/src/components/drawer/CustomDrawer.vue
@@ -5,26 +5,26 @@
 		</div>
 		<div class="pc-mouldboard column exampleSlide">
 			<div class="header flex items-center justify-center">
-				<div
+				<!-- <div
 					class="box-border flex w-[234px] h-[32px] rounded-md items-center justify-between cursor-pointer relative border border-solid border-[#2c2d33]"
 				>
 					<div
 						class="tabbar-item"
-						:class="state.activeName === item.ID ? 'set-tabbar-active' : ''"
+						:class="activeGroupType.value === item.ID ? 'set-tabbar-active' : ''"
 						@click="handleTabClick(item)"
 						v-for="item in state.tabNameList"
 						:key="item.ID"
 					>
 						{{ item.Name }}
 					</div>
-				</div>
+				</div> -->
 				<i
 					class="ywifont ywicon-guanbi text-[#999] text-[18px] absolute right-[14px] top-5 cursor-pointer"
 					@click="handleCloseTemplate"
 				></i>
 			</div>
 
-			<div class="box-border w-[354px] flex-1 min-h-0 bg-[#e0e7fb]" v-show="state.activeName == 1">
+			<div class="box-border w-[354px] flex-1 min-h-0 bg-[#e0e7fb]" v-show="activeGroupType == '涓氬姟鍦烘櫙'">
 				<div class="flex flex-col w100 h100 pt-0 pr-[15px] pb-0 pl-[20px]">
 					<div class="flex items-center w100 h-[30px] border border-solid border-[#b2b2b2] transition-[border-color 1s] rounded-2xl">
 						<el-input v-model="queryParams.sample_title" placeholder="鎼滅储鏇村" class="set-input" :prefix-icon="Search" clearable>
@@ -80,7 +80,7 @@
 					</div>
 				</div>
 			</div>
-			<div class="box-border w-[354px] flex-1 min-h-0 bg-[#e0e7fb]" v-show="state.activeName == 2">
+			<div class="box-border w-[354px] flex-1 min-h-0 bg-[#e0e7fb]" v-show="activeGroupType == '鍔炲叕鍔╂墜'">
 				<div class="flex flex-col w100 h100 pt-0 pr-[15px] pb-0 pl-[20px]">
 					<div class="flex items-center w100 h-[30px] border border-solid border-[#b2b2b2] transition-[border-color 1s] rounded-2xl">
 						<el-input v-model="officeParams.template_title" placeholder="鎼滅储鏇村" class="set-input" :prefix-icon="Search" clearable>
@@ -130,7 +130,7 @@
 					</div>
 				</div>
 			</div>
-			<div class="box-border w-[354px] flex-1 min-h-0 bg-[#e0e7fb]" v-show="state.activeName == 3">
+			<div class="box-border w-[354px] flex-1 min-h-0 bg-[#e0e7fb]" v-show="activeGroupType == '鐭ヨ瘑搴�'">
 				<div class="flex flex-col w100 h100 pt-0 pr-[15px] pb-0 pl-[20px]">
 					<div class="flex items-center w100 h-[30px] border border-solid border-[#b2b2b2] transition-[border-color 1s] rounded-2xl">
 						<el-input v-model="queryParams.sample_title" placeholder="鎼滅储鏇村" class="set-input" :prefix-icon="Search" clearable>
@@ -204,16 +204,10 @@
 import { computed, reactive, ref, watch } from 'vue';
 import { getSectionList, getSelectSample, getUserTemplateList } from '/@/api/ai/chat';
 import { useSearch } from '/@/hooks/useSearch';
-import { activeRoomId, activeSampleId, activeSectionAId, sectionAList, setRoomConfig } from '/@/stores/chatRoom';
+import { activeGroupType, activeRoomId, activeSampleId, activeSectionAId, sectionAList, setRoomConfig } from '/@/stores/chatRoom';
 import { convertListToTree, debounce } from '/@/utils/util';
 import { OptClassificationMap, classificationEnum } from '/@/views/types/processDrawing/index';
 let state = reactive({
-	tabNameList: [
-		{ ID: 1, Name: '涓氬姟鍦烘櫙' },
-		{ ID: 2, Name: '鍔炲叕鍔╂墜' },
-		{ ID: 3, Name: '鐭ヨ瘑搴�' },
-	],
-	activeName: 1,
 	activeBusinessName: '', //鍦烘櫙
 	activeBusinessChildName: '',
 	customBusinessList: [],
@@ -286,16 +280,7 @@
 };
 //#endregion
 //#region ====================== 榛樿閫夋嫨绗竴涓殑鍦烘櫙鐨勫瓙鍦烘櫙 ======================
-//tags鏍囩鍒囨崲
-const handleTabClick = async (item) => {
-	state.activeName = item.ID;
-	if (state.activeName == 2) {
-		if (state.listInstructExpand) return;
-		await getUserTemplate();
-		state.listInstructExpand = true;
-	}
-	tagListClick(sectionAList.value);
-};
+
 //鍦烘櫙瀛愬満鏅�
 const handleBusinessClick = (item) => {
 	state.activeBusinessName = item.group_id;
@@ -375,7 +360,7 @@
 		await getMainSectionList().finally(() => {
 			loadingData.value = false;
 		});
-		if (state.activeName == 1 || state.activeName == 3) {
+		if (activeGroupType.value == '涓氬姟鍦烘櫙' || activeGroupType.value == '鐭ヨ瘑搴�') {
 			if (state.listSampleExpand) return;
 			await getSelectListSample();
 			state.listSampleExpand = true;
@@ -469,8 +454,8 @@
 				officeList.push(item);
 			}
 		});
-		switch (state.activeName) {
-			case 1:
+		switch (activeGroupType.value) {
+			case '涓氬姟鍦烘櫙':
 				const treeBusinessList = convertListToTree(businessList, {
 					ID: 'group_id',
 					Children: 'Children',
@@ -481,7 +466,7 @@
 				state.customBusinessChildList = treeBusinessList[0].Children; //榛樿閫変腑绗竴涓笟鍔″満鏅殑绗竴涓瓙鍦烘櫙鐨勬暟鎹簮
 				state.activeBusinessChildName = treeBusinessList[0].Children[0].group_id;
 				break;
-			case 2:
+			case '鍔炲叕鍔╂墜':
 				const treeOfficeList = convertListToTree(officeList, {
 					ID: 'group_id',
 					Children: 'Children',
@@ -492,7 +477,7 @@
 				state.customOfficeChildList = treeOfficeList[0].Children; //榛樿閫変腑绗竴涓姙鍏姪鎵嬬殑绗竴涓瓙鍦烘櫙鐨勬暟鎹簮
 				state.activeOfficeChildName = treeOfficeList[0].Children[0].group_id; //榛樿閫変腑绗竴涓姙鍏姪鎵嬬殑绗竴涓瓙鍦烘櫙
 				break;
-			case 3:
+			case '鐭ヨ瘑搴�':
 				const treeTagList = convertListToTree(selectTagList, {
 					ID: 'group_id',
 					Children: 'Children',
@@ -521,6 +506,20 @@
 };
 //#endregion
 
+watch(
+	() => activeGroupType.value,
+	async (val) => {
+		if (val == '鍔炲叕鍔╂墜') {
+			if (state.listInstructExpand) return;
+			await getUserTemplate();
+			state.listInstructExpand = true;
+		}
+		tagListClick(sectionAList.value);
+	},
+	{
+		immediate: true,
+	}
+);
 defineExpose({ getTableData });
 </script>
 <style scoped lang="scss">
diff --git a/src/views/project/ch/home/component/waterRight/bottom.vue b/src/views/project/ch/home/component/waterRight/bottom.vue
index f56b70e..27485eb 100644
--- a/src/views/project/ch/home/component/waterRight/bottom.vue
+++ b/src/views/project/ch/home/component/waterRight/bottom.vue
@@ -58,7 +58,6 @@
 import { getSectionList } from '/@/api/ai/chat';
 import router from '/@/router';
 import { activeSectionAId, sectionAList } from '/@/stores/chatRoom';
-import { OptClassificationMap, classificationEnum } from '/@/views/types/metrics';
 let state = reactive({
 	applicationScenarios: [],
 	scenariosIds: [],
@@ -68,7 +67,20 @@
 }>();
 const changeScenarios = async (item) => {
 	activeSectionAId.value = item.group_id;
-	emits('tagListClick', item);
+	const curGroupID = item.p_group_id;
+	const curID = item.group_id;
+	let curGroupIDs = [];
+	//鍒ゆ柇褰撳墠涓虹埗绾�
+	if (!curGroupID) {
+		state.applicationScenarios.forEach((item) => {
+			if (curID == item.p_group_id) {
+				curGroupIDs.push(item.group_id);
+			}
+		});
+	} else {
+		curGroupIDs.push(curID);
+	}
+	emits('tagListClick', curGroupIDs);
 	// setRoomConfig(activeRoomId.value, 'isAnswerByLLM', false);
 };
 const iconList = ref([
@@ -95,13 +107,8 @@
 	const res = await getSectionList();
 	let result = [];
 	res.groups.forEach((sectionItem, index) => {
-		if (
-			sectionItem.group_type != OptClassificationMap[classificationEnum.Office] &&
-			sectionItem.group_type != OptClassificationMap[classificationEnum.Knowledge]
-		) {
-			sectionItem.Icon = getIconByIndex(index);
-			result.push(sectionItem);
-		}
+		sectionItem.Icon = getIconByIndex(index);
+		result.push(sectionItem);
 	});
 	state.applicationScenarios = result;
 	sectionAList.value = res.groups;
@@ -175,6 +182,7 @@
 		&_item {
 			width: 50%;
 			border-radius: 5px;
+
 			padding: 18px 12px;
 			-webkit-transition: background-color 0.1s ease-in-out;
 			-o-transition: background-color 0.1s ease-in-out;
@@ -218,7 +226,6 @@
 					font-weight: 500;
 					height: 16px;
 					transition: background-color 0.2s;
-				
 				}
 
 				p {
diff --git a/src/views/project/ch/home/component/waterRight/center.vue b/src/views/project/ch/home/component/waterRight/center.vue
index 4235038..444e49f 100644
--- a/src/views/project/ch/home/component/waterRight/center.vue
+++ b/src/views/project/ch/home/component/waterRight/center.vue
@@ -6,17 +6,36 @@
 				<span class="split"></span>
 				<span class="change cursor-pointer" @click="advanceExampleClick">楂樼骇绀轰緥 ></span>
 			</div>
-			<div class="cursor-pointer">
-				<span class="mr-1 changeBatch" @click="batchChange">鎹竴鎵�</span>
+			<div class="cursor-pointer" @click="batchChange">
+				<span class="mr-1 changeBatch">鎹竴鎵�</span>
 				<i class="myiconfont icon-shuaxin"></i>
 			</div>
 		</div>
 		<div class="main">
-			<el-carousel height="80" :interval="6000" indicator-position="none">
-				<el-carousel-item v-for="group in batchSourceData" :key="group" class="set-carousel-item">
+			<el-carousel height="80" :interval="6000" indicator-position="none" v-show="!state.isShowExample">
+				<el-carousel-item v-for="(group, index) in state.m_groupArr" :key="index" class="set-carousel-item">
 					<div
 						class="main_item flex items-center cursor-pointer"
-						v-for="(item, index) in state.exampleContent"
+						v-for="(item, index) in group"
+						:key="index"
+						:class="{ main_item_active: item.sample_id === activeSampleId }"
+						@click="changeExample(item)"
+					>
+						<div class="left flex items-center justify-center" :class="['color' + index]">
+							<img :src="item.Icon" alt="" />
+						</div>
+						<div class="right">
+							<h4>{{ item.sample_title }}</h4>
+							<p>{{ item.sample_question }}</p>
+						</div>
+					</div>
+				</el-carousel-item>
+			</el-carousel>
+			<el-carousel height="80" :interval="6000" indicator-position="none" v-show="state.isShowExample">
+				<el-carousel-item v-for="(group, index) in state.m_groupArr" :key="index" class="set-carousel-item">
+					<div
+						class="main_item flex items-center cursor-pointer"
+						v-for="(item, index) in group"
 						:key="index"
 						:class="{ main_item_active: item.sample_id === activeSampleId }"
 						@click="changeExample(item)"
@@ -36,12 +55,13 @@
 </template>
 
 <script setup lang="ts">
-import { computed, onMounted, reactive, ref } from 'vue';
+import { onMounted, reactive, ref } from 'vue';
 import { getSelectSample } from '/@/api/ai/chat';
 import { activeRoomId, activeSampleId, activeSectionAId, setRoomConfig } from '/@/stores/chatRoom';
 let state = reactive({
 	exampleContent: [],
-	exampleRandomContent: [],
+	isShowExample: false,
+	m_groupArr: [],
 });
 const exampleList = ref([]); //妯$増鍒楄〃
 const emits = defineEmits<{
@@ -51,28 +71,20 @@
 onMounted(() => {
 	getSelectListSample();
 });
-//鎹竴鎵规暟鎹簮
-const groupedArray = computed(() => {
+
+const initGroupedArr = () => {
 	const groups = [];
 	let i = 0;
-	while (state.exampleRandomContent.length > i) {
-		groups.push(state.exampleRandomContent.slice(i, (i += 4)));
+	while (state.exampleContent.length > i) {
+		groups.push(state.exampleContent.slice(i, (i += 4)));
 	}
-	return groups;
-});
-//鑷姩鎾斁
-const batchSourceData = computed(() => {
-	const batch = [];
-	let i = 0;
-	while (exampleList.value.length > i) {
-		batch.push(exampleList.value.slice(i, (i += 4)));
-	}
-	return batch;
-});
+
+	state.m_groupArr = groups;
+};
+
 //鑾峰彇妯$増鍒楄〃
 const getSelectListSample = async () => {
 	const res = await getSelectSample({});
-	state.exampleRandomContent = res.samples;
 	const array = [];
 	res.samples.forEach((sample, index) => {
 		sample.Icon = '/static/images/wave/ChatImg.png';
@@ -82,7 +94,6 @@
 		}
 	});
 	exampleList.value = res.samples;
-	state.exampleContent = array;
 };
 
 const changeExample = (item) => {
@@ -93,33 +104,31 @@
 };
 //鎹竴鎵�
 const batchChange = () => {
-	const index = Math.floor(Math.random() * groupedArray.value.length);
-	state.exampleContent = groupedArray.value[index];
+	let groups = state.m_groupArr;
+	// 鎵撲贡鎵规椤哄簭
+	for (let i = groups.length - 1; i > 0; i--) {
+		const j = Math.floor(Math.random() * (i + 1));
+		[groups[i], groups[j]] = [groups[j], groups[i]];
+	}
+
+	state.m_groupArr = groups;
 };
 //鎵撳紑楂樼骇绀轰緥
 const advanceExampleClick = () => {
 	emits('advanceExampleClick', true);
 };
-const tagListClick = (group_item) => {
-	const curGroupID = group_item.p_group_id;
-	const curID = group_item.group_id;
-	const exampleContent = exampleList.value;
-	let curGroupIDs = [];
-	if (!curGroupID) {
-		curGroupIDs.push(curID);
-	} else {
-		exampleContent.forEach((item) => {
-			curGroupIDs.push(item.group_id);
-		});
-	}
+const tagListClick = (tagList) => {
 	let result = [];
-	curGroupIDs.forEach((curItem) => {
-		exampleContent.forEach((sample) => {
-			if (curItem == sample.group_id) result.push(sample);
+	tagList.forEach((tag) => {
+		exampleList.value.forEach((sample) => {
+			if (tag == sample.group_id) {
+				result.push(sample);
+			}
 		});
 	});
-	console.log('馃殌 ~ result:', result);
-	batchChange();
+	state.exampleContent = result;
+
+	initGroupedArr();
 };
 //闅忔満鐢熸垚棰滆壊
 const randomHexColor = () => {
@@ -173,6 +182,7 @@
 			width: calc(50% - 16px);
 			margin: 8px;
 			padding: 12px;
+			height: 84px;
 			border: 1px solid #d9dbde;
 			border-radius: 5px;
 			background-color: transparent;
diff --git a/src/views/project/ch/home/component/waterRight/top.vue b/src/views/project/ch/home/component/waterRight/top.vue
index 44a2524..440d8fe 100644
--- a/src/views/project/ch/home/component/waterRight/top.vue
+++ b/src/views/project/ch/home/component/waterRight/top.vue
@@ -3,20 +3,7 @@
 		<img src="/static/images/logo/logoWithNoName.png" alt="logo" class="layout-logo-medium-img" />
 		<p class="set-waterTitle"><strong>WI 姘村姟鏅鸿兘绠″</strong>鏅烘収姘村姟鍔╂墜</p>
 	</div>
-	<div class="flex items-center pc-roleList">
-		<!-- <div v-for="(item, index) in llmList" :key="item.logicId" class="flex items-center pl-6" @click="handleClick(item)">
-			<div class="modelItem cursor-pointer flex items-center" :class="{ modelItemActive: item.logicId === activeLLMId }">
-				<img :src="item.icon" alt="icon" class="set-icon box-border" />
-				<span>{{ item.logicTitle }}</span>
-			</div>
-		</div>
-		<div class="flex items-center cursor-pointer pl-5">
-			<div class="modelItem cursor-pointer flex items-center">
-				<img src="/static/images/wave/More.png" alt="icon" class="set-icon-more box-border" />
-				<span>鏇村</span>
-			</div>
-		</div> -->
-	</div>
+	<div class="flex items-center pc-roleList"></div>
 	<PlayBar v-model="inputValue" @send-click="sendClick" :is-home="true" />
 </template>
 
@@ -29,7 +16,6 @@
 import { activeChatRoom, activeLLMId, activeSectionAId } from '/@/stores/chatRoom';
 import { handleNormalAuth } from '/@/utils/request';
 
-import logo from './logo.png'
 const emits = defineEmits(['sendClick']);
 const inputValue = ref('鏂板缓瀵硅瘽寮�濮�');
 
diff --git a/src/views/types/metrics/index.ts b/src/views/types/metrics/index.ts
index baa63cc..21396f4 100644
--- a/src/views/types/metrics/index.ts
+++ b/src/views/types/metrics/index.ts
@@ -38,18 +38,4 @@
 	[eDimensionFilterOps.All]: '=',
 	[eDimensionFilterOps.IN]: 'IN',
 	[eDimensionFilterOps.LIKE]: 'LIKE',
-} as const;
-// 涓氬姟鍒嗙被
-export enum classificationEnum {
-	/** @description 涓氬姟 */
-	Business = 1,
-	/** @description 鍔炲叕 */
-	Office = 2,
-	/** @description 鐭ヨ瘑 */
-	Knowledge = 3,
-}
-export const OptClassificationMap = {
-	[classificationEnum.Business]: '涓氬姟鍦烘櫙',
-	[classificationEnum.Office]: '鍔炲叕鍔╂墜',
-	[classificationEnum.Knowledge]: '鐭ヨ瘑搴�',
-};
\ No newline at end of file
+} as const;
\ No newline at end of file

--
Gitblit v1.9.3