<template>
  <div class="filtration-step">
    <el-form label-width="120px">
      <el-form-item label="滤膜类型">
        <el-select v-model="formData.filterType" placeholder="请选择滤膜类型">
          <el-option label="0.22μm" value="0.22"></el-option>
          <el-option label="0.45μm" value="0.45"></el-option>
          <el-option label="0.8μm" value="0.8"></el-option>
          <el-option label="1.2μm" value="1.2"></el-option>
        </el-select>
      </el-form-item>
      
      <el-form-item label="压力">
        <el-input v-model="formData.pressure" placeholder="请输入压力值">
          <el-select v-model="formData.pressureUnit" slot="append" style="width: 80px;">
            <el-option label="kPa" value="kPa"></el-option>
            <el-option label="bar" value="bar"></el-option>
            <el-option label="psi" value="psi"></el-option>
          </el-select>
        </el-input>
      </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="min" value="min"></el-option>
            <el-option label="s" value="s"></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.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-input 
          v-model="formData.notes" 
          type="textarea" 
          :rows="3" 
          placeholder="请输入备注信息"
        ></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'FiltrationStep',
  props: ['stepData'],
  data() {
    return {
      formData: {
        filterType: '',
        pressure: '',
        pressureUnit: 'kPa',
        time: '',
        timeUnit: 'min',
        temperature: '',
        temperatureUnit: '℃',
        notes: ''
      }
    }
  },
  created() {
    this.formData = { ...this.formData, ...this.stepData }
  },
  watch: {
    formData: {
      handler(newVal) {
        this.$emit('update', newVal)
      },
      deep: true
    }
  }
}
</script>