<template>
  <div class="add-solution-step">
    <el-form label-width="120px">
      <el-form-item label="溶液名称">
        <el-input v-model="formData.solutionName" placeholder="请输入溶液名称"></el-input>
      </el-form-item>
      <el-form-item label="加入体积">
        <div style="display: flex; gap: 10px;">
          <el-input v-model="formData.volume" placeholder="体积"></el-input>
          <el-select v-model="formData.unit" style="width: 80px;">
            <el-option label="μl" value="μl"></el-option>
            <el-option label="ml" value="ml"></el-option>
            <el-option label="l" value="l"></el-option>
          </el-select>
        </div>
      </el-form-item>
      <el-form-item label="浓度">
        <el-input v-model="formData.concentration" 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.additionSpeed" 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: 'AddSolutionStep',
  props: ['stepData'],
  data() {
    return {
      formData: {
        solutionName: '',
        volume: '',
        unit: 'ml',
        concentration: '',
        temperature: '',
        additionSpeed: '',
        notes: ''
      }
    }
  },
  created() {
    this.formData = { ...this.formData, ...this.stepData }
  },
  watch: {
    formData: {
      handler(newVal) {
        this.$emit('update', newVal)
      },
      deep: true
    }
  }
}
</script>