<template>
|
<div id="title">
|
<div id="bkuang" style="border-top: none">
|
<div class="skuang">
|
<div class="zhuname">入库8005站台</div>
|
<div class="zhankuang">
|
<div class="xname">放货完成(写):</div>
|
<div class="xzhi" :title="flData.W_PutFinish5">{{ flData.W_PutFinish5 || '-' }}</div>
|
</div>
|
<div class="zhankuang">
|
<div class="xname">入库到位指令(读):</div>
|
<div class="xzhi" :title="flData.R_ConveyArrivaled5">{{ flData.R_ConveyArrivaled5 || '-' }}</div>
|
</div>
|
<div class="zhankuang">
|
<div class="xname">到位托盘号(读):</div>
|
<div class="xzhi" :title="flData.R_Barcode5">{{ flData.R_Barcode5 || '-' }}</div>
|
</div>
|
<div class="zhankuang">
|
<div class="xname">到位任务号(读):</div>
|
<div class="xzhi" :title="flData.R_TaskNum5">{{ flData.R_TaskNum5 || '-' }}</div>
|
</div>
|
</div>
|
|
<div class="skuang">
|
<div class="zhuname">出库8001站台</div>
|
<div class="zhankuang">
|
<div class="xname">放货完成(写):</div>
|
<div class="xzhi" :title="flData.W_PutFinish1">{{ flData.W_PutFinish1 || '-' }}</div>
|
</div>
|
<div class="zhankuang">
|
<div class="xname">是否允许放货(读):</div>
|
<div class="xzhi" :title="flData.R_IsCanPut">{{ flData.R_IsCanPut || '-' }}</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { ref, nextTick, watch, onUnmounted } from "vue";
|
import { useStore } from "vuex";
|
import { onMounted } from "vue";
|
|
export default {
|
data() {
|
return {
|
xuan: 0
|
};
|
},
|
setup() {
|
const store = useStore();
|
// 仅存储FL相关数据
|
const flData = ref({});
|
|
// 延迟更新配置,解决闪烁问题
|
const UPDATE_DELAY = 300; // 300ms延迟,平衡实时性和界面稳定性
|
let updateTimer = null; // 定时器实例
|
|
// FL数据映射规则配置
|
const flStatusConfig = {
|
// FL boolean类型字段映射
|
booleanFields: {
|
keys: [
|
"W_PutFinish5", "W_PutFinish1",
|
"R_IsCanPut", "R_ConveyArrivaled5"
|
],
|
map: { true: "是", false: "否" }
|
}
|
};
|
|
// 处理FL原始数据
|
const processFLData = (rawData) => {
|
if (!rawData) return {};
|
const processed = { ...rawData };
|
|
// 处理boolean类型字段
|
flStatusConfig.booleanFields.keys.forEach(key => {
|
if (processed.hasOwnProperty(key)) {
|
processed[key] = flStatusConfig.booleanFields.map[processed[key]] || processed[key];
|
}
|
});
|
|
return processed;
|
};
|
|
// 延迟更新FL数据,避免高频刷新导致的闪烁
|
const delayedUpdateFLData = (newRawData) => {
|
if (updateTimer) clearTimeout(updateTimer);
|
|
updateTimer = setTimeout(() => {
|
// 检查是否包含FL特征字段
|
const hasFLFields = flStatusConfig.booleanFields.keys.some(key =>
|
newRawData && newRawData[key] !== undefined
|
);
|
|
if (hasFLFields) {
|
flData.value = processFLData(newRawData);
|
|
// 更新样式
|
nextTick(() => {
|
const valueElements = document.getElementsByClassName("xzhi");
|
for (let i = 0; i < valueElements.length; i++) {
|
const text = valueElements[i].innerHTML;
|
if (text === "是") {
|
valueElements[i].style.color = "yellow";
|
} else if (text === "否") {
|
valueElements[i].style.color = "red";
|
}
|
}
|
});
|
}
|
}, UPDATE_DELAY);
|
};
|
|
onMounted(() => {
|
// 初始加载数据
|
const initialData = store.state.homedata;
|
const hasFLFields = flStatusConfig.booleanFields.keys.some(key =>
|
initialData && initialData[key] !== undefined
|
);
|
|
if (hasFLFields) {
|
flData.value = processFLData(initialData);
|
}
|
|
// 监听数据变化,只处理FL数据
|
const unwatch = watch(
|
() => store.state.homedata,
|
(newData) => {
|
const hasFLFields = flStatusConfig.booleanFields.keys.some(key =>
|
newData && newData[key] !== undefined
|
);
|
|
if (hasFLFields) {
|
delayedUpdateFLData(newData);
|
}
|
},
|
{ deep: true }
|
);
|
|
// 组件卸载时清理资源
|
onUnmounted(() => {
|
unwatch();
|
if (updateTimer) clearTimeout(updateTimer);
|
});
|
});
|
|
return {
|
flData
|
};
|
}
|
};
|
</script>
|
|
<style scoped>
|
.ding {
|
float: left;
|
width: 20px;
|
height: 20px;
|
margin-top: 7px;
|
}
|
.yan {
|
color: white;
|
float: left;
|
font-size: 25px;
|
}
|
.dakuang {
|
width: 250px;
|
height: 50px;
|
position: absolute;
|
top: 150px;
|
left: 200px;
|
}
|
#xiugai {
|
width: 100px;
|
height: 30px;
|
float: left;
|
border-radius: 5px;
|
text-align: center;
|
line-height: 30px;
|
cursor: pointer;
|
border: 1px solid white;
|
color: white;
|
background: rgba(255, 255, 255, 0.5);
|
font-size: 25px;
|
position: absolute;
|
top: 150px;
|
left: 450px;
|
}
|
#xiugai:hover {
|
background: #f60;
|
}
|
#shu1,
|
#shu2 {
|
width: 200px;
|
height: 30px;
|
float: left;
|
margin-top: 0px;
|
margin-right: 0px;
|
border-radius: 5px;
|
border: 1px solid white;
|
}
|
#guan {
|
width: 40px;
|
height: 40px;
|
float: left;
|
font-size: 1.1cqw;
|
text-align: center;
|
line-height: 40px;
|
cursor: pointer;
|
margin-left: 560px;
|
color: white;
|
position: absolute;
|
}
|
#ti {
|
width: 600px;
|
height: 300px;
|
position: relative;
|
background: rgba(255, 255, 255, 1);
|
border-radius: 10px;
|
top: 230px;
|
left: 35%;
|
display: none;
|
background-image: url("../../img/1.png");
|
background-repeat: no-repeat;
|
background-size: 170%;
|
background-position: -220px 0px;
|
}
|
.zhuname {
|
width: 100%;
|
height: 5vh;
|
float: left;
|
text-align: center;
|
line-height: 50px;
|
font-weight: 700;
|
font-size: 1.1cqw;
|
color: white;
|
}
|
.xname {
|
width: 70%;
|
height: 80px;
|
float: left;
|
line-height: 7vh;
|
font-size: 1.1cqw;
|
color: white;
|
}
|
.xzhi {
|
width: 30%;
|
height: 7vh;
|
float: left;
|
line-height: 50px;
|
font-size: 1.1cqw;
|
color: rgb(242, 242, 50);
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
}
|
.zhankuang {
|
width: 45%;
|
height: 3vh;
|
margin-top: 10px;
|
margin-left: 5%;
|
float: left;
|
}
|
#title {
|
float: left;
|
width: 95%;
|
height: 88vh;
|
margin-top: 40px;
|
margin-left: 3%;
|
background-image: url("../../img/1.png");
|
background-repeat: no-repeat;
|
background-size: 100%;
|
container-type: inline-size;
|
}
|
#bkuang {
|
width: 100%;
|
height: 55vh;
|
float: left;
|
}
|
.skuang {
|
width: 31%;
|
height: 55vh;
|
float: left;
|
border-top: none;
|
border-left: none;
|
border-bottom: none;
|
background: rgba(255, 255, 255, 0.2);
|
margin-left: 1.7%;
|
border-radius: 10px;
|
}
|
</style>
|
|