Files
xj-screen/src/components/body-d-right/bodyRightHooks.ts
T

155 lines
3.5 KiB
TypeScript

import { computed, ref } from 'vue';
// 列表字段
export const columns = [
{
title: '姓名',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '单位信息',
dataIndex: 'age',
align: 'center',
key: 'age',
},
{
title: '联系电话',
dataIndex: 'address',
align: 'center',
key: 'address',
},
{
title: '联系电话',
dataIndex: 'address1',
align: 'center',
key: 'address1',
},
{
title: '异常事件',
dataIndex: 'address2',
align: 'center',
key: 'address2',
},
{
title: '异常值',
dataIndex: 'address2',
align: 'center',
key: 'address2',
},
{
title: '发生时间',
dataIndex: 'address2',
align: 'center',
key: 'address2',
},
{
title: '发生地点',
dataIndex: 'address2',
align: 'center',
key: 'address2',
},
];
//大病人数
export function useHealth() {
const healthData = ref([
{
name: '高危人数',
value: '0',
type: '1',
type_dictText: '恶性肿瘤',
},
{
name: '中危人数',
value: '0',
type: '2',
type_dictText: '其他',
},
{
name: '可控人数',
value: '0',
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,
};
}
export function ringOption(chartData, total) {
return {
title: {
text: '总人数',
subtext: total + '',
x: 'center',
y: '35%',
textStyle: {
fontSize: 14,
color: '#ffffff',
fontWeight: 'normal',
},
subtextStyle: {
color: '#ffffff',
fontSize: 24,
fontWeight: 'bold',
},
},
color: ['#0098FA', '#0CD9B5', '#3B72AD'],
tooltip: {
trigger: 'item',
show: true,
textStyle: {
color: '#fff',
},
backgroundColor: 'rgba(50,50,50,0.7)',
borderColor: '#1b7ef2',
},
legend: {
bottom: '0',
left: 'center',
icon: 'circle',
textStyle: {
color: '#ffffff',
fontSize: 16,
},
},
series: [
{
type: 'pie',
radius: ['50%', '80%'],
avoidLabelOverlap: false,
label: {
show: true,
position: 'inner',
formatter: '{d}%',
color: '#ffffff',
fontSize: 14,
},
labelLine: {
show: false,
},
data: chartData,
},
],
};
}