helongyang
2025-11-17 291067c13bfe8fb9c876e3764a828dc3ddd22f99
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Client/src/views/deviceMonitoring/SolderMaskWarehouse.vue
@@ -28,6 +28,11 @@
          <div class="xname">托盘类型:</div>
          <div class="xzhi" :title="zhData.R_ZH_TrayType">{{ zhData.R_ZH_TrayType || '-' }}</div>
        </div>
        <!-- æ–°å¢žï¼šå½“前所在列显示 -->
        <div class="zhankuang">
          <div class="xname">当前所在列:</div>
          <div class="xzhi" :title="zhData.R_ZH_Column">{{ zhData.R_ZH_Column || '未知' }}</div>
        </div>
      </div>
      <!-- ZH关联站台(入库301+入库302) -->
@@ -172,6 +177,30 @@
        </div>
      </div>
    </div>
    <!-- æ–°å¢žï¼šå †åž›æœºå½“前列文字显示 -->
    <div id="zh-nowcolumn" :class="{ 'abnormal-column': zhData.R_ZH_Status !== '正常' }">
      <div>阻焊堆垛机当前所在列:
        <span :title="zhData.R_ZH_Column">{{ zhData.R_ZH_Column || '未知' }}</span>
      </div>
    </div>
    <!-- æ–°å¢žï¼šåˆ—方格展示区域 -->
    <div class="zh-column-container" :class="{ 'pp-status-abnormal': zhData.R_ZH_Status !== '正常' }">
      <!-- ä¸Šæ–¹1-24列 -->
      <div class="column-grid-container">
        <div
          v-for="num in 28"
          :key="num"
          class="column-grid-item"
          :class="{ 'active': num == zhData.R_ZH_Column }"
          :title="`列号: ${num}`"
        >
          {{ num }}
        </div>
      </div>
    </div>
  </div>
</template>
@@ -188,19 +217,18 @@
  },
  setup() {
    const store = useStore();
    // ä»…存储ZH数据,与其他数据隔离
    const zhData = ref({});
    // å»¶è¿Ÿæ›´æ–°é…ç½®ï¼Œè§£å†³é—ªçƒé—®é¢˜
    const UPDATE_DELAY = 300; // å»¶è¿Ÿ300ms更新UI
    let updateTimer = null;   // å®šæ—¶å™¨å®žä¾‹
    const UPDATE_DELAY = 300;
    let updateTimer = null;
    // ZH数据映射规则
    // ZH数据映射规则(新增列号处理)
    const zhStatusMap = {
      R_ZH_Status: {
        1: "正常",
        2: "故障",
        3: "急停",
        0: "正常",
        1: "故障",
        2: "急停",
        3: "未知"
      },
      R_ZH_AutoStatus: {
        0: "ç»´ä¿®",
@@ -229,7 +257,9 @@
        2: "中托盘(2)",
        3: "大托盘(3)",
        4: "特大托盘(4)",
      }
      },
      // æ–°å¢žï¼šåˆ—号映射处理
      R_ZH_Column: (val) => val !== undefined ? val : "未知"
    };
    // ZH字段分组
@@ -256,7 +286,7 @@
      }
    };
    // å¤„理ZH原始数据
    // å¤„理ZH原始数据(包含列号处理)
    const processZHData = (rawData) => {
      if (!rawData) return {};
      const processedData = { ...rawData };
@@ -264,7 +294,10 @@
      // å¤„理核心状态字段
      Object.keys(zhStatusMap).forEach(key => {
        if (processedData.hasOwnProperty(key)) {
          processedData[key] = zhStatusMap[key][processedData[key]] || processedData[key];
          const mapper = zhStatusMap[key];
          processedData[key] = typeof mapper === 'function'
            ? mapper(processedData[key])
            : (mapper[processedData[key]] || processedData[key]);
        }
      });
@@ -280,14 +313,13 @@
      return processedData;
    };
    // å»¶è¿Ÿæ›´æ–°ZH数据,避免高频刷新
    // å»¶è¿Ÿæ›´æ–°ZH数据
    const delayedUpdateZHData = (newRawData) => {
      if (updateTimer) {
        clearTimeout(updateTimer);
      }
      updateTimer = setTimeout(() => {
        // åªå¤„理包含ZH特征字段的数据
        if (newRawData && newRawData.R_ZH_Status !== undefined) {
          zhData.value = processZHData(newRawData);
          
@@ -307,13 +339,11 @@
    };
    onMounted(() => {
      // åˆå§‹åŠ è½½æ•°æ®
      const initialData = store.state.homedata;
      if (initialData && initialData.R_ZH_Status !== undefined) {
        zhData.value = processZHData(initialData);
      }
      // ç›‘听数据变化,只处理ZH数据
      const unwatch = watch(
        () => store.state.homedata,
        (newData) => {
@@ -341,6 +371,7 @@
</script>
<style scoped>
/* åŽŸæœ‰æ ·å¼ä¿æŒä¸å˜ */
.ding {
  float: left;
  width: 20px;
@@ -477,4 +508,76 @@
  margin-left: 1.7%;
  border-radius: 10px;
}
/* æ–°å¢žï¼šZH堆垛机当前列样式 */
#zh-nowcolumn {
  width: 100%;
  height: 70px;
  float: left;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5cqw;
  font-weight: bold;
  color: #00ff4c;
}
/* å¼‚常状态文字变色 */
#zh-nowcolumn.abnormal-column {
  color: red !important;
}
#zh-nowcolumn.abnormal-column span {
  color: red !important;
}
/* åˆ—容器样式 */
.zh-column-container {
  width: 95%;
  margin: 0 auto;
  position: relative;
  clear: both;
  padding-top: 15px;
}
/* æ–¹æ ¼å®¹å™¨æ ·å¼ */
.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;
}
/* æ–¹æ ¼æ ·å¼ */
.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>