From 2323c93baf009d2f60acaec545622611673203cb Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 18 六月 2025 16:48:13 +0800
Subject: [PATCH] 1.巡检上传页面开发、联调
---
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