176 lines
3.8 KiB
Vue

<template>
<view class="control">
<view class="fixedheader">
<headers :themeType="true" :showBack="true">
<view class="headerName">
{{title}}
</view>
</headers>
</view>
<view :style="{ 'padding-top': ((statusBarHeight * 2) + 45) * 1.5 + 'rpx' }">
<view class="checkbox-wrap">
<checkbox-group class="form-checkbox" @change="checkboxChange">
<label class="uni-list-cell uni-list-cell-pd flex a-center" v-for="(item,index) in list" :key="index">
<view>
<checkbox :value="JSON.stringify(item)" style="transform: scale(0.7);" :checked="item.checked" />
</view>
<view>{{item.checkDetailContent}}</view>
</label>
</checkbox-group>
</view>
<view class="bottom-btn-box">
<view class="other-btn" @click="addForm(1)">创建其他隐患</view>
<view class="submit-btn" :style="{'opacity': checkList.length>0 ? '1' : '0.6'}" @click="addForm(2)">创建隐患</view>
</view>
</view>
</view>
</template>
<script>
import dangerBigCheckDetail from './dangerBigCheckDetail.vue'
export default {
data(){
return{
userCheckId: "",
statusBarHeight: 0,
title: "选择检查项",
list: [],
checkList: [],
engineeringId: ""
}
},
components:{
dangerBigCheckDetail
},
onShow(val){
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
},
onLoad(val){
this.userCheckId = val.id
this.engineeringId = val.engineeringId
this.initData();
},
methods:{
initData(){
this.sendRequest({
url:'xmgl/acceptanceTableUserCheckRecord/getUerHiddenDangerCheckItemResultList',
method:'post',
data:{userCheckId: this.userCheckId},
success:res=>{
uni.hideLoading()
this.list = res.result
console.log(res)
}
})
},
checkboxChange(e){
let arr = []
e.detail.value.forEach(item=>{
arr.push(JSON.parse(item))
})
console.log(arr)
this.checkList = arr
// this.checkList = JSON.parse(e.detail.value)
},
addForm(val){
if(val == 2){
uni.setStorageSync('engineeringList',this.checkList)
} else{
if(uni.getStorageSync('engineeringList')){
uni.removeStorageSync('engineeringList');
}
}
if(uni.getStorageSync('dangerData')){
uni.removeStorageSync('dangerData');
}
if(uni.getStorageSync('detailData')){
uni.removeStorageSync('detailData');
}
if(val == 2 && this.checkList.length == 0){
return
}
uni.redirectTo({
url:'../safeManage/addExamine?type=1&engineeringId='+this.engineeringId
})
}
}
}
</script>
<style lang="scss" scoped>
.control{
min-height: 100%;
background: #fff;
padding: 0 20rpx;
.fixedheader{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
}
.flex{
display: flex;
}
.j-between{
justify-content: space-between;
}
.a-center{
align-items: center;
}
.b-bottom{
border-bottom: 1px solid #F6F6F6;
}
.control-h2{
font-size: 28rpx;
height: 60rpx;
padding: 0 20rpx;
background: rgba(255,255,255,0.5);
}
.bottom-btn-box{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 96rpx;
display: flex;
align-items: center;
text-align: center;
background: #fff;
.other-btn{
flex: 1;
height: 100%;
line-height: 96rpx;
color: #409EFF;
border: 1px solid #409EFF;
box-sizing: border-box;
}
.submit-btn{
flex: 1;
height: 100%;
background: #409EFF;
line-height: 96rpx;
color: #fff;
opacity: 0.6;
}
}
.checkbox-wrap{
padding-bottom: 96rpx;
padding-top: 20rpx;
.uni-list-cell{
border-bottom: 1px solid #eee;
height: 80rpx;
>view:nth-child(2){
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
</style>