You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.5 KiB

<template>
<div class="w-[51.29vh] h-[40.09vh] bgBottomLeftBox mt-[2.68vh] relative" v-loading="isLoading">
1 year ago
<div class="w-[12.4vh] h-[5.07vh] ml-[1.85vh] flex justify-between items-center">
<img src="@/assets/svg/Monitor/Triangle.svg" />
1 year ago
<span class="text-[2.03vh] youshe leading-none">手术量统计</span>
</div>
<div class="w-[42.96vh] h-[27.12vh] ml-[2.96vh] my-[3.7vh]" ref="echartsContainer"></div>
<div class="absolute right-0 top-1/4 w-[3.51vh] h-[12.6vh]" :class="sliderClass">
<div class="h-[6.3vh] leading-[6.3vh] text-center text-[#C0D3E1] cursor-pointer" @click="toWeek"></div>
<div class="h-[6.3vh] leading-[6.3vh] text-center text-[#C0D3E1] cursor-pointer" @click="toMonth"></div>
1 year ago
</div>
</div>
</template>
<script>
1 year ago
import * as echarts from 'echarts';
import { GetMonitorOperationNumber } from '@/api/monitor';
import { fnR } from '@/utils/common';
import dayjs from 'dayjs';
let chartLeft = null;
1 year ago
export default {
data() {
return {
chartOptions: {
grid: {
left: '0%',
right: '0%',
top: '0%',
bottom: '10%',
},
xAxis: {
type: 'category',
data: ['择期手术', '急诊手术', '日间手术', '门诊手术'],
},
yAxis: {
type: 'value',
},
series: [
{
data: [1, 1, 1, 1],
1 year ago
type: 'bar',
barWidth: '10%',
},
],
},
startDate: dayjs().subtract(7, 'day').format('YYYY-MM-DD'),
endDate: dayjs().format('YYYY-MM-DD'),
sliderClass: {
bgWeekBox: true,
bgMonthBox: false,
},
renderTimer: null,
isLoading: true,
1 year ago
};
},
methods: {
onGetPageData() {
this.isLoading = true;
GetMonitorOperationNumber({ startDate: this.startDate, endDate: this.endDate }).then(res => {
this.chartOptions['series'][0]['data'] = [res['data']['ElectiveCount'], res['data']['EmergencyCount'], res['data']['DaySurgeryCount'], res['data']['OutSurgeryCount']];
if (this.$store.getters.isMock) {
let data = [fnR(), fnR(), fnR(), fnR()];
this.chartOptions['series'][0]['data'] = data;
}
this.isLoading = false;
chartLeft.setOption(this.chartOptions);
});
},
toWeek() {
this.startDate = dayjs().subtract(7, 'day').format('YYYY-MM-DD');
this.sliderClass.bgWeekBox = true;
this.sliderClass.bgMonthBox = false;
this.onGetPageData();
},
toMonth() {
this.startDate = dayjs().subtract(30, 'day').format('YYYY-MM-DD');
this.sliderClass.bgWeekBox = false;
this.sliderClass.bgMonthBox = true;
this.onGetPageData();
},
},
1 year ago
mounted() {
this.onGetPageData();
chartLeft = echarts.init(this.$refs.echartsContainer);
1 year ago
chartLeft.setOption(this.chartOptions);
this.renderTimer = setInterval(() => {
if (this.sliderClass.bgWeekBox) {
this.toMonth();
} else {
this.toWeek();
}
}, 20000);
},
beforeRouteLeave() {
clearInterval(this.renderTimer);
1 year ago
},
};
</script>
1 year ago
<style>
.bgBottomLeftBox {
background-image: url('@/assets/svg/Monitor/BottomLeft/Box.svg');
background-size: contain;
background-position: center;
background-repeat: no-repeat;
}
.bgWeekBox {
background-image: url('@/assets/svg/Monitor/BottomLeft/WeekActive.svg');
background-size: contain;
background-position: center;
background-repeat: no-repeat;
}
.bgMonthBox {
background-image: url('@/assets/svg/Monitor/BottomLeft/MonthActive.svg');
}
</style>