<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">{{item.items.__KdN9OL4mTiSZImobQUx.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() {
			
			this.http.request({
				url: this.http.urls.wt_xqsh+'&_currpage='+this.pageNum,
				data: this.param,
				method:'POST',
				loading: 'false',
				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 = this.list.filter(item => item.check);
		},
		//选中并返回
		back() {
			uni.$emit('select', this.selects,this.ste);
			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>
