headCenter.vue 7.2 KB
<template>
	<div style="width: 100%;height: 100%;display: flex;">
		<div style="width: 15%;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: 25%;height: 100%;">
			<div
				style="width: 100%; height: 100%; position: relative; left: 0.5vw; top: 0vw;border: 2px solid #3879c9; width: 96%;">
				<div class="title-text">在线设备</div>
				<div class="location2">
					<div id="dayPie" style="width: 50%;height: 100%;"></div>
					<div id="weekPie" style="width: 50%;height: 100%;"></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: [],
			dayPieChartOption: dayPieChartOption,
			weekPieChartOption: weekPieChartOption
			// 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 = "实际电压"
				}
			})
		},
		getDayPie(rawData) {
			// console.log(rawData)
			// const dates = rawData.map(item => item.CurryDate);
			// const quantities = rawData.map(item => item.Quantity);
			let myChart = this.$echarts.init(document.getElementById('dayPie'))
			// this.warehouseHealthOption.xAxis.data = dates
			// this.warehouseHealthOption.series[0].data = quantities
			myChart.clear()
			myChart.setOption(this.dayPieChartOption)

			let myChart2 = this.$echarts.init(document.getElementById('weekPie'))
			// this.warehouseHealthOption.xAxis.data = dates
			// this.warehouseHealthOption.series[0].data = quantities
			myChart2.clear()
			myChart2.setOption(this.weekPieChartOption)

			window.addEventListener('resize', () => {
				myChart.resize();
				myChart2.resize();
			});
		},
		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
		this.getDayPie();
	},
}
</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 3vh 0px 1vh;
}

.location2 {
	height: 100%;
	display: flex;
	// border: 2px solid #3879c9;
	flex-direction: row;
	justify-content: space-between;
	// align-items: center;
	margin: 0px 0 7px 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;
	max-width: 70%;
	word-wrap: break-word;
	/* 允许长单词/URL换行 */
	word-break: break-all;
	/* 强制在任意字符处断行(适合中文)*/
	white-space: normal;
	/* 允许正常换行(默认值,但显式声明更安全)*/
	overflow-wrap: break-word;
	/* 现代标准,等效于 word-wrap */
}

.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>