<template>
  <div class="package-step">
    <el-form label-width="120px">
      <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="vial"></el-option>
          <el-option label="微孔板" value="microplate"></el-option>
        </el-select>
      </el-form-item>
      
      <el-form-item label="分装数量">
        <el-input-number 
          v-model="formData.quantity" 
          :min="1" 
          :max="100" 
          :step="1"
        ></el-input-number>
      </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-radio-group v-model="formData.method">
          <el-radio label="manual">手动分装</el-radio>
          <el-radio label="auto">自动分装</el-radio>
        </el-radio-group>
      </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: 'PackageStep',
  props: ['stepData'],
  data() {
    return {
      formData: {
        containerType: '',
        quantity: 1,
        volume: '',
        unit: 'ml',
        method: 'manual',
        temperature: '',
        temperatureUnit: '℃',
        notes: ''
      }
    }
  },
  created() {
    this.formData = { ...this.formData, ...this.stepData }
  },
  watch: {
    formData: {
      handler(newVal) {
        this.$emit('update', newVal)
      },
      deep: true
    }
  }
}
</script>