wujingjing
2025-04-02 7866aa30bd13dab1fc0662e1baf6675d0dc1b282
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<template>
    <el-dialog
        class=""
        :destroy-on-close="true"
        v-model="dialogIsShow"
        width="70%"
        :close-on-click-modal="false"
        @closed="closeDialog"
    >
        <template #header>
            <div style="color: #fff">
                <SvgIcon name="ele-Document" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" />
                <span>查看指标</span>
            </div>
        </template>
        <div class="w100 h100">
            <div class="h-[32rem] flex-column" v-if="dialogIsShow">
                <ChartDisplay
                    class="h-full"
                    :values="dataValues"
                    :mapRow="{
                        title: data?.title ??'',
                    }"
                />
            </div>
        </div>
    </el-dialog>
</template>
 
<script setup lang="ts">
import type { PropType } from 'vue';
import { computed, ref, watch } from 'vue';
// import TableSearch from './search/index.vue';
import type { Attach } from '../hook/useAttach';
import ChartDisplay from './ChartDisplay.vue';
 
const dialogIsShow = defineModel({
    type: Boolean,
});
const props = defineProps({
    data: {
        type: Object as PropType<Attach>,
        default: () => {},
    },
});
const closeDialog = () => {
    dialogIsShow.value = false;
};
 
const getIndexMapItem = (columns) => {
    return new Map<number, any>(
        columns.map((item, index) => {
            return [index, item];
        })
    );
};
 
//#region ====================== 查询 ======================
 
const parseRecordData = (values, columns) => {
    const indexMapItem = getIndexMapItem(columns);
    return (values || []).map((item, index) => {
        const row = {} as any;
        item?.forEach((item, index) => {
            row[indexMapItem.get(index).name] = item;
        });
        return row;
    });
};
 
//#endregion
 
const dataValues = computed(() => {
    return {
        columns: props.data?.model?.columns ?? [],
        records: props.data?.model?.values ?? [],
    };
});
watch(
    () => dialogIsShow.value,
    (val) => {
        if (!val) return;
    }
);
</script>
<style scoped lang="scss">
.set-permission {
    padding-block: 16px;
    padding-block-end: 0;
}
.set-form {
    display: block;
    box-sizing: border-box;
    height: 100%;
    padding-block: 16px;
    .set-form-item {
        font-weight: 500;
        color: #667085;
        font-size: 14px;
    }
}
 
:deep(.el-dialog__body) {
    // height: calc(90vh - 111px) !important;
}
</style>
<style lang="scss">
.limit-height {
    .el-dialog__body {
        // height: calc(90vh - 111px) !important;
    }
}
 
.yw-layout-main {
    .el-card__body {
        padding: 10px;
    }
}
</style>