|
@@ -0,0 +1,116 @@
|
|
|
+<!-- eslint-disable vue/multi-word-component-names -->
|
|
|
+<template>
|
|
|
+ <CostumeHeader :api="fetchOptions" @change="selectDeviceByID">
|
|
|
+ <div class="w-200px flex flex-items-center">
|
|
|
+ <RightCircleOutlined class="w-30px" />
|
|
|
+ <div class="flex-grow-1">
|
|
|
+ {{ selectedDevice.strinstallpos }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </CostumeHeader>
|
|
|
+ <Bar
|
|
|
+ :option="chartOption"
|
|
|
+ series-prop-type="valueA"
|
|
|
+ x-axis-prop-type="x"
|
|
|
+ :chart-data="[
|
|
|
+ { valueA: 1, valueB: 1, x: 2 },
|
|
|
+ { valueA: 1, valueB: 1, x: 4 },
|
|
|
+ { valueA: 1, valueB: 1, x: 4 },
|
|
|
+ { valueA: 1, valueB: 1, x: 4 },
|
|
|
+ { valueA: 2, valueB: 2, x: 4 },
|
|
|
+ { valueA: 3, valueB: 1, x: 4 },
|
|
|
+ { valueA: 1, valueB: 1, x: 4 },
|
|
|
+ ]"
|
|
|
+ height="250px"
|
|
|
+ />
|
|
|
+ <!-- <div class="flex justify-around mt-10px">
|
|
|
+ <MiniBoard v-for="item in configs" :key="item.prop" :label="item.label" :value="selectedDevice[item.prop]" />
|
|
|
+ </div> -->
|
|
|
+</template>
|
|
|
+<script lang="ts" setup>
|
|
|
+ import { onMounted, ref } from 'vue';
|
|
|
+ import { list as cfgList } from '@/views/vent/deviceManager/configurationTable/configuration.api';
|
|
|
+ import { list } from '@/views/vent/deviceManager/deviceTable/device.api';
|
|
|
+ import CostumeHeader from './CostumeHeader.vue';
|
|
|
+ import { RightCircleOutlined } from '@ant-design/icons-vue';
|
|
|
+ import Bar from '/@/components/chart/Bar.vue';
|
|
|
+ import { EChartsOption, graphic } from 'echarts';
|
|
|
+ // import MiniBoard from './MiniBoard.vue';
|
|
|
+ // import mapComponent from './components/3Dmap/index.vue';
|
|
|
+
|
|
|
+ // 设备类别,是个枚举 TODO: 将手动换为自动获取类别
|
|
|
+ const devicekind = 'fanlocal';
|
|
|
+
|
|
|
+ const configs = ref<{ prop: string; label: string }[]>([]);
|
|
|
+ function fetchConfig() {
|
|
|
+ cfgList({
|
|
|
+ deviceType: 'devicekind',
|
|
|
+ }).then(({ records }) => {
|
|
|
+ const moduleData = JSON.parse(records[0]?.moduleData);
|
|
|
+ configs.value = Object.keys(moduleData).map((k) => {
|
|
|
+ return {
|
|
|
+ prop: k,
|
|
|
+ label: moduleData[k],
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ const devices = ref<any[]>([]);
|
|
|
+ const selectedDevice = ref<any>({});
|
|
|
+ function selectDeviceByID(id: string) {
|
|
|
+ selectedDevice.value = devices.value.find((e) => {
|
|
|
+ return e.id === id;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 获取全部局扇的数据,并以选项格式返回给 Header 消费
|
|
|
+ function fetchOptions() {
|
|
|
+ return list({
|
|
|
+ devicekind,
|
|
|
+ }).then(({ records }) => {
|
|
|
+ devices.value = records;
|
|
|
+ selectDeviceByID(records[0]?.id);
|
|
|
+ return records.map((e) => {
|
|
|
+ return {
|
|
|
+ label: e.strinstallpos,
|
|
|
+ key: e.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 图表相关
|
|
|
+ const chartOption: EChartsOption = {
|
|
|
+ yAxis: {
|
|
|
+ splitLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#ffffff',
|
|
|
+ opacity: 0.3,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: 'bar',
|
|
|
+ type: 'bar',
|
|
|
+ itemStyle: {
|
|
|
+ color: new graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ { offset: 0, color: '#0091ffff' },
|
|
|
+ { offset: 1, color: '#0091ff44' },
|
|
|
+ ]),
|
|
|
+ borderRadius: [50, 50, 0, 0],
|
|
|
+ },
|
|
|
+ barWidth: 20,
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ textStyle: {
|
|
|
+ color: '#fff',
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ fetchConfig();
|
|
|
+ });
|
|
|
+</script>
|
|
|
+<style scoped></style>
|