<template>
  <div class="app-container">
    <el-card class="container">
      <template #header>
        <div class="card-header">
          <span>新增报表</span>
        </div>
      </template>
      <el-form :model="form"
        label-width="100px">
        <el-form-item label="报表名字"
          prop="reportName">
          <el-input v-model="form.reportName"
            placeholder="请输入报表名字" />
        </el-form-item>
        <!-- 超链接输入 -->
        <el-form-item label="超链接"
          prop="link">
          <el-input v-model="form.link"
            placeholder="请输入超链接地址" />
        </el-form-item>
        <!-- 提交按钮 -->
        <el-form-item>
          <el-button type="primary"
            @click="handleSubmit">提交</el-button>
        </el-form-item>
      </el-form>

    </el-card>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { submitOtherReportAPI } from '@/api' // 假设你的API接口

// 表单数据
const form = ref({
  link: '',
  remark: ''
})

// 提交处理
const handleSubmit = async () => {
  try {
    if (!form.value.group || !form.value.link) {
      ElMessage.warning('请填写完整信息')
      return
    }

    await submitOtherReportAPI(form.value)
    ElMessage.success('提交成功')
    // 清空表单
    form.value = {
      link: '',
      remark: ''
    }
  } catch (error) {
    ElMessage.error('提交失败')
  }
}
</script>

<style scoped>
.app-container {
  padding: 20px;
}
</style>
