From 291067c13bfe8fb9c876e3764a828dc3ddd22f99 Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期一, 17 十一月 2025 16:50:12 +0800
Subject: [PATCH] 监控优化,代码功能优化
---
代码管理/WCS/WIDESEAWCS_Client/src/views/deviceMonitoring/BoardWarehouse.vue | 473 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 442 insertions(+), 31 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/deviceMonitoring/BoardWarehouse.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/deviceMonitoring/BoardWarehouse.vue"
index 8b42e03..39b9a75 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/deviceMonitoring/BoardWarehouse.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/deviceMonitoring/BoardWarehouse.vue"
@@ -1,45 +1,456 @@
<template>
- <div class="message-container">
- <div class="item" v-for="(item, index) in list" :key="index">
- <div class="title">{{ item.title }}({{ item.date }})</div>
- <div class="content">{{ item.message }}</div>
+ <div id="title">
+ <div id="bkuang" style="border-top: none">
+ <!-- BC浠撳爢鍨涙満鐘舵�侀潰鏉� -->
+ <div class="skuang">
+ <div class="bcuname">鏉挎枡浠撳爢鍨涙満</div>
+ <div class="bcankuang">
+ <div class="xname">鍫嗗灈鏈虹姸鎬�:</div>
+ <div class="xbci" :title="bcData.R_BC_Status">{{ bcData.R_BC_Status || '-' }}</div>
+ </div>
+ <div class="bcankuang">
+ <div class="xname">鍫嗗灈鏈烘墜鑷姩鐘舵��:</div>
+ <div class="xbci" :title="bcData.R_BC_AutoStatus">{{ bcData.R_BC_AutoStatus || '-' }}</div>
+ </div>
+ <div class="bcankuang">
+ <div class="xname">姝e湪鎵ц鐨勪换鍔″彿:</div>
+ <div class="xbci" :title="bcData.R_BC_TaskNum">{{ bcData.R_BC_TaskNum || '-' }}</div>
+ </div>
+ <div class="bcankuang">
+ <div class="xname">鍫嗗灈鏈哄伐浣滅姸鎬�:</div>
+ <div class="xbci" :title="bcData.R_BC_WorkStatus">{{ bcData.R_BC_WorkStatus || '-' }}</div>
+ </div>
+ <div class="bcankuang">
+ <div class="xname">浣滀笟绫诲瀷:</div>
+ <div class="xbci" :title="bcData.R_BC_WorkType">{{ bcData.R_BC_WorkType || '-' }}</div>
+ </div>
+ <div class="bcankuang">
+ <div class="xname">鎵樼洏绫诲瀷:</div>
+ <div class="xbci" :title="bcData.R_BC_TrayType">{{ bcData.R_BC_TrayType || '-' }}</div>
+ </div>
+ <!-- 鏂板锛氬綋鍓嶅垪鐘舵�佹樉绀� -->
+ <div class="bcankuang">
+ <div class="xname">褰撳墠鎵�鍦ㄥ垪:</div>
+ <div class="xbci" :title="bcData.R_BC_Column">{{ bcData.R_BC_Column || '鏈煡' }}</div>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鏂板锛氬爢鍨涙満褰撳墠鍒楁枃瀛楁樉绀猴紙涓嶱P浠撲竴鑷达級 -->
+ <div id="bc-nowcolumn" :class="{ 'abnormal-column': bcData.R_BC_Status !== '姝e父' }">
+ <div>鏉挎枡鍫嗗灈鏈哄綋鍓嶆墍鍦ㄥ垪:
+ <span :title="bcData.R_BC_Column">{{ bcData.R_BC_Column || '鏈煡' }}</span>
+ </div>
+ </div>
+
+ <!-- 鏂板锛氬垪鏂规牸灞曠ず鍖哄煙锛堜笌PP浠撻�昏緫涓�鑷达級 -->
+ <div class="bc-column-container" :class="{ 'pp-status-abnormal': bcData.R_BC_Status !== '姝e父' }">
+ <!-- 涓婃柟1-24鍒� -->
+ <div class="column-grid-container">
+ <div
+ v-for="num in 37"
+ :key="num"
+ class="column-grid-item"
+ :class="{ 'active': num == bcData.R_BC_Column }"
+ :title="`鍒楀彿: ${num}`"
+ >
+ {{ num }}
+ </div>
+ </div>
+ <!-- 涓嬫柟25-47鍒� (23涓�) -->
+ <div class="column-grid-container">
+ <div
+ v-for="i in 34"
+ :key="'bc-lower-' + i"
+ class="column-grid-item"
+ :class="{ 'active': (103 + i) == bcData.R_BC_Column }"
+ :title="`鍒楀彿: ${103 + i}`"
+ >
+ {{ 103 + i }}
+ </div>
+ </div>
+ <div class="column-grid-container">
+ <div
+ v-for="i in 34"
+ :key="'bc-lower-' + i"
+ class="column-grid-item"
+ :class="{ 'active': (203 + i) == bcData.R_BC_Column }"
+ :title="`鍒楀彿: ${203 + i}`"
+ >
+ {{ 203 + i }}
+ </div>
+ </div>
</div>
</div>
</template>
<script>
+import { ref, nextTick, watch, onUnmounted } from "vue";
+import { useStore } from "vuex";
+import { onMounted } from "vue";
+
export default {
- props: {
- list: {
- type: Array,
- default: () => {
- return [];
- }
- }
+ data() {
+ return {
+ xuan: 0
+ };
},
- created() {
- if (!this.list.length) {
- this.list.push({
- title: '娑堟伅娴嬭瘯鏍噏weqweqweqw棰�',
- message: '娑堟伅娴嬭瘯鍐呭娑堟伅娴嬭瘯鍐呭娑堟伅娴嬭瘯鍐呭娑堟伅娴嬭瘯鍐呭',
- date: '2022-05-02 03:10'
+ setup() {
+ const store = useStore();
+ const bcData = ref({});
+
+ const UPDATE_DELAY = 300;
+ let updateTimer = null;
+
+ // BC鏁版嵁鏄犲皠瑙勫垯锛堟柊澧濺_BC_Column鍒楀彿澶勭悊锛�
+ const bcStatusMap = {
+ R_BC_Status: {
+ 0: "姝e父",
+ 1: "鏁呴殰",
+ 2: "鎬ュ仠",
+ 3: "鏈煡"
+ },
+ R_BC_AutoStatus: {
+ 0: "缁翠慨",
+ 1: "鎵嬪姩",
+ 2: "鍗婅嚜鍔�",
+ 3: "鑷姩",
+ },
+ R_BC_WorkStatus: {
+ 0: "寰呮満",
+ 1: "鍙栬揣涓�",
+ 2: "鍙栬揣瀹屾垚",
+ 4: "鏀捐揣涓�",
+ 5: "鏀捐揣瀹屾垚",
+ 6: "浠诲姟瀹屾垚",
+ },
+ R_BC_WorkType: {
+ 0: "鏃犱綔涓氫换鍔�(0)",
+ 1: "鍙栨斁璐т綔涓�(1)",
+ 2: "鍙彇璐т綔涓�(2)",
+ 3: "鍙斁璐т綔涓�(3)",
+ 4: "绉诲姩鍒版寚瀹氫綅缃�"
+ },
+ R_BC_TrayType: {
+ "-1": "绌虹(-1)",
+ 1: "灏忔墭鐩�(1)",
+ 2: "涓墭鐩�(2)",
+ 3: "澶ф墭鐩�(3)",
+ 4: "鐗瑰ぇ鎵樼洏(4)",
+ },
+ // 鏂板锛氬垪鍙锋槧灏勶紙涓嶱P浠撲竴鑷达級
+ R_BC_Column: (val) => val !== undefined ? val : "鏈煡"
+ };
+
+ const bcFieldGroups = {
+ permissionFields: {
+ keys: ["R_BC_IsCanPut1", "R_BC_IsCanTake1", "R_BC_IsCanPut2", "R_BC_IsCanTake2",
+ "R_BC_IsCanPut3", "R_BC_IsCanTake3", "R_BC_IsCanPut4", "R_BC_IsCanTake4"],
+ map: { true: "鏄�", false: "鍚�" }
+ },
+ requestFields: {
+ keys: ["W_BC_PutRequest1", "W_BC_TakeRequest1", "W_BC_PutRequest2", "W_BC_TakeRequest2",
+ "W_BC_PutRequest3", "W_BC_TakeRequest3", "W_BC_PutRequest4", "W_BC_TakeRequest4"],
+ map: { true: "鏄�", false: "鍚�" }
+ },
+ finishFields: {
+ keys: ["W_BC_PutFinish1", "W_BC_TakeFinish1", "W_BC_PutFinish2", "W_BC_TakeFinish2",
+ "W_BC_PutFinish3", "W_BC_TakeFinish3", "W_BC_PutFinish4", "W_BC_TakeFinish4"],
+ map: { true: "鏄�", false: "鍚�" }
+ },
+ palletTypeFields: {
+ keys: ["R_BC_TakePalletType1", "R_BC_TakePalletType2", "R_BC_TakePalletType3", "R_BC_TakePalletType4",
+ "W_BC_PutPalletType1", "W_BC_PutPalletType2", "W_BC_PutPalletType3", "W_BC_PutPalletType4"],
+ map: { "-1": "绌虹(-1)", 1: "灏忔墭鐩�(1)", 2: "涓墭鐩�(2)", 3: "澶ф墭鐩�(3)", 4: "鐗瑰ぇ鎵樼洏(4)" }
+ }
+ };
+
+ const processBCData = (rawData) => {
+ if (!rawData) return {};
+ const processedData = { ...rawData };
+
+ // 澶勭悊鏍稿績鐘舵�佸瓧娈碉紙鍖呭惈鍒楀彿锛�
+ Object.keys(bcStatusMap).forEach(key => {
+ if (processedData.hasOwnProperty(key)) {
+ const mapper = bcStatusMap[key];
+ processedData[key] = typeof mapper === 'function'
+ ? mapper(processedData[key])
+ : (mapper[processedData[key]] || processedData[key]);
+ }
});
- }
+
+ Object.values(bcFieldGroups).forEach(group => {
+ group.keys.forEach(key => {
+ if (processedData.hasOwnProperty(key)) {
+ processedData[key] = group.map[processedData[key]] || processedData[key];
+ }
+ });
+ });
+
+ return processedData;
+ };
+
+ const delayedUpdateBCData = (newRawData) => {
+ if (updateTimer) {
+ clearTimeout(updateTimer);
+ }
+
+ updateTimer = setTimeout(() => {
+ if (newRawData && newRawData.R_BC_Status !== undefined) {
+ bcData.value = processBCData(newRawData);
+
+ nextTick(() => {
+ const valueElements = document.getElementsByClassName("xbci");
+ for (let i = 0; i < valueElements.length; i++) {
+ if (valueElements[i].innerHTML === "鏄�") {
+ valueElements[i].style.color = "yellow";
+ } else if (valueElements[i].innerHTML === "鍚�") {
+ valueElements[i].style.color = "red";
+ }
+ }
+ });
+ }
+ }, UPDATE_DELAY);
+ };
+
+ onMounted(() => {
+ const initialData = store.state.homedata;
+ if (initialData && initialData.R_BC_Status !== undefined) {
+ bcData.value = processBCData(initialData);
+ }
+
+ const unwatch = watch(
+ () => store.state.homedata,
+ (newData) => {
+ if (newData && newData.R_BC_Status !== undefined) {
+ delayedUpdateBCData(newData);
+ }
+ },
+ { deep: true }
+ );
+
+ onUnmounted(() => {
+ unwatch();
+ if (updateTimer) {
+ clearTimeout(updateTimer);
+ }
+ });
+ });
+
+ return {
+ bcData
+ };
}
};
</script>
-<style scoped lang="less">
-.message-container {
- .title {
- padding-bottom: 10px;
- }
- .item {
- border-bottom: 1px solid #eee;
- padding: 10px 20px;
- }
- .content {
- color: #7e7e7e;
- font-size: 13px;
- }
+
+<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;
+}
+.bcuname {
+ 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;
+}
+.xbci {
+ 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;
+}
+.bcankuang {
+ 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;
+}
+
+/* 鏂板锛欱C鍫嗗灈鏈哄綋鍓嶅垪鏂囧瓧鏍峰紡锛堜笌PP浠撲竴鑷达級 */
+#bc-nowcolumn {
+ width: 100%;
+ height: 70px;
+ float: left;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 1.5cqw;
+ font-weight: bold;
+ color: #00ff4c;
+}
+
+/* 鏂板锛欱C鍫嗗灈鏈哄紓甯哥姸鎬佹枃瀛楀彉鑹� */
+#bc-nowcolumn.abnormal-column {
+ color: red !important;
+}
+#bc-nowcolumn.abnormal-column span {
+ color: red !important;
+}
+
+/* 鏂板锛欱C鍒楀鍣ㄦ牱寮� */
+.bc-column-container {
+ width: 95%;
+ margin: 0 auto;
+ position: relative;
+ clear: both;
+ padding-top: 15px;
+}
+
+/* 澶嶇敤锛氭柟鏍煎鍣ㄦ牱寮忥紙涓嶱P浠撲竴鑷达級 */
+.column-grid-container {
+ width: 100%;
+ display: flex;
+ flex-wrap: nowrap;
+ justify-content: space-between;
+ align-items: center;
+ gap: 2px;
+ position: relative;
+ z-index: 2;
+ margin-bottom: 10px;
+ padding: 0 2px;
+}
+
+/* 澶嶇敤锛氭柟鏍兼牱寮忥紙涓嶱P浠撲竴鑷达級 */
+.column-grid-item {
+ flex: 1;
+ min-width: 24px;
+ max-width: 60px;
+ height: 30px;
+ border: 1px solid #fff;
+ border-radius: 8px 8px 0 0;
+ color: white;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: clamp(8px, 1vw, 14px);
+ box-sizing: border-box;
+ transition: background-color 0.3s ease;
+}
+
+/* 澶嶇敤锛氬綋鍓嶅垪楂樹寒鏍峰紡 */
+.column-grid-item.active {
+ background-color: green;
+ font-weight: bold;
+}
+
+/* 澶嶇敤锛氬紓甯哥姸鎬佷笅褰撳墠鍒楃孩鑹查珮浜� */
+.pp-status-abnormal .column-grid-item.active {
+ background-color: red !important;
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3