<template>
	<view class="content">
		<view class="input">
			<input type="text" placeholder="搜索单位" @input="getCompanies($event)">
		</view>
		<view class="content_item_box">
			<view class="content_item" v-for="(item,index) in list" :key="index">
				<text @tap="aaa(index)">{{item.companyName}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['cid'],
		data() {
			
			return {
				list: []
			}
		},
		created() {

			this.getCompanies()
		},
		methods: {
			getCompanies(e) {
				let a = ""
				if (e) {
					a = e.detail.value
				}
				let OrganizationId = uni.getStorageSync("user").organizationId
				let params = {
					companyName: a,
					OrganizationId: OrganizationId,
					PageNumber: 1,
					PageSize: 50
				}
				this.$request.get('/api/Companies', params, (data, res) => {
					console.log(res,4444);
					this.list = res.items
				})
			},
			aaa(i) {
				console.log(i);

				this.$parent.Company(this.list[i]);
			}
		}
	}
</script>

<style lang="scss">
	.content {
		height: 100%;
		display: flex;
		flex-direction: column;
		padding:  20rpx;
		.input{
			border: 2rpx solid #E4E7EC;
			height: 60rpx;
			padding: 0 20rpx;
			input{
				height: 100%;
			}
		}
		.content_item_box {
			flex: 1;
			overflow: auto;
			.content_item{
				height: 80rpx;
				line-height: 80rpx;
				padding-left: 20rpx;
				border-bottom: 2rpx solid #eceff3;
			}
		}
	}
</style>
