119 lines
2.9 KiB
TypeScript
119 lines
2.9 KiB
TypeScript
import {computed, ref} from 'vue';
|
|
|
|
export function sleepCharts() {
|
|
return {
|
|
grid: {
|
|
top: '15%',
|
|
left: '8%',
|
|
right: '3%',
|
|
bottom: '18%',
|
|
},
|
|
legend: {
|
|
data: ['清醒', '浅睡', '深睡'],
|
|
textStyle: {
|
|
color: '#ffffff'
|
|
},
|
|
left: '55%',
|
|
},
|
|
color: ['#14B3F8', '#6D7BEB', '#5451DC'],
|
|
xAxis: {
|
|
type: 'category',
|
|
axisLabel: {
|
|
color: '#ffffff'
|
|
},
|
|
data: ['0', '2', '4', '6', '8', '10', '12', '14', '16', '18', '20', '22'],
|
|
},
|
|
yAxis: {
|
|
type: 'value',
|
|
axisLabel: {
|
|
color: '#ffffff'
|
|
},
|
|
axisLine: {
|
|
show: false
|
|
},
|
|
splitLine: {
|
|
lineStyle: {
|
|
type: 'dashed',
|
|
color: '#696969'
|
|
}
|
|
}
|
|
},
|
|
series: [
|
|
{
|
|
name: '清醒',
|
|
type: 'bar',
|
|
data: [
|
|
2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
|
|
],
|
|
},
|
|
{
|
|
name: '浅睡',
|
|
type: 'bar',
|
|
data: [
|
|
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
|
|
],
|
|
},
|
|
{
|
|
name: '深睡',
|
|
type: 'bar',
|
|
data: [
|
|
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
|
|
],
|
|
}
|
|
]
|
|
};
|
|
}
|
|
|
|
export function useHealth() {
|
|
const healthData = ref([
|
|
{
|
|
name: '5000以下',
|
|
value: '0',
|
|
type: '1',
|
|
type_dictText: '恶性肿瘤',
|
|
},
|
|
{
|
|
name: '5000~1w',
|
|
value: '2',
|
|
type: '2',
|
|
type_dictText: '其他',
|
|
},
|
|
{
|
|
name: '1~1.5w',
|
|
value: '34',
|
|
type: '3',
|
|
type_dictText: '其他',
|
|
},
|
|
{
|
|
name: '1.5w~2w',
|
|
value: '43',
|
|
type: '3',
|
|
type_dictText: '其他',
|
|
},
|
|
{
|
|
name: '2以上',
|
|
value: '43',
|
|
type: '3',
|
|
type_dictText: '其他',
|
|
},
|
|
]);
|
|
const getValue = computed(() => healthData.value.map((item) => item.value));
|
|
const getName = computed(() => healthData.value.map((item) => item.name));
|
|
|
|
function setHealth(data) {
|
|
data?.map((item1) => {
|
|
healthData.value.map((item2) => {
|
|
if (item1.type == item2.type) {
|
|
item2.value = item1.count;
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
return {
|
|
healthData,
|
|
getValue,
|
|
getName,
|
|
setHealth,
|
|
};
|
|
} |