<template>
  <el-card shadow="never">
    <template #header>
      <div class="header">{{ title }}</div>
    </template>

    <el-form label-width="100px" style="max-width: 720px">
      <el-form-item label="标题">
        <el-input v-model="form.title" placeholder="请输入标题" />
      </el-form-item>
      <el-form-item label="描述">
        <el-input v-model="form.desc" type="textarea" :rows="4" placeholder="请输入内容说明" />
      </el-form-item>
      <el-form-item label="状态">
        <el-select v-model="form.status" style="width: 180px">
          <el-option label="草稿" value="draft" />
          <el-option label="进行中" value="processing" />
          <el-option label="已完成" value="done" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submit">保存</el-button>
        <el-button @click="reset">重置</el-button>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script setup lang="ts">
import { ElMessage } from 'element-plus'
import { reactive } from 'vue'

defineProps<{ title: string }>()

const form = reactive({
  title: '',
  desc: '',
  status: 'draft',
})

function submit() {
  ElMessage.success('已保存（迁移阶段示例提交）')
}

function reset() {
  form.title = ''
  form.desc = ''
  form.status = 'draft'
}
</script>

<style scoped>
.header {
  font-weight: 600;
}
</style>
