From 96279191d9fe0e80123c557f1c7dafb2e74ed195 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期五, 10 一月 2025 10:01:29 +0800 Subject: [PATCH] 单位支持 --- src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue | 28 +++++++++++++++++++--------- src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue | 12 ++++++++---- src/components/chat/chatComponents/summaryCom/components/deviceLastValue/MonitorContent.vue | 4 ++-- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/components/chat/chatComponents/summaryCom/components/deviceLastValue/MonitorContent.vue b/src/components/chat/chatComponents/summaryCom/components/deviceLastValue/MonitorContent.vue index 9739fba..c4f4cec 100644 --- a/src/components/chat/chatComponents/summaryCom/components/deviceLastValue/MonitorContent.vue +++ b/src/components/chat/chatComponents/summaryCom/components/deviceLastValue/MonitorContent.vue @@ -30,7 +30,7 @@ @mouseleave="valueMouseLeave" @click="emit('itemClick', item, row)" > - {{ item[type]?.['OVALUE'] }} + {{ row.unit ? `${item[type]?.['OVALUE']} ${row.unit}` : item[type]?.['OVALUE'] }} </span> </div> <div @@ -54,7 +54,7 @@ </div> <div v-if="hoverState.data?.[type] || hoverState.data?.[type] === 0" class="flex"> <div class="w-8">鐩戞祴</div> - <div class="before:content-[':'] before:pr-1.5">{{ hoverState.data?.[type]?.['OVALUE'] }}</div> + <div class="before:content-[':'] before:pr-1.5">{{ row.unit ? `${hoverState.data?.[type]?.['OVALUE']} ${row.unit}` : hoverState.data?.[type]?.['OVALUE'] }}</div> </div> <div class="flex" v-if="hoverState.data?.OTIME"> <div class="w-8">鏃堕棿</div> diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue index 23bd8e5..2f082a3 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue @@ -100,9 +100,9 @@ type: String, required: false, }, - tableHeight:{ - type:Number, - default:document.body.clientHeight * 0.7, + tableHeight: { + type: Number, + default: document.body.clientHeight * 0.7, }, showFilter: { type: Boolean, @@ -112,7 +112,7 @@ type: Boolean, default: false, }, - reportIndex:{ + reportIndex: { type: Number, default: 0, }, @@ -136,7 +136,7 @@ const getVisibleParams = (data) => { // const visibleList = props.data?.params?.filter((item) => !item?.hide) ?? []; // index 浣滀负 id - const dataFilter = data?.filter ?? []; + const dataFilter = data?.filter ?? []; const visibleList = (data?.filter ?? []).map((item, index) => { // 涓嶄慨鏀瑰師濮嬪湴鍧� item.id = index + ''; @@ -284,8 +284,6 @@ } : axisLabelFormatter; - - const tooltipValueFormatter = (value) => { const realValue = originChartType === ChartTypeEnum.Score ? scoreMap[value] : value; return realValue + (props.data.unit ? ` ${props.data.unit}` : ''); @@ -704,7 +702,7 @@ return `${name}锛�${props.data.unit}锛塦; } return name; - } + }; const cols = currentSeries.value.map((item, index) => ({ title: getColName(item.name ?? `鍊�${index + 1}`), type: 'text', @@ -767,13 +765,25 @@ updateCurrent(summary?.[props.summaryIndex], true); }; +const clearChart = () => { + chartInstance.value.setOption( + { + title: { + text: '', + }, + series: [], + }, + true + ); +}; + defineExpose({ drawChart, isMultiCompare, handleMultiCompare, handleData, updateAll, - + clearChart, updateIndexSummary, }); </script> diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue index aa2821c..d46e8d3 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSetDialog.vue @@ -30,7 +30,7 @@ import { getRecentDateRange } from '/@/utils/util'; import service from '/@/utils/request'; -const props = defineProps([ 'isDialog', 'height', 'metrics', 'tableHeight','metricsInfo','lastValueItem']); +const props = defineProps(['isDialog', 'height', 'metrics', 'tableHeight', 'metricsInfo', 'lastValueItem']); // SDVAL_FULL_FLOW true 25 DEV_FLOW_W const computedIsDialog = computed(() => props.isDialog ?? true); @@ -67,10 +67,9 @@ const stepTime = ref('5 minutes'); const chartValues = ref(null); const setChartData = async () => { - let url = ''; if (computedIsDialog.value) { - const otype = props.metricsInfo.id; + const otype = props.metricsInfo.id; const oname = props.lastValueItem[otype]?.ONAME; const queryId = props.metricsInfo.query_detail_id; url = `chat/query_detail_values?query_id=${queryId}&otype=${otype}&oname=${oname}`; @@ -104,7 +103,7 @@ ], }, }; - }else{ + } else { res = { json_ok: res.json_ok, values: { @@ -122,9 +121,13 @@ ], }, }; + if (props.metricsInfo.unit) { + res.values.unit = props.metricsInfo.unit; + } } chartValues.value = res.values; chartValues.value.chart = 'single_line'; + nextTick(() => { setTimeout(() => { if (recordSetRef.value.isMultiCompare) { @@ -141,6 +144,7 @@ () => isShow.value, (val) => { if (!val) { + recordSetRef.value?.clearChart(); return; } queryRange.value = getRecentDateRange(1).map((item) => formatDate(item)); -- Gitblit v1.9.3