<template>
  <div class="vortex-step">
    <el-form label-width="120px">
      <el-form-item label="混匀方式">
        <el-select v-model="formData.method" placeholder="请选择混匀方式">
          <el-option label="漩涡混匀" value="vortex"></el-option>
          <el-option label="摇床混匀" value="shaker"></el-option>
          <el-option label="磁力搅拌" value="magnetic"></el-option>
          <el-option label="机械搅拌" value="mechanical"></el-option>
        </el-select>
      </el-form-item>
      
      <el-form-item label="混匀时间">
        <el-input v-model="formData.time" placeholder="请输入时间">
          <el-select v-model="formData.timeUnit" slot="append" style="width: 80px;">
            <el-option label="s" value="s"></el-option>
            <el-option label="min" value="min"></el-option>
            <el-option label="h" value="h"></el-option>
          </el-select>
        </el-input>
      </el-form-item>
      
      <el-form-item label="转速设置">
        <el-input v-model="formData.speed" placeholder="请输入转速">
          <el-select v-model="formData.speedUnit" slot="append" style="width: 80px;">
            <el-option label="rpm" value="rpm"></el-option>
            <el-option label="Hz" value="Hz"></el-option>
          </el-select>
        </el-input>
      </el-form-item>
      
      <el-form-item label="体积范围">
        <el-input v-model="formData.volume" placeholder="请输入体积">
          <el-select v-model="formData.unit" slot="append" style="width: 80px;">
            <el-option label="ml" value="ml"></el-option>
            <el-option label="μl" value="μl"></el-option>
            <el-option label="l" value="l"></el-option>
          </el-select>
        </el-input>
      </el-form-item>
      
      <el-form-item label="温度控制">
        <el-input v-model="formData.temperature" placeholder="请输入温度">
          <el-select v-model="formData.temperatureUnit" slot="append" style="width: 60px;">
            <el-option label="℃" value="℃"></el-option>
            <el-option label="℉" value="℉"></el-option>
          </el-select>
        </el-input>
      </el-form-item>
      
      <el-form-item label="容器类型">
        <el-select v-model="formData.containerType" placeholder="请选择容器类型">
          <el-option label="离心管" value="centrifugeTube"></el-option>
          <el-option label="试管" value="testTube"></el-option>
          <el-option label="烧杯" value="beaker"></el-option>
          <el-option label="培养皿" value="petriDish"></el-option>
        </el-select>
      </el-form-item>
      
      <el-form-item label="混匀模式">
        <el-radio-group v-model="formData.mode">
          <el-radio label="continuous">连续混匀</el-radio>
          <el-radio label="interval">间歇混匀</el-radio>
        </el-radio-group>
      </el-form-item>
      
      <el-form-item v-if="formData.mode === 'interval'" label="间歇时间">
        <el-input v-model="formData.intervalTime" placeholder="请输入间歇时间">
          <el-select v-model="formData.intervalTimeUnit" slot="append" style="width: 80px;">
            <el-option label="s" value="s"></el-option>
            <el-option label="min" value="min"></el-option>
          </el-select>
        </el-input>
      </el-form-item>
      
      <el-form-item label="备注">
        <el-input 
          v-model="formData.notes" 
          type="textarea" 
          :rows="3" 
          placeholder="请输入备注信息"
        ></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'VortexStep',
  props: ['stepData'],
  data() {
    return {
      formData: {
        method: '',
        time: '',
        timeUnit: 's',
        speed: '',
        speedUnit: 'rpm',
        volume: '',
        unit: 'ml',
        temperature: '',
        temperatureUnit: '℃',
        containerType: '',
        mode: 'continuous',
        intervalTime: '',
        intervalTimeUnit: 's',
        notes: ''
      }
    }
  },
  created() {
    this.formData = { ...this.formData, ...this.stepData }
  },
  watch: {
    formData: {
      handler(newVal) {
        this.$emit('update', newVal)
      },
      deep: true
    }
  }
}
</script>