headCenter.vue 3.96 KB
<template>
	<div class="start">
		<div class="AGV-start-left" v-for="(item, index) in contents" :key="index" :class="{ 'agv-first-item': index === 0 }">
			<div :class="eqName(item.status)">
				{{ item.status }}
			</div>
			<div style="width:100%;height:100%;">
				<div class="imgStyle">
					<div class="imgCSS">
						<img style="height: 80%;margin:10px 0 0 0px;" src="../assets/img/四向车.png" alt="" />
					</div>
					<div class="taskStatus">{{ item.fwsCode }}</div>
				</div>
				<div class="BottomStyleTop">
					<div class="BottomStyle">托盘编码:{{ item.containerCod }}</div>
					<div class="BottomStyle">任务类型:{{ getTaskText(item.getOrPut) }}</div>
					<div class="BottomStyle">运行时长:{{ item.runningMinutes }}分</div>
					<div class="BottomStyle">空闲时长:{{ item.freeMinutes }}分</div>
					<div class="dianchiCss">
						<div style="width: 25%;margin-top: 0.5vh;">电量:</div>
						<div style="width: 48%;height: 80%;" :id="createChartId(index)"></div>
						<div style="width: 6%;font-size: 1.5vw;">{{ item.powerLevel }}%</div>
					</div>
				</div>
			</div>
		</div>
		<!-- <div class="AGV-start-right">
			<div :class="eqName('自动暂停')">
				自动暂停
			</div>
		</div> -->
	</div>
</template>

<script>
export default {
	data() {
		return {
			contents: [
				// { status: 0, fwsCode: 'FWS02', containerCode: '', speed: '', powerLevel: 13 },
				// { status: 0, fwsCode: 'FWS01', containerCode: '', speed: '', powerLevel: 14 },
			],
		}
	},
	methods: {
		getData(data) {
			this.contents = data
			this.battery()
		},
		createChartId(index) {
			return 'main_' + index
		},
		eqName(name) {
			if (name == '待机') {
				return 'agvStle-yolle'
			} else if (name == '任务执行中') {
				return 'agvStle-status'
			} else if (name == '错误') {
				return 'agvStle-status-red'
			} else if (name == '充电') {
				return 'agvStle-status'
			}
		},
		battery() {
			setTimeout(() => {
				for (let i = 0; i < this.contents.length; i++) {
					let myChart = this.$echarts.init(document.getElementById('main_' + i))
					dianLiangOne.series[1].data = [this.contents[i].powerLevel]
					myChart.clear()
					myChart.setOption(dianLiangOne)
					window.onresize = myChart.resize
				}
			}, 200)
		},
		getTaskText(typeCode) {
			switch (typeCode) {
				case 0:
					return '无任务'
				case 1:
					return '取货'
				case 2:
					return '放货'
				case 3:
					return '充电'
				case 4:
					return '行走'
			}
		},
	},
	mounted() {
		// this.battery()
		// this.getAGVDataTwo()
		// this.getAGVDataThere()
		// this.intInterval()
	},
}
</script>

<style>
.start {
	display: flex;
}
.AGV-start-left {
	width: 50%;
	height: 100%;
}
.agv-first-item {
	border-right: 2px solid #3879c9;
}
.AGV-start-right {
	width: 50%;
	height: 100%;
}
.agvStle-status {
	height: 10%;
	width: 42%;
	line-height: 2.5vw;
	line-height: 2.5vw;
	text-align: center;
	font-size: 1.3vw;
	color: aliceblue;
	background-color: #009966;
}
.agvStle-yolle {
	height: 10%;
	width: 42%;
	line-height: 2.5vw;
	text-align: center;
	font-size: 1.3vw;
	color: aliceblue;
	background-color: #fdb300;
}
.agvStle-status-red {
	height: 10%;
	width: 42%;
	line-height: 2.5vw;
	text-align: center;
	font-size: 1.3vw;
	color: aliceblue;
	background-color: red;
}
.agvStle-status-lixian {
	height: 10%;
	width: 42%;
	line-height: 2.5vw;
	text-align: center;
	font-size: 1.3vw;
	color: aliceblue;
	background-color: rgb(154, 146, 146);
}
.imgStyle {
	height: 30%;
	width: 100%;
}
.imgCSS {
	height: 100%;
	width: 100%;
	text-align: center;
}

.taskStatus {
	height: 30%;
	width: 100%;
	text-align: center;
	font-size: 1.5vw;
	color: #fff;
}
.BottomStyleTop {
	width: 100%;
	height: 30%;
	margin-top: 6vh;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
.BottomStyle {
	font-size: 1.5vw;
	color: aliceblue;
	margin: 0.5vh 0 0 2vw;
}
.dianchiCss {
	width: 95%;
	/* height: 30px; */
	display: flex;
	font-size: 1.5vw;
	color: aliceblue;
	margin-left: 2vw;
	align-items: center;
}
</style>