qa-prevention-gwj-first-app/pages/application/high-risk-work/home.vue

154 lines
4.7 KiB
Vue
Raw Normal View History

2023-11-07 09:43:46 +08:00
<template>
<view class="background-none">
<cu-custom bgColor="bg-gradual-blueness" :isBack="true" :isRingt="true">
<block slot="backText">返回</block>
<block slot="content">高危作业</block>
</cu-custom>
<view class="new-apps-box">
<view class="new-apps-warp">
<view class="new-apps-item" v-for="(item,index) in highRiskList" :key="index">
<navigator class="a" hover-class="none" :url="item.url">
<view class="image">
<image :src="item.image" mode=""></image>
<view v-if="item.hotWorkCount > 0" class="badge">{{ item.hotWorkCount }}</view>
<view v-if="item.hightWorkCount > 0" class="badge">{{ item.hightWorkCount }}</view>
<view v-if="item.blindBoardCount > 0" class="badge">{{ item.blindBoardCount }}</view>
<view v-if="item.HoistingCount > 0" class="badge">{{ item.HoistingCount }}</view>
<view v-if="item.confinedSpaceCount > 0" class="badge">{{ item.confinedSpaceCount }}</view>
<view v-if="item.electricityCount > 0" class="badge">{{ item.electricityCount }}</view>
2023-11-07 09:43:46 +08:00
</view>
<view class="title">
<text>{{ item.title }}</text>
</view>
</navigator>
</view>
</view>
</view>
</view>
</template>
<script>
import { basePath, loginUser } from '@/common/tool.js';
2023-11-07 09:43:46 +08:00
export default {
data() {
return {
highRiskList: [
2023-11-07 09:43:46 +08:00
{
title: '动火作业',
url: '/pages/application/eight-assignments/index',
image: require('../../../static/new_images/i1.png'),
hotWorkCount: 0,
2023-11-14 10:42:01 +08:00
},
2023-11-07 09:43:46 +08:00
{
title: '高处作业',
url: '/pages/application/gf-eight-work/high-work/home',
image: require('../../../static/new_images/i2.png'),
hightWorkCount: 0,
2023-11-07 09:43:46 +08:00
},
{
title: '盲板作业',
url: '/pages/application/gf-eight-work/blind-board/home',
image: require('../../../static/new_images/i3.png'),
blindBoardCount: 0,
2023-11-07 09:43:46 +08:00
},
{
title: '吊装作业',
url: '/pages/application/gf-eight-work/hoisting/home',
image: require('../../../static/new_images/i4.png'),
HoistingCount: 0,
2023-11-07 09:43:46 +08:00
},
{
title: '有限空间安全作业',
url: '/pages/application/gf-eight-work/confinedspace/home',
image: require('../../../static/new_images/i5.png'),
confinedSpaceCount: 0,
2023-11-07 09:43:46 +08:00
},
{
title: '临时用电安全作业',
url: '/pages/application/gf-eight-work/electricity/home',
image: require('../../../static/new_images/i6.png'),
electricityCount: 0,
2023-11-07 09:43:46 +08:00
},
],
};
2023-11-07 09:43:46 +08:00
},
onShow() {
this.updateWorkCounts('/app/hotwork/cfd/countCheck', '动火作业', 'hotWorkCount');
this.updateWorkCounts('/app/gfHighwork/countCheck', '高处作业', 'hightWorkCount');
this.updateWorkCounts('/app/gfBlindBoard/countCheck', '盲板作业', 'blindBoardCount');
this.updateWorkCounts('/app/gfHoisting/countCheck', '吊装作业', 'blindBoardCount');
this.updateWorkCounts('/app/gfConfinedSpace/countCheck', '有限空间安全作业', 'blindBoardCount');
this.updateWorkCounts('//app/gfElectricity/countCheck', '临时用电安全作业', 'electricityCount');
},
methods: {
updateWorkCounts(url, title, countKey) {
uni.showLoading({ title: "加载中..." }); // 加载中动画
uni.request({
url: basePath + url,
method: 'POST',
dataType: 'json',
header: { 'Content-type': 'application/x-www-form-urlencoded' },
data: {
tm: new Date().getTime(),
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
uni.hideLoading(); // 结束加载中动画
if (res.data.result === "success") {
let totalCount = res.data.count.SUMCOUNT;
this.highRiskList = this.highRiskList.map(item => {
if (item.title === title) {
return { ...item, [countKey]: totalCount };
}
return item;
});
}
}
});
}
}
};
2023-11-07 09:43:46 +08:00
</script>
<style>
.new-apps-box {
padding: 20upx;
}
.new-apps-warp {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.new-apps-item {
position: relative;
width: 30%;
margin-bottom: 20upx;
text-align: center;
}
.new-apps-item .image {
position: relative;
width: 100%;
height: 100upx;
}
.new-apps-item .badge {
position: absolute;
top: -10px;
right: 0;
background-color: #dd514c;
color: white;
border-radius: 50%;
padding: 2px 5px;
font-size: 12px;
}
2023-11-07 09:43:46 +08:00
.new-apps-item .title {
margin-top: -5upx;
}
2023-11-07 09:43:46 +08:00
</style>