<template>
  <wt-card
    title="年度投资情况（单位：万元）"
    class="mt-10"
    :edit-btn="true"
    @change="change"
    @save="save"
  >
    <el-form class="mt-20" :disabled="disabled">
      <div class="flex flex-justify-center">
        <el-form-item class="full-width flex-child-average">
          <div class="flex flex-center full-width item">
            <span class="title">年产值:</span>
            <el-input v-model="form.benefit_annual_output"></el-input>
          </div>
        </el-form-item>
        <el-form-item class="full-width flex-child-average">
          <div class="flex flex-center full-width item">
            <span class="title">年税收:</span>
            <el-input v-model="form.benefit_annual_tax"></el-input>
          </div>
        </el-form-item>
        <el-form-item class="full-width flex-child-average">
          <div class="flex flex-center full-width item">
            <span class="title">新增就业人数:</span>
            <el-input v-model="form.benefit_new_employment"></el-input>
          </div>
        </el-form-item>
      </div>
    </el-form>
  </wt-card>
</template>

<script>
import wtCard from '@/components/wt-card/index.vue'

export default {
  components: {
    wtCard
  },
  props: {
    info: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  watch: {
    info: {
      handler(val) {
        this.form = val
      },
      immediate: true
    }
  },
  data() {
    return {
      disabled: true,
      form: {}
    }
  },
  methods: {
    save() {
      console.log('save')
      this.$api.project.proUpdate(this.form).then(res => {
        if (res.code === 200) {
          this.$message.success(res.msg)
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    change(res) {
      this.disabled = res
    }
  }
}
</script>

<style lang="scss" scoped>
.title {
  width: 120px;
  padding-right: 10px;
  text-align: right;
}

.title-textarea {
  width: 85px;
  text-align: left;
}

.item {
  width: 90%;
}
</style>
