<template>
  <el-form label-width="100px">
    <el-form-item label="SN：" required>
      <el-input
        v-model="data.sn"
        style="width: 250px"
        :maxlength="500"
        placeholder="请输入"
      />
    </el-form-item>
  </el-form>
</template>

<script setup lang="ts">
import { QuiskExpose } from "@/helper/mount";
import { ElMessage } from "element-plus";
import { ref } from "vue";

const props = defineProps<{
  submit: (sn: string) => Promise<any>;
}>();
const data = ref({ sn: "" });

defineExpose<QuiskExpose>({
  async submit() {
    if (!data.value.sn) {
      ElMessage.error("请输入SN！");
      throw "请输入SN！";
    }
    await props.submit(data.value.sn);
  },
});
</script>
