From ffb1bd190e9d4263c8c7d6c0096e0ec844cb3b52 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期四, 19 六月 2025 17:30:55 +0800 Subject: [PATCH] 1.系统管理样式修改 --- src/views/archiveManagement/mould/archiveDialog.vue | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/views/archiveManagement/mould/archiveDialog.vue b/src/views/archiveManagement/mould/archiveDialog.vue index 521ae1a..5406cc2 100644 --- a/src/views/archiveManagement/mould/archiveDialog.vue +++ b/src/views/archiveManagement/mould/archiveDialog.vue @@ -36,10 +36,11 @@ </el-row> </template> <fileUpload - v-model="ruleForm.file" + ref="fileUploadRef" :fileSize="1024" :fileType="['pdf', 'docx', 'txt', 'xlsx', 'pptx....']" :limit="10" + v-model:modelValue="modelValue" /> </el-dialog> </template> @@ -48,6 +49,7 @@ import { ref, watch } from "vue"; import { addOrEditArchive } from "@/api/archiveManagement"; import fileUpload from "@/components/FileUpload/index.vue"; +import { ElMessage } from "element-plus"; const centerDialogVisible = defineModel("centerDialogVisible", { type: Boolean, @@ -72,6 +74,7 @@ name: "", type: "", status: "", + storageBlobDTO: [], // 纭繚 storageBlobDTO 鏄竴涓暟缁� }; }; @@ -93,13 +96,29 @@ type: [{ required: true, message: "璇烽�夋嫨鏂囨。绫诲瀷", trigger: "blur" }], status: [{ required: true, message: "璇烽�夋嫨鏂囨。鐘舵��", trigger: "blur" }], }; +const fileUploadRef = ref(null); +const initForm = () => { + ruleForm.value = {} + fileUploadRef.value.init() +}; +const editForm = (val) => { + ruleForm.value = copyForm.value; + nextTick(() => { + fileUploadRef.value.editInit(val); + }); +}; +defineExpose({ + initForm, + editForm, +}); const options = [ { value: "鏈夋晥", label: "鏈夋晥" }, { value: "鏃犳晥", label: "鏃犳晥" }, { value: "浣滃簾", label: "浣滃簾" }, ]; -const emit = defineEmits(["submitForm"]); +const emit = defineEmits(["submitForm", "update:modelValue"]); +const modelValue = ref([]); const submit = async () => { // 楠岃瘉琛ㄥ崟 if (!ruleFormRef.value) return; @@ -109,19 +128,31 @@ if (!valid) { return; } - + ruleForm.value.storageBlobDTO = modelValue.value; // 纭繚 ruleForm 鏄渶鏂扮殑 // 璋冪敤 API - let res = await addOrEditArchive(ruleForm.value); - console.log("API 鍝嶅簲:", res); - + try { + const res = await addOrEditArchive(ruleForm.value); + ElMessage({ + type: "success", + message: res.msg || "鎿嶄綔鎴愬姛", + }); + emit("submitForm", res); + } catch (error) { + ElMessage({ + type: "error", + message: error.msg || "鎿嶄綔澶辫触", + }); + return; + } // 鍙戦�� emit 浜嬩欢 - emit("submitForm", res); - console.log("emit submitForm 宸插彂閫�"); - + // 鍏抽棴瀵硅瘽妗� centerDialogVisible.value = false; } catch (error) { - console.error("琛ㄥ崟楠岃瘉澶辫触鎴朅PI璋冪敤澶辫触:", error); + ElMessage({ + type: "error", + message: error.msg || "鎿嶄綔澶辫触", + }); } }; </script> -- Gitblit v1.9.3