Commit d3ebe885acd1b7478e861aa278522330b6afe2fe
Merge branch 'sqy_dev' into 'main'
'fix:修复设备详情线上地图铆钉不显示,首页告警数更改' See merge request huang/yun-teng-iot-front!104
Showing
4 changed files
with
22 additions
and
5 deletions
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | - <p class="center" v-if="alarmList.length">告警数</p> | |
| 4 | 3 | <div ref="chartRef" :style="{ height, width }" v-show="alarmList.length"></div> |
| 5 | 4 | <div v-show="!alarmList.length"><Empty /></div> |
| 6 | 5 | </div> |
| ... | ... | @@ -24,6 +23,10 @@ |
| 24 | 23 | const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); |
| 25 | 24 | |
| 26 | 25 | onMounted(() => { |
| 26 | + let alarmTotal = 0; | |
| 27 | + for (const item of props.alarmList) { | |
| 28 | + alarmTotal += Number(item[1]); | |
| 29 | + } | |
| 27 | 30 | setOptions({ |
| 28 | 31 | tooltip: { |
| 29 | 32 | trigger: 'axis', |
| ... | ... | @@ -34,7 +37,11 @@ |
| 34 | 37 | bottom: '3%', |
| 35 | 38 | containLabel: true, |
| 36 | 39 | }, |
| 37 | - | |
| 40 | + legend: { | |
| 41 | + data: ['告警数'], | |
| 42 | + left: 'center', | |
| 43 | + formatter: (name) => `${name} ${alarmTotal}`, | |
| 44 | + }, | |
| 38 | 45 | xAxis: { |
| 39 | 46 | type: 'time', |
| 40 | 47 | }, |
| ... | ... | @@ -56,6 +63,10 @@ |
| 56 | 63 | watch( |
| 57 | 64 | () => props.alarmList, |
| 58 | 65 | (newValue) => { |
| 66 | + let alarmTotal = 0; | |
| 67 | + for (const item of props.alarmList) { | |
| 68 | + alarmTotal += Number(item[1]); | |
| 69 | + } | |
| 59 | 70 | setOptions({ |
| 60 | 71 | tooltip: { |
| 61 | 72 | trigger: 'axis', |
| ... | ... | @@ -66,7 +77,11 @@ |
| 66 | 77 | bottom: '3%', |
| 67 | 78 | containLabel: true, |
| 68 | 79 | }, |
| 69 | - | |
| 80 | + legend: { | |
| 81 | + data: ['告警数'], | |
| 82 | + left: 'center', | |
| 83 | + formatter: (name) => `${name} ${alarmTotal}`, | |
| 84 | + }, | |
| 70 | 85 | xAxis: { |
| 71 | 86 | type: 'time', |
| 72 | 87 | }, | ... | ... |
| ... | ... | @@ -38,6 +38,8 @@ |
| 38 | 38 | import { useModal } from '/@/components/Modal'; |
| 39 | 39 | import ManageDeviceTokenModal from '../modal/ManageDeviceTokenModal.vue'; |
| 40 | 40 | import { getDeviceToken } from '/@/api/device/deviceManager'; |
| 41 | + import wz from '/@/assets/images/wz.png'; | |
| 42 | + | |
| 41 | 43 | export default defineComponent({ |
| 42 | 44 | components: { |
| 43 | 45 | Image, |
| ... | ... | @@ -62,7 +64,7 @@ |
| 62 | 64 | const BMap = (window as any).BMap; |
| 63 | 65 | if (!wrapEl) return; |
| 64 | 66 | const map = new BMap.Map(wrapEl); |
| 65 | - let myIcon = new BMap.Icon('/src/assets/images/wz.png', new BMap.Size(20, 30)); | |
| 67 | + let myIcon = new BMap.Icon(wz, new BMap.Size(20, 30)); | |
| 66 | 68 | |
| 67 | 69 | const point = new BMap.Point(Number(longitude), Number(latitude)); |
| 68 | 70 | var content = `我在 ${address}`; | ... | ... |