<template>
	<view class="main_manual">
		<SubTitle title="储充信息  8" titleEng="Storage and charging information"></SubTitle>
		<view class="header_title">
			<image class="header_title_img" src="../../../static/equipment/tip.png" mode=""></image>
			仓位上方是电池，下方是充电机，点击仓位可查看充电详情信息
		</view>
		<view class="box_swiper">
			<scroll-view scroll-x="true" class="scroll_x">
				<view v-for="(item, index) in storeInfoLists" :key="index"> <!-- @click="drawer(item,index)"-->
					<StorageInfo :store-code="item.storeCode" :com-state="item.comState" :sn="item.sn" :soc="item.soc" @drawer="drawer(item,index)"
						:chg-estimated-time="item.chargerInfoVo.chgEstimatedTime" :current="item.current"
						:voltage="item.voltage" :min-temperature="item.minTemperature"
						:max-temperature="item.maxTemperature" :max-cell-voltage="item.maxCellVoltage" index
						:min-cell-voltage="item.minCellVoltage" :soh="item.soh" :store-state="item.storeState"
						:charger-info-vo="item.chargerInfoVo" :class="box_num == index ? 'slect_box':''" />
				</view>

			</scroll-view>
			
			
			<!--右侧抽屉 -->
			<uni-drawer ref="showRight" mode="right" :width="400" :mask-click="true" @change='changemask'>
				<scroll-view style="height: 100%;" scroll-y="true">
					<PublicDrawer :flag="false" :title="titlenum" @closeDrawer="closeDrawer">
						<!-- <view class="header_drawer_btn">
							<view class="header_drawer_btn_left" :class="batteryInfoActive == 0?'active':''" @click="batteryInfoActive = 0">
								电池
							</view>
							<view class="header_drawer_btn_right" :class="batteryInfoActive == 1?'active':''" @click="batteryInfoActive = 1">
								充电机
							</view>
						</view> -->
						<!-- <view class="drawer_main">
							<view v-if="!batteryInfoActive"> -->
								<batteryDrawe :infodata="infodata"></batteryDrawe>
							<!-- </view>
							<view v-if="batteryInfoActive"><chargerDrawe :infodata="infodata"></chargerDrawe></view>
						</view> -->
					</PublicDrawer>
				</scroll-view>
			</uni-drawer>
			<!-- 右侧抽屉结束 -->
			
			
			
		</view>
	</view>
</template>

<script>
	import SubTitle from "../../../components/SubTitle/SubTitle.vue"
	import StorageInfo from "../components/StorageInfo.vue"
	import batteryDrawe from "../components/batteryDrawe.vue"
	import chargerDrawe from "../components/chargerDrawe.vue"
	name:'manual'
	export default {
		components: {
			SubTitle,
			StorageInfo,
			batteryDrawe,
			chargerDrawe
		},
		props: ['storeInfoLists'],
		data() {
			return {
				isSlecte: true,
				box_num: -1, //记录选中了第几个
				titlenum: '充电设置', //抽屉标题
				batteryInfoActive:1,//0代表电池1代表充电机
				infodata:{},//详情数据
			}
		},
		mounted() {
			// console.log(this.storeInfoLists,'storeInfoLists999999999999')
		},
		methods: {
			//抽屉
			drawer(item, index) {
				this.box_num = index;
				// this.titlenum = item.storeCode + '号仓充电详情'
				this.$refs.showRight.open();
				this.infodata = item;
				console.log(item, index, 'item')
			},
			//关闭抽屉
			closeDrawer(){
				this.batteryInfoActive = 1;
				this.box_num = -1;
				this.$refs.showRight.close();
			},
			//抽屉改变事件
			changemask(e){
				if(!e){
					this.closeDrawer()
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main_manual {
		position: relative;

		.header_title {
			position: absolute;
			font-size: 12px;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #414A63;
			right: 10px;
			top: 5px;

			.header_title_img {
				width: 14px;
				height: 14px;
				vertical-align: middle;
				margin-right: 5px;
				margin-top: -2px;
			}
		}

		.box_swiper {
			width: 1000px;
			height: 600px;
			background: #111827;
			padding: 20px;

			.scroll_x {
				width: 100%;
				height: 100%;
				// border: 1px solid red;

				/deep/ .uni-scroll-view-content {
					display: flex;
					view:last-child{
						.storage-item{
							margin-right: 0px;
						}
					}
				}
			}
		}
	}

	.slect_box {
		border: 1px solid #338150 !important;
	}
	.header_drawer_btn{
		display: flex;
		font-size: 14px;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		.header_drawer_btn_left{
			width: 60px;
			height: 32px;
			background: #263042;
			border-radius: 2px 0px 0px 2px;
			line-height: 32px;
			text-align: center;
		}
		.header_drawer_btn_right{
			line-height: 32px;
			text-align: center;
			width: 74px;
			height: 32px;
			background: #263042;
			border-radius: 0px 2px 2px 0px;
		}
		.active{
			color: black;
			background: #91FDB9;
		}
	}
	
	.drawer_main{
		// border: 1px solid red;
		padding-top: 20px;
		
	}
</style>
