智能安全检查移动端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

664 lines
18 KiB

<template>
<view class="custom-content">
<z-paging ref="paging" v-model="dataList" @query="queryList">
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中,如果需要跟着滚动,则不要设置slot="top" -->
<!-- 注意!此处的z-tabs为独立的组件,可替换为第三方的tabs,若需要使用z-tabs,请在插件市场搜索z-tabs并引入,否则会报插件找不到的错误 -->
<template #top>
<uni-nav-bar :fontSizes="17" left-icon="left" @clickLeft="back" :fixed="true" :border="false"
background-color="transparent" status-bar title="检查记录" />
<view class="search-box">
<uni-easyinput :inputBorder="false" :styles="inputStyles" class="search-input" prefixIcon="search"
v-model="reviewName" placeholder="请输入搜索内容" @confirm="confirmForm" @iconClick="iconClick">
</uni-easyinput>
<view class="search-btn-box" @click="openPop">
<view class="shaixuan-icon">
<!-- <image src="https://mp-df79fe8b-b924-41b0-bcb1-960be6b4a619.cdn.bspapp.com/images/common/shaixuan@2x.png" /> -->
<image src="https://i.postimg.cc/qvbhdmZR/shaixuan-2x.png" />
</view>
<text>筛选</text>
</view>
</view>
<!-- <view class="tags-box">
<view class="tags-item" :class="{ 'active': choseindex == 0 }"> 安全检查 </view>
<view class="tags-item" :class="{ 'active': choseindex == 1 }"> 安全复查 </view>
</view> -->
</template>
<!-- 自定义下拉刷新view(如果use-custom-refresher为true且不设置下面的slot="refresher",此时不用获取refresherStatus,会自动使用z-paging自带的下拉刷新view) -->
<!-- 注意注意注意!!字节跳动小程序中自定义下拉刷新不支持slot-scope,将导致custom-refresher无法显示 -->
<!-- 如果是字节跳动小程序,请参照sticky-demo.vue中的写法,此处使用slot-scope是为了减少data中无关变量声明,降低依赖 -->
<template #refresher="{ refresherStatus }">
<!-- 此处的custom-refresh为demo中自定义的组件,非z-paging的内置组件,请在实际项目中自行创建。这里插入什么view,下拉刷新就显示什么view -->
<custom-refresher :status="refresherStatus" />
</template>
<!-- 自定义没有更多数据view -->
<template #loadingMoreNoMore>
<!-- 此处的custom-nomore为demo中自定义的组件,非z-paging的内置组件,请在实际项目中自行创建。这里插入什么view,没有更多数据就显示什么view -->
<custom-nomore></custom-nomore>
</template>
<!-- 如果希望其他view跟着页面滚动,可以放在z-paging标签内 -->
<view class="list-item" v-for="(item, index) in dataList" :key="index">
<view class="list-item-header">
<view class="list-item-header-title">
<text class="mx70">
{{ item.reviewName }}
</text>
<text class="sign-box1" :class="{ 'is-sign': item.status == 2 }">
{{ getLabelByValue(item.status, statusList) }}
</text>
</view>
<view class="list-item-header-index">#{{ index + 1 }}</view>
</view>
<view class="list-item-body">
<view class="list-item-body-desc">
<text class="list-item-body-desc-label">企业名称</text>
<text class="list-item-body-desc-value">{{ item.enterpriseName }}</text>
</view>
<view class="list-item-body-desc">
<text class="list-item-body-desc-label">检查日期</text>
<text class="list-item-body-desc-value">{{ item.checkTime }}</text>
</view>
<!-- <view class="list-item-body-desc">
<text class="list-item-body-desc-label">检查人</text>
<text class="list-item-body-desc-value">{{ item.creater }}</text>
</view> -->
<view class="list-item-body-desc">
<text class="list-item-body-desc-label">来源</text>
<text class="list-item-body-desc-value">{{ getLabelByValue(item.checkType, checkTypeList) }}</text>
</view>
</view>
<view class="list-item-feet border-top">
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status==1&&userType == 1||item.status==1&&userType == 2" @click="viewDetails(item,false)">修改</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status==1" @click="signIng(item)">签字</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status!=1" @click="goReport(item)">查看报告</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status==2&&userType == 1||item.status==2&&userType == 2" @click="viewDetails(item,true,'1')">复查</view>
<view class="list-btn ani" hover-class="isHoverIng" @click="viewDetails(item,true)">查看详情</view>
</view>
</view>
</z-paging>
<!-- <view class="top-fixed" :style="{ top: autoTop }">
<view class="search-box">
<uni-easyinput prefixIcon="search" v-model="value" placeholder="请输入搜索内容" @iconClick="iconClick">
</uni-easyinput>
<view class="search-btn-box">
<view class="shaixuan-icon">
<image src="https://mp-df79fe8b-b924-41b0-bcb1-960be6b4a619.cdn.bspapp.com/images/common/shaixuan@2x.png" />
</view>
<text>筛选</text>
</view>
</view>
</view>
<view class=""></view> -->
<uni-popup ref="selectPopup">
<view class="popup-content">
<view class="popup-header">
请选择签名方式
</view>
<view class="popup-body">
<!-- <view class="sign-item" @click="open">
<view class="sign-item-icon"> -->
<!-- <image src="https://mp-df79fe8b-b924-41b0-bcb1-960be6b4a619.cdn.bspapp.com/images/common/pam@2x.png"> -->
<!-- <image src="https://i.postimg.cc/j5JJczcj/pam-2x.png">
</image>
</view>
<text>检查人与企业签字</text>
</view> -->
<view class="sign-item" @click="open(1)" v-if="userType == 1||userType == 2">
<view class="sign-item-icon">
<!-- <image src="https://mp-df79fe8b-b924-41b0-bcb1-960be6b4a619.cdn.bspapp.com/images/common/m@2x.png"> -->
<image src="https://i.postimg.cc/bJK1f6rb/m-2x.png">
</image>
</view>
<text>检查人签字</text>
</view>
<view class="sign-item" @click="open(2)" v-if="userType == 0">
<view class="sign-item-icon">
<!-- <image src="https://mp-df79fe8b-b924-41b0-bcb1-960be6b4a619.cdn.bspapp.com/images/common/p@2x.png"> -->
<image src="https://i.postimg.cc/D0k4M8pP/p-2x.png">
</image>
</view>
<text>企业签字</text>
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="popup" type="bottom">
<view class="sign-popup">
<!-- 签字板 -->
<view class="sign-box">
<sp-sign-board v-if="showSign" ref="signBoardRef" sid="sign-board-popup" :showMark="false"
bgColor="#f8f8f8" :horizontal="true" popup-mode :needBack="false"></sp-sign-board>
</view>
<!-- 自定义控制栏 -->
<view class="sign-control">
<button class="sign-btn" size="mini" type="default" @click="close">关闭</button>
<button class="sign-btn reset" size="mini" @click="reset">重置</button>
<button class="sign-btn confirm" size="mini" @click="confirm">确认</button>
</view>
</view>
</uni-popup>
<uni-popup ref="filterPopup" type="bottom" background-color="#fff">
<view class="popup-box">
<view class="popup-box-content">
<view class="popup-box-content-item">
<text>检查类型</text>
<view>
<uni-data-checkbox :map="maps" v-model="checkType"
:localdata="checkTypeList"></uni-data-checkbox>
</view>
</view>
<view class="popup-box-content-item">
<text>检查状态</text>
<view>
<uni-data-checkbox :map="maps" v-model="status" :localdata="statusList"></uni-data-checkbox>
</view>
</view>
</view>
<view class="popup-box-btn-box">
<view class="popup-box-btn-box-item" @click="resetForm">重置</view>
<view class="popup-box-btn-box-item" @click="confirmForm">确定</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import CustomNomore from '@/components/custom-nomore/custom-nomore'
import CustomRefresher from '@/components/custom-refresher/custom-refresher'
import { parseTime } from '@/utils/ruoyi'
import { getDicts } from '@/api/system/user'
import * as Api from '@/api/index/index'
import { getLabelByValue } from '@/utils/showDictLabel.js' // 导入工具函数
export default {
components: {
CustomNomore,
CustomRefresher
},
data() {
return {
dataList: [],
inputStyles: {
borderRadius: '20rpx',
backgroundColor: '#ffffff',
},
showSign: false, // 是否显示签字板 仅微信小程序需要该配置
signBase64: '',
signTempimg: '',
choseindex: 0,
checkTypeList: [],
statusList: [],
reviewName: '',
checkType: '',
status: '',
userType: this.$store.state.user.userType,
maps: {
text: 'label',
value: 'value'
},
signType: null,
signItemId: null,
selectedItem: null,
}
},
computed: {
autoTop() {
return this.getVal()
},
},
mounted() {
// 监听,有必要时请正确处理on、once和off
uni.$on('getSignImg', (e) => {
console.log('getSignImg', e)
// 多签名场景下可根据 sid 区分不同签名
if (e.sid == 'sign-board-popup') {
if (this.signType == 1) {
this.selectedItem.checkPeopleSignature = e.base64
Api.updateInitialReview({
id: this.signItemId,
checkPeopleSignature: e.base64
}).then(res => {
debugger
uni.showToast({
title: '检查人签字完成',
icon: 'none',
mask: true
})
if (this.selectedItem.enterpriseSignature) {
this.updateItemStatus()
}else{
this.$refs.paging.refresh()
}
console.log(res)
}).catch(err => {
console.log(err)
})
} else {
this.selectedItem.enterpriseSignature = e.base64
Api.updateInitialReview({
id: this.signItemId,
enterpriseSignature: e.base64
}).then(res => {
debugger
uni.showToast({
title: '企业签字完成',
icon: 'none',
mask: true
})
console.log(res)
if (this.selectedItem.checkPeopleSignature) {
this.updateItemStatus()
}else{
this.$refs.paging.refresh()
}
}).catch(err => {
console.log(err)
})
}
this.signBase64 = e.base64
this.signTempimg = e.path
}
// 一定注意不能确认签字完成后立马关闭弹窗,否则签字板会销毁,无法获取签名。需要等签名正确获取到之后再关闭弹窗
this.close()
})
this.getDicts('initial_review_check_type')
this.getDicts('initial_review_status')
},
methods: {
resetForm() {
this.reviewName = '',
this.checkType = '',
this.status = ''
},
confirmForm() {
this.$refs.paging.refresh()
this.$refs.filterPopup.close()
},
getLabelByValue() {
return getLabelByValue.apply(this, arguments)
},
getDicts(type) {
const params = {
type: type
}
getDicts(params).then(res => {
if (type === 'initial_review_check_type') {
this.checkTypeList = res.data
} else if (type === 'initial_review_status') {
this.statusList = res.data
}
}).catch(err => {
console.log(err)
})
},
openPop() {
this.$refs.filterPopup.open()
},
parseTime(time) {
return parseTime(time)
},
back() {
uni.switchTab({ url: '/pages/index' })
},
getVal() {
return uni.getSystemInfoSync().statusBarHeight + 44 + 'px'
},
queryList(pageNo, pageSize) {
//组件加载时会自动触发此方法,因此默认页面加载时会自动触发,无需手动调用
//这里的pageNo和pageSize会自动计算好,直接传给服务器即可
//模拟请求服务器获取分页数据,请替换成自己的网络请求
const params = {
pageNo: pageNo,
pageSize: pageSize,
reviewName: this.reviewName,
checkType: this.checkType,
status: this.status
}
Api.getInitialReviewList(params).then(res => {
//将请求的结果数组传递给z-paging
this.$refs.paging.complete(res.data.list);
}).catch(res => {
//如果请求失败写this.$refs.paging.complete(false);
//注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
//在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
this.$refs.paging.complete(false);
})
},
signIng(item) {
console.log(item)
this.signItemId = item.id
this.selectedItem = item
this.$refs.selectPopup.open('center')
},
//更新状态
updateItemStatus() {
if (this.selectedItem.checkPeopleSignature && this.selectedItem.enterpriseSignature) {
Api.updateInitialReview({
id: this.signItemId,
status: '2'
}).then(res => {
debugger
console.log(res)
this.$refs.paging.refresh()
}).catch(err => {
console.log(err)
this.$refs.paging.refresh()
})
}
},
// 打开弹窗
open(val) {
this.signType = val
this.$refs.selectPopup.close()
this.$refs.popup.open()
this.$nextTick(() => {
this.showSign = true // 微信小程序需要此步骤来初始化签字板
})
},
// 关闭弹窗
close() {
this.$refs.popup.close()
this.$nextTick(() => {
this.showSign = false // 微信小程序需要此步骤来销毁签字板
this.signType = null
})
},
// 重置签名
reset() {
this.$refs.signBoardRef.reset()
},
// 确认签名
confirm() {
this.$refs.signBoardRef.confirm()
// 一定注意不能确认签字完成后立马关闭弹窗,否则签字板会销毁,无法获取签名。需要等签名正确获取到之后再关闭弹窗
},
//查看详情,修改都走这里
viewDetails(item,val,type){
const data = encodeURIComponent(JSON.stringify(item))
uni.navigateTo({
url: '/pageIndex/addSafeCheck/readdSafeCheck?data='+data+'&val='+val+'&type='+type
})
},
goReport(item) {
const data = encodeURIComponent(JSON.stringify(item))
uni.navigateTo({
url: '/pageIndex/filePage/filePage?data=' + data
})
}
}
}
</script>
<style lang="scss">
.uni-easyinput,
.uni-easyinput__content {
border-radius: 20rpx;
}
.tags-box {
display: flex;
align-items: center;
width: 100%;
justify-content: space-around;
height: 100rpx;
.tags-item {
font-family: Alibaba PuHuiTi;
font-weight: 400;
font-size: 30rpx;
color: #666666;
position: relative;
&.active {
color: #1B1B1B;
}
&.active::after {
content: '';
width: 100%;
width: 72rpx;
height: 5rpx;
background: linear-gradient(90deg, #00DAEF 0%, #3E73F5 100%);
border-radius: 3rpx;
position: absolute;
bottom: -10rpx;
left: 50%;
transform: translateX(-50%);
}
}
}
.popup-content {
width: 93vw;
margin: 0 auto;
border-radius: 24rpx;
background: #fff;
.popup-header {
height: 120rpx;
background: linear-gradient(180deg, #D4E4FC 0%, rgba(192, 216, 252, 0) 100%);
border-radius: 24rpx;
font-weight: 400;
font-size: 32rpx;
color: #1B1B1B;
padding: 54rpx 0 32rpx;
text-align: center;
}
.popup-body {
padding: 0 30rpx;
display: flex;
flex-direction: column;
.sign-item {
display: flex;
align-items: center;
background: #F7F8FB;
border-radius: 20rpx;
margin-bottom: 32rpx;
padding: 10rpx 0 10rpx 30rpx;
&:last-child {
margin-bottom: 50rpx;
}
.sign-item-icon {
width: 78rpx;
height: 78rpx;
margin-right: 28rpx;
position: relative;
top: 20rpx;
image {
width: 100%;
height: 100%;
}
}
text {
font-weight: 500;
font-size: 30rpx;
color: #1B1B1B;
}
}
}
}
.sign-popup {
background-color: #fff;
height: 85vh;
padding: 24rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
}
.sign-control {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
transform: rotate(90deg);
/* 顺时针旋转 90 度 */
}
.sign-btn {
&.confirm {
background: #3E73F5;
border-radius: 12rpx;
color: #fff;
}
&.reser {
background: #FFFFFF;
border-radius: 12rpx;
color: #3E73F5;
}
}
.sign-btn:not(:last-child) {
margin-bottom: 40rpx;
}
.sign-box {
flex: 1;
}
.sign-box1 {
background: #3E73F5;
border-radius: 8rpx 8rpx 8rpx 0rpx;
color: #fff !important;
font-size: 24rpx !important;
padding: 6rpx 12rpx;
margin-left: 10rpx;
}
.is-sign {
background: #00ba16;
}
.popup-box {
padding: 30rpx;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
&.center {
width: 80vw;
max-height: 80vh;
.popup-box-title {
font-size: 32rpx;
font-weight: bold;
text-align: center;
margin-bottom: 24rpx;
}
.content-box {
max-height: 60vh;
overflow-y: scroll;
.content {
margin: 24rpx 0;
.content-label {
font-weight: 500;
margin-bottom: 12rpx;
}
.content-value {
color: #656565;
// display: -webkit-box;
// -webkit-box-orient: vertical;
// -webkit-line-clamp: 3;
// overflow: hidden;
}
}
}
}
&-content {
&-item {
margin-bottom: 40rpx;
&:last-child {
margin-bottom: 0;
}
>text {
display: block;
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
}
.uni-data-checkbox {
display: flex;
flex-wrap: wrap;
::v-deep .uni-checkbox-group {
display: flex;
flex-wrap: wrap;
.uni-label {
width: 50%;
margin-bottom: 20rpx;
display: flex;
align-items: center;
.uni-checkbox-input {
transform: scale(0.8);
margin-right: 10rpx;
}
}
}
}
}
}
&-btn-box {
display: flex;
justify-content: space-between;
margin-top: 30rpx;
&-item {
flex: 1;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 10rpx;
font-size: 30rpx;
&:first-child {
background-color: #f5f5f5;
color: #666;
margin-right: 20rpx;
}
&:last-child {
background-color: #007AFF;
color: #fff;
margin-left: 20rpx;
}
}
}
}
.list-item-header-title {
.mx70 {
max-width: 80%;
width: fit-content !important;
}
}
</style>