|
@@ -23,7 +23,7 @@
|
|
|
<el-radio-button label="2">未关闭告警</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
- <Chart height="250px" ref="chart1"></Chart>
|
|
|
+ <Chart :height="chartHeight" ref="chart1"></Chart>
|
|
|
</div>
|
|
|
<div class="chart-item" style="flex: 1.5">
|
|
|
<div class="chart-title flex-row">
|
|
@@ -34,11 +34,11 @@
|
|
|
<el-radio-button label="3">月</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
- <Chart height="250px" ref="chart2"></Chart>
|
|
|
+ <Chart :height="chartHeight" ref="chart2"></Chart>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="chart-wrapper">
|
|
|
- <div class="chart-item" style="flex: 1">
|
|
|
+ <div class="chart-item mb-0" style="flex: 1; margin-bottom: 0">
|
|
|
<div class="chart-title flex-row">
|
|
|
处理状态
|
|
|
<el-date-picker
|
|
@@ -55,26 +55,26 @@
|
|
|
style="max-width: 200px"
|
|
|
/>
|
|
|
</div>
|
|
|
- <Chart height="300px" ref="chart3"></Chart>
|
|
|
+ <Chart :height="chartHeight" ref="chart3"></Chart>
|
|
|
</div>
|
|
|
- <div class="chart-item" style="flex: 1.5">
|
|
|
+ <div class="chart-item" style="flex: 1.5; margin-bottom: 0">
|
|
|
<div class="chart-title">设备告警TOP10</div>
|
|
|
- <Chart height="300px" ref="chart4"></Chart>
|
|
|
+ <Chart :height="chartHeight" ref="chart4"></Chart>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <AlarmList></AlarmList>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { toRefs, reactive, onMounted, ref, watch, nextTick, onActivated, getCurrentInstance, onUnmounted } from 'vue'
|
|
|
+import { reactive, ref, watch, getCurrentInstance } from 'vue'
|
|
|
import api from '/@/api/alarm'
|
|
|
-import AlarmList from '/@/views/iot/alarm/list/index.vue'
|
|
|
import Chart from '/@/components/chart/index.vue'
|
|
|
-import { getBarOption, getBarRowOption, getLineOption, getPie2Option, getPie3Option, getPie4Option, getPieOption } from '/@/components/chart/options'
|
|
|
+import { getBarRowOption, getLineOption, getPieOption } from '/@/components/chart/options'
|
|
|
import dayjs from 'dayjs'
|
|
|
import { useThemeChangeFunc } from '/@/hooks/useCommon'
|
|
|
|
|
|
+const chartHeight = 'calc(50vh - 168px)'
|
|
|
+
|
|
|
const chart1 = ref()
|
|
|
const chart2 = ref()
|
|
|
const chart3 = ref()
|
|
@@ -85,10 +85,7 @@ const searchType = ref('')
|
|
|
// 统计间隔:1小时 2天 3月
|
|
|
const intervalType = ref('1')
|
|
|
// 处理状态时间范围
|
|
|
-const statusDateRange = ref([
|
|
|
- dayjs().startOf('month').format('YYYY-MM-DD'),
|
|
|
- dayjs().format('YYYY-MM-DD')
|
|
|
-])
|
|
|
+const statusDateRange = ref([dayjs().startOf('month').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')])
|
|
|
|
|
|
// 禁用未来日期
|
|
|
const disabledDate = (time: Date) => {
|
|
@@ -171,7 +168,7 @@ const onSearchTypeChange = () => {
|
|
|
legend: {
|
|
|
orient: 'vertical',
|
|
|
top: 'center',
|
|
|
- right: 5,
|
|
|
+ left: '60%',
|
|
|
},
|
|
|
total,
|
|
|
data: resData.map((item: any) => ({
|
|
@@ -204,8 +201,16 @@ const getAlarmStatusData = () => {
|
|
|
const resData = res || []
|
|
|
const total = resData.reduce((a: any, b: any) => a + b.alarmCount, 0)
|
|
|
chart3.value?.draw(
|
|
|
- getPie3Option({
|
|
|
+ getPieOption({
|
|
|
total,
|
|
|
+ radius: ['45%', '60%'],
|
|
|
+ center: ['32%', '50%'],
|
|
|
+ legend: {
|
|
|
+ orient: 'vertical',
|
|
|
+ top: 'center',
|
|
|
+ left: '60%',
|
|
|
+ },
|
|
|
+ centerText: '总计',
|
|
|
data: resData.map((item: any) => ({ name: statusMap[item.status as keyof typeof statusMap], value: item.alarmCount })),
|
|
|
})
|
|
|
)
|
|
@@ -227,8 +232,10 @@ const getOverviewData = () => {
|
|
|
api.dashboard.getDeviceAlarmTop10().then((res: any) => {
|
|
|
const list = res || []
|
|
|
const chartData = getBarRowOption({
|
|
|
- data: [list.map((item: any) => item.alarmCount)],
|
|
|
+ data: list.map((item: any) => item.alarmCount),
|
|
|
xAxis: list.map((item: any) => item.deviceName),
|
|
|
+ // data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
|
+ // xAxis: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
|
|
|
})
|
|
|
chart4.value.draw(chartData)
|
|
|
})
|