<template>
  <div class="static-start-step">
    <el-form label-width="120px">
      <el-form-item label="静置目的">
        <el-input v-model="formData.purpose" placeholder="请输入静置目的"></el-input>
      </el-form-item>
      
      <el-form-item label="预计时间">
        <el-input v-model="formData.duration" placeholder="请输入预计时间">
          <el-select v-model="formData.durationUnit" slot="append" style="width: 80px;">
            <el-option label="min" value="min"></el-option>
            <el-option label="h" value="h"></el-option>
            <el-option label="d" value="d"></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-select v-model="formData.containerState" placeholder="请选择容器状态">
          <el-option label="密封" value="sealed"></el-option>
          <el-option label="半密封" value="semiSealed"></el-option>
          <el-option label="开放" value="open"></el-option>
        </el-select>
      </el-form-item>
      
      <el-form-item label="环境条件">
        <el-checkbox-group v-model="formData.environmentConditions">
          <el-checkbox label="避光">避光</el-checkbox>
          <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-select v-model="formData.position" placeholder="请选择静置位置">
          <el-option label="室温" value="roomTemp"></el-option>
          <el-option label="冷藏" value="refrigerated"></el-option>
          <el-option label="冷冻" value="frozen"></el-option>
          <el-option label="恒温箱" value="incubator"></el-option>
          <el-option label="水浴" value="waterBath"></el-option>
        </el-select>
      </el-form-item>
      
      <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="beaker"></el-option>
          <el-option label="培养皿" value="petriDish"></el-option>
          <el-option label="容量瓶" value="volumetricFlask"></el-option>
        </el-select>
      </el-form-item>
      
      <el-form-item label="体积范围">
        <el-input v-model="formData.volume" placeholder="请输入体积">
          <el-select v-model="formData.volumeUnit" 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-date-picker
          v-model="formData.startTime"
          type="datetime"
          placeholder="请选择开始时间"
          format="yyyy-MM-dd HH:mm"
          value-format="yyyy-MM-dd HH:mm:ss"
        ></el-date-picker>
      </el-form-item>
      
      <el-form-item label="观察记录">
        <el-checkbox-group v-model="formData.observationRecords">
          <el-checkbox label="颜色变化">颜色变化</el-checkbox>
          <el-checkbox label="沉淀形成">沉淀形成</el-checkbox>
          <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: 'StaticStartStep',
  props: ['stepData'],
  data() {
    return {
      formData: {
        purpose: '',
        duration: '',
        durationUnit: 'h',
        temperature: '',
        temperatureUnit: '℃',
        containerState: '',
        environmentConditions: [],
        position: '',
        containerType: '',
        volume: '',
        volumeUnit: 'ml',
        startTime: '',
        observationRecords: [],
        notes: ''
      }
    }
  },
  created() {
    this.formData = { ...this.formData, ...this.stepData }
  },
  watch: {
    formData: {
      handler(newVal) {
        this.$emit('update', newVal)
      },
      deep: true
    }
  }
}
</script>