<template>
  <div>
    <el-form ref="tonggao" :model="formData" :rules="rules" size="medium" label-width="100px">
      <el-form-item label="通告标题" prop="title">
        <el-input v-model="formData.title" placeholder="请输入通告标题" clearable :style="{width: '100%'}">
        </el-input>
      </el-form-item>
      <el-form-item label="通告副标题" prop="fubiaoti">
        <el-input v-model="formData.fubiaoti" placeholder="请输入通告副标题" clearable :style="{width: '100%'}">
        </el-input>
      </el-form-item>
      <el-form-item label="通告内容" prop="content">
        <el-input v-model="formData.content" type="textarea" placeholder="请输入通告内容"
          :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
      </el-form-item>
      <el-form-item size="large">
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button @click="resetForm">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  components: {},
  props: [],
  data() {
    return {
      formData: {
        title: undefined,
        fubiaoti: undefined,
        content: undefined,
      },
      rules: {
        title: [{
          required: true,
          message: '请输入通告标题',
          trigger: 'blur'
        }],
        fubiaoti: [{
          required: true,
          message: '请输入通告副标题',
          trigger: 'blur'
        }],
        content: [{
          required: true,
          message: '请输入通告内容',
          trigger: 'blur'
        }],
      },
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submitForm() {
      this.$refs['tonggao'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
        updataForm(JSON.stringify(this.form)).then(response => {
          if (response.code === 200) {
            this.msgSuccess("提交成功");
            this.getList();
          }
        });
      })
    },
    resetForm() {
      this.$refs['tonggao'].resetFields()
    },
  }
}

</script>
<style>
</style>
