<template>
	<view class="list">
		<view class="item" v-for="(item, index) in list" :key="index" @click="select(item)">
			<view class="icon select check" v-if="item.check">&#xe600;</view>
			<view class="icon select" v-else>&#xe8bb;</view>
			<view class="title" v-if="ste.ste==1">{{item.items.__KdN9OL4mTiSZImobQUx.value}}</view>
			<view class="title" v-if="ste.ste==2">{{item.items.__yJV3YYKM0JUVIiiHesi.value}}</view>
			<view class="title" v-if="ste.ste==3">{{item.items.__TjZBRDXIVjYIcNArUTX.value}}</view>
			
			<view class="title" v-if="ste.ste==4">{{item.items.__fhQZx0AyyZcLJ5ubMM3.value}}</view>
			<view class="title" v-if="ste.ste==5">{{item.items.__O7t5AtyKhdgA8ysFYJP.value}}</view>
			
			<view class="icon more">&#xe631;</view>
			<view class="clear"></view>
		</view>
		<view class="footer">
			<button class="btn ws" @click="back">确定（{{ selects.length }}）</button>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [
				
			],
			selects: {},//选中
			ste:{},
			param: {allow:"false",appId:"__gAPYBW4YxB3UePM3lqO",datetime:"1670298187436",eventMapping:"WTXQSH",fieldid:"__cs7TNRZDZtqKrhZrLPv",formId:"__YFJYj8ON2DXzasI3GSh",isEdit:"true",mutil:"false",parentid:"__JoaMwBw5Qw0DL4xun3e",searchForm:"false",selectOne:"false",viewId:"__MhHakFCgVJAm81MFUnt",_:"1670298187436",_defaultSize:"true"},
			pageNum:1
		};
	},
	onLoad(e) {
		console.log('eeee:' + JSON.stringify(e));
		this.ste=e;
	
		this.getData();
	},
	methods: {
		getData() {
			var url=this.http.urls.wt_xqsh;
			if(this.ste.ste==1){
			this.param.viewId='__MhHakFCgVJAm81MFUnt';	
				url=this.http.urls.wt_xqsh;
			}else if(this.ste.ste==2){
				
				this.param.viewId='__r4IN5HOqV4HIips1s0Q';
					url=this.http.urls.wt_sysh;
			}
			else if(this.ste.ste==3){
				this.param.viewId='__yoOF16IOiZdmrbDOujU';
					url=this.http.urls.wt_xqpz;
			}
			else if(this.ste.ste==4){
				this.param.viewId='__b6gD17cP1g4gFdTq0Ox';
					url=this.http.urls.wt_sypz;
			}
			else if(this.ste.ste==5){
				this.param.viewId='__m9w03S06KHbg3KioRIh';
					url=this.http.urls.wt_rwfp;
			}
			this.http.request({
				url: url+'&_currpage='+this.pageNum,
				data: this.param,
				method:'POST',
				
				success: res => {
					console.log("res.data.data.page==="+JSON.stringify(res));
					console.log("this.pageNum==="+this.pageNum);
					this.loadMore = res.data.data.page > this.pageNum-1 ? true : false;
					res.data.data.data.forEach(item => {
						this.list.push(item);
					});
					
				}
			});
		},
		
		//选择
		select(item) {
			item.check = !item.check;
			
			item.ste=this.ste.ste;
			console.log("this.item==="+JSON.stringify(item));
			this.selects=item;
			uni.$emit('select', this.selects);
			uni.navigateBack();
			
			//this.selects = this.list.filter(item => item.check);
		},
		//选中并返回
		back() {
			uni.$emit('select', this.selects);
			uni.navigateBack();
		}
	}
};
</script>

<style lang="scss">
.list {
	padding: 10px;
	.item {
		padding: 13px;
		background-color: white;
		border-bottom: 1px solid #efecec;
		.select {
			float: left;
			padding-right: 7px;
			margin-top: 1px;
			font-size: 20px;
		}
		.check {
			color: #4581fb;
		}
		.more {
			float: right;
			margin-top: -18px;
			color: darkgray;
		}
	}
}
</style>
