<template>
  <div class="manual-weigh-step">
    <el-form label-width="120px">
      <el-form-item label="实际重量(g)">
        <el-input v-model="formData.actualWeight" placeholder="请输入实际重量"></el-input>
      </el-form-item>
      <el-form-item label="目标重量(g)">
        <el-input v-model="formData.targetWeight" placeholder="请输入目标重量"></el-input>
      </el-form-item>
      <el-form-item label="差值(g)">
        <el-input v-model="formData.difference" placeholder="自动计算"></el-input>
      </el-form-item>
      <el-form-item label="样品名称">
        <el-input v-model="formData.sampleName" placeholder="请输入样品名称"></el-input>
      </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: 'ManualWeighStep',
  props: ['stepData'],
  data() {
    return {
      formData: {
        actualWeight: '',
        targetWeight: '',
        difference: '',
        sampleName: '',
        notes: ''
      }
    }
  },
  created() {
    this.formData = { ...this.formData, ...this.stepData }
  },
  watch: {
    formData: {
      handler(newVal) {
        this.$emit('update', newVal)
      },
      deep: true
    }
  }
}
</script>