import * as echarts from 'echarts';
import { initatorTypee, isTrueOfFalse, SexType, sexTypeList, sexTypeListNew } from '/@/utils/settings.ts';
import { getDictByCode2 } from '/@/views/index.api.ts';
import dayjs from 'dayjs';
import { h } from 'vue';
export const legend1 = new URL('/@/assets/img/legend1.png', import.meta.url).href;
export const legend2 = new URL('/@/assets/img/legend5.png', import.meta.url).href;
export const legend3 = new URL('/@/assets/img/legend3.png', import.meta.url).href;
export const legend4 = new URL('/@/assets/img/legend4.png', import.meta.url).href;
export const checkData = await (async () => {
return await getDictByCode2({ dictCode: 'xj_check_type' });
})();
export function getClassCharts(dx: any, dy: any, m: any) {
return {
grid: {
top: 40,
bottom: 40,
left: '60',
},
xAxis: {
type: 'category',
data: dx,
axisTick: {
show: false,
lineStyle: {
color: 'rgba(101, 198, 231, .1)',
},
},
axisLabel: {
color: '#C9DAFF',
fontSize: 12,
},
axisLine: {
lineStyle: {
color: '#65C6E7', // 设置轴线颜色为红色
},
},
},
yAxis: {
type: 'value',
name: '次数',
// nameLocation: 'end', // 将单位名称位置设置为起始位置
// nameGap: 10,
// nameRotate: 0, // 设置旋转角度,0 表示水平
nameTextStyle: {
fontSize: 10,
color: '#65C6E7',
left: 100,
},
splitLine: {
show: true,
lineStyle: {
color: 'rgba(101, 198, 231, .1)',
width: 1,
type: 'solid',
},
},
// interval: 25, // 步长
max: m,
min: 0, // 起始 - 设置y轴刻度的最小值
axisLabel: {
color: '#65C6E7',
formatter: function (value: any) {
return value;
},
},
},
series: [
{
data: dy.map((item: any) => {
return {
value: item,
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: '#5ABFFF' },
{ offset: 0.2, color: 'rgba(30, 166, 253, .5)' },
{ offset: 0.5, color: 'rgba(30, 166, 253, .1)' },
{ offset: 0.8, color: 'rgba(30, 166, 253, .5)' },
{ offset: 1, color: '#5ABFFF' },
]),
borderColor: '#51caf5', // 黑色边框
borderWidth: item ? 1 : 0,
},
};
}),
label: {
show: true, // 显示标签
position: 'top', // 标签显示在柱子顶部
color: '#51caf5', // 设置字体颜色
fontSize: 12, // 设置字体大小
},
type: 'bar',
barWidth: 18,
},
],
};
}
export enum TabType {
all = '', //所有资源
youTianYiYuan = '1', //油田医院
jianKangXiaoWu = '3', //健康小屋
aed = '4', //AED
jiuHuChe = '5', //救护车
}
export const tabList = [
{
name: '所有资源',
type: TabType.all,
},
{
name: '健康小屋',
type: TabType.jianKangXiaoWu,
},
{
name: '油田医院',
type: TabType.youTianYiYuan,
},
{
name: '救护车',
type: TabType.jiuHuChe,
},
{
name: 'AED',
type: TabType.aed,
},
{
name: '急救路线',
},
];
export const legendList = [
{ img: legend2, text: '健康小屋', color: '#1BEFF6' },
{ img: legend1, text: '油田医院', color: '#D86AF7' },
{ img: legend3, text: '救护车', color: '#45FFA1' },
{ img: legend4, text: 'AED', color: '#F23F3D' },
];
export function infoContent(res: any) {
return `
单位:
${res.orgName ? res.orgName : '--'}
关爱人数:
${res.loveNum ? res.loveNum : '--'}
电话:
${res.mobile ? res.mobile : '--'}
地点:
${res.address ? res.address : '--'}
`;
}
export function infoContent1(res: any) {
return `
${res.type === '1' ? '医院名称' : '救护车名称'}:
${res.name ? res.name : '--'}
${
res.type === '1'
? `
电话:
${res.mobile ? res.mobile : '--'}
`
: ``
}
地点:
${res.address ? res.address : '--'}
`;
}
export function infoContent4(res: any) {
return `
AED名称:
${res.name ? res.name : '--'}
地点:
${res.address || '--'}
`;
}
export function infoContentSpecial(res: any) {
return `
${res.type === '1' ? '油田医院' : res.type === '4' ? 'AED' : '健康小屋'}
地址:
${res.address || '--'}
相距:
${res.distance > 1000 ? (res.distance / 1000).toFixed(2) + 'km' : parseInt(res.distance) + 'm' || '--'}
${res.distance > 2000 ? '驾车' : '步行'}:
${res.driveTime || '--'}
联系人:
${res.manageName || '--'}
联系电话:
${res.managePhone || '--'}
`;
}
const columns1 = [
{
title: '姓名',
dataIndex: 'realName',
key: 'realName',
},
{
title: '单位',
dataIndex: 'departName',
key: 'departName',
ellipsis: true,
},
{
title: '部门',
dataIndex: 'orgName',
key: 'orgName',
ellipsis: true,
},
{
title: '性别',
dataIndex: 'sex_dictText',
key: 'sex_dictText',
width: 80,
},
{
title: '时间',
dataIndex: 'time',
key: 'time',
},
{
title: '电话',
dataIndex: 'phone',
key: 'phone',
},
];
const columns2 = [
{
title: '被救助人',
dataIndex: 'salvageUserName',
key: 'salvageUserName',
},
{
title: '单位',
dataIndex: 'salvageUserSecondDepart',
key: 'salvageUserSecondDepart',
},
{
title: '部门',
dataIndex: 'salvageUserDepart',
key: 'salvageUserDepart',
},
{
title: '性别',
dataIndex: 'salvageUserSex_dictText',
key: 'salvageUserSex_dictText',
},
{
title: '救助方式',
dataIndex: 'initiatorType',
key: 'initiatorType',
customRender: ({ text }) => {
if (text === '0') {
return '120';
} else if (text === '1') {
return '应急就医';
}
},
},
{
title: '救助时间',
dataIndex: 'createTime',
key: 'createTime',
},
{
title: '联系电话',
dataIndex: 'salvageUserMobile',
key: 'salvageUserMobile',
},
];
const fromList = [
{
label: '姓名',
field: 'realName',
type: 'input',
placeholder: '请输入姓名',
defaultValue: '',
},
{
label: '性别',
field: 'sex',
type: 'select',
placeholder: '请选择性别',
options: sexTypeList,
defaultValue: SexType.all,
},
];
const fromList2 = [
{
label: '救助人',
field: 'salvageUserName',
type: 'input',
placeholder: '请输入',
defaultValue: '',
},
{
label: '性别',
field: 'salvageUserSex',
type: 'select',
placeholder: '请选择性别',
options: sexTypeListNew,
defaultValue: '',
},
{
label: '救助方式',
field: 'initiatorType',
type: 'select',
placeholder: '请选择性别',
options: initatorTypee,
defaultValue: '',
},
];
export const columns = [columns1, columns2];
export const fromLists = [fromList, fromList2];
export const threeRModalColumns = [
{
title: '单位',
dataIndex: 'departName',
key: 'departName',
},
{
title: '姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '性别',
dataIndex: 'sex_dictText',
key: 'sex_dictText',
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
},
{
title: '体检医院',
dataIndex: 'hospitalName',
key: 'hospitalName',
},
{
title: '检查日期',
dataIndex: 'checkInDate',
key: 'checkInDate',
},
];
export const threeRModalFromList = [
{
label: '姓名',
field: 'name',
type: 'input',
placeholder: '请输入姓名',
defaultValue: '',
},
{
label: '体检医院',
field: 'hospitalName',
type: 'input',
placeholder: '请输入体检医院',
defaultValue: '',
},
{
label: '单位',
field: 'departName',
type: 'input',
placeholder: '请输入单位',
defaultValue: '',
},
];
const towRcolumn1 = [
{
title: '单位',
dataIndex: 'departName',
key: 'departName',
},
{
title: '姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '性别',
dataIndex: 'sex_dictText',
key: 'sex_dictText',
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
},
{
title: '身高(cm)',
dataIndex: 'height',
key: 'height',
},
{
title: '体重(kg)',
dataIndex: 'weight',
key: 'weight',
},
{
title: 'BMI',
dataIndex: 'bmi',
key: 'bmi',
},
{
title: 'BMI是否异常',
dataIndex: 'bmiFlag',
key: 'bmiFlag',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
},
{
title: '腰围(cm)',
dataIndex: 'waist',
key: 'waist',
},
{
title: '填报日期',
dataIndex: 'inputDate',
key: 'inputDate',
},
];
const towRcolumn2 = [
{
title: '单位',
dataIndex: 'departName',
key: 'departName',
},
{
title: '姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '性别',
dataIndex: 'sex_dictText',
key: 'sex_dictText',
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
},
{
title: '血糖值(mmol/L)',
dataIndex: 'bsVal',
key: 'bsVal',
},
{
title: '血糖是否异常',
dataIndex: 'bmiFlag',
key: 'bmiFlag',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
},
{
title: '腰围(cm)',
dataIndex: 'waist',
key: 'waist',
},
{
title: '填报日期',
dataIndex: 'inputDate',
key: 'inputDate',
},
];
const towRcolumn3 = [
{
title: '单位',
dataIndex: 'departName',
key: 'departName',
},
{
title: '姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '性别',
dataIndex: 'sex_dictText',
key: 'sex_dictText',
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
},
{
title: '收缩压(mmHg)',
dataIndex: 'sbp',
key: 'sbp',
},
{
title: '收缩压是否异常',
dataIndex: 'sbpFlag',
key: 'sbpFlag',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
},
{
title: '舒张压(mmHg)',
dataIndex: 'dbp',
key: 'dbp',
},
{
title: '舒张压是否异常',
dataIndex: 'dbpFlag',
key: 'dbpFlag',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
},
{
title: '填报日期',
dataIndex: 'inputDate',
key: 'inputDate',
},
];
export function twoRform(type: any) {
return [
{
label: '员工姓名',
field: 'realName',
type: 'input',
placeholder: '请输入',
defaultValue: '',
},
// {
// label: '异常标记',
// field: 'abFlag',
// type: 'select',
// placeholder: '请选择',
// options: normalTypeList,
// defaultValue: type,
// },
{
label: '单位',
field: 'departName',
type: 'input',
placeholder: '请输入单位',
},
];
}
export const towRcolumns = [towRcolumn1, towRcolumn2, towRcolumn3];
export const centerMapColumns = [
{
title: '单位',
dataIndex: 'departName',
key: 'departName',
},
{
title: '姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '检查日期',
dataIndex: 'checkInDate',
key: 'checkInDate',
},
{
title: '检查类型',
dataIndex: 'checkTypeName',
key: 'checkTypeName',
// customRender: ({ text }) => {
// const dddd = checkData.filter((item) => item.value == text) || [];
// return dddd.length > 0 ? dddd[0].label : '';
// },
},
{
title: '去年检查值',
dataIndex: 'lastVal',
key: 'lastYearCheckVal',
},
{
title: '控降目标',
dataIndex: 'goalVal',
key: 'targetVal',
},
{
title: '本次测量值',
dataIndex: 'currentVal',
key: 'thisCheckVal',
},
{
title: '控降差值',
dataIndex: 'compareVal',
key: 'diffVal',
},
{
title: '是否成功控降',
dataIndex: 'successFlag',
key: 'successFlag',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
},
];
export const centerMapFromList = [
{
label: '员工姓名',
field: 'name',
type: 'input',
placeholder: '请输入姓名',
defaultValue: '',
},
// {
// label: '检查类型',
// field: 'checkType',
// type: 'select',
// placeholder: '请输入检查类型',
// options: checkData,
// defaultValue: '',
// },
// {
// label: '是否成功控降',
// field: 'successFlag',
// type: 'select',
// placeholder: '请选择是否成功控降',
// options: isTrueOfFalse,
// defaultValue: '',
// },
// {
// label: '单位名称',
// field: 'departName',
// type: 'input',
// placeholder: '请输入单位名称',
// defaultValue: '',
// },
];
export const twoRNewColumns = [
{
title: '单位',
dataIndex: 'workUnit',
key: 'workUnit',
},
{
title: '姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '性别',
dataIndex: 'sexCode',
key: 'sexCode',
width: 50,
customRender: ({ text }) => {
switch (text) {
case '1':
return '女';
case '2':
return '男';
default:
return '';
}
},
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
width: 50,
},
{
title: '身高',
dataIndex: 'height',
key: 'height',
width: 50,
},
{
title: '体重',
dataIndex: 'weight',
key: 'weight',
width: 50,
},
{
title: 'BMI',
dataIndex: 'bmi',
key: 'bmi',
width: 50,
},
{
title: '肥胖人员',
dataIndex: 'flagFat',
key: 'flagFat',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
width: 70,
},
{
title: '高血压',
dataIndex: 'hypertension',
key: 'hypertension',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
width: 70,
},
{
title: '糖尿病',
dataIndex: 'diabetes',
key: 'diabetes',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
width: 70,
},
{
title: '关爱状态',
dataIndex: 'dataLevel',
key: 'dataLevel',
customRender: ({ text }) => {
if (text == '1') {
return '是';
} else {
return '否';
}
},
width: 70,
},
{
title: '填报日期',
dataIndex: 'updateDate',
key: 'updateDate',
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : dayjs(record.createDate).format('YYYY-MM-DD');
},
width: 90,
},
];
export const twoRNewForm = [
{
label: '姓名',
field: 'name',
type: 'input',
placeholder: '请输入姓名',
defaultValue: '',
},
{
label: '单位',
field: 'workUnit',
type: 'input',
placeholder: '请输入单位',
defaultValue: '',
},
];
export const oneRNewColumns = [
{
title: '单位',
dataIndex: 'departName',
key: 'departName',
},
{
title: '部门',
dataIndex: 'orgName',
key: 'orgName',
},
{
title: '姓名',
dataIndex: 'realName',
key: 'name',
},
{
title: '性别',
dataIndex: 'sex',
key: 'sex',
width: 80,
customRender: ({ text }) => {
if (text == '1') {
return '女';
} else {
return '男';
}
},
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
width: 80,
},
{
title: '应急方式',
dataIndex: 'emergencyType',
key: 'emergencyType',
width: 90,
customRender: ({ text }) => {
switch (text) {
case '0':
return '120';
case '1':
return '紧急求助';
case '2':
return '云坐席';
case '3':
return '终端报警';
default:
return '-';
}
},
},
{
title: '应急时间',
dataIndex: 'time',
key: 'time',
},
{
title: '详细地址',
dataIndex: 'd',
key: 'd',
width: 90,
ellipsis: true,
},
{
title: '操作',
dataIndex: 'cz',
key: 'cz',
width: 80,
},
];
export const monitorColumns = [
{
title: '姓名',
dataIndex: 'realName',
key: 'realName',
},
{
title: '单位名称',
dataIndex: 'orgName1',
key: 'orgName1',
},
{
title: '部门名称',
dataIndex: 'orgName2',
key: 'orgName2',
},
{
title: '手机号码',
dataIndex: 'phone',
key: 'phone',
width: 100,
},
{
title: '事件类型',
dataIndex: 'eventType_dictText',
key: 'eventType_dictText',
width: 100,
},
{
title: '异常值',
dataIndex: 'dataValue',
key: 'dataValue',
width: 80,
},
{
title: '详细地址',
dataIndex: 'address',
key: 'address',
customRender: ({ record }) => {
return !record?.address ? h('div', { style: { color: 'red' } }, record?.gpsErrorMsg) : record?.address;
},
ellipsis: true,
},
{
title: '预警时间',
dataIndex: 'warnTime',
key: 'warnTime',
},
];
export const contactListColumns = [
{
title: '联系人姓名',
dataIndex: 'name',
key: 'name',
},
{
title: '关系',
dataIndex: 'familyRelation_dictText',
key: 'familyRelation_dictText',
},
{
title: '联系人电话',
dataIndex: 'phone',
key: 'phone',
},
{
title: '身份证号',
dataIndex: 'idCard',
key: 'idCard',
customRender: ({ text }) => {
if (text) {
return text.substring(0, 6) + '********' + text.substring(14);
}
return '-';
},
},
];