| | |
| | | import dayjs from 'dayjs'; |
| | | import { selectDevicePage } from '@/api/home/machineNest'; |
| | | import { useStore } from 'vuex' |
| | | import useEchartsResize from '@/hooks/useEchartsResize' |
| | | |
| | | const echartsOption = { |
| | | tooltip: { |
| | |
| | | }; |
| | | }); |
| | | const echartsRef = ref(null); |
| | | let chart = null; |
| | | let { chart } = useEchartsResize(echartsRef) |
| | | const deviceList = ref([]); |
| | | const today = dayjs().format('YYYY-MM-DD'); |
| | | const timeArr = ref([today, today]); |
| | |
| | | Object.keys(seriesObj).forEach(key => {seriesObj[key].data = []}) |
| | | list.forEach(item => { |
| | | item.data.forEach((item1, index) => { |
| | | if (!seriesObj?.[item1.status]) return |
| | | seriesObj[item1.status].data.push(item1.value); |
| | | }); |
| | | }); |
| | | completionRateSeries.data = list.map(item => item.rate); |
| | | echartsOption.series = Object.values(seriesObj); |
| | | echartsOption.series.push(completionRateSeries); |
| | | chart.setOption(echartsOption); |
| | | chart.value.setOption(echartsOption); |
| | | }); |
| | | }; |
| | | |
| | |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | chart = echarts.init(echartsRef.value); |
| | | window.addEventListener('resize', chart.resize); |
| | | getJobEventTotal().then(res => { |
| | | eventTotal.value = res?.data?.data || 0; |
| | | }); |