<template>
  <div class="detail_container">
    <bg-breadcrumb></bg-breadcrumb>
    <div class="main_container">
      <div class="add-form-main bg-scroll">
        <add-form ref="add_form"></add-form>
      </div>
      <div class="add-btns">
        <el-button size="default" @click="Cancle">取消</el-button>
        <el-button type="primary" size="default" @click="SaveSubmit">保存</el-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
import addForm from "../modules/add-form.vue";
import { Save } from "../modules/interface.js";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const route = useRoute();
const { id, class_id } = route.query;
const add_form = ref(null);
const params = {};
const SaveSubmit = async () => {
  let res = await add_form.value.Submit();
  if (!res) return;
  Save(res, { id, class_id }, () => {
    Cancle();
  });
};
const Cancle = () => {
  router.go(-1);
};
</script>

<style lang="scss" scoped>
.detail_container {
  width: 100%;
  height: calc(100vh - 56px);
  padding: 0 24px 16px;
  min-height: 100%;
  .main_container {
    height: calc(100% - 46px);
    padding: 0;
    .add-form-main {
      padding: 24px 24px 16px;
      height: calc(100% - 68px);
    }
    .add-btns {
      height: 68px;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      border-top: 1px solid #ddd;
      padding: 0 24px;
    }
  }
}
</style>
