headCenter.vue 2.86 KB
<template>
	<div>
		<div class="title-text">仓库设备目前状态</div>
		<div class="location">
			<div class="item" v-for="(item, index) in tableList" :key="index">
				<div>
					<span>{{ item.type }}: </span>
					<span class="infoStle-normal">{{ item.name }}</span>
				</div>
				<div>
					<span>运行状态: </span>
					<span :class="eqName(item.status)">{{ item.status }}</span>
				</div>
				<div>
					<span>报警信息: </span>
					<span :class="eqInfo(item.status)">{{ item.info }}</span>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
export default {
	data() {
		return {
			tableList: []
		}
	},
	methods: {
		getData(data) {
			this.tableList = data
		},
		createChartId(index) {
			return 'main_' + index
		},
		eqName(name) {
			if (name == '待机') {
				return 'agvStle-yolle'
			} else if (name == '任务执行中') {
				return 'agvStle-status'
			} else if (name == '故障') {
				return 'agvStle-error'
			} else if (name == '运行') {
				return 'agvStle-run'
			}
		},
		eqInfo(name) {
			if (name == '故障') {
				return 'infoStle-error'
			} else {
				return 'infoStle-normal'
			}
		},
		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 lang="scss" scoped>
.title-text {
	width: 100%;
	height: 3vh;
	font-size: 2vh;
	font-weight: 600;
	color: #fff;
	text-align: left;
	padding-left: 1vw;
}

.location {
	height: 90%;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	grid-template-rows: repeat(2, 1fr);
	gap: 0px;
	padding: 0px;
	box-sizing: border-box;
}

.item {
	padding: 0vh 1vh 1vh 2vh;
	color: #fff;
	font-size: 2vh;
	display: flex;
	flex-direction: column;
	justify-content: center;

	>div {
		margin-bottom: 5px;

		&:last-child {
			margin-bottom: 0vh;
		}
	}
}

// .multiline-ellipsis {
// 	display: inline-block;
// 	/* 必须有宽度限制,inline 元素无法限制宽度 */
// 	max-width: 200px;
// 	/* 根据你的布局调整 */
// 	white-space: nowrap;
// 	overflow: hidden;
// 	text-overflow: ellipsis;
// }

.agvStle-run {
	font-size: 1.9vh !important;
	color: #00d384;
}

.agvStle-error {
	font-size: 1.9vh !important;
	color: #ff5447;
}

.infoStle-normal {
	font-size: 1.9vh !important;
	color: #fff;
}

.infoStle-error {
	font-size: 1.9vh !important;
	color: #ff5447;
}
</style>