<template>
  <div class="seal2-step">
    <el-form label-width="120px">
      <el-form-item label="封装方式">
        <el-select v-model="formData.method" placeholder="请选择封装方式">
          <el-option label="热封" value="heat"></el-option>
          <el-option label="机械封" value="mechanical"></el-option>
          <el-option label="封膜" value="membrane"></el-option>
          <el-option label="盖子封" value="cap"></el-option>
        </el-select>
      </el-form-item>
      
      <el-form-item label="密封材料">
        <el-select v-model="formData.material" placeholder="请选择密封材料">
          <el-option label="铝箔" value="aluminum"></el-option>
          <el-option label="塑料膜" value="plastic"></el-option>
          <el-option label="橡胶塞" value="rubber"></el-option>
          <el-option label="螺旋盖" value="screwCap"></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.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.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-number 
          v-model="formData.tubeCount" 
          :min="2" 
          :max="2" 
          :step="1"
        ></el-input-number>
      </el-form-item>
      
      <el-form-item label="质量检查">
        <el-checkbox-group v-model="formData.qualityChecks">
          <el-checkbox label="密封性检查">密封性检查</el-checkbox>
          <el-checkbox label="外观检查">外观检查</el-checkbox>
          <el-checkbox label="标识检查">标识检查</el-checkbox>
        </el-checkbox-group>
      </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: 'Seal2Step',
  props: ['stepData'],
  data() {
    return {
      formData: {
        method: '',
        material: '',
        pressure: '',
        pressureUnit: 'kPa',
        temperature: '',
        temperatureUnit: '℃',
        time: '',
        timeUnit: 's',
        tubeCount: 2,
        qualityChecks: [],
        notes: ''
      }
    }
  },
  created() {
    this.formData = { ...this.formData, ...this.stepData }
  },
  watch: {
    formData: {
      handler(newVal) {
        this.$emit('update', newVal)
      },
      deep: true
    }
  }
}
</script>