|
@@ -14,42 +14,48 @@
|
|
|
import { Row, Col } from 'ant-design-vue';
|
|
|
import { BasicTree } from '/@/components/Tree';
|
|
|
import type { TreeProps } from 'ant-design-vue';
|
|
|
- import { VENTILATION_STATUS_HEADER_CONFIG, VENTILATION_STATUS_TREE_CONFIG } from '../billboard.data';
|
|
|
+ import { DEFAULT_TEST_DATA, VENTILATION_STATUS_HEADER_CONFIG, VENTILATION_STATUS_TREE_CONFIG } from '../billboard.data';
|
|
|
import MiniBoard from './MiniBoard.vue';
|
|
|
import { onMounted, ref, shallowRef } from 'vue';
|
|
|
import CommonTitle from './CommonTitle.vue';
|
|
|
- import { getSummary } from '../billboard.api';
|
|
|
// import mapComponent from './components/3Dmap/index.vue';
|
|
|
|
|
|
- const data = shallowRef({});
|
|
|
+ const props = withDefaults(
|
|
|
+ defineProps<{
|
|
|
+ data?: any;
|
|
|
+ }>(),
|
|
|
+ {
|
|
|
+ data: DEFAULT_TEST_DATA,
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ const baseData = shallowRef({});
|
|
|
const ventilatorCount = ref('0');
|
|
|
const treeData = shallowRef<TreeProps['treeData']>([]);
|
|
|
|
|
|
function fetchData() {
|
|
|
- getSummary().then((r) => {
|
|
|
- ventilatorCount.value = r.ventInfo.fanMainList.length.toString();
|
|
|
- data.value = r.ventInfo;
|
|
|
- treeData.value = r.ventInfo.fanMainList.map((e, i) => {
|
|
|
- const { prefix, suffix, prop, children } = VENTILATION_STATUS_TREE_CONFIG;
|
|
|
- return {
|
|
|
- title: `${prefix}${e[prop]}${suffix}`,
|
|
|
- key: i.toString(),
|
|
|
- children: children.map((child, j) => {
|
|
|
- // 配置里如果指定了多个prop则进行合并
|
|
|
- if (Array.isArray(child.prop)) {
|
|
|
- return {
|
|
|
- title: `${child.prefix}${child.prop.map((p) => `${e[p]}${suffix}`).join('-')}`,
|
|
|
- key: `${i}-${j}`,
|
|
|
- };
|
|
|
- } else {
|
|
|
- return {
|
|
|
- title: `${child.prefix}${e[child.prop]}${child.suffix}`,
|
|
|
- key: `${i}-${j}`,
|
|
|
- };
|
|
|
- }
|
|
|
- }),
|
|
|
- };
|
|
|
- });
|
|
|
+ ventilatorCount.value = props.data.ventInfo.fanMainList.length.toString();
|
|
|
+ baseData.value = props.data.ventInfo;
|
|
|
+ treeData.value = props.data.ventInfo.fanMainList.map((e, i) => {
|
|
|
+ const { prefix, suffix, prop, children } = VENTILATION_STATUS_TREE_CONFIG;
|
|
|
+ return {
|
|
|
+ title: `${prefix}${e[prop]}${suffix}`,
|
|
|
+ key: i.toString(),
|
|
|
+ children: children.map((child, j) => {
|
|
|
+ // 配置里如果指定了多个prop则进行合并
|
|
|
+ if (Array.isArray(child.prop)) {
|
|
|
+ return {
|
|
|
+ title: `${child.prefix}${child.prop.map((p) => `${e[p]}${suffix}`).join('-')}`,
|
|
|
+ key: `${i}-${j}`,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ title: `${child.prefix}${e[child.prop]}${child.suffix}`,
|
|
|
+ key: `${i}-${j}`,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ };
|
|
|
});
|
|
|
}
|
|
|
|