update:大屏调整

This commit is contained in:
zk
2024-01-22 15:49:00 +08:00
parent 84dfa935ea
commit 5cf32ce40e
16 changed files with 298 additions and 138 deletions
+29 -12
View File
@@ -14,23 +14,25 @@
<div class="physical-container">
<a-spin :spinning="spinning" class="spin"></a-spin>
<div class="RadarCharts"></div>
<!-- <div class="physical-item" v-for="(item, i) in hospitalList" :key="i" :class="[i < 3 ? 'b1' : 'b2']">-->
<!-- <div class="ct">-->
<!-- <div class="value">{{ countData[item.key] || '/' }}</div>-->
<!-- <div class="label">{{ item.title }}</div>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { onMounted, ref, watch } from 'vue';
import PublicTitle from '../publicTitle.vue';
import { getDetail } from '/@/components/body-d-left/left.api';
import { hospitalList, useSpin, timeTab, useHospitalList, radarCharts } from '/@/components/body-d-left/bodyLeftHooks';
import { useSpin, timeTab, useHospitalList, radarCharts, allValueEmpty } from '/@/components/body-d-left/bodyLeftHooks';
import { useSession, caching } from '/@/hooks/autoRefresh/caching.ts';
import * as echarts from 'echarts';
const props = defineProps({
refreshState: {
type: Boolean,
},
});
const { setSession, getSession } = useSession();
const { LEFT_KEY3 } = caching;
const { setSpin, spinning } = useSpin();
const selectIndex = ref(0);
@@ -46,23 +48,31 @@
getList();
});
const { radarList, setRadarList } = useHospitalList();
const { radarList, setRadarList, getRadarList } = useHospitalList();
async function getList() {
setSpin(true);
try {
const { code, result } = (await getDetail({})) || {};
setSpin(!spinning.value);
if (code != 200) {
if (code != 200 || !Array.isArray(result)) {
return;
}
setRadarList(result[0]);
initChart();
setSession(LEFT_KEY3, JSON.stringify(result[0]));
setValue(result[0]);
} catch {
const result = JSON.parse(getSession(LEFT_KEY3));
setValue(result);
setSpin(!spinning.value);
}
}
function setValue(result) {
setRadarList(result);
const everyEmpty = allValueEmpty('value', getRadarList());
everyEmpty && initChart();
}
function initChart() {
const myChart = echarts.init(document.querySelector('.RadarCharts'));
let countList = radarList.value.map((item) => item.value);
@@ -74,6 +84,13 @@
myChart.resize();
});
}
watch(
() => props.refreshState,
() => {
getList();
}
);
</script>
<style lang="less" scoped>
.inner {