From 80367ddf4383493729420bb62aa8c8ebb9616dd9 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期日, 04 一月 2026 16:54:04 +0800
Subject: [PATCH] 代码调整9
---
src/views/contractor/evaluateTemplate/Modal.vue | 71 +++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/src/views/contractor/evaluateTemplate/Modal.vue b/src/views/contractor/evaluateTemplate/Modal.vue
new file mode 100644
index 0000000..7efe4e9
--- /dev/null
+++ b/src/views/contractor/evaluateTemplate/Modal.vue
@@ -0,0 +1,71 @@
+<template>
+ <el-dialog :title="modalOptions.title" v-model="visible" @close="close" width="30%">
+ <Form ref="formRef"></Form>
+ <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 { add, update } from "@/api/financialManagement/revenueManagement";
+import Form from "./Form.vue";
+import { ElMessage } from "element-plus";
+import dayjs from "dayjs";
+const { proxy } = getCurrentInstance()
+
+defineOptions({
+ name: "鏀跺叆鏂板缂栬緫",
+});
+
+const emits = defineEmits(["success"]);
+
+const formRef = ref();
+const {
+ id,
+ visible,
+ loading,
+ openModal,
+ modalOptions,
+ handleConfirm,
+ closeModal,
+} = useModal({ title: "鏀跺叆" });
+
+const sendForm = () => {
+ proxy.$refs.formRef.$refs.formRef.validate(async valid => {
+ if (valid) {
+ formRef.value.form.incomeDate = dayjs(new Date()).format("YYYY-MM-DD")
+ const {code} = id.value
+ ? await update({id: id.value, ...formRef.value.form})
+ : await add(formRef.value.form);
+ if (code == 200) {
+ emits("success");
+ ElMessage({message: "鎿嶄綔鎴愬姛", type: "success"});
+ close();
+ } else {
+ loading.value = false;
+ }
+ }
+ })
+};
+
+const close = () => {
+ formRef.value.resetFormAndValidate();
+ closeModal();
+};
+
+const loadForm = async (id) => {
+ openModal(id);
+ await nextTick();
+ formRef.value.loadForm(id);
+};
+
+defineExpose({
+ openModal,
+ loadForm,
+});
+</script>
--
Gitblit v1.9.3