headRight2.vue 3.76 KB
<template>
	<div>
		<!-- <div class="title-text">立库统计</div> -->
		<div style="width: 100%; height: 100%; position: relative; left: 0vw; top: 0vw;border: 2px solid #3879c9;">
			<div class="title-text">立库统计</div>
			<div class="location">
				<div class="box left-box">
					<div class="item">
						<div class="name">总库存库位</div>
						<div class="value">{{ form.v_total_locations }}</div>
					</div>
					<div class="item">
						<div class="name">使用率</div>
						<div class="value">{{ form.v_usage_rate }}%</div>
					</div>
					<div class="item">
						<div class="name">当日入库</div>
						<div class="value">{{ form.v_today_in }}</div>
					</div>
					<div class="item">
						<div class="name">当月入库</div>
						<div class="value">{{ form.v_month_in }}</div>
					</div>
				</div>

				<div class="box">
					<div class="item">
						<div class="name">已用</div>
						<div class="value">{{ form.v_used_locations }}</div>
					</div>
					<div class="item">
						<div class="name">未用</div>
						<div class="value">{{ form.v_free_locations }}</div>
					</div>
					<div class="item">
						<div class="name">当日出库</div>
						<div class="value">{{ form.v_today_out }}</div>
					</div>
					<div class="item">
						<div class="name">当月出库</div>
						<div class="value">{{ form.v_month_out }}</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
export default {
	data() {
		return {
			baseUrlOff: 'http://172.16.30.219:5221/api/Index/GetFWSWebStatsInfo',
			baseUrlOnLine: window.appConfig.baseUrlintThree,
			form: {},
			sysInitTimeNum: 5,
			sysData: {
				v_total_locations: 0,
				v_usage_rate: 0,
				v_today_in: 0,
				v_month_in: 0,
				v_used_locations: 0,
				v_free_locations: 0,
				v_today_out: 0,
				v_month_out: 0,
			},
		}
	},
	methods: {
		getDataInfo() {
			let opt = {
				urlSuffix: window.baseOnLineOrOff ? this.baseUrlOnLine : this.baseUrlOff,
				logTitle: 'AGV-立库统计',
				isUrlALL: true,
				headers: window.baseOnLineOrOff,
				header: window.baseOnLineOrOff,
				// isHanderAjaxSuccessActionLoad: true,
				// type: 'post',
			}
			let callBackFn = (res) => {
				if (!this.ajaxSuccessDataBefore(res, opt.logTitle)) return
				this.form = res.data.data
			}
			''.ajax(this, opt, callBackFn)
		},
		ajaxSuccessDataBefore(res, title) {
			if (res.data.data == null || res.data.data.length == 0) {
				this.form = {}
				''.Log(title + '无数据', 'getData')
				return false
			}
			return true
		},
		intInterval: function () {
			// ''.intInterval(this, this.sysInitTimeNum, () => {
			// 	this.getDataInfo()
			// })

			setInterval(() => {
				this.getDataInfo()
			}, 30000)
		},
	},
	mounted() {
		debugger
		this.getDataInfo()
		this.intInterval()
	},
}
</script>

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

.location {
	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水平居中 */
}

/* 每个小项样式:宽85%、高18%、边框、内部左右排列 */
.item {
	width: 80%;
	height: 17%;
	border-radius: 5px;
	border: 1px solid #67c8fb;
	display: flex;
	justify-content: space-between;
	/* 名称左、数值右 */
	align-items: center;
	/* 内容垂直居中 */
	padding: 0 5px;
	/* 内容不贴边框 */
	background-color: #062448;
}

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

.value {
	color: #67c8fb;
	font-size: 18px;
	font-weight: bold;
}
</style>