| | |
| | | <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" |
| | | :key="item.id" |
| | |
| | | ></component> |
| | | </template> |
| | | |
| | | <ColFilter v-if="!isTotalTable" class="ml-auto" :columnList="colList" @change="colFilterChange" /> |
| | | <DisplayMode v-if="isTotalTable" class="ml-auto" :order="modeChangeOrder" v-model="showMode" :displayModeTypeMap="displayModeTypeMap" @change="displayModeChange" /> |
| | | <DisplayMode |
| | | v-if="isTotalTable" |
| | | class="ml-auto" |
| | | :order="modeChangeOrder" |
| | | v-model="showMode" |
| | | :modeTypeMap="displayModeTypeMap" |
| | | @change="displayModeChange" |
| | | /> |
| | | <div class="ml-auto space-x-2 flex-items-center" v-if="isMap || !isTotalTable"> |
| | | <ColFilter |
| | | v-if="(!isMap && !isTotalTable) || (isMap && showMode2 === DisplayModeType2.List && !isTotalTable)" |
| | | :columnList="colList" |
| | | @change="colFilterChange" |
| | | /> |
| | | |
| | | <DisplayMode v-if="isMap" class="ml-auto" :order="modeChangeOrder2" :displayModeTypeMap="displayModeTypeMap2" v-model="showMode2" @change="displayModeChange2" /> |
| | | <DisplayMode |
| | | v-if="isMap" |
| | | :order="modeChangeOrder2" |
| | | :modeTypeMap="displayModeTypeMap2" |
| | | v-model="showMode2" |
| | | @change="displayModeChange2" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <div class="flex-auto flex-col" style="display: flex" v-show="showMode === DisplayModeType.List && showMode2===DisplayModeType2.List"> |
| | | <div |
| | | class="flex-auto flex-col" |
| | | style="display: flex" |
| | | v-show="(!isMap && showMode === DisplayModeType.List) || (isMap && showMode2 === DisplayModeType2.List)" |
| | | > |
| | | <div class="flex-auto" ref="containerRef" v-resize="resizeHandler" v-loading="queryLoading"> |
| | | <el-table |
| | | ref="tableRef" |
| | |
| | | :cell-style="tableCellStyle" |
| | | :header-cell-style="tableHeaderCellStyle" |
| | | :data="tableData" |
| | | @row-click="recordSelectChange" |
| | | @row-dblclick="tableDblClick" |
| | | @row-click="tableRowClick" |
| | | @sort-change="sortChange" |
| | | :spanMethod="objectSpanMethod" |
| | | class="w-full h-full" |
| | |
| | | /> |
| | | </div> |
| | | |
| | | <div class="flex-auto" v-if="showMode2 === DisplayModeType2.Map"> |
| | | <MapView :data="data"/> |
| | | <div class="flex-auto" v-if="isMap && showMode2 === DisplayModeType2.Map"> |
| | | <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> |
| | | <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" /> |
| | |
| | | import { createReusableTemplate } from '@vueuse/core'; |
| | | import * as echarts from 'echarts'; |
| | | import type { TableInstance } from 'element-plus'; |
| | | import { chunk, sortBy } from 'lodash-es'; |
| | | import type { CSSProperties } from 'vue'; |
| | | import { computed, nextTick, onMounted, reactive, ref, shallowRef, watchEffect, type PropType } from 'vue'; |
| | | import { PATH_ICON } from '../../../common'; |
| | | import { ChartTypeEnum } from '../../../types'; |
| | | import { BORDER_COLOR, COL_HEADER_CELL_BG_COLOR, THICK_BORDER_WIDTH } from '../deviceLastValue/constants'; |
| | | import DisplayMode from '../recordSet/components/DisplayMode.vue'; |
| | | import { DisplayModeType, DisplayModeType2,displayModeTypeMap2,displayModeTypeMap } from '../recordSet/components/types'; |
| | | import { DisplayModeType, DisplayModeType2, displayModeTypeMap, displayModeTypeMap2 } from '../recordSet/components/types'; |
| | | import { RecordSetParamsType, recordSetMapCom } from '../recordSet/types'; |
| | | import MapView from './map/Map.vue' |
| | | import InfoDetail from './infoDetail/InfoDetail.vue'; |
| | | import MapView from './map/Map.vue'; |
| | | import { curveQuery } from '/@/api/ai/chat'; |
| | | import ColFilter from '/@/components/table/colFilter/ColFilter.vue'; |
| | | import { TableCol } from '/@/components/table/colFilter/types'; |
| | | import { axisLabelFormatter } from '/@/utils/chart'; |
| | | import { LocalPlus } from '/@/utils/storage'; |
| | | import { debounce, getTextWidth, toPercent } from '/@/utils/util'; |
| | | import { sortBy, chunk } from 'lodash-es'; |
| | | import RecordSetDialog from '../recordSet/RecordSetDialog.vue'; |
| | | |
| | | const props = defineProps({ |
| | | data: { |
| | |
| | | |
| | | const isMap = computed(() => { |
| | | return props.data?.hasOwnProperty('map') ?? false; |
| | | |
| | | }); |
| | | |
| | | const isTotalTable = computed(() => checkIsTotalTable(props.data)); |
| | |
| | | }; |
| | | } |
| | | }; |
| | | 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>(); |
| | | |
| | |
| | | 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)总宽小于容器宽:直接按比例分 |
| | |
| | | * 3)计算完的宽度放在 colList.value 的 width 属性上 |
| | | * @param width |
| | | */ |
| | | |
| | | const calcColWidth = (width) => { |
| | | // 返回所有标题字符串 |
| | | const maxStrList = tableCols.value.map((item, index) => { |
| | |
| | | |
| | | // 是否已经显示所有列了 |
| | | const haveShowAll = computed(() => visibleColProp.value.length === colList.value.length); |
| | | const recordSelectChange = (row) => { |
| | | const showInfoDetail = (row) => { |
| | | if (haveShowAll.value) return; |
| | | detailMapRow.value = row; |
| | | infoDetailIsShow.value = true; |
| | |
| | | const sendOrderName = sendOrder ? `${colName},${sendOrder}` : ''; |
| | | orderDimName = sendOrderName; |
| | | |
| | | |
| | | queryUpdate().then(()=>{ |
| | | orderMap.set(prop,order); |
| | | queryUpdate().then(() => { |
| | | orderMap.set(prop, order); |
| | | column.order = order; |
| | | }); |
| | | }; |
| | | |
| | | // 地图模式展示 |
| | | const showMode2 = ref(DisplayModeType2.List); |
| | | const modeChangeOrder2 = [DisplayModeType2.List, DisplayModeType2.Map]; |
| | | const showMode2 = ref(DisplayModeType2.Map); |
| | | const modeChangeOrder2 = [DisplayModeType2.Map, DisplayModeType2.List]; |
| | | |
| | | const displayModeChange2 = (val: DisplayModeType2) => { |
| | | if (val === DisplayModeType2.Map) { |
| | | //if (!chartInstance.value || needUpdateChart) { |
| | | //updateChart(); |
| | | //needUpdateChart = false; |
| | | //updateChart(); |
| | | //needUpdateChart = false; |
| | | //} |
| | | } |
| | | }; |
| | | |
| | | 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 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); |
| | | }; |
| | | |
| | | 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> |