From 7bbab0e74d1d0208fa24ec67e3201427078980cd Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期日, 04 一月 2026 17:01:59 +0800
Subject: [PATCH] 器具校准,校准记录
---
src/views/diagnosis/Modal/RepairModal.vue | 77 ++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/src/views/diagnosis/Modal/RepairModal.vue b/src/views/diagnosis/Modal/RepairModal.vue
new file mode 100644
index 0000000..4e2ef55
--- /dev/null
+++ b/src/views/diagnosis/Modal/RepairModal.vue
@@ -0,0 +1,77 @@
+<template>
+ <el-dialog v-model="visible" :title="modalOptions.title" @close="close">
+ <RepairForm ref="repairFormRef" :id="id" />
+ <template #footer>
+ <el-button type="primary" @click="sendForm" :loading="loading">
+ {{ modalOptions.confirmText }}
+ </el-button>
+ <el-button @click="closeModal">{{ modalOptions.cancelText }}</el-button>
+ </template>
+ </el-dialog>
+</template>
+
+<script setup>
+import { useModal } from "../../../hooks/useModal";
+import RepairForm from "../Form/RepairForm.vue";
+import {
+ addRepair,
+ editRepair,
+ getRepairById,
+} from "../../../api/equipmentManagement/repair";
+import { ElMessage } from "element-plus";
+
+defineOptions({
+ name: "璁惧鏁呴殰寮圭獥",
+});
+
+const emits = defineEmits(["ok"]);
+
+const repairFormRef = ref();
+const {
+ id,
+ visible,
+ loading,
+ openModal,
+ modalOptions,
+ handleConfirm,
+ closeModal,
+} = useModal({ title: "璁惧鏁呴殰" });
+
+const sendForm = async () => {
+ loading.value = true;
+ const form = await repairFormRef.value.getForm();
+ const { code } = id.value
+ ? await editRepair({ id: unref(id), ...form })
+ : await addRepair(form);
+ if (code == 200) {
+ ElMessage.success(`${id ? "缂栬緫" : "鏂板"}鏁呴殰鎴愬姛`);
+ closeModal();
+ emits("ok");
+ }
+ loading.value = false;
+};
+
+const openAdd = async () => {
+ openModal();
+ await nextTick();
+ await repairFormRef.value.loadDeviceName();
+};
+
+const openEdit = async (id) => {
+ const { data } = await getRepairById(id);
+ openModal(id);
+ await nextTick();
+ await repairFormRef.value.loadDeviceName();
+ await repairFormRef.value.setForm(data);
+};
+
+const close = () => {
+ repairFormRef.value.resetForm();
+ closeModal();
+};
+
+defineExpose({
+ openAdd,
+ openEdit,
+});
+</script>
--
Gitblit v1.9.3