<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>
|