From 59cf25e40c6ab33d7a7c6e73594cd1e358906250 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 28 十一月 2024 17:58:22 +0800 Subject: [PATCH] tab --- src/components/chat/chatComponents/summaryCom/components/recordSetTable/RecordSetTable.vue | 124 +++++++++++++++++++++++++--------------- 1 files changed, 77 insertions(+), 47 deletions(-) diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/RecordSetTable.vue b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/RecordSetTable.vue index f097a31..eb1e325 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/RecordSetTable.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/RecordSetTable.vue @@ -4,7 +4,7 @@ <div class="flex-0 flex-items-center mb-1 flex-wrap"> <template v-if="visibleParams && visibleParams.length > 0 && showFilter"> <component - class="flex-0 m-2" + class="flex-0 m-2 first-of-type:ml-0" :class="{ invisible: showMode2 === DisplayModeType2.Map }" v-model="visibleParams[index].value" v-for="(item, index) in visibleParams as any" @@ -27,7 +27,11 @@ @change="displayModeChange" /> <div class="ml-auto space-x-2 flex-items-center" v-if="isMap || !isTotalTable"> - <ColFilter v-if="!isTotalTable" :columnList="colList" @change="colFilterChange" /> + <ColFilter + v-if="(!isMap && !isTotalTable) || (isMap && showMode2 === DisplayModeType2.List && !isTotalTable)" + :columnList="colList" + @change="colFilterChange" + /> <DisplayMode v-if="isMap" @@ -112,14 +116,24 @@ </div> <div class="flex-auto" v-if="isMap && showMode2 === DisplayModeType2.Map"> - <MapView :data="data" @equipClick="showCurve"/> + <MapView :data="data" @equipClick="showCurve" @closeInfoWindow="closeInfoWindow" /> </div> <div class="flex-auto" v-resize="debounceResizeChart" v-show="showMode === DisplayModeType.Chart"> <div ref="chartRef" style="height: 25rem"></div> </div> - - <RecordSetDialog v-model="chartDlgIsShow" indexName="SDVAL_FULL_FLOW" oname="25" otype="DEV_FLOW_W" :isDialog="false" height="20rem"/> + <div class="mt-5 relative" v-if="chartDlgIsShow && metricsList.length > 0"> + <span + class="absolute right-[10px] top-[5px] ywifont ywicon-guanbi text-[#528abe] font-bold cursor-pointer" + style="z-index: 2" + @click="closeChartDlg" + ></span> + <el-tabs v-model="activeTab" type="border-card"> + <el-tab-pane lazy v-for="(item, index) in metricsList" :key="`${chartDlgKey}_${index}`" :label="item.title" :name="index" + ><RecordSetDialog :modelValue="true" :isDialog="false" height="20rem" :metrics="item" + /></el-tab-pane> + </el-tabs> + </div> <InfoDetail class="text-base" v-model="infoDetailIsShow" :item="detailMapRow" :colList="colList" /> </div> @@ -147,7 +161,6 @@ import { LocalPlus } from '/@/utils/storage'; import { debounce, getTextWidth, toPercent } from '/@/utils/util'; import RecordSetDialog from '../recordSet/RecordSetDialog.vue'; - const props = defineProps({ data: { @@ -339,7 +352,27 @@ }; } }; +const getItemMap = (arr: any[], defaultProps = 'ID', isMultiple = false) => { + if (!arr || arr.length === 0) return {}; + const result = arr.reduce((acc, curr) => { + if (isMultiple) { + if (!acc.get(curr[defaultProps])) { + acc.set(curr[defaultProps], [curr]); + } else { + { + /* acc[curr[defaultProps]].push(curr); */ + } + acc.get(curr[defaultProps]).push(curr); + } + } else { + acc.set(curr[defaultProps], curr); + } + return acc; + }, new Map()); + + return result; +}; // 鍗曞厓鏍艰鍚堝苟鎯呭喌 const cellRowSpanMap = new Map<string, number | undefined>(); @@ -374,28 +407,6 @@ return result; }; -const getItemMap = <T>(arr: T[], defaultProps = 'ID', isMultiple = false) => { - if (!arr || arr.length === 0) return {}; - - const result = arr.reduce((acc, curr) => { - if (isMultiple) { - if (!acc.get(curr[defaultProps])) { - acc.set(curr[defaultProps], [curr]); - } else { - { - /* acc[curr[defaultProps]].push(curr); */ - } - acc.get(curr[defaultProps]).push(curr); - } - } else { - acc.set(curr[defaultProps], curr); - } - return acc; - }, new Map()) as Map<string, T | T[]>; - - return result; -}; - /** * 璁$畻姣忎竴鍒楃殑瀹藉害 * 1锛夋�诲灏忎簬瀹瑰櫒瀹斤細鐩存帴鎸夋瘮渚嬪垎 @@ -403,6 +414,7 @@ * 3锛夎绠楀畬鐨勫搴︽斁鍦� colList.value 鐨� width 灞炴�т笂 * @param width */ + const calcColWidth = (width) => { // 杩斿洖鎵�鏈夋爣棰樺瓧绗︿覆 const maxStrList = tableCols.value.map((item, index) => { @@ -1141,33 +1153,51 @@ } }; -const chartDlgIsShow = ref(false) - -const showCurve = (row) =>{ +const chartDlgIsShow = ref(false); +const chartDlgKey = ref(''); +const activeTab = ref(0); +const metricsList = ref([]); +const resetTab = () => { + activeTab.value = 0; +}; +const showCurve = (row) => { + resetTab(); chartDlgIsShow.value = true; -} -const tableRowClick =(row)=>{ - if(isMap.value) { - showCurve(row) - }else{ - showInfoDetail(row) + const quotaChartCol = props.data?.quota_chart?.col; + if (!quotaChartCol) { + chartDlgKey.value = ''; + metricsList.value = []; + } else { + const str = row[quotaChartCol] ?? '[]'; + chartDlgKey.value = str; + metricsList.value = JSON.parse(str); + } +}; +const closeInfoWindow = () => { + closeChartDlg(); +}; +const closeChartDlg = () => { + chartDlgIsShow.value = false; +}; + +const tableRowClick = (row) => { + if (isMap.value) { + showCurve(row); + } else { + showInfoDetail(row); } chartDlgIsShow.value = true; -} +}; -const tableDblClick = (row) =>{ - if(!isMap.value) return; - showInfoDetail(row) +const tableDblClick = (row) => { + if (!isMap.value) return; + showInfoDetail(row); +}; -} defineExpose({ updateAll, updateCurrent, updateIndexSummary, }); </script> -<style scoped lang="scss"> -// :deep(.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell){ -// background-color: v-bind(stripedBgColor); -// } -</style> +<style scoped lang="scss"></style> -- Gitblit v1.9.3