1
HuBingJie
7 天以前 5da3a276b7847187a7c155ee069d3cd4c9e58074
´úÂë¹ÜÀí/WCS/WCS/WIDESEAWCS_Client/src/views/Home.vue
@@ -145,34 +145,8 @@
                :loading="loadingStates[deviceKey]?.fw">
                å¤ä½
              </el-button>
              <!-- é•¿æŒ‰ï¼šä¸Šå‡/下降(按下=1,松开=0) -->
              <el-button type="success" size="small"
                @pointerdown.prevent="handleLiftPress(deviceKey, 'ss')"
                @pointerup="handleLiftRelease(deviceKey, 'ss')"
                @pointercancel="handleLiftRelease(deviceKey, 'ss')"
                :disabled="!isManualMode(deviceData) || deviceData['上升信号到位'] === 1"
                :loading="activeLift && activeLift.deviceKey === deviceKey && activeLift.operationType === 'ss'">
                ä¸Šå‡
              </el-button>
              <el-button type="info" size="small"
                @pointerdown.prevent="handleLiftPress(deviceKey, 'xj')"
                @pointerup="handleLiftRelease(deviceKey, 'xj')"
                @pointercancel="handleLiftRelease(deviceKey, 'xj')"
                :disabled="!isManualMode(deviceData) || deviceData['下降信号到位'] === 1"
                :loading="activeLift && activeLift.deviceKey === deviceKey && activeLift.operationType === 'xj'">
                ä¸‹é™
              </el-button>
              <!-- ä¿éšœï¼šæ‰‹åŠ¨åœæ­¢æŒ‰é’®ï¼ˆç‚¹å‡»å³å‘0) -->
              <el-button type="warning" size="small"
                @click="stopLift(deviceKey, 'ss')"
                :disabled="!isManualMode(deviceData)">
                åœæ­¢ä¸Šå‡
              </el-button>
              <el-button type="warning" size="small"
                @click="stopLift(deviceKey, 'xj')"
                :disabled="!isManualMode(deviceData)">
                åœæ­¢ä¸‹é™
              </el-button>
              <!-- æ‰“开点动面板 -->
              <el-button type="primary" size="small" @click="openJogDialog(deviceKey)">点动面板</el-button>
            </template>
            <!-- æ¯è½¦æ“ä½œæŒ‰é’® -->
@@ -227,38 +201,8 @@
                :loading="loadingStates[deviceKey]?.radarToggle" :disabled="!isManualMode(deviceData)">
                {{ getRadarButtonText(deviceData) }}
              </el-button>
              <!-- é•¿æŒ‰ï¼šä¸Šå‡/下降(按下=1,松开=0) -->
              <el-button type="success" size="small"
                @pointerdown.prevent="handleLiftPress(deviceKey, 'ss')"
                @pointerup="handleLiftRelease(deviceKey, 'ss')"
                @mousedown.prevent="handleLiftPress(deviceKey, 'ss')"
                @mouseup="handleLiftRelease(deviceKey, 'ss')"
                @touchstart.prevent="handleLiftPress(deviceKey, 'ss')"
                @touchend="handleLiftRelease(deviceKey, 'ss')"
                @touchcancel="handleLiftRelease(deviceKey, 'ss')"
                :disabled="!isManualMode(deviceData) || deviceData['上升信号到位'] === 1"
                :loading="activeLift && activeLift.deviceKey === deviceKey && activeLift.operationType === 'ss'">
                ä¸Šå‡
              </el-button>
              <el-button type="info" size="small"
                @pointerdown.prevent="handleLiftPress(deviceKey, 'xj')"
                @pointerup="handleLiftRelease(deviceKey, 'xj')"
                @pointercancel="handleLiftRelease(deviceKey, 'xj')"
                :disabled="!isManualMode(deviceData) || deviceData['下降信号到位'] === 1"
                :loading="activeLift && activeLift.deviceKey === deviceKey && activeLift.operationType === 'xj'">
                ä¸‹é™
              </el-button>
              <!-- ä¿éšœï¼šæ‰‹åŠ¨åœæ­¢æŒ‰é’®ï¼ˆç‚¹å‡»å³å‘0) -->
              <el-button type="warning" size="small"
                @click="stopLift(deviceKey, 'ss')"
                :disabled="!isManualMode(deviceData)">
                åœæ­¢ä¸Šå‡
              </el-button>
              <el-button type="warning" size="small"
                @click="stopLift(deviceKey, 'xj')"
                :disabled="!isManualMode(deviceData)">
                åœæ­¢ä¸‹é™
              </el-button>
              <!-- æ‰“开点动面板 -->
              <el-button type="primary" size="small" @click="openJogDialog(deviceKey)">点动面板</el-button>
            </template>
          </div>
@@ -291,6 +235,66 @@
    <el-dialog v-model="showOperationDialog" title="设备高级操作" width="600px">
      <div>设备初始化、写入参数等高级操作界面</div>
    </el-dialog>
    <!-- ç‚¹åŠ¨å¯¹è¯æ¡†ï¼šå°å­é¡µé¢ -->
    <el-dialog
      v-model="jogDialogVisible"
      :title="jogDeviceKey ? (getDeviceDisplayName(jogDeviceKey) + ' ç‚¹åŠ¨é¢æ¿') : '点动面板'"
      width="380px"
      :close-on-click-modal="false"
      :destroy-on-close="true"
      append-to-body
      @close="onJogDialogClosed"
    >
      <div class="jog-dialog">
        <div class="jog-hint">在本面板内按下即发1,松开即发0;面板打开期间已暂停监控刷新。</div>
        <div class="jog-status">
          <div class="status-item">
            <span>上升到位:</span>
            <span class="value">
              {{ (jogDeviceData && (jogDeviceData['上升信号到位']===1 || jogDeviceData['RGV_Risingsignalplace']===1 || jogDeviceData['RiseArrived']===1)) ? '已到位' : '未到位' }}
              <span class="signal-indicator" :class="getSignalClass((jogDeviceData && (jogDeviceData['上升信号到位']===1 || jogDeviceData['RGV_Risingsignalplace']===1 || jogDeviceData['RiseArrived']===1)) ? 1 : 0)"></span>
            </span>
          </div>
          <div class="status-item">
            <span>下降到位:</span>
            <span class="value">
              {{ (jogDeviceData && (jogDeviceData['下降信号到位']===1 || jogDeviceData['RGV_Descentsignal']===1 || jogDeviceData['DescendArrived']===1)) ? '已到位' : '未到位' }}
              <span class="signal-indicator" :class="getSignalClass((jogDeviceData && (jogDeviceData['下降信号到位']===1 || jogDeviceData['RGV_Descentsignal']===1 || jogDeviceData['DescendArrived']===1)) ? 1 : 0)"></span>
            </span>
          </div>
        </div>
        <div class="jog-row">
          <el-button type="success" class="jog-btn"
            :disabled="!isManualMode(jogDeviceData) || jogDeviceData?.['上升信号到位'] === 1"
            @pointerdown.prevent="jogDeviceKey && handleLiftPress(jogDeviceKey, 'ss')"
            @pointerup="jogDeviceKey && handleLiftRelease(jogDeviceKey, 'ss')"
            @pointercancel="jogDeviceKey && handleLiftRelease(jogDeviceKey, 'ss')"
          >上升</el-button>
          <el-button type="warning" class="jog-btn"
            :disabled="!isManualMode(jogDeviceData)"
            @click="jogDeviceKey && stopLift(jogDeviceKey, 'ss')"
          >停止上升</el-button>
        </div>
        <div class="jog-row">
          <el-button type="info" class="jog-btn"
            :disabled="!isManualMode(jogDeviceData) || jogDeviceData?.['下降信号到位'] === 1"
            @pointerdown.prevent="jogDeviceKey && handleLiftPress(jogDeviceKey, 'xj')"
            @pointerup="jogDeviceKey && handleLiftRelease(jogDeviceKey, 'xj')"
            @pointercancel="jogDeviceKey && handleLiftRelease(jogDeviceKey, 'xj')"
          >下降</el-button>
          <el-button type="warning" class="jog-btn"
            :disabled="!isManualMode(jogDeviceData)"
            @click="jogDeviceKey && stopLift(jogDeviceKey, 'xj')"
          >停止下降</el-button>
        </div>
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="onJogDialogClosed">关闭</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
@@ -317,6 +321,11 @@
      signalPollInterval: 1200, // è½»é‡ä¿¡å·è½®è¯¢é—´éš”(ms)
      lastLiftPressAt: {}, // è®°å½•每个(deviceKey-op)最后按下的时间戳
      liftReleaseInProgress: {}, // æ­£åœ¨å‘送释放(0)的标记,防重复
      // ç‚¹åŠ¨å­é¡µé¢ï¼ˆå¯¹è¯æ¡†ï¼‰
      jogDialogVisible: false,
      jogDeviceKey: null,
      jogSignalPollingTimer: null,
      // ç‚¹å‡»å¼å‡é™æŽ§åˆ¶çŠ¶æ€
      activeLiftStates: {}, // { [deviceKey]: { ss: boolean, xj: boolean } }
@@ -682,6 +691,12 @@
          return this.inboundDeviceData
      }
    }
    ,
    // ç‚¹åŠ¨å¯¹è¯æ¡†å½“å‰è®¾å¤‡æ•°æ®
    jogDeviceData() {
      const map = this.currentMonitorDataMap()
      return this.jogDeviceKey && map ? map[this.jogDeviceKey] : null
    }
  },
  methods: {
    // æš‚停/恢复监控轮询
@@ -690,6 +705,80 @@
      if (this.pollingTimer) {
        clearTimeout(this.pollingTimer)
        this.pollingTimer = null
      }
    },
    // æ‰“å¼€/关闭 ç‚¹åŠ¨å¯¹è¯æ¡†
    openJogDialog(deviceKey) {
      this.jogDeviceKey = deviceKey
      this.jogDialogVisible = true
      // æ‰“开时暂停监控,避免刷新影响点动释放0
      this.pauseMonitoring()
      // å¯åŠ¨ä»…é’ˆå¯¹è¯¥è®¾å¤‡çš„ä¿¡å·è½®è¯¢
      this.startJogSignalPolling(deviceKey)
    },
    onJogDialogClosed() {
      // ç»Ÿä¸€å…³é—­é€»è¾‘
      this.jogDialogVisible = false
      this.jogDeviceKey = null
      // åœæ­¢å¯¹è¯æ¡†å†…的轻量信号轮询
      this.stopJogSignalPolling()
      // å…³é—­æ—¶æ¢å¤ç›‘控
      this.resumeMonitoring()
    },
    // å¯¹è¯æ¡†å†…:仅轮询当前设备的上/下到位信号
    startJogSignalPolling(deviceKey) {
      this.stopJogSignalPolling()
      this.jogSignalPollingTimer = setInterval(async () => {
        try {
          if (!this.jogDialogVisible || !deviceKey) {
            this.stopJogSignalPolling()
            return
          }
          const response = await this.http.post('api/Rgvoperainform/GetDeviceStatusDto', {
            off: 1,
            monitorType: this.currentMonitorType
          })
          if (response && response.status && response.data) {
            const keys = Object.keys(response.data)
            const respKey = keys.find(k => k.toLowerCase() === String(deviceKey).toLowerCase())
            const dev = respKey ? response.data[respKey] : null
            if (!dev) return
            const updateMap = (mapObj) => {
              if (!mapObj) return null
              const devOld = mapObj[deviceKey] || {}
              const patch = { ...devOld }
              const riseVal = Object.prototype.hasOwnProperty.call(dev, '上升信号到位') ? dev['上升信号到位']
                : (Object.prototype.hasOwnProperty.call(dev, 'RGV_Risingsignalplace') ? dev['RGV_Risingsignalplace']
                : (Object.prototype.hasOwnProperty.call(dev, 'RiseArrived') ? dev['RiseArrived'] : undefined))
              const downVal = Object.prototype.hasOwnProperty.call(dev, '下降信号到位') ? dev['下降信号到位']
                : (Object.prototype.hasOwnProperty.call(dev, 'RGV_Descentsignal') ? dev['RGV_Descentsignal']
                : (Object.prototype.hasOwnProperty.call(dev, 'DescendArrived') ? dev['DescendArrived'] : undefined))
              if (riseVal !== undefined) patch['上升信号到位'] = riseVal
              if (downVal !== undefined) patch['下降信号到位'] = downVal
              return { ...mapObj, [deviceKey]: patch }
            }
            if (this.currentMonitorType === 'inbound') {
              const next = updateMap(this.inboundDeviceData)
              if (next) this.inboundDeviceData = next
            } else if (this.currentMonitorType === 'outbound') {
              const next = updateMap(this.outboundDeviceData)
              if (next) this.outboundDeviceData = next
            } else if (this.currentMonitorType === 'safetydoor') {
              const next = updateMap(this.safetyDoorDeviceData)
              if (next) this.safetyDoorDeviceData = next
            } else if (this.currentMonitorType === 'platform') {
              const next = updateMap(this.platformDeviceData)
              if (next) this.platformDeviceData = next
            }
            if (typeof this.$forceUpdate === 'function') this.$forceUpdate()
          }
        } catch (_) { /* ignore */ }
      }, this.signalPollInterval)
    },
    stopJogSignalPolling() {
      if (this.jogSignalPollingTimer) {
        clearInterval(this.jogSignalPollingTimer)
        this.jogSignalPollingTimer = null
      }
    },
    resumeMonitoring() {
@@ -1869,6 +1958,25 @@
  gap: 10px;
}
/* ç‚¹åŠ¨å¯¹è¯æ¡†æ ·å¼ */
.jog-dialog {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.jog-hint {
  color: #909399;
  font-size: 12px;
}
.jog-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.jog-btn {
  width: 100%;
}
.operation-panel {
  text-align: center;
  padding: 20px;