From 647ef6974a149e21bc88e4b559ba9badaafe367e Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: Mon, 11 Jul 2022 18:02:28 +0800
Subject: [PATCH] 添加我的申请tab切换页面,优化组件表单的校验
---
src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/highWorkForm.vue | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/highWorkForm.vue b/src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/highWorkForm.vue
index 009bf9d..1ae364a 100644
--- a/src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/highWorkForm.vue
+++ b/src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/highWorkForm.vue
@@ -1,6 +1,6 @@
<template>
<div class="comp-container">
- <el-form :model="hwForm" label-width="150px" :rules="hwRules" ref="ruleFormRef">
+ <el-form :model="hwForm" label-width="150px" :rules="hwRules" ref="hwRef">
<div class="homeCard">
<el-row>
<el-col :span="8">
@@ -80,13 +80,24 @@
const { userInfos } = storeToRefs(userInfo);
const state = reactive<stateType>({});
const hwForm1 = reactive(props.hwForm)
- const ruleFormRef = ref<FormInstance>()
+ const hwRef = ref<FormInstance>()
const hwRules = reactive<FormRules>({
hwDepartment:[{required: true,message: '此处不可为空',trigger: 'blur'}],
hwApplyName:[{required: true,message: '此处不可为空',trigger: 'blur'}],
hwLevel: [{required: true,message: '此处不可为空',trigger: 'blur'}],
hwHeight: [{required: true,message: '此处不可为空',trigger: 'blur'}]
})
+ const validateForm = async () => {
+ let flag = null
+ await hwRef.value.validate(valid=>{
+ if(valid){
+ flag = true
+ }else{
+ flag = false
+ }
+ })
+ return flag
+ }
// 折线图
const renderMenu = async (value: string) => {
Session.set('projectId',value)
@@ -96,8 +107,9 @@
return {
renderMenu,
hwForm1,
- ruleFormRef,
+ hwRef,
hwRules,
+ validateForm,
...toRefs(state),
};
},
--
Gitblit v1.9.2