<template>
  <el-form ref="form" label-width="84px">
    <el-form-item label="模型名称">
      <el-input
        v-model="bindModel.modelTitle"
        maxlength="50"
        placeholder="请输入模型名称"
      />
    </el-form-item>
  </el-form>
</template>

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

const props = defineProps<{ model: ModelScene }>();
const bindModel = ref<ModelScene>({ ...props.model });

defineExpose<QuiskExpose>({
  async submit() {
    if (!bindModel.value.modelTitle || !bindModel.value.modelTitle.trim()) {
      ElMessage.error("模型名称不能为空");
      throw "模型名称不能为空";
    }
    await setModelScene(bindModel.value);
  },
});
</script>
