feat: add production task overview dashboard

This commit is contained in:
meswork764
2026-07-11 18:07:38 +08:00
parent 1e3f9299df
commit b5bc8d7358
10 changed files with 3382 additions and 12 deletions

View File

@@ -0,0 +1,45 @@
import * as echarts from 'echarts'
import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
export function useEchart(optionRef) {
const elRef = ref(null)
let chart = null
const render = async () => {
await nextTick()
if (!elRef.value) {
return
}
if (!chart) {
chart = echarts.init(elRef.value)
}
chart.setOption(optionRef.value || {}, true)
}
const resize = () => {
if (chart) {
chart.resize()
}
}
onMounted(() => {
render()
window.addEventListener('resize', resize)
})
watch(optionRef, render, { deep: true })
onUnmounted(() => {
window.removeEventListener('resize', resize)
if (chart) {
chart.dispose()
chart = null
}
})
return {
elRef,
resize,
render
}
}