| | |
| | | * @Author: shuishen 1109946754@qq.com |
| | | * @Date: 2023-03-13 14:54:26 |
| | | * @LastEditors: shuishen 1109946754@qq.com |
| | | * @LastEditTime: 2024-11-19 15:33:01 |
| | | * @LastEditTime: 2024-12-03 12:31:17 |
| | | * @FilePath: \bigScreen\src\views\survey\components\box\unitContent.vue |
| | | * @Description: |
| | | * |
| | |
| | | let $echarts = inject("echarts") |
| | | const curEcharts = ref(null) |
| | | |
| | | let myEcharts = reactive(null) |
| | | let myEcharts = reactive({ |
| | | chart: '' |
| | | }) |
| | | |
| | | function getEmergencySpace () { |
| | | getEmergencySpaceStatistic().then((res) => { |
| | | // console.log(res) |
| | | let data = res.data.data |
| | | let dataRsult = [] |
| | | var total = 0 |
| | |
| | | total = total + item.num |
| | | }) |
| | | |
| | | myEcharts.setOption({ |
| | | myEcharts.chart.setOption({ |
| | | title: { |
| | | text: "总数", |
| | | subtext: String(total), |
| | |
| | | }, |
| | | legend: { |
| | | orient: "vertical", |
| | | top: "20%", |
| | | top: "4%", |
| | | left: "5%", |
| | | textStyle: { |
| | | color: "#fff", |
| | |
| | | } |
| | | |
| | | nextTick(() => { |
| | | myEcharts = $echarts.init(curEcharts.value) |
| | | myEcharts.chart = $echarts.init(curEcharts.value) |
| | | getEmergencySpace() |
| | | }) |
| | | |
| | | const echartsResize = () => { |
| | | myEcharts && myEcharts.resize() |
| | | myEcharts.chart && myEcharts.chart.resize() |
| | | } |
| | | |
| | | useEchartsResize(echartsResize) |
| | | |
| | | onUnmounted(() => { |
| | | if (myEcharts.chart) { |
| | | myEcharts.chart.clear() |
| | | myEcharts.chart.dispose() |
| | | |
| | | myEcharts.chart = null |
| | | } |
| | | }) |
| | | </script> |
| | | |
| | | <template> |