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/dict/index.vue | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index f23fa65..710d0fc 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -125,9 +125,7 @@ <script setup name="Dict" lang="ts"> import useDictStore from '@/store/modules/dict' import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"; -import { ComponentInternalInstance } from "vue"; import { DictTypeForm, DictTypeQuery, DictTypeVO } from "@/api/system/dict/type/types"; -import { DateModelType } from 'element-plus'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { sys_normal_disable } = toRefs<any>(proxy?.useDict("sys_normal_disable")) @@ -141,8 +139,8 @@ const total = ref(0); const dateRange = ref<[DateModelType, DateModelType]>(['', '']); -const dictFormRef = ref(ElForm); -const queryFormRef = ref(ElForm); +const dictFormRef = ref<ElFormInstance>(); +const queryFormRef = ref<ElFormInstance>(); const dialog = reactive<DialogOption>({ @@ -191,7 +189,7 @@ /** 琛ㄥ崟閲嶇疆 */ const reset = () => { form.value = {...initFormData}; - dictFormRef.value.resetFields(); + dictFormRef.value?.resetFields(); } /** 鎼滅储鎸夐挳鎿嶄綔 */ const handleQuery = () => { @@ -201,7 +199,7 @@ /** 閲嶇疆鎸夐挳鎿嶄綔 */ const resetQuery = () => { dateRange.value = ['', '']; - queryFormRef.value.resetFields(); + queryFormRef.value?.resetFields(); handleQuery(); } /** 鏂板鎸夐挳鎿嶄綔 */ @@ -232,7 +230,7 @@ } /** 鎻愪氦鎸夐挳 */ const submitForm = () => { - dictFormRef.value.validate(async (valid: boolean) => { + dictFormRef.value?.validate(async (valid: boolean) => { if (valid) { form.value.dictId ? await updateType(form.value) : await addType(form.value); proxy?.$modal.msgSuccess("鎿嶄綔鎴愬姛"); -- Gitblit v1.9.3