ZhiYeJianKang_QiYe_APP/pages/Occupationalhazards/Occupationalhazards.vue

430 lines
9.5 KiB
Vue
Raw Permalink Normal View History

2025-02-20 15:38:43 +08:00
<template>
<view class="app">
<view class="harmtitle">
职业病危害因素检测结果
</view>
<view class="top">
<view class="sub" @tap="submit()">
保存
</view>
<view class="derive" @tap="derive()">
导出
</view>
</view>
<uni-table border stripe emptyText="暂无更多数据" class="harmdata">
<uni-tr>
<uni-th align="center" width="80">车间/部门</uni-th>
<uni-th align="center">岗位/工种</uni-th>
<uni-th align="center" width="50">接害人数</uni-th>
<uni-th align="center" width="100">危害因素名称</uni-th>
<uni-th align="center" width="70">C-TWA</uni-th>
<uni-th align="center" width="70">C-STE</uni-th>
<uni-th align="center" width="70">C-ME</uni-th>
<uni-th align="center" width="70">PE/PC-TWA</uni-th>
<uni-th align="center" width="70">噪声等效声级</uni-th>
<uni-th align="center" width="70">其他因素浓度</uni-th>
<uni-th align="center" width="95">接触水平</uni-th>
<uni-th align="center" width="80">危害因素性质</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in list" :key='index'>
<uni-td align="center">{{item.bmName}}</uni-td>
<uni-td align="center">{{item.gzName}}</uni-td>
<uni-td align="center">{{item.ygCount}}</uni-td>
<uni-td align="center">{{item.hywhName}}</uni-td>
<uni-td align="center"><input v-model="item.cTwa" type="text" /></uni-td>
<uni-td align="center"><input v-model="item.cStel" type="text" /></uni-td>
<uni-td align="center"><input v-model="item.cMac" type="text" /></uni-td>
<uni-td align="center"> <input v-model="item.peTwa" type="text" /></uni-td>
<uni-td align="center"> <input v-model="item.zcdxsj" type="text" /></uni-td>
<uni-td align="center"><input v-model="item.qtys" type="text" /></uni-td>
<!-- <uni-td align="center">{{item.jcsp}}</uni-td> -->
<uni-td align="center">
<uni-data-select v-model="item.jcsp" :localdata="range" @change="changeaccord(item)" :clear="false" >
</uni-data-select>
</uni-td>
<uni-td align="center">{{item.whXz}}</uni-td>
</uni-tr>
</uni-table>
<view class="page" >
<uni-pagination :pageSize="limit" :current="page" :total="total" :show-icon="true" @change="change" />
</view>
<table border stripe emptyText="暂无更多数据" class="harmdatalist">
<!-- 表头行 -->
<tr class="h-tr">
<th align="center">职业病危害因素性质</th>
<th align="center">暴露水平</th>
<th align="center">接触人数</th>
<th align="center">风险级别</th>
<th align="center">风险判定结论</th>
</tr>
<!-- 表格数据行 -->
<tr rowspan="2">
<td align="center" rowspan="2">一般</td>
<td align="center">符合</td>
<td align="center">{{this.listhrrm.ybbcbCount}}</td>
<td align="center">{{this.listhrrm.fxjbybbcbStr}}</td>
<td align="center" rowspan="4">{{this.listhrrm.fxjb}}</td>
</tr>
<tr>
<td align="center">不符合</td>
<td align="center">{{this.listhrrm.ybcbCount}}</td>
<td align="center">{{this.listhrrm.fxjbybcbStr}}</td>
<!-- <td align="center">1</td> -->
</tr>
<tr rowspan="2">
<td align="center" rowspan="2">严重</td>
<td align="center">符合</td>
<td align="center">{{this.listhrrm.yzbcbCount}}</td>
<td align="center">{{this.listhrrm.fxjbyzbcbStr}}</td>
</tr>
<tr>
<td align="center">不符合</td>
<td align="center">{{this.listhrrm.yzcbCount}}</td>
<td align="center">{{this.listhrrm.fxjbyzcbStr}}</td>
</tr>
</table>
</view>
</template>
<script>
import {
getblTest,
blTestEditSelect,
whblfxpg,
blTestEdit,
qyexportApp,
delPgFile,
} from '@/api/Occupationalhazards/Occupationalhazards.js'
import baseUrl from '@/api/baseurl.js'
export default {
data() {
return {
// value: 0,
range: [{
value: 0,
text: "符合"
},
{
value: 1,
text: "不符合"
},
],
page: 1,
limit: 10,
list: [],
total: null,
eid: '',
filePath: '',
// id: '',
// jcsp: '',
listhrrm: [],
}
},
onShow() {
this.infolist();
},
mounted() {
// plus.screen.lockOrientation( 'landscape-secondary');
// #ifdef APP-PLUS
plus.screen.lockOrientation('landscape-primary');
// #endif
},
onUnload() {
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁死屏幕方向为竖屏
// #endif
},
// 监听页面返回
onBackPress() {
console.log(111)
// 跳转至空白页
uni.redirectTo({
url: '/pages/perfect/perfect'
});
},
methods: {
infolist() {
// this.page = 1;
getblTest(this.page, this.limit, this.eid).then(res => {
console.log(res, '打印res')
this.list = res.data
// this.id = res.data.blID
this.total = res.count
this.list.forEach((e) => {
e.jcsp = Number(e.jcsp)
console.log(e)
});
}),
whblfxpg(this.eid).then(res => {
console.log(res, '66')
this.listhrrm = res
})
},
change(e) {
console.log(e)
this.page = e.current;
this.infolist()
},
changeaccord(val) {
if (val.jcsp == 0) {
val.jcsp = 1
} else {
val.jcsp = 0
}
blTestEditSelect(val.blID, val.jcsp).then(res => {})
},
// 保存
submit() {
this.list.forEach((e) => {
});
blTestEdit(this.list).then(res => {
this.infolist();
uni.showToast({
title: '保存成功',
icon: 'none',
duration: 2000
})
})
},
// 导出
derive(){
qyexportApp().then(res=>{
console.log(('dayin',res))
this.filePath = res
uni.downloadFile({
url: baseUrl + `/dzzyb` + res,
success: (data) => {
console.log(data)
if (data.statusCode == 200) {
//文件保存到本地
uni.saveFile({
tempFilePath: data.tempFilePath, //临时路径
success: function(res) {
console.log(res)
// uni.showToast({
// icon: 'none',
// mask: true,
// title: '文件已保存:' + res
// .savedFilePath, //保存路径
// duration: 3000,
// });
// console.log(res)
// setTimeout(() => {
// //打开文档查看
// }, 3000)
}
});
uni.openDocument({
filePath: data.tempFilePath,
success: function(res) {
// console.log('打开文档成功');
},
fail: function() {
uni.showToast({
title: '暂不支持此类型',
duration: 2000,
icon: "none",
});
}
});
if (this.filePath) {
delPgFile(this.filePath).then(res => {
})
};
}
},
})
})
},
}
}
</script>
<style lang="scss">
//css函数 声明函数
@function tovmin($rpx) {
//$rpx为需要转换的字号
@return #{$rpx * 100 / 750}vmin;
}
table,
tr,
td {
border: tovmin(1) solid silver;
border-collapse: collapse;
color: #666666;
margin: auto;
}
.data::v-deep .u-dropdown__content__mask {
background: none !important;
}
::v-deep .uni-pagination__num {
width: tovmin(1000);
// background-color: red;
}
::v-deep .uni-input-input {
text-align: center;
}
::v-deep .page--active {
// padding-left: 100rpx;
font-size: tovmin(30);
width: tovmin(80);
}
::v-deep .uni-pagination__num-tag {
min-width: tovmin(80);
}
// ::v-deep .u-dropdown .u-dropdown__menu .u-dropdown__menu__item .u-flex .u-dropdown__menu__item__arrow .u-icon__icon {
// color: #169BD5 !important;
// }
// ::v-deep .u-dropdown .u-dropdown__menu .u-dropdown__menu__item .u-flex .u-dropdown__menu__item__text {
// color: #169BD5 !important;
// font-size: 24rpx !important;
// }
// ::v-deep .u-dropdown .u-dropdown__menu {
// height: 65rpx !important;
// }
.app {
color: #000;
/* font-weight: 400; */
height: 100vh;
position: relative;
th {
font-size: tovmin(35);
}
td {
font-size: tovmin(30);
/*为页面中所有的td标签添加样式*/
// border: black 1px solid;
/*添加边框*/
}
.top{
float: right;
margin-top: tovmin(10);
margin-bottom: tovmin(10);
margin-right:tovmin(30);
.sub {
// margin: auto;
vertical-align: middle;
font-size:tovmin(30);
// display: inline-block;
width: tovmin(150);
height: tovmin(80);
// background-color: red;
text-align: center;
line-height: tovmin(80);
color: #fff;
background-color: #3C9CFF;
border-radius: tovmin(20);
display: inline-block;
}
.derive{
display: inline-block;
font-size:tovmin(30);
width: tovmin(150);
height: tovmin(80);
text-align: center;
line-height: tovmin(80);
color: #fff;
background-color: #3C9CFF;
border-radius: tovmin(20);
margin-left: tovmin(20);
vertical-align: middle;
}
}
.harmdatalist {
width: 100%;
height: 70%;
margin-bott: 5%;
}
.harmtitle {
position: absolute;
height: tovmin(90);
line-height: tovmin(90);
font-size: tovmin(50);
margin-left: 5%;
}
::v-deep .uni-table-th {
background-color: #F2F2F2;
}
.harmdata {
width: 100%;
// position: absolute;
top: 6%;
}
.h-tr {
background-color: #F2F2F2;
border: none;
font-size: tovmin(30);
}
.page {
margin-top: 2%;
margin-bottom: 2%;
}
.data {
width: 20%;
position: absolute;
top: tovmin(-10);
left: 75%;
}
}
</style>