From 1476d27514874e9c95002451a81878bd9bec8382 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期六, 14 十二月 2024 15:36:53 +0800
Subject: [PATCH] 多轮对话

---
 src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue |   94 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 71 insertions(+), 23 deletions(-)

diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue
index 17e3a83..5d02b44 100644
--- a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue
+++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue
@@ -1,23 +1,41 @@
 <template>
-	<el-dialog :destroy-on-close="true" v-model="isShow" draggable :close-on-click-modal="false" :title="chartValues?.title">
-		<RecordSet chartHeight="30rem" ref="recordSetRef" :data="chartValues">
+	<el-dialog
+		:destroy-on-close="true"
+		v-model="isShow"
+		draggable
+		:close-on-click-modal="false"
+		:title="chartValues?.title"
+		v-if="computedIsDialog"
+	>
+		<RecordSet :chartHeight="computedHeight" ref="recordSetRef" :data="chartValues">
 			<TimeRange ref="timeRangeRef" v-model="queryRange" class="flex-0 m-1" @change="timeRangeChange" />
-			<List class="flex-0 m-1" v-model="stepTime" :data="listData" @change="selectStepChange" />
+			<List  class="flex-0 m-1" v-model="stepTime" :data="listData" @change="selectStepChange" />
 		</RecordSet>
 	</el-dialog>
+	<div v-else v-show="isShow">
+		<RecordSet :chartHeight="computedHeight" ref="recordSetRef" :data="chartValues">
+			<TimeRange ref="timeRangeRef" v-model="queryRange" class="flex-0 m-1" @change="timeRangeChange" />
+		
+		</RecordSet>
+	</div>
 </template>
 
 <script setup lang="ts">
-import { nextTick, ref, watch } from 'vue';
+import { computed, nextTick, ref, watch } from 'vue';
 import RecordSet from './RecordSet.vue';
+import List from './components/List.vue';
+import TimeRange from './components/TimeRange.vue';
 import { queryScadaTimeValues } from '/@/api/ai/chat';
+import { formatDate } from '/@/utils/formatTime';
 import { useCompRef } from '/@/utils/types';
 import { getRecentDateRange } from '/@/utils/util';
-import { formatDate } from '/@/utils/formatTime';
-import TimeRange from './components/TimeRange.vue';
-import List from './components/List.vue';
+import service from '/@/utils/request';
 
-const props = defineProps(['otype', 'oname', 'indexName']);
+const props = defineProps(['otype', 'oname', 'indexName', 'isDialog', 'height','metrics']);
+// SDVAL_FULL_FLOW true 25 DEV_FLOW_W
+
+const computedIsDialog = computed(() => props.isDialog ?? true);
+const computedHeight = computed(() => props.height ?? '30rem');
 
 const isShow = defineModel({
 	type: Boolean,
@@ -50,24 +68,52 @@
 const stepTime = ref('5 minutes');
 const chartValues = ref(null);
 const setChartData = async () => {
-	const res = await queryScadaTimeValues({
-		// 璁惧绫诲瀷
-		ptype: props.otype,
-		// 璁惧鍚嶇О
-		pname: props.oname,
-		otype: props.indexName,
-		start_time: timeRangeRef.value.formatDateValue[0],
-		end_time: timeRangeRef.value.formatDateValue[1],
-		step_time: stepTime.value,
-	});
+	let res = computedIsDialog.value
+		? await queryScadaTimeValues({
+				// 璁惧绫诲瀷
+				ptype: props.otype,
+				// 璁惧鍚嶇О
+				pname: props.oname,
+				otype: props.indexName,
+				start_time: timeRangeRef.value.formatDateValue[0],
+				end_time: timeRangeRef.value.formatDateValue[1],
+				step_time: stepTime.value,
+		  })
+		: await service({
+				url: props.metrics.url,
+				method: 'post',
+				data: {
+					start_time: timeRangeRef.value.formatDateValue[0],
+					end_time: timeRangeRef.value.formatDateValue[1],
+				},
+		  });
+	if (!computedIsDialog.value) {
+		res = {
+			json_ok: res.json_ok,
+			values: {
+				title: props.metrics.title,
+				values: res.values,
+				cols: [
+					{
+						title: '鏃堕棿',
+						type: 'time',
+					},
+					{
+						title: '鍊�',
+						type: 'value',
+					},
+				],
+			},
+		};
+	}
 	chartValues.value = res.values;
 	chartValues.value.chart = 'single_line';
 	nextTick(() => {
 		setTimeout(() => {
-			if(recordSetRef.value.isMultiCompare){
+			if (recordSetRef.value.isMultiCompare) {
 				recordSetRef.value.handleData();
 				recordSetRef.value.handleMultiCompare();
-			}else{
+			} else {
 				recordSetRef.value.drawChart();
 			}
 		}, 0);
@@ -81,10 +127,12 @@
 			return;
 		}
 		queryRange.value = getRecentDateRange(1).map((item) => formatDate(item));
-		nextTick(()=>{
+		nextTick(() => {
 			setChartData();
-
-		})
+		});
+	},
+	{
+		immediate:true
 	}
 );
 </script>

--
Gitblit v1.9.3