From 8a83d674fa87300dd18499e7ceaa7a2f783af7b5 Mon Sep 17 00:00:00 2001 From: 曹睿 <360930172@qq.com> Date: 星期一, 23 六月 2025 17:13:31 +0800 Subject: [PATCH] feat: 设备台账完成导出删除 --- src/hooks/useModal.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/src/hooks/useModal.js b/src/hooks/useModal.js new file mode 100644 index 0000000..12d945c --- /dev/null +++ b/src/hooks/useModal.js @@ -0,0 +1,42 @@ +import { ref } from "vue"; +export function useModal(options) { + const id = ref(); + const visible = ref(false); + const loading = ref(false); + const modalOptions = ref({}); + + const openModal = (e) => { + id.value = e; + modalOptions.value = { + title: e ? "缂栬緫璁惧鍙拌处" : "鏂板璁惧鍙拌处", + content: "纭畾鎵ц姝ゆ搷浣滃悧锛�", + confirmText: "纭畾", + cancelText: "鍙栨秷", + ...options, + }; + visible.value = true; + }; + + // 鍏抽棴妯℃�佹 + const closeModal = () => { + visible.value = false; + loading.value = false; + }; + + // 纭鎿嶄綔 + const handleConfirm = async (callback) => { + loading.value = true; + callback(); + closeModal(); + }; + + return { + id, + visible, + loading, + modalOptions, + openModal, + closeModal, + handleConfirm, + }; +} -- Gitblit v1.9.3