<template>
  <div class="app-container">
    <el-card shadow="always" style="width: 55%; margin: 0 auto">
      <LaboratoryForm
        v-model="form"
        :isAdd="false"
        :labelWidth="labelWidth"
        ref="laboratoryForm"
      />
      <div :style="{ marginLeft: labelWidth + 'px' }">
        <el-button @click="$router.go(-1)">取消</el-button>
        <el-button type="primary" @click="submitForm">提交</el-button>
      </div>
    </el-card>
  </div>
</template>
<script setup>
import { laboratory } from "@/api/identity/index";
import LaboratoryForm from "./components/LaboratoryForm";
const { proxy } = getCurrentInstance();
const labelWidth = 140;
const form = reactive({});
function submitForm(status) {
  if (proxy.$refs.laboratoryForm.submitForm()) {
    laboratory(form).then((res) => {
      proxy.$modal.msgSuccess("新增成功");
      proxy.$router.go(-1);
    });
  } else {
    console.log("校验未通过");
  }
}
</script>