<script setup lang="ts" name="AddClass">
import { ref } from "vue";
import CustomUpload from "@/components/CustomUpload/index.vue"

const emit = defineEmits(["update:modelValue", "cancel", "confirm"]);

const radioValue = ref(1);
const fileList = ref<File[]>([]);

// 取消
const cancel = () => {
  emit("cancel");
};

// 确认
const confirm = () => {
  console.log(fileList.value);
  // emit("confirm");
};

const handleUpload = (file: File) => {
  console.log(file);
  // 上传文件
  // 处理上传结果
  // 更新modelValue
};
</script>

<template>
  <div>
    <div class="mb20">
      <CustomUpload v-model:file-list="fileList" :limit="1" :needType="false" :needSize="false"  :listShow="false"  prompt='点击或拖拽文件到此处上传' />
    </div>
    <el-form-item label="上传方式" label-width="200px">
      <el-radio-group v-model="radioValue">
        <el-radio :label="1">覆盖原数据</el-radio>
        <el-radio :label="2">追加数据</el-radio>
      </el-radio-group>
    </el-form-item>
    <div class="btn">
      <el-button type="info" style="width: 150px;" @click="cancel">取消</el-button>
      <el-button type="primary" style="width: 150px;" @click="confirm">确认</el-button>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.btn {
  padding: 20px;
  display: flex;
  justify-content: center;
}
</style>