foodConten.vue 2.44 KB
<template>
	<div class="stacker-status-container">
		<!-- 顶部标题栏 -->
		<div class="status-header">
			<span class="div-span-title">堆垛机状态(当前)</span>
			<div class="status-legend">
				<div class="legend-item">
					<span class="legend-color color-run"></span>
					<span>运行</span>
				</div>
				<div class="legend-item">
					<span class="legend-color color-idle"></span>
					<span>待机</span>
				</div>
				<div class="legend-item">
					<span class="legend-color color-error"></span>
					<span>故障</span>
				</div>
			</div>
		</div>

		<!-- 主体内容区 -->
		<div id="status-chart"></div>
	</div>
</template>

<script>
export default {
	data() {
		return {
			sysData: {},
			initDataList: [],
			dianLiangOne: window.dianLiangOne,
		}
	},
	methods: {
		// 生产情况
		getData(data) {
			let tempData = [
				{ value: data.srmEquipmentRecords.run, itemStyle: { color: '#00e068' } }, // 运行:绿色
				{ value: data.srmEquipmentRecords.free, itemStyle: { color: '#ffb800' } }, // 待机:橙色
				{ value: data.srmEquipmentRecords.error, itemStyle: { color: '#ff3333' } }, // 故障:红色
			]
			// 初始化ECharts实例
			let myChart = this.$echarts.init(document.getElementById('status-chart'))
			this.dianLiangOne.series[0].data = tempData

			myChart.clear()
			myChart.setOption(this.dianLiangOne)
			window.onresize = myChart.resize
		},
	},
	mounted() {
		// this.getData()
		//eslint-disable-next-line no-debugger
		debugger
	},
}
</script>

<style scoped>
/* 最外层容器:深色背景,和截图一致 */
.stacker-status-container {
	width: 32vw;
	height: 22vw;
	border: 1px solid #1e3a7a;
	border-radius: 0.3vw;
	/* padding: 1.5vw; */
	position: relative;
	overflow: hidden;
}

/* 顶部标题栏 */
.status-header {
	width: 100%;
	height: 3vw;
	display: flex;
	padding: 0.2vw 0 0 0.5vw;
}

/* 状态图例 */
.status-legend {
	display: flex;
	font-size: 1.8vw;
	color: #ffffff;
	margin: -1.6vw 0 0 4vw;
}

.legend-item {
	display: flex;
	align-items: center;
	gap: 0.5vw;
	font-size: 1.1vw;
}

.legend-color {
	width: 1vw;
	height: 1vw;
	border-radius: 0.2vw;
	margin-left: 1vw;
}
.color-run {
	background-color: #00e068;
}
.color-idle {
	background-color: #ffb800;
}
.color-error {
	background-color: #ff3333;
}
.color-offline {
	background-color: #888888;
}

/* 主体内容区:左右分栏 */
#status-chart {
	width: 100%;
	height: calc(100%);
	display: flex;
	align-items: center;
	/* gap: 3vw; */
}
</style>