- 工作台新增近 7 日预约趋势与订单状态分布图 - 订单/用户/就诊人/陪诊师支持 CSV 导出,逐页拉取规避接口分页上限 - 订单列表增加状态快筛、筛选条件同步地址栏、加载失败重试 - 订单详情支持指派/更换陪诊师,性别值归一到订单枚举 - 用户列表支持批量锁定/解锁,导出补齐就诊人数量与归属信息 - 抽取 useTableQuery 统一分页、搜索与删除后页码回退 - ESLint 开启 vue/no-undef-properties,修复 EChart 扩展只注册一次的问题
57 lines
1.4 KiB
Vue
57 lines
1.4 KiB
Vue
<template>
|
|
|
|
<VueECharts :key="layoutKey" :option="options" v-bind="props" autoresize />
|
|
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { EChartsOption } from 'echarts'
|
|
import { use } from 'echarts/core'
|
|
import { storeToRefs } from 'pinia'
|
|
import { computed, onBeforeMount, onMounted, ref, watch } from 'vue'
|
|
import { useLayout } from '~/stores/layout'
|
|
import { getDefaultFontFamily } from '~/utils/helpers'
|
|
type ChartExtension = Exclude<Parameters<typeof use>[0], unknown[]>
|
|
|
|
type PropsType = {
|
|
getOptions: () => EChartsOption
|
|
extensions: ChartExtension[]
|
|
}
|
|
|
|
const props = defineProps<PropsType>()
|
|
|
|
// 每个实例都注册自己的扩展:echarts 的 use 是幂等的,
|
|
// 用模块级开关会导致第二个图表实例的扩展注册被跳过
|
|
onBeforeMount(() => {
|
|
use(props.extensions)
|
|
})
|
|
|
|
const layoutStore = useLayout()
|
|
const { layout } = storeToRefs(layoutStore)
|
|
|
|
const layoutKey = computed(() => `${layout.value.theme}-${layout.value.skin}`)
|
|
|
|
const options = ref<EChartsOption>()
|
|
|
|
onMounted(() => {
|
|
watch(
|
|
layoutKey,
|
|
() => {
|
|
if (typeof window === 'undefined') return
|
|
window.requestAnimationFrame(() => {
|
|
const baseOptions = props.getOptions()
|
|
|
|
options.value = {
|
|
...baseOptions,
|
|
textStyle: {
|
|
...(baseOptions.textStyle || {}),
|
|
fontFamily: getDefaultFontFamily(),
|
|
},
|
|
} as EChartsOption
|
|
})
|
|
},
|
|
{ immediate: true }
|
|
)
|
|
})
|
|
</script>
|