<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['business:medicalExamination:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="medicalExaminationList" @selection-change="handleSelectionChange" border>
<el-table-column label="厂区" align="center" prop="site" :min-width="100"/>
<el-table-column label="工号" align="center" prop="cpf01" :min-width="100">
<template slot-scope="scope">
<a @click="handleLastCard(scope.row.cpf01)">{{ scope.row.cpf01 }}</a>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="性别" align="center" prop="sex" />
<el-table-column label="年龄" align="center" prop="age" />
<el-table-column label="员工类别" align="center" prop="salaryType" />
<el-table-column label="厂处" align="center" prop="dptname03" />
<el-table-column label="体检日期" align="center">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.examinationDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="高压(mmHg)" align="center" prop="high" />
<el-table-column label="低压(mmHg)" align="center" prop="low" />
<el-table-column label="体检报告" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-download"
@click="handleDownload(scope.row)"
v-hasPermi="['business:medicalExamination:download']"
>下载PDF</el-button>
</template>
</el-table-column>
<el-table-column label="入职日期" align="center">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.cpfud13, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="身高(cm)" align="center" prop="height" />-->
<!-- <el-table-column label="体重(kg)" align="center" prop="weight" />-->
<!-- <el-table-column label="BMI" align="center" prop="bmi" />-->
<!-- <el-table-column label="高压(mmHg)" align="center" prop="high" />-->
<!-- <el-table-column label="低压(mmHg)" align="center" prop="low" />-->
<!-- <el-table-column label="心率(次/分)" align="center" prop="rate" />-->
<!-- <el-table-column label="血氧饱和度(%)" align="center" prop="sp" />-->
<!-- <el-table-column label="体温(℃)" align="center" prop="tiwen" />-->
<!-- <el-table-column label="脂肪量(kg)" align="center" prop="zfl" />-->
<!-- <el-table-column label="脂肪率(%)" align="center" prop="zflv" />-->
<!-- <el-table-column label="体水分量(kg)" align="center" prop="tsfl" />-->
<!-- <el-table-column label="体水分率(%)" align="center" prop="tsflv" />-->
<!-- <el-table-column label="肌肉量(kg)" align="center" prop="jrl" />-->
<!-- <el-table-column label="肌肉率(%)" align="center" prop="jrlv" />-->
<!-- <el-table-column label="蛋白质(kg)" align="center" prop="dbz" />-->
<!-- <el-table-column label="蛋白质率(%)" align="center" prop="dbzlv" />-->
<!-- <el-table-column label="细胞内液量(kg)" align="center" prop="xbnyl" />-->
<!-- <el-table-column label="细胞内液率(%)" align="center" prop="xbnylv" />-->
<!-- <el-table-column label="细胞外液量(kg)" align="center" prop="xbwyl" />-->
<!-- <el-table-column label="细胞外液率(%)" align="center" prop="xbwylv" />-->
<!-- <el-table-column label="基础代谢(kcal)" align="center" prop="jcdx" />-->
<!-- <el-table-column label="骨盐(kg)" align="center" prop="gy" />-->
<!-- <el-table-column label="去脂体重(kg)" align="center" prop="qztz" />-->
<!-- <el-table-column label="骨量(kg)" align="center" prop="gl" />-->
<!-- <el-table-column label="内脏脂肪(级)" align="center" prop="nzzf" />-->
<!-- <el-table-column label="阻抗(Ω)" align="center" prop="zukang" />-->
<!-- <el-table-column label="体表面积(平方米)" align="center" prop="tbmj" />-->
<!-- <el-table-column label="超重百分比(%)" align="center" prop="czbfb" />-->
<!-- <el-table-column label="骨骼肌量(kg)" align="center" prop="ggjl" />-->
<!-- <el-table-column label="骨骼肌率(%)" align="center" prop="ggjlv" />-->
<!-- <el-table-column label="皮下脂肪量(kg)" align="center" prop="pxzf" />-->
<!-- <el-table-column label="皮下脂肪率(%)" align="center" prop="pxzflv" />-->
<!-- <el-table-column label="最大心率(次/分钟)" align="center" prop="maxrate" />-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改体检一体机对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-table v-loading="loading" :data="cardList" border :max-height="550">
<el-table-column label="姓名" align="center" prop="emp_no" :width="150"/>
<el-table-column label="工号" align="center" prop="emp_name" :width="150"/>
<el-table-column label="刷卡时间" align="center">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.event_time, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="刷卡位置" align="center" prop="event_location" />
</el-table>
</el-dialog>
</div>
</template>
<script>
import { listMedicalExamination, getMedicalExamination, delMedicalExamination, addMedicalExamination, updateMedicalExamination } from "@/api/business/medicalExamination";
import * as https from "https";
import axios from "axios";
export default {
name: "MedicalExamination",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 体检一体机表格数据
medicalExaminationList: [],
cardList : [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
sex: null,
age: null,
cpf01: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询体检一体机列表 */
getList() {
this.loading = true;
listMedicalExamination(this.queryParams).then(response => {
this.medicalExaminationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
sex: null,
age: null,
cpf01: null,
examinationDate: null,
height: null,
weight: null,
bmi: null,
lxtz: null,
mbtz: null,
high: null,
low: null,
rate: null,
sp: null,
tiwen: null,
zfl: null,
zflv: null,
tsfl: null,
tsflv: null,
jrl: null,
jrlv: null,
dbz: null,
dbzlv: null,
xbnyl: null,
xbnylv: null,
xbwyl: null,
xbwylv: null,
jcdx: null,
gy: null,
qztz: null,
gl: null,
nzzf: null,
zukang: null,
tbmj: null,
czbfb: null,
ggjl: null,
ggjlv: null,
pxzf: null,
pxzflv: null,
maxrate: null,
createTime: null,
createBy: null,
site: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加体检一体机";
},
/** 下载PDF操作 */
handleDownload(row) {
},
handleLastCard(cpf01){
this.open = true;
this.getCardData(cpf01)
},
async getCardData(cpf01) {
try {
const empNo = cpf01;
const eventTime = this.formatDate(new Date()); // 使用当前日期
const endUrl = 'doris%2Fehs_special_case_track';
const response = await axios.get(
`https://ehs.luxsan-ict.com/prod-api/business/ehs-api-caller/getApiData?endUrl=${endUrl}&empNo=${empNo}&eventTime=${eventTime}`
);
if (response.data.error === 0) {
this.cardList = response.data.data;
} else {
alert("请求失败: " + response.data.message);
}
} catch (error) {
console.error("接口请求错误:", error);
alert("网络请求失败,请检查接口是否可用");
} finally {
this.loading = false;
}
},
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateMedicalExamination(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMedicalExamination(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除体检一体机编号为"' + ids + '"的数据项?').then(function() {
return delMedicalExamination(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('business/medicalExamination/export', {
...this.queryParams
}, `medicalExamination_${new Date().getTime()}.xlsx`)
}
}
};
</script>
刷卡时间倒叙排序
最新发布