From 6af68085ff6615e1ec3a5dd18c761250800d6fca Mon Sep 17 00:00:00 2001 From: LiuHao <liuhaoai545@gmail.com> Date: 星期二, 06 六月 2023 22:23:43 +0800 Subject: [PATCH] update 修改页面代码 去除ele的引入以及vue的类型声明 --- src/views/system/post/index.vue | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index e82cfa2..6b1e8fd 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -109,7 +109,6 @@ <script setup name="Post" lang="ts"> import { listPost, addPost, delPost, getPost, updatePost } from "@/api/system/post"; import { PostForm, PostQuery, PostVO } from "@/api/system/post/types"; -import { ComponentInternalInstance } from "vue"; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { sys_normal_disable } = toRefs<any>(proxy?.useDict("sys_normal_disable")); @@ -122,8 +121,8 @@ const multiple = ref(true); const total = ref(0); -const postFormRef = ref(ElForm); -const queryFormRef = ref(ElForm); +const postFormRef = ref<ElFormInstance>(); +const queryFormRef = ref<ElFormInstance>(); const dialog = reactive<DialogOption>({ visible: false, @@ -173,7 +172,7 @@ /** 琛ㄥ崟閲嶇疆 */ const reset = () => { form.value = {...initFormData}; - postFormRef.value.resetFields(); + postFormRef.value?.resetFields(); } /** 鎼滅储鎸夐挳鎿嶄綔 */ const handleQuery = () => { @@ -182,7 +181,7 @@ } /** 閲嶇疆鎸夐挳鎿嶄綔 */ const resetQuery = () => { - queryFormRef.value.resetFields(); + queryFormRef.value?.resetFields(); handleQuery(); } /** 澶氶�夋閫変腑鏁版嵁 */ @@ -212,12 +211,12 @@ } /** 鎻愪氦鎸夐挳 */ const submitForm = () => { - postFormRef.value.validate(async (valid: boolean) => { + postFormRef.value?.validate(async (valid: boolean) => { if (valid) { form.value.postId ? await updatePost(form.value) : await addPost(form.value); proxy?.$modal.msgSuccess("鎿嶄綔鎴愬姛"); dialog.visible = false; - getList(); + await getList(); } }); } @@ -226,7 +225,7 @@ const postIds = row?.postId || ids.value; await proxy?.$modal.confirm('鏄惁纭鍒犻櫎宀椾綅缂栧彿涓�"' + postIds + '"鐨勬暟鎹」锛�'); await delPost(postIds); - getList(); + await getList(); proxy?.$modal.msgSuccess("鍒犻櫎鎴愬姛"); } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ -- Gitblit v1.9.3