<template>
	<z-paging ref="paging" @query="queryList" v-model="dataList" :auto-show-system-loading="true"
		empty-view-text="抱歉，暂时还没有相关数据！">
		<template #top>
			<custom-nav-bar :left="true" title="阀门"></custom-nav-bar>
		</template>
		<view class="index-container">
			<view class="item-container" v-for="item in dataList">
				<view style="display: flex; align-items: center; justify-content: space-between;">
					<view class="flex-text" style="margin: 15px;">
						<view class="flex-text-one" style="color: black;">基站：</view>
						<view>{{ item.deviceCode}}</view>
					</view>
					<view style="margin-right: 5px;" v-hasPermi="['system:land:edit']">
						<u-button type="primary" plain plainFill>
							{{ item.status == 'online' ? '在线':'离线'}}
						</u-button>
					</view>
				</view>
				<u-gap height="1" bgColor="#D2D2D2"></u-gap>
				<view style="display: flex;justify-content: space-between;align-items: center;"
					@click="openStationValve(item)">
					<view class="data">
						<view class="flex-text global-font-size-1">
							<view class="flex-text-one">版本：</view>
							<view>{{ item.operSubject}}</view>
						</view>
						<view class="flex-text global-font-size-1">
							<view class="flex-text-one">频段：</view>
							<view>{{ item.rolaFrequency}}</view>
						</view>
						<u-button>修改频段</u-button>
						<u-button>阀门列表</u-button>
					</view>
				</view>
			</view>
		</view>
	</z-paging>
</template>
<script>
	import * as DevOpsApi from "@/api/dev-ops/index.js"

	export default {
		data() {
			return {
				station: null,
				dataList: [],
			}
		},
		onLoad(par) {
			console.error("par:", par);
			if (par.station) {
				console.error("基站阀门");
			} else {
				console.error("阀门");
			}


			// const cacheData = uni.getStorageSync("cacheData");
			// if (cacheData) {
			// 	this.landId = cacheData.land.id;
			// } else {
			// 	this.landId = -1;
			// }
		},
		onShow() {},
		mounted() {},
		methods: {
			queryList(pageNo, pageSize) {
				// DevOpsApi.getStationList(this.landId).then(res => {
				// 	console.error("res:", res);
				// 	this.$refs.paging.completeByTotal(res.rows);
				// });
				this.$refs.paging.completeByTotal([]);
			},
			editRolaFrequency(item) {
				console.error("editRolaFrequency:", item);
			},
			openStationValve(item) {
				console.error("openStationValve:", item);
				uni.navigateTo({
					url: '/pages/dev-ops/valve?id=' + item.id
				});
			},
		}
	}
</script>

<style lang="scss">
	.index-container {
		.list {
			margin: 0px 10px;
		}

		.list-size {
			display: flex;
			padding: 5px 5px;
			background: white;
			justify-content: center;
		}

		.search {
			background-color: white;
			padding: 10px;
		}

		.item-container {
			margin: 10px 10px;
			background-color: white;
			padding-bottom: 10px;
			border-radius: 10px;
			box-shadow: 1px 1px 2px 2px rgba(0, 0, 0, 0.05);
		}

		.flex-text {
			display: flex;
			align-items: center;

			.flex-text-one {
				color: #939393;
				font-weight: bold;
			}
		}

		.data {
			margin: 10px 20px;
		}
	}
</style>