headCenter.vue 6.16 KB
<template>
	<div style="width: 100%;height: 100%;display: flex;">
		<div style="width: 20%;height: 100%;">
			<div style="width: 100%; height: 100%; position: relative; left: 0vw; top: 0vw;">
				<div class="location">
					<div class="item" style="margin-bottom: 10px;">
						<div class="name">焊机</div>
						<div class="value">{{ deviceInfo.hanji }}台</div>
					</div>
					<div class="item" style="margin-bottom: 10px;">
						<div class="name">带锯床</div>
						<div class="value">{{ deviceInfo.daijuchuang }}台</div>
					</div>
					<div class="item" style="margin-bottom: 10px;">
						<div class="name">切坡一体机</div>
						<div class="value">{{ deviceInfo.qiepo }}台</div>
					</div>
					<div class="item">
						<div class="name">弯管机</div>
						<div class="value">{{ deviceInfo.wanguan }}台</div>
					</div>
				</div>
			</div>
		</div>
		<div style="width: 60%;height: 100%;border: 2px solid #3879c9;">
			<div class="title-text">在线设备</div>
			<div class="container">
				<!-- 每列数据 -->
				<div v-for="(item, index) in dataList" :key="index" class="column-wrapper">
					<div class="data-column">
						<!-- 上半部分:实际电流 -->
						<div class="data-item">
							<div class="value2">{{ item.Value1 }}</div>
							<div class="label">{{ item.unit1 }}</div>
						</div>
						<!-- 虚线分隔 -->
						<div class="divider"></div>
						<!-- 下半部分:实际电压 -->
						<div class="data-item">
							<div class="value2">{{ item.Value2 }}</div>
							<div class="label">{{ item.unit2 }}</div>
						</div>
						<div class="data-item">
							<div :class="{
								'status_run': item.status === '在线',
								'status_error': item.status === '故障'
							}">
								{{ item.status }}
							</div>
						</div>
					</div>
					<!-- 列标题 -->
					<div class="column-title">{{ item.EquipmentName }}</div>
				</div>
			</div>
		</div>
		<div style="width: 20%;height: 100%;">
			<div style="width: 100%; height: 100%; position: relative; left: 0vw; top: 0vw;">
				<div class="location">
					<div class="item" style="margin-bottom: 15px;background-color: #33af3362;">
						<div class="name" style="color: #00d200;">在线</div>
						<div class="value" style="color: #00d200;">{{ form.online }}台</div>
					</div>
					<div class="item" style="background-color: #ff00005e;">
						<div class="name" style="color: #ff0000;">故障</div>
						<div class="value" style="color: #ff0000;">{{ form.error }}台</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>

export default {
	data() {
		return {
			sysinfo: [],
			form: {
				online: 0,
				error: 0
			},
			deviceInfo: {
				hanji: 0,
				daijuchuang: 0,
				qiepo: 0,
				wanguan: 0
			},
			dataList: []
			// dataList: [
			// 	{ Value1: '22A', Value2: '220V', EquipmentName: '1号焊机', status: '在线', unit1: '实际电流', unit2: '实际电压' },
			// 	{ Value1: '22A', Value2: '220V', EquipmentName: '2号焊机', status: '在线', unit1: '实际电流', unit2: '实际电压' },
			// 	// { current: '22A', voltage: '220V', title: '1号弯管机', status: '故障' },
			// 	// { current: '22A', voltage: '220V', title: '2号弯管机', status: '故障' },
			// 	// { current: '22A', voltage: '220V', title: '带锯床', status: '在线' },
			// 	// { current: '22A', voltage: '220V', title: '切坡一体机', status: '在线' }
			// ]
		}
	},
	methods: {
		sed(data) {
			this.dataList = data;
			this.dataList.forEach(item => {
				item.status = "在线"
				if (item.EquipmentName == "切坡一体机") {
					item.unit1 = "转速"
					item.unit2 = "入刀速度"
				} else if (item.EquipmentName.includes("带锯床")) {
					item.unit1 = "锯轮线速度"
					item.unit2 = "工进速度"
				} else {
					item.unit1 = "实际电流"
					item.unit2 = "实际电压"
				}
			})
		},
		setOnlineInfo(data) {
			this.form = data;
		},
		setDeviceInfo(data) {
			this.deviceInfo.hanji = data[0]
			this.deviceInfo.daijuchuang = data[1]
			this.deviceInfo.qiepo = data[2]
			this.deviceInfo.wanguan = data[3]
		},
	},
	mounted() {
		debugger

	},
}
</script>

<style lang="scss" scoped>
.title-text {
	width: 100%;
	height: 2vh;
	font-size: 2vh;
	font-weight: 600;
	color: #fff;
	text-align: left;
	padding-left: 1vw;
}

.location {
	height: 100%;
	display: flex;
	// border: 2px solid #3879c9;
	flex-direction: column;
	justify-content: space-between;
	// align-items: center;
	margin: 0vh 7px 0px 7px;
}

.location2 {
	height: 100%;
	display: flex;
	// border: 2px solid #3879c9;
	justify-content: space-between;
	// align-items: center;
	margin: 0px 0 10px 7px;
}

.box {
	flex: 1;
	/* 左右各占50%宽度 */
	height: 100%;
	display: flex;
	// flex-direction: column;
	/* 内部item上下排列 */
	justify-content: space-around;
	/* item均匀分布 */
	// align-items: center;
	/* item水平居中 */
}

.item {
	width: 90%;
	height: 44%;
	border-radius: 5px;
	border: 1px solid #67c8fb;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	/* 名称左、数值右 */
	align-items: center;
	/* 内容垂直居中 */
	padding: 0 10px;

	/* 内容不贴边框 */
	background-color: #062448;
}

/* 名称/数值样式区分 */
.name {
	color: #fff;
	font-size: 2vh;
}

.value {
	color: #67c8fb;
	font-size: 3vh;
	font-weight: bold;
}

.container {
	display: flex;
	flex-wrap: wrap;
	gap: 0.1vw;
	/* 列之间的间距 */
	padding: 1vh;
	// background-color: #0a1428;
	color: #fff;
}

.column-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	// 控制整体列宽
	min-width: 9.5vw;
	height: 100%;
}

.data-column {
	width: 100%;
	border: 2px solid #00bfff;
	border-radius: 8px;
	padding: 1vh;
	box-sizing: border-box;
	text-align: center;
}

.data-item {
	// margin-bottom: 16px;
	text-align: center;
}

.value2 {
	font-size: 3vh;
	font-weight: bold;
	color: #00bfff;
	margin-bottom: 0.4vh;
}

.label {
	font-size: 12px;
	color: #ccc;
}

.status_run {
	font-size: 12px;
	color: #45f505;
}

.status_error {
	font-size: 12px;
	color: #e4072c;
}

.divider {
	width: 100%;
	height: 1px;
	border-top: 1px dashed #00bfff;
	margin: 2px 0;
	// color: #e30b0ba5;
}

.column-title {
	font-size: 14px;
	color: #ccc;
	margin-top: 5px;
	text-align: center;
}
</style>