<template>
  <div class="centrifuge-step">
    <el-form label-width="120px">
      <el-form-item label="转速(rpm)">
        <el-input v-model="formData.speed" placeholder="请输入转速"></el-input>
      </el-form-item>
      <el-form-item label="时间(min)">
        <el-input v-model="formData.time" placeholder="请输入时间"></el-input>
      </el-form-item>
      <el-form-item label="温度(℃)">
        <el-input v-model="formData.temperature" placeholder="请输入温度"></el-input>
      </el-form-item>
      <el-form-item label="加速度">
        <el-select v-model="formData.acceleration" placeholder="请选择加速度">
          <el-option label="慢" value="slow"></el-option>
          <el-option label="中" value="medium"></el-option>
          <el-option label="快" value="fast"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="减速度">
        <el-select v-model="formData.deceleration" placeholder="请选择减速度">
          <el-option label="慢" value="slow"></el-option>
          <el-option label="中" value="medium"></el-option>
          <el-option label="快" value="fast"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="formData.notes" type="textarea" :rows="2"></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'CentrifugeStep',
  props: ['stepData'],
  data() {
    return {
      formData: {
        speed: '',
        time: '',
        temperature: '',
        acceleration: '',
        deceleration: '',
        notes: ''
      }
    }
  },
  created() {
    this.formData = { ...this.formData, ...this.stepData }
  },
  watch: {
    formData: {
      handler(newVal) {
        this.$emit('update', newVal)
      },
      deep: true
    }
  }
}
</script>