index.vue
2.09 KB
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
<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { useMultipleDataFetch } from '../../../hook/useSocket';
import { ComponentPropsConfigType, MultipleDataFetchUpdateFn } from '../../../index.type';
import { option } from './config';
import { DeviceName } from '/@/views/visual/commonComponents/DeviceName';
import { BasicTable, useTable, BasicColumn } from '/@/components/Table';
const props = defineProps<{
config: ComponentPropsConfigType<typeof option>;
}>();
const realTimeList = ref<any>([
{ attribute: '测试', price: 2, time: '2023-06-29' },
{ attribute: '测试1', price: 21, time: '2023-06-29' },
{ attribute: '测试2', price: 213, time: '2023-06-29' },
]);
const realTimeColumn = reactive<BasicColumn[]>([
{ title: '属性', dataIndex: 'attribute', width: 80, ellipsis: true },
{ title: '值', dataIndex: 'price', width: 80, ellipsis: true },
{ title: '时间', dataIndex: 'time', width: 80, ellipsis: true },
]);
const [registerTable] = useTable({
showIndexColumn: false,
showTableSetting: false,
dataSource: realTimeList,
canResize: true,
maxHeight: 144,
size: 'small',
// columns: [{ title: '属性', dataIndex: 'attribute', width: 80 }],
columns: realTimeColumn as any,
});
// const getDesign = computed(() => {
// const { persetOption, option } = props.config;
// clearInterval;
// return {};
// });
// const randomFn = () => {
// useIntervalFn(() => {
// const value = (Math.random() * 100).toFixed(0);
// unref(chartInstance)?.setOption({
// series: [{ data: [{ value }] }, { data: [{ value }] }],
// } as EChartsOption);
// }, 3000);
// };
const updateFn: MultipleDataFetchUpdateFn = () => {};
useMultipleDataFetch(props, updateFn);
// const { getRatio } = useComponentScale(props);
</script>
<template>
<main class="flex flex-col justify-center items-center">
<DeviceName :config="config" />
<div>
<!-- <PageWrapper> -->
<BasicTable @register="registerTable" />
<!-- </PageWrapper> -->
</div>
</main>
</template>