This commit is contained in:
2025-12-24 17:10:59 +08:00
parent 482d165651
commit 0b67be998a
4 changed files with 52 additions and 51 deletions
+31 -47
View File
@@ -63,11 +63,8 @@
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, watch, reactive, onBeforeUnmount, nextTick } from 'vue';
import * as echarts from 'echarts';
// import { getClassCharts } from '/@/views/indexSun/indexSun.ts';
import { allSecondaryDepartsApi, twoLApi } from '/@/views/indexSun/indexSun.api.ts';
import { useUserStore } from '/@/store/modules/user.ts';
import { ref, onMounted, reactive, onBeforeUnmount } from 'vue';
import { allSecondaryDepartsApi } from '/@/views/indexSun/indexSun.api.ts';
import ThreeLeftNewItem from '/@/views/indexSun/threeLeftNewItem/threeLeftNewItem.vue';
import SleepItem from '/@/views/indexSun/threeLeftNewItem/sleepItem.vue';
import StepItem from '/@/views/indexSun/threeLeftNewItem/stepItem.vue';
@@ -81,7 +78,6 @@
import item6Png from '/@/assets/images/threeLeftNew/item6.png';
import dayjs from 'dayjs';
const { getCenterInfo } = useUserStore();
const props = defineProps({
bKey: {
type: String,
@@ -153,7 +149,7 @@
if (selectOptions.value.length === 1) {
getAllDepart();
}
// setTimer();
setTimer();
});
// watch(props, () => {
// selectValue.value = '';
@@ -177,6 +173,7 @@
p['startTime'] = dayjs().subtract(1, 'year').format('YYYY-MM-DD');
break;
}
console.log(params);
switch (chooseType.value) {
case 0:
p['type'] = 1;
@@ -211,6 +208,9 @@
}
function heart(params: any) {
if (params.dataIndex === 0) {
return 1;
}
if (params.dataIndex === 1) {
return 0;
}
@@ -220,6 +220,9 @@
if (params.dataIndex === 1) {
return 0;
}
if (params.dataIndex === 0) {
return 1;
}
return -1;
}
function pressure(params: any) {
@@ -229,6 +232,12 @@
if (params.dataIndex === 2) {
return 1;
}
if (params.dataIndex === 1) {
return 3;
}
if (params.dataIndex === 0) {
return 2;
}
return -1;
}
function temperature(params: any) {
@@ -238,12 +247,27 @@
if (params.dataIndex === 1) {
return 1;
}
if (params.dataIndex === 0) {
return 2;
}
return -1;
}
function step(params: any) {
if (params.dataIndex === 0) {
return 0;
}
if (params.dataIndex === 1) {
return 1;
}
if (params.dataIndex === 2) {
return 2;
}
if (params.dataIndex === 3) {
return 3;
}
if (params.dataIndex === 4) {
return 4;
}
return -1;
}
@@ -287,46 +311,6 @@
console.log(err);
});
}
// const myChart = ref();
// function getData() {
// twoLApi({
// sex: chooseType.value,
// depart: selectValue.value,
// centerId: getCenterInfo?.id,
// })
// .then((res: any) => {
// if (res.code == 200) {
// initChart(res.result);
// }
// })
// .catch((err) => {
// console.log(err);
// });
// }
//
// function initChart(value: any) {
// nextTick(() => {
// myChart.value = echarts.init(newChart.value);
// const dx =
// value.map((item: any) => {
// return item.name;
// }) || [];
// const dy =
// value.map((item: any) => {
// return item.count;
// }) || [];
//
// const max =
// value.sort((a: any, b: any) => b.count - a.count).length > 0 ? value.sort((a: any, b: any) => b.count - a.count)[0].count : [];
// const m = max % 25 === 0 ? max : (parseInt(max / 25) + 1) * 25;
// let option = getClassCharts(dx, dy, m);
// myChart.value.setOption(option);
// window.addEventListener('resize', () => {
// myChart.value.resize();
// });
// });
// }
</script>
<style lang="less" scoped>
.two-l-box {
+18 -2
View File
@@ -62,12 +62,28 @@
initChart(props.data, props.userCount, props.color);
}
function initChart(chartData, total, color) {
function initChart(chartData: any, total: any, color: any) {
nextTick(() => {
let myChart = echarts.init(healthChart.value);
myChart.off('click');
let options = circleRing(chartData, total, color, props.chooseIndex);
myChart.setOption(options);
const obj =
props.chooseIndex > 1
? {
legend: {
right: '5%',
top: 'center',
orient: 'vertical', // 设置垂直排列
icon: 'circle',
textStyle: {
color: '#ffffff',
},
selectedMode: false,
},
}
: {};
myChart.clear();
myChart.setOption({ ...options, ...obj });
myChart.on('click', function (params) {
if (params.componentType === 'series') {
@@ -59,7 +59,7 @@ export function screenPie(chartData) {
}
//左侧圆
export function circleRing(chartData, total, color, index = 0) {
export function circleRing(chartData: any, total: any, color: any, index = 0) {
const data = visibleChartLabel(chartData);
return {
color: color,
@@ -166,7 +166,8 @@
let resData = result.find((v: any) => v.type == item.type);
item.userCount = resData.userCount;
if (item.type === '1') {
item.tips = resData?.minData === null || resData?.maxData === null ? '' : `${resData?.minData}~${resData?.maxData}次/分钟`;
item.tips =
resData?.minData === null || resData?.maxData === null ? '' : `最小值${resData?.minData}~最大值${resData?.maxData}次/分钟`;
}
item.data = item.data.map((val: any) => {
val.value = resData[val.key];