<template>
	<!-- 顶部导航栏 -->
	<custom-nav-bar :left="true" leftText="" @leftClick="" title="轮灌组列表"></custom-nav-bar>
	<view class="text-intel">
		<view>
			<span>轮灌组：</span>
			<span class="font-green">2个</span>
		</view>
		<view>
			<span>总时长：</span>
			<span class="font-green">12:12:12</span>
		</view>
	</view>
	<view class="card">
		<uni-collapse>
			<uni-collapse-item title-border="none" :border="false" :show-arrow="false" :open="true">
				<template v-slot:title>
					<view class="cards-title">
						<view>
							<view class="text">轮灌组1</view>
							<view>
								<uni-forms>
									<uni-forms-item label="时长：">
										<uni-easyinput placeholder="1:00:00" />
									</uni-forms-item>
								</uni-forms>
							</view>
							<view>已选：3</view>
						</view>
						<view class="title-r">
							<u-button type="success" size="mini" text="编辑" />
							<u-button class="bg-red" type="success" size="mini" text="删除" />
						</view>
					</view>
				</template>
				<view class="content">
					<view class="cards-content">
						<view class="greybar">
							<view>出水口：<span>1-1</span></view>
							<view>三通<span>①开</span></view>
						</view>
						<view class="greybar">
							<view>出水口：<span>1-1</span></view>
							<view>三通<span>①开</span></view>
						</view>
						<view class="greybar">
							<view>出水口：<span>1-1</span></view>
							<view>三通<span>①开</span></view>
						</view>
					</view>
				</view>
			</uni-collapse-item>
		</uni-collapse>
	</view>
	<view class="bottom-btn">
		<u-button type="success" size="large" text="新增" @click="config" />
	</view>

	<custom-irrigation-select ref="irrigationSelectRef" :woData="woData" :selectData="selectData" :isBatchControl="true"
		confirmLabel="确定" @confirm="woClick" />
</template>

<script>
	import {
		getWaterOutletPermissionList
	} from "@/api/system/landWaterOutletPermission";

	export default {
		data() {
			return {
				landId: null,
				itemId: null,
				woData: [],
				selectData: {},
				dataList: [],
			}
		},
		onLoad(par) {
			console.error("par:", par);
			if (par.landId) {
				this.landId = par.landId;
			}
			if (par.id) {
				this.itemId = par.id;
			}
		},
		mounted() {
			getWaterOutletPermissionList(this.landId).then(res => {
				console.error("res:", res)
				if (res.data) {
					this.woData = res.data;
				} else {
					this.woData = [];
				}
				this.$nextTick(() => {
					this.$refs.irrigationSelectRef.open();
				})
			});
		},
		methods: {
			// 页面跳转
			config() {
				uni.navigateTo({
					url: '/pages/irrigation/config'
				});
			},
			woClick(e) {
				console.error(e);
			},
		},

	};
</script>

<style lang="scss" scoped>
	uni-app,
	uni-page,
	uni-page-wrapper,
	uni-page-body {
		padding-bottom: 38px !important;
	}

	::v-deep .uni-forms {
		margin-right: 10px;
		padding: 0 !important;
	}

	::v-deep .uni-forms-item {
		margin-bottom: 0 !important;
	}

	::v-deep .uni-forms-item__label {
		min-width: 0 !important;
		width: auto !important;
		font-size: 0.8rem;
		height: inherit;
		padding: 0;
	}

	::v-deep .uni-easyinput__content-input {
		height: 20px;
		width: 50px;
		padding-left: 5px !important;
	}
</style>