<template>
  <el-form ref="form" label-width="110px" :model="form">
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="1月" prop="january">
          <el-input-number
            v-model="form.january"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="2月" prop="february">
          <el-input-number
            v-model="form.february"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="3月" prop="march">
          <el-input-number
            v-model="form.march"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="4月" prop="april">
          <el-input-number
            v-model="form.april"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="5月" prop="may">
          <el-input-number
            v-model="form.may"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="6月" prop="june">
          <el-input-number
            v-model="form.june"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="7月" prop="july">
          <el-input-number
            v-model="form.july"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="8月" prop="august">
          <el-input-number
            v-model="form.august"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="9月" prop="september">
          <el-input-number
            v-model="form.september"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="10月" prop="october">
          <el-input-number
            v-model="form.october"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-form-item label="11月" prop="november">
          <el-input-number
            v-model="form.november"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="12月" prop="december">
          <el-input-number
            v-model="form.december"
            :min="0"
            style="width: 300px"
          ></el-input-number>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>
<script>
import {
  performanceAnalysisPlan,
  performanceUpdatePlan
} from '@/api/deviceManagement'
export default {
  name: 'productPowerEdit',
  data() {
    return {
      form: {}
    }
  },
  mounted() {},
  methods: {
    init(param) {
      let date = new Date(param.timePosition)
      let year = date.getFullYear()
      performanceAnalysisPlan({
        name: param.name,
        year: year
      }).then((res) => {
        console.log(res)
        if (res.code === 0 && !!res.data) {
          this.form = res.data
        }
      })
    },
    submitForm() {
      performanceUpdatePlan({ ...this.form }).then((res) => {
        if (res.code === 0) {
          this.$message({
            message: '操作成功',
            type: 'success',
            duration: 1500
          })
          this.$emit('successSubmit')
        }
      })
    },
    formClear() {
      this.$refs.form.resetFields()
    }
  }
}
</script>
