bodyCenterLeft.vue
3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<template>
<div class="dv-content-body-center-list-left">
<dv-border-box-12 :dur="35">
<div style="width: 100%;">
<span class="div-span-title">库位使用情况</span>
</div>
<!-- 6个数据:一行2个,共3排 → 标签+数值 左右排列 -->
<div class="data-grid-container">
<div class="data-item" v-for="(item, index) in showData" :key="index">
<div class="item-label">{{ item.label }}</div>
<div class="item-value">{{ item.value }}</div>
</div>
</div>
</dv-border-box-12>
</div>
</template>
<script>
export default {
data() {
return {
baseUrlOff: 'http://172.16.43.82:6002/api/BulletinBoard/Mes/V1/ReadData1',
baseUrlOnLine: window.appConfig.baseUrlintTwo,
sysData: [],
showData: [
{ label: '总库位数', value: '0' },
{ label: '有货库位数', value: '0' },
{ label: '在库空托盘数', value: '0' },
{ label: '空闲库位数', value: '0' },
{ label: '锁定库位数', value: '0' },
{ label: '库位利用率', value: '0' },
],
}
},
methods: {
getData() {
let opt = {
urlSuffix: window.baseOnLineOrOff ? this.baseUrlOnLine : this.baseUrlOnLine,
logTitle: '库位使用情况',
isUrlALL: true,
headers: false,
}
let callBackFn = (res) => {
if (!this.ajaxSuccessDataBefore(res, opt.logTitle)) return
this.updateShowData(res.data.result)
}
''.ajax(this, opt, callBackFn)
},
updateShowData(data) {
const item = data
this.showData = [
{ label: '总库位数', value: item.totalLocationCount || 0 },
{ label: '有货库位数', value: item.hasGoodsLocationCount || 0 },
{ label: '在库空托盘数', value: item.emptyPalletLocationCount || 0 },
{ label: '空闲库位数', value: item.emptyLocationCount || 0 },
{ label: '锁定库位数', value: item.lockLocationCount || 0 },
{ label: '库位利用率', value: item.locationUseRate || 0 },
]
},
ajaxSuccessDataBefore(res, title) {
if (!res.data || !res.data.result || res.data.result.length === 0) {
console.log(title + '无数据')
return false
}
return true
},
},
mounted() {
// this.getData()
},
}
</script>
<style lang="less" scoped>
.dv-content-body-center-list-left {
width: 33vw;
height: 95%;
}
.div-span-title {
font-size: 1.5vw;
color: #fff;
padding: 0.5vw 1vw;
display: inline-block;
}
/* 布局:一行2个,共3排 */
.data-grid-container {
width: 95%;
height: 85%;
margin-left: 0.8vw;
display: flex;
flex-wrap: wrap;
text-align: center;
justify-content: space-between;
// align-content: space-around;
}
/* 单个数据块:标签 + 数值 左右并排 + 内边距充足,不靠边 */
.data-item {
width: 48%;
height: 24%;
background-color: rgba(255, 255, 255, 0.1);
border-radius: 0.5vw;
display: flex;
align-items: center;
justify-content: flex-start;
/* 👇 核心:内边距,让文字不靠边 */
padding: 0 1vw;
color: #fff;
box-sizing: border-box;
}
.item-label {
font-size: 1.3vw;
opacity: 0.8;
margin-right: 1vw;
white-space: nowrap;
}
.item-value {
font-size: 1.6vw;
font-weight: bold;
color: #00eeff;
}
</style>