Files
xj-screen/src/components/body-d-left/bodyLeftHooks.ts
T

150 lines
3.1 KiB
TypeScript

import { ref } from 'vue';
import * as echarts from 'echarts';
export const timeTab = [
{
name: '全部',
value: '1',
},
{
name: '本年',
value: '2',
},
{
name: '本月',
value: '3',
},
{
name: '本周',
value: '4',
},
];
export const sexType = [
{
name: '男',
value: '2',
},
{
name: '女',
value: '1',
},
];
export function useSpin() {
const spinning = ref(true);
function setSpin(flag: boolean) {
spinning.value = flag;
}
return {
spinning,
setSpin,
};
}
export const hospitalList = [
{
title: '兴隆医院',
key: 'tangdu',
},
{
title: '泾河医院',
key: 'zhigong',
},
{
title: '宁夏宝石花医院',
key: 'yangehu',
},
{
title: '庆阳医院',
key: 'changan',
},
{
title: '延安市人民医院',
key: 'yananshi',
},
{
title: '西京医院',
key: 'xijing',
},
];
export function barOption(xData, ydata) {
function maxCount() {
if (ydata.length) {
return Math.max(...ydata) < 5 ? 5 : null;
} else {
return 5;
}
}
return {
grid: {
top: '18%',
left: '8%',
right: '8%',
bottom: '15%',
},
tooltip: {
show: true,
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
color: '#FFFFFF',
fontSize: 14,
},
axisLine: {
color: '#bac9e1',
},
},
yAxis: {
name: '次数',
nameTextStyle: {
color: '#fff',
padding: [0, 0, 0, -15],
},
type: 'value',
axisLabel: {
color: '#FFFFFF',
fontSize: 14,
},
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: 'rgba(217, 231, 255, 0.2)',
},
},
min: 0,
max: maxCount(),
},
series: [
{
data: ydata,
type: 'bar',
barWidth: '20%',
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#008CFF' },
{ offset: 1, color: '#33CBFE' },
]),
},
barMaxWidth: '10',
label: {
show: true,
position: 'top',
color: '#33CBFE',
fontWeight: 'normal',
},
},
],
};
}