managePlatform.vue 3.79 KB
<template>
	<div class="app-body">
		<Header title="CNC机床中控管理平台" :sysInitTimeNum="sysTimeNum"></Header>
		<div class="dv-content-body">
			<!-- 顶部头表 -->
			<div class="dv-content-body-head-list">
				<headLeft ref="headLeft"></headLeft>
				<headCenter ref="headCenter"></headCenter>
				<headRight ref="headRight"></headRight>
			</div>
			<!-- 中间图表 -->
			<div class="dv-content-body-center-list">
				<bodyCenterLeft ref="bodyCenterLeft"></bodyCenterLeft>
				<bodyCenter ref="bodyCenter"></bodyCenter>
				<bodyCenterRight ref="bodyCenterRight"></bodyCenterRight>
			</div>
			<!-- 底部图表 -->
			<div class="dv-content-body-bottom-list">
				<footerLeft ref="footerLeft"></footerLeft>
				<footerCenter ref="footerCenter"></footerCenter>
				<footerRight ref="footerRight"></footerRight>
			</div>
		</div>
	</div>
</template>

<script>
import Header from '@/layout/appHead'

import headLeft from '@/components/headLeft'
import headCenter from '@/components/headCenter'
import headRight from '@/components/headRight'

import bodyCenterLeft from '@/components/bodyCenterLeft'
import bodyCenter from '@/components/bodyCenter'
import bodyCenterRight from '@/components/bodyCenterRight'

import footerLeft from '@/components/footerLeft'
import footerCenter from '@/components/footerCenter'
import footerRight from '@/components/footerRight'

export default {
	data() {
		return {
			baseUrlOff: 'http://127.0.0.1:6002/api/BulletinBoard/Mes/V1/ReadData2',
			baseUrlOnLine: window.appConfig.baseUrlOnLine2,

			sysData: {},
			sysInitTimeNum: 20,
			sysTimeNum: 20,
		}
	},
	components: {
		Header,

		headLeft,
		headCenter,
		headRight,

		bodyCenterLeft,
		bodyCenterRight,
		bodyCenter,

		footerLeft,
		footerCenter,
		footerRight,
	},

	methods: {
		getECSData() {
			let opt = {
				urlSuffix: window.baseOnLineOrOff ? this.baseUrlOnLine : this.baseUrlOff,
				logTitle: 'CNC实时数据',
				isUrlALL: true,
				headers: false,
			}
			let callBackFn = (res) => {
				if (!this.ajaxSuccessDataBefore(res, opt.logTitle)) return
				this.$refs.bodyCenter.bingDataSource(res.data.result)

				this.$refs.bodyCenterRight.bingDataSource(res.data.result)

				this.$refs.footerLeft.bingDataSource(res.data.result)

				// 报警信息(前24小时)
				// this.$refs.footerRight.bingDataSource(this.sysData.equipmentAlarms)
			}
			''.ajax(this, opt, callBackFn)
		},
		ajaxSuccessDataBefore(res, title) {
			if (res.data == null) {
				''.Log(title + '无数据', 'getData')
				return false
			}
			return true
		},

		getAllWMSData() {
			let dataTable = {
				header: ['巷道', '可存盘', '实际入盘', '使用率'],
				align: ['left'],
			}
			let flag = window.baseOnLineOrOff ? 'B' : ''
			this.$refs.headLeft.getData(flag, 'B')
			this.$refs.headCenter.getData(flag)
			this.$refs.headRight.getData(flag)

			this.$refs.bodyCenterLeft.getData(flag, dataTable)
			this.$refs.footerCenter.getData(flag)
		},

		intInterval: function() {
			''.intInterval(this, this.sysInitTimeNum, () => {
				this.getECSData()
			})
			//WMS
			setInterval(() => {
				this.getAllWMSData()
			}, 2000)
		},
	},
	mounted() {
		//eslint-disable-next-line no-debugger
		debugger
		this.getECSData()

		// this.getAllWMSData()

		// // 【发布的时候要取消注释】
		// this.intInterval()
	},
}
</script>

<style lang="scss" scoped>
.app-body {
	height: 100%;
	width: 100%;
	.dv-content-body {
		height: 90%;
		width: 100%;
		// background: rebeccapurple;
	}
	.dv-content-body-head-list {
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 25%;
	}
	.dv-content-body-center-list {
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 35%;
	}
	.dv-content-body-bottom-list {
		display: flex;
		height: 40%;
		justify-content: space-between;
		align-items: center;
	}
}
</style>