From 5cf32ce40e46a7b0624981243ccabcc058700784 Mon Sep 17 00:00:00 2001 From: zk Date: Mon, 22 Jan 2024 15:49:00 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E5=A4=A7=E5=B1=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/body-d-left/bodyLeftHooks.ts | 40 ++++++++++--- src/components/body-d-left/oneL.vue | 38 ++++++++++--- src/components/body-d-left/threeL.vue | 41 +++++++++---- src/components/body-d-left/twoL.vue | 25 +++++--- src/components/body-d-right/oneR.vue | 34 ++++------- src/components/body-d-right/twoR.vue | 19 +++++-- src/components/chinaMap/chinaMap.vue | 6 -- src/components/item-d/pieCharts.ts | 4 +- .../screen-left/screenLeft.vue | 40 ++++++++----- .../secondaryScreen/screen-right/oneR.vue | 57 ++++++++++++------- .../screen-right/screenRightHooks.ts | 12 +++- .../secondaryScreen/screen-right/threeR.vue | 30 +++++++--- .../secondaryScreen/screen-right/twoR.vue | 33 ++++++----- src/hooks/autoRefresh/caching.ts | 39 +++++++++++++ src/views/index.vue | 10 ++-- src/views/indexSon.vue | 8 +-- 16 files changed, 298 insertions(+), 138 deletions(-) create mode 100644 src/hooks/autoRefresh/caching.ts 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 @@