From f5052fa7d4e73c0df5a02a6ad8987f35df42b8f8 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 07 十一月 2024 17:23:50 +0800 Subject: [PATCH] 1. 完成场景报告模块 2. 日报管理模块添加时间范围选择以及word报告生成 --- src/composables/formConfirm.js | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/composables/formConfirm.js b/src/composables/formConfirm.js index d568fe0..e1eafd1 100644 --- a/src/composables/formConfirm.js +++ b/src/composables/formConfirm.js @@ -1,4 +1,4 @@ -import { defineProps, onActivated, onDeactivated, ref, watch } from 'vue'; +import { defineProps, onActivated, onDeactivated, reactive, ref, watch } from 'vue'; import { useCloned } from '@vueuse/core'; import { useMessageBoxTip, useMessageBox } from './messageBox'; @@ -13,17 +13,17 @@ }, reset = { do: () => {} - } + }, }) { if (!submit.title) submit.title = '鎻愪氦'; if (!submit.msg) submit.msg = '纭鏄惁鎻愪氦锛�'; if (!cancel.title) cancel.title = '鍙栨秷'; if (!cancel.msg) cancel.msg = '鏄惁鏀惧純宸茬紪杈戠殑鍐呭锛�'; - const formProps = defineProps({ - // 鏄惁鍦ㄦ彁浜ゆ垚鍔熷悗娓呯┖琛ㄥ崟 - clearAftSubmit: Boolean - }); + // const formProps = defineProps({ + // // 鏄惁鍦ㄦ彁浜ゆ垚鍔熷悗娓呯┖琛ㄥ崟 + // clearAftSubmit: Boolean + // }); //琛ㄥ崟鍐呭 const formObj = ref(defaultForm ? defaultForm : {}); @@ -69,32 +69,33 @@ // 閲嶇疆琛ㄥ崟 const _reset = function () { + formRef.value.clearValidate(); edit.value = false; isReset = true; formObj.value = useCloned(formObjClone.cloned, { manual: true }).cloned.value; - formRef.value.clearValidate(); }; // 娓呯┖琛ㄥ崟 const clear = function () { isReset = true; - // formRef.value.resetFields(); + formRef.value.resetFields(); edit.value = false; }; // 鎻愪氦鎴愬姛鍚� const submited = function () { - if (formProps.clearAftSubmit) clear(); + // if (formProps.clearAftSubmit) clear(); edit.value = false; formObjClone = useCloned(formObj, { manual: true }); }; // 鎻愪氦琛ㄥ崟 - const onSubmit = function () { - formRef.value.validate((valid) => { + const onSubmit = function (messageBox = true) { + formRef.value.validate(async (valid) => { if (valid) { + if (messageBox) { useMessageBoxTip({ confirmMsg: submit.msg, confirmTitle: submit.title, @@ -104,6 +105,10 @@ return res; } }); + } else { + await submit.do(); + submited(); + } } }); }; @@ -147,5 +152,5 @@ } }; - return { formProps, formObj, formRef, edit, onSubmit, onCancel, onReset }; + return { formObj, formRef, edit, onSubmit, onCancel, onReset, clear }; } -- Gitblit v1.9.3