huang
7 天以前 22e17b6db03ca58bc477a35ca067e55a09cffce7
mes-web/src/views/device/components/DeviceLogicConfig/LoadVehicleConfig.vue
@@ -32,29 +32,16 @@
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="玻璃间隔(秒)">
        <el-form-item label="玻璃间隙(mm)">
          <el-input-number
            v-model="glassIntervalSeconds"
            :min="0.1"
            :max="10"
            :step="0.1"
            :precision="1"
            style="width: 100%;"
          />
          <span class="form-tip">玻璃上料间隔时间(秒)</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="默认玻璃长度(mm)">
          <el-input-number
            v-model="config.defaultGlassLength"
            :min="100"
            :max="10000"
            :step="100"
            v-model="config.glassGap"
            :min="0"
            :max="1000"
            :step="10"
            style="width: 100%;"
            @change="emitConfigUpdate"
          />
          <span class="form-tip">当玻璃未提供长度时使用的默认值</span>
          <span class="form-tip">多块玻璃之间的物理间隔空隙,默认200mm</span>
        </el-form-item>
      </el-col>
    </el-row>
@@ -149,21 +136,6 @@
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="最大重试次数">
          <el-input-number
            v-model="config.maxRetryCount"
            :min="0"
            :max="10"
            :step="1"
            style="width: 100%;"
            @change="emitConfigUpdate"
          />
        </el-form-item>
      </el-col>
    </el-row>
    <el-form-item label="位置映射">
      <div class="position-mapping">
        <div
@@ -173,7 +145,7 @@
        >
          <el-input
            v-model="item.key"
            placeholder="位置代码(如900/901)"
            placeholder="位置代码(如1001/1002)"
            size="small"
            style="width: 150px; margin-right: 10px;"
            @change="handlePositionKeyChange(index)"
@@ -221,8 +193,7 @@
const config = ref({
  vehicleCapacity: 6000,
  vehicleSpeed: 1.0,
  glassIntervalMs: 1000,
  defaultGlassLength: 2000,
  glassGap: 200,
  homePosition: 0,
  minRange: 1,
  maxRange: 100,
@@ -230,7 +201,6 @@
  taskMonitorIntervalMs: 1000,
  mesConfirmTimeoutMs: 30000,
  autoFeed: true,
  maxRetryCount: 5,
  positionMapping: {}
})
@@ -270,7 +240,6 @@
syncPositionListFromConfig()
// 时间字段(秒)- 用于前端显示和输入
const glassIntervalSeconds = ref(1.0)
const idleMonitorIntervalSeconds = ref(2.0)
const taskMonitorIntervalSeconds = ref(1.0)
const mesConfirmTimeoutSeconds = ref(30)
@@ -282,8 +251,7 @@
    config.value = {
      vehicleCapacity: newVal.vehicleCapacity ?? 6000,
      vehicleSpeed: newVal.vehicleSpeed ?? 1.0,
      glassIntervalMs: newVal.glassIntervalMs ?? 1000,
      defaultGlassLength: newVal.defaultGlassLength ?? 2000,
      glassGap: newVal.glassGap ?? 200,
      homePosition: newVal.homePosition ?? 0,
      minRange: newVal.minRange ?? 1,
      maxRange: newVal.maxRange ?? 100,
@@ -291,11 +259,9 @@
      taskMonitorIntervalMs: newVal.taskMonitorIntervalMs ?? 1000,
      mesConfirmTimeoutMs: newVal.mesConfirmTimeoutMs ?? 30000,
      autoFeed: newVal.autoFeed ?? true,
      maxRetryCount: newVal.maxRetryCount ?? 5,
      positionMapping: newVal.positionMapping || {}
    }
    // 将毫秒转换为秒用于显示
    glassIntervalSeconds.value = (config.value.glassIntervalMs ?? 1000) / 1000
    idleMonitorIntervalSeconds.value = (config.value.idleMonitorIntervalMs ?? 2000) / 1000
    taskMonitorIntervalSeconds.value = (config.value.taskMonitorIntervalMs ?? 1000) / 1000
    mesConfirmTimeoutSeconds.value = (config.value.mesConfirmTimeoutMs ?? 30000) / 1000
@@ -305,11 +271,6 @@
}, { immediate: true, deep: true })
// 监听秒字段变化,转换为毫秒并更新config
watch(glassIntervalSeconds, (val) => {
  config.value.glassIntervalMs = Math.round(val * 1000)
  emitConfigUpdate()
})
watch(idleMonitorIntervalSeconds, (val) => {
  config.value.idleMonitorIntervalMs = Math.round(val * 1000)
  emitConfigUpdate()