+
料架号: {{ item.rackCode }}
-
-
-
+
+
+
+
+ {{ item2.layerNum === 1 ? '上层' : '中层' }}
+
+
+
+
+
+
+
+
@@ -49,6 +59,7 @@ const pblOptions = ref([])
/// ========================= 仓库信息 =============================
import { listStoragelocation } from '@/api/PBL/storagelocation.js'
+import { SearchfeedingMaterialInfomation } from '@/api/PBL/bigscreen.js'
const loading = ref(false)
const total = ref(0)
const dataList = ref([])
@@ -59,36 +70,38 @@ const queryParams = reactive({
const msg = ref('JT-002缺料')
function getList() {
loading.value = true
- listStoragelocation(queryParams).then((res) => {
+ SearchfeedingMaterialInfomation(queryParams).then((res) => {
const { code, data } = res
if (code == 200) {
- // 数据模拟
- let _list = data.result
- _list = _list.map((item, index) => {
- if (index < 2) {
- item.packageCapacity = 16
- } else {
- item.packageCapacity = 8
- }
- if (index == 7 || index == 5) {
- item.status = 1
- }
- return item
- })
- dataList.value = _list
- total.value = data.totalNum
+ dataList.value = data
loading.value = false
}
})
}
+// 灯状态变动
+function changeLight(rackCode, partnumber, status = 1) {
+ dataList.value.forEach((item) => {
+ if (item.rackCode === rackCode && item.partnumber === partnumber) {
+ item.status = status
+ }
+ })
+}
+// 手动灭灯
+function closeLight(item) {
+ if (item.status === 1) {
+ item.status = 0
+ }
+}
+
+// 灯状态
function getStatusClass(item) {
- return item.status === 1 ? 'light' : ''
+ return item.isLight ? 'light' : ''
}
function boxSelectClass(num, index) {
let _index = index + 1
let className = ''
// 小于等于2空箱报警时
- if (num <= 2) {
+ if (num <= 1) {
className += ' box-danger'
}
// 空箱
@@ -100,6 +113,39 @@ function boxSelectClass(num, index) {
getList()
/// =============================================================
+/// ========================== MQTT ==============================
+import mqttStore from '@/store/modules/mqtt'
+const mqtt = mqttStore()
+function mqttCreate() {
+ mqtt.create('ws', 'nbhx/pbl/light/#')
+}
+function mqttClose() {
+ mqtt.close()
+}
+function mqttMessage() {
+ if (mqtt.checkClient()) {
+ mqtt.client.on('message', function (topic, payload, packet) {
+ console.log(`Topic: ${topic}, Message: ${payload.toString()}, QoS: ${packet.qos}`)
+ console.log(`getMessageByJsonStr`, mqtt.getMessageByJsonStr(payload))
+ })
+ } else {
+ console.log('mqtt 未连接 error')
+ }
+}
+
+onMounted(() => {
+ mqttCreate()
+ setTimeout(() => {
+ mqttMessage()
+ }, 1000)
+ console.log('mqtt组件已挂载')
+})
+onUnmounted(() => {
+ mqttClose()
+ console.log('mqtt组件已卸载')
+})
+/// ==================================================================
+
/// ======================= 自动刷新 ========================
// 自动获取数据
const getTimerData = () => {
@@ -139,6 +185,9 @@ onUnmounted(() => {
filter: brightness(0.4);
z-index: -1;
}
+.border {
+ border: 2px solid #a9aabc;
+}
.screen {
padding: 0;
margin: 0;
@@ -172,7 +221,7 @@ onUnmounted(() => {
.screen .card {
margin: 10px;
padding: 0px;
- min-height: 260px;
+ min-height: 280px;
background-color: transparent;
border: 5px solid #a9aabc;
color: #eeeeee;
@@ -190,6 +239,14 @@ onUnmounted(() => {
.card-body {
padding: 20px;
}
+.card-left-text {
+ height: 100%;
+ font-size: 20px;
+ font-weight: 600;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
/* 亮灯颜色 */
.light {
/* border: 5px solid #eedd78 !important; */
@@ -202,9 +259,9 @@ onUnmounted(() => {
/* 箱子原始状态 */
.box {
font-size: 14px;
- margin-bottom: 10px;
+ margin: 5px;
border: 2px solid #a9aabc;
- height: 50px;
+ height: 30px;
display: flex;
flex-direction: column;
align-items: center;
diff --git a/src/views/PBL/dataScreen/index.vue b/src/views/PBL/dataScreen/index.vue
index c9ea113..4e2d15b 100644
--- a/src/views/PBL/dataScreen/index.vue
+++ b/src/views/PBL/dataScreen/index.vue
@@ -1,31 +1,33 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
{{ item.partnumber }}
-
-
-
-
+
+
+
+
+ 料架号: {{ item.rackCode }}
+
+
+
+
+
+
+ {{ item2.layerNum === 1 ? '上层' : '中层' }}
+
+
+
+
+
+
+
+
+
+
+
@@ -43,6 +45,7 @@ const config = reactive({
/// ========================= 仓库信息 =============================
import { listStoragelocation } from '@/api/PBL/storagelocation.js'
+import { SearchShelfLightInfomation } from '@/api/PBL/bigscreen.js'
const loading = ref(false)
const total = ref(0)
const dataList = ref([])
@@ -52,11 +55,10 @@ const queryParams = reactive({
})
function getList() {
loading.value = true
- listStoragelocation(queryParams).then((res) => {
+ SearchShelfLightInfomation(queryParams).then((res) => {
const { code, data } = res
if (code == 200) {
- dataList.value = data.result
- total.value = data.totalNum
+ dataList.value = data
loading.value = false
}
})
@@ -64,93 +66,132 @@ function getList() {
// function getStatusExplain(status) {
// return status === 0 ? '缺料' : '正常';
// }
-function getStatusClass(status) {
- return status === 0 ? ' background-red' : ''
+
+// 料架操作,手动灭灯
+function closeLight(item) {
+ if (item.status === 1) {
+ item.status = 0
+ }
}
-function boxSelecExplain(num, index) {
- return num >= index + 1
+// 灯状态
+function getStatusClass(item) {
+ return ''
}
+
+// 空箱
function boxSelectClass(num, index) {
- return num >= index + 1 ? 'box-select' : 'box'
+ let _index = index + 1
+ let className = ''
+ // 每一层小于等于1空箱报警时
+ if (num <= 1) {
+ className += ' box-danger'
+ }
+ // 空箱
+ if (num < _index) {
+ className += ' box-empty'
+ }
+ return className
}
getList()
/// =============================================================