wujingjing
2025-01-17 055c8329a8e8f7bc50bb1f10711031ea0bccaf2f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<template>
    <div class="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="height" :metrics="item" :tableHeight="tableHeight"
            /></el-tab-pane>
        </el-tabs>
    </div>
</template>
 
<script setup lang="ts" name="EquipCurve">
import { onMounted, ref, watch } from 'vue';
import { isSharePage } from '/@/stores/chatRoom';
import RecordSetDialog from '../../recordSet/RecordSetDialog.vue';
const props = defineProps({
    data: {
        type: Object,
        default: () => ({}),
    },
    quotaChartCol: {
        type: Number,
        default: null,
    },
    height: {
        type: String,
        default: '20rem',
    },
    tableHeight: {
        type: Number,
    },
});
const chartDlgIsShow = defineModel('isShow', {
    type: Boolean,
    default: false,
});
 
const chartDlgKey = ref('');
const activeTab = ref(0);
const metricsList = ref([]);
const resetTab = () => {
    activeTab.value = 0;
};
const showCurve = () => {
    if (isSharePage.value) return;
    resetTab();
    // chartDlgIsShow.value = true;
    const quotaChartCol = props.quotaChartCol;
    if (!quotaChartCol) {
        chartDlgKey.value = '';
        metricsList.value = [];
    } else {
        const str = props.data[props.quotaChartCol] ?? '[]';
        chartDlgKey.value = str;
        metricsList.value = JSON.parse(str);
    }
};
const closeChartDlg = () => {
    chartDlgIsShow.value = false;
};
 
watch(
    () => props.data,
    (val) => {
        if (chartDlgIsShow.value && val) {
            showCurve();
        }
    }
);
</script>
<style scoped lang="scss"></style>