From 432ddf1abeaa9dcac86f628913af1f2a03cfe22f Mon Sep 17 00:00:00 2001 From: 张诺 <zhang_12370@163.com> Date: 星期三, 18 六月 2025 09:00:09 +0800 Subject: [PATCH] 1.昭德-文档管理上传图片联调 2.昭德-完善生产加工模块 3.昭德-后端协商数据格式页面渲染问题 --- src/views/archiveManagement/mould/archiveDialog.vue | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/views/archiveManagement/mould/archiveDialog.vue b/src/views/archiveManagement/mould/archiveDialog.vue index 521ae1a..844bd1a 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,31 @@ 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; + // fileUploadRef.value.editInit(ruleForm.value); + nextTick(() => { + // console.log("缂栬緫琛ㄥ崟鏁版嵁:", fileUploadRef.value); + 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,15 +130,25 @@ 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 || "鎿嶄綔澶辫触", + }); + console.error("API 璋冪敤澶辫触:", error); + return; + } // 鍙戦�� emit 浜嬩欢 - emit("submitForm", res); - console.log("emit submitForm 宸插彂閫�"); - + // 鍏抽棴瀵硅瘽妗� centerDialogVisible.value = false; } catch (error) { -- Gitblit v1.9.3