From 8a83d674fa87300dd18499e7ceaa7a2f783af7b5 Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期一, 23 六月 2025 17:13:31 +0800
Subject: [PATCH] feat: 设备台账完成导出删除

---
 src/views/equipmentManagement/ledger/Modal.vue |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/src/views/equipmentManagement/ledger/Modal.vue b/src/views/equipmentManagement/ledger/Modal.vue
new file mode 100644
index 0000000..d1562dd
--- /dev/null
+++ b/src/views/equipmentManagement/ledger/Modal.vue
@@ -0,0 +1,60 @@
+<template>
+  <el-dialog :title="modalOptions.title" v-model="visible">
+    <Form ref="formRef"></Form>
+    <template #footer>
+      <el-button @click="closeModal">{{ modalOptions.cancelText }}</el-button>
+      <el-button type="primary" @click="sendForm" :loading="loading">
+        {{ modalOptions.confirmText }}
+      </el-button>
+    </template>
+  </el-dialog>
+</template>
+
+<script setup>
+import { useModal } from "@/hooks/useModal";
+import { addLedger, editLedger } from "@/api/equipmentManagement/ledger";
+import Form from "./Form.vue";
+import { ElMessage } from "element-plus";
+
+defineOptions({
+  name: "璁惧鍙拌处鏂板缂栬緫",
+});
+
+const emits = defineEmits(["success"]);
+
+const formRef = ref();
+const {
+  id,
+  visible,
+  loading,
+  openModal,
+  modalOptions,
+  handleConfirm,
+  closeModal,
+} = useModal();
+
+const sendForm = async () => {
+  loading.value = true;
+  const { code } = id.value
+    ? await editLedger({ id: id.value, ...formRef.value.form })
+    : await addLedger(formRef.value.form);
+  if (code == 200) {
+    emits("success");
+    ElMessage({ message: "鎿嶄綔鎴愬姛", type: "success" });
+    closeModal();
+  } else {
+    loading.value = false;
+  }
+};
+
+const loadForm = async (id) => {
+  openModal(id);
+  await nextTick();
+  formRef.value.loadForm(id);
+};
+
+defineExpose({
+  openModal,
+  loadForm,
+});
+</script>

--
Gitblit v1.9.3