智能安全检查移动端
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.
 
 
 
 
 
safe-check-mobile/pageIndex/checkHsitory/recheckHsitory.vue

544 lines
14 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="confirm">
</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 == 4 }">
{{ 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.checkPerson }}</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">修改</view>
// <view class="list-btn">复制报告链接</view>
// <view class="list-btn" @click="signIng(item)">签字</view> -->
<view class="list-btn ani" hover-class="isHoverIng" @click="goReport(item)">查看报告</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status == 3&&userType == 1||item.status == 3&&userType == 2"
@click="viewDetails(item, true, '1')">复查</view>
<view class="list-btn ani" hover-class="isHoverIng" v-if="item.status == 4&&userType == 1||item.status == 4&&userType == 2"
@click="viewDetails(item, true, '2')">同步到学一学</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="popup" 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="reset">重置</view>
<view class="popup-box-btn-box-item" @click="confirm">确定</view>
</view>
</view>
</uni-popup>
<uni-popup ref="comTypePopup" 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="comType" :localdata="comTypeList"></uni-data-checkbox>
</view>
</view>
</view>
<view class="popup-box-btn-box">
<view class="popup-box-btn-box-item" @click="reset">重置</view>
<view class="popup-box-btn-box-item" @click="tongbu">确定</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',
},
choseindex: 0,
maps: {
text: 'label',
value: 'value'
},
checkTypeList: [],
statusList: [],
comTypeList: [],
checkType: '',
comType: '',
status: '',
reviewName: '',
formData:null,
userType: this.$store.state.user.userType,
}
},
computed: {
autoTop() {
return this.getVal()
},
},
mounted() {
this.getDicts('initial_review_check_type')
this.getDicts('initial_review_status')
this.getDicts('com_type')
},
methods: {
reset() {
this.checkType = ''
this.comType = ''
this.status = ''
this.reviewName = ''
},
confirm() {
this.$refs.paging.refresh()
this.$refs.popup.close()
},
//同步学一学
tongbu() {
if (!this.comType) {
uni.showToast({
title: '请选择企业类型',
icon: 'none'
})
return
}
let that = this
uni.showModal({
title: '提示',
content: '确定同步吗?',
showCancel: true,
success: function (res) {
if (res.confirm) {
that.formData = {
...that.formData,
type:that.comType
}
debugger
Api.updateReview(that.formData).then(res => {
uni.showToast({
title: '同步完成',
icon: 'none'
})
that.$refs.comTypePopup.close()
that.$refs.paging.refresh()
}).catch(err => {
console.log(err)
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
},
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.splice(2, 2)
} else if (type === 'com_type') {
this.comTypeList = res.data
}
}).catch(err => {
console.log(err)
})
},
getLabelByValue() {
return getLabelByValue.apply(this, arguments)
},
openPop() {
this.$refs.popup.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,
checkType: this.checkType,
reviewName: this.reviewName,
status: this.status
}
Api.getReviewList(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);
})
},
viewDetails(item, val, type) {
if (type == 1) {
const data = encodeURIComponent(JSON.stringify(item))
uni.navigateTo({
url: '/pageIndex/addSafeCheck/readdSafeCheck?data=' + data + '&val=' + val + '&type=' + type
})
}
if (type == 2) {
this.formData = item
this.$refs.comTypePopup.open()
}
},
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;
}
.list-btn {
width: 50%;
text-align: center;
color: #fff !important;
background-color: #3E73F5;
}
.popup-box {
padding: 30rpx;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
&-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>