<template>
  <div>
    <div class="cmain">
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="日期" prop="month">
          <el-date-picker v-model="form.month" type="month" placeholder="选择日期" value-format="yyyy-MM">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="投资金额(万)" prop="price">
          <el-input
            type="number"
            v-model="form.price"
            placeholder="请输入投资金额"
          ></el-input>
        </el-form-item>

        <el-form-item label="形象进度" prop="schedule">
          <el-input
            v-model="form.schedule"
            placeholder="请输入形象进度"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="mfooter">
        <el-button type="primary" @click="submitForm">保 存</el-button>
        <el-button @click="$layer.close(layerid)">取 消</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import {
  listARTICLE,
  getARTICLE,
  delARTICLE,
  addARTICLE,
  updateARTICLE,
  addDATAFILLING,
} from "@/api/portal/ARTICLE/ARTICLE.js";
export default {
  props: {
    param: {
      type: Object,
      default: () => {
        return {};
      },
    },
    layerid: {
      type: String,
    },
  },
  created() {
    // console.log(this.param.param);
  },
  data() {
    return {
      // 表单参数
      form: {
        articleId: this.param.param.id,
        deptId: this.param.deptId,
        month: "",
        plan: this.param.param.plan,
        price: "",
        schedule: "",
      },
      rules: {
        month: [
          { required: true, message: "年月不能为空", trigger: "blur" },
        ],
        price: [
          { required: true, message: "投资金额不能为空", trigger: "blur" },
        ],
        schedule: [
          { required: true, message: "形象进度不能为空", trigger: "blur" },
        ],
      },
    };
  },
  methods: {
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          addDATAFILLING(this.form).then((res) => {
            this.$modal.msgSuccess("填报成功！");
            this.$parent.getList()
            this.$layer.close(this.layerid);
          });
        }
      });
    },
  },
};
</script>

<style>
</style>