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