<!-- 安全检查-发起巡查计划-选择内容 -->
<template>
  <view class="examine">
	  <view class="lab_title">
		<view class="lab_title_r">
			<view class="lab_title_r_btn" @click="searchBtn">
				<img src="@/pages_safetyExamine/images/icon_aqjc_ss.png"/>
			</view>
			<input type="text" v-model="getData.searchValue" placeholder="请输入检查内容" maxlength="50" placeholder-style="color: #CCCCCC;font-size:26rpx;">
			<view class="clear" @click="clearBtn">清除</view>
		</view>
	  </view>
	<scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
		<view>
			<view class="list">
				<view class="list_li" v-for="(item,index) in  dataList" :key="index" @click="labSelete(item)">
					<text :class="item.type?'color_B':'color_A'">{{item.gasName}}-{{item.levelName}}({{item.sizeName}})</text>
					<img v-if="item.type" src="@/pages_safetyExamine/images/icon_xzwt_xz.png">
				</view>
			</view>
		</view>
	</scroll-view>	
  </view>

</template>

<script>
import { config } from '@/api/request/config.js'
import {conditionCollegeInfo,conditionSubjectInfo,findDeviceList,haveHazardInSub,airbottleBottleTypeList,getDicts} from '@/api/index.js'
export default {
  name: "rectifyList",
  components: {
   
  },
  data() {
    return {
	  pageType:0,
      //列表请求参数
      getData:{
        pageNum:1,
        pageSize:20,
		searchValue:'',
      },
	  total:0,
	  dataList:[],
	  seleteListDevice:[],//临时存储选中的 
	  form:{},
	  gasBottleLevel:uni.getStorageSync('gasBottleLevel'),//  气瓶级别 
	  gasBottleSpecification:uni.getStorageSync('gasBottleSpecification'), // 气瓶规格
	}
  },
  onLoad(option) {
	  if(option.form){
		 this.form=JSON.parse(decodeURIComponent(option.form)); 
	  }
  },
  onShow() {
      
  },
  mounted(){
	  this.getList(); 
  },
  methods: {
	  //滚动事件
	  scrollGet(){
		  let self=this;
	      if(self.total/self.getData.pageSize<=self.getData.pageNum){
	          console.log('没有更多数据!')
	      }else{
			  setTimeout(function(){
				  self.getData.pageNum += 1;
				  self.getList(); 
			  },1000)
			 
		  }
	  },
	  //点击选择实验室
	  labSelete(item){
	  	console.log(item)
		 this.$set(this.form,'gasName',item.gasName);
		 this.$set(this.form,'gasComposition',item.gasComposition);
		 this.$set(this.form,'level',item.level);
		 this.$set(this.form,'levelName',item.levelName);
		 this.$set(this.form,'size',item.size);
		 this.$set(this.form,'sizeName',item.sizeName);
		 this.$set(this.form,'levelSizeName',item.levelName+item.sizeName);
		uni.redirectTo({
		    url:'/pages/gasBottle/stockList/storageAdd?form='+encodeURIComponent(JSON.stringify(this.form))
		});
	  },
	  //实验室搜索
	  searchBtn(){
		  this.dataList=[];
		  this.getList();
	  },
	  //清除
	  clearBtn(){
		  this.getData.pageNum=1;
		  this.getData.searchValue='';
		  this.dataList=[];
		  this.getList();
	  },
	  handleClick(doType){
		  let self=this;
		  if( doType=='subBtn'){//保存数据
			
		  }
	  },
	  
	  async getList(){
	      let _this = this;
	      const {data} = await airbottleBottleTypeList(_this.getData);
	      if(data.code==200){
			  for(let i=0;i<data.data.records.length;i++){
				  for(let b=0;b<this.gasBottleSpecification.length;b++){
				  		if(this.gasBottleSpecification[b].dictValue==data.data.records[i].size){
							data.data.records[i].sizeName=this.gasBottleSpecification[b].dictLabel
						}
						
				  }
				  for(let t=0;t<this.gasBottleLevel.length;t++){
					if(this.gasBottleLevel[t].dictValue==data.data.records[i].level){
						data.data.records[i].levelName=this.gasBottleLevel[t].dictLabel
					}
				  }
				  
			  }
			  
			  console.log(data.data.records)
			  this.dataList=[...this.dataList,...data.data.records]
			  _this.total=data.data.total;
		  }
      }
  }
}
</script>

<style lang="stylus" scoped>
.examine{
	height:100%;
	display flex;
	.info-max-box{
		flex: 1;
		overflow: scroll;
		padding: 120rpx 0rpx 30rpx;
		box-sizing: border-box;
	}
	.lab_title{
		width: 750rpx;
		height: 100rpx;
		background: #FFFFFF;
		position: fixed;
		top: 0;
		padding: 10rpx 30rpx;
		box-sizing: border-box;
		
		.lab_title_r{
			width: 690rpx;
			height: 80rpx;
			position:relative;
			border-radius: 10rpx;
			border: 1rpx solid #E0E0E0;
			.lab_title_r_btn{
				width: 60rpx;
				height: 80rpx
				position: absolute;
				top: 0rpx;
				left:0rpx;
				>img{
					width: 20rpx;
					height: 20rpx;
					position: absolute;
					top: 30rpx;
					left: 24rpx;
				}
			}
			>input{
				width: 274rpx;
				height: 80rpx;
				position: absolute;
				top: 0rpx;
				left: 60rpx;
			}
			.clear{
				width: 60rpx;
				height: 80rpx
				position: absolute;
				top: 0rpx;
				right:20rpx;
				font-size: 30rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				color: #0183FA;
				line-height: 80rpx;
			}
		}
	}
	.list{
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 0rpx 0rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		margin: 0 30rpx;
		.list_li{
			display: flex;
			justify-content:space-between;
			align-items: center;
			height: 80rpx;
			border-bottom: 1rpx solid #E0E0E0;
			>text{
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				line-height: 80rpx;
				overflow: hidden;
				text-overflow:ellipsis;
				white-space: nowrap;
			}
			>img{
				width: 24rpx;
				height: 16rpx;
				margin-right: 14rpx;
			} 
		}
		.list_li:last-child{
			border: none;
		}
		.color_A{
			color: #333333;
		}
		.color_B{
			color: #0183FA;
		}
	}
}
</style>
