diff --git a/src/components/body-d-left/bodyLeftHooks.ts b/src/components/body-d-left/bodyLeftHooks.ts index a419b44..b38b8d0 100644 --- a/src/components/body-d-left/bodyLeftHooks.ts +++ b/src/components/body-d-left/bodyLeftHooks.ts @@ -1,4 +1,4 @@ -import { ref } from 'vue'; +import { ref, unref } from 'vue'; import * as echarts from 'echarts'; export function useStatistics() { @@ -25,6 +25,10 @@ export function useStatistics() { }, ]); + function getStatistics() { + return unref(statistics); + } + function setStatistics(data = {}) { statistics.value.forEach((item) => { const { key } = item; @@ -34,6 +38,7 @@ export function useStatistics() { return { statistics, + getStatistics, setStatistics, }; } @@ -84,47 +89,52 @@ export const hospitalList = [ { name: '泾河医院', key: 'zhigong', - value: '', + value: 0, }, { name: '兴隆医院', key: 'tangdu', - value: '', + value: 0, }, { name: '宁夏宝石花医院', key: 'yangehu', - value: '', + value: 0, }, { name: '延安市人民医院', key: 'yananshi', - value: '', + value: 0, }, { name: '西京医院', key: 'xijing', - value: '', + value: 0, }, { name: '庆阳医院', key: 'changan', - value: '', + value: 0, }, ]; export function useHospitalList() { const radarList = ref(hospitalList); - function setRadarList(res) { + function getRadarList() { + return unref(radarList); + } + + function setRadarList(res = {}) { radarList.value.forEach((item) => { const { key } = item; - item.value = res[key]; + item.value = res[key] || 0; }); } return { radarList, + getRadarList, setRadarList, }; } @@ -333,4 +343,16 @@ export function barOption(xData, ydata) { }, ], }; +} + +/** + * @desc 值是否不为零 + * @param list 数组 + * @param key 元素属性 + */ +export function allValueEmpty(key: string, list: any[]) { + if (!Array.isArray(list)) { + return false + } + return list.every((item: any) => item?.[key] != 0) } \ No newline at end of file diff --git a/src/components/body-d-left/oneL.vue b/src/components/body-d-left/oneL.vue index 966bf9b..66162e5 100644 --- a/src/components/body-d-left/oneL.vue +++ b/src/components/body-d-left/oneL.vue @@ -22,14 +22,21 @@