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/hangLoadForm.vue | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/hangLoadForm.vue b/src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/hangLoadForm.vue
index 858080e..6b36361 100644
--- a/src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/hangLoadForm.vue
+++ b/src/views/specialWorkSystem/workApplyManagement/workApplyForm/components/hangLoadForm.vue
@@ -1,6 +1,6 @@
<template>
<div class="comp-container">
- <el-form :model="hlForm" label-width="180px" :rules="hlFormRules" ref="ruleFormRef">
+ <el-form :model="hlForm" label-width="180px" :rules="hlFormRules" ref="hlRef">
<div class="homeCard">
<el-row>
<el-col :span="8">
@@ -87,18 +87,15 @@
}
export default defineComponent({
name: 'hangLoadForm',
- setup() {
+ props: {
+ hlForm: Object
+ },
+ setup(props) {
const userInfo = useUserInfo()
const { userInfos } = storeToRefs(userInfo);
const state = reactive<stateType>({});
- const hlForm = reactive({
- hlDepartment: '',
- hlApplyName: '',
- hlLevel: '',
- hlWeight: '',
- hlToolsName: ''
- })
- const ruleFormRef = ref<FormInstance>()
+ const hlForm1 = reactive(props.hlForm)
+ const hlRef = ref<FormInstance>()
const hlFormRules = reactive<FormRules>({
hlDepartment:[{required: true,message: '此处不可为空',trigger: 'blur'}],
hlApplyName:[{required: true,message: '此处不可为空',trigger: 'blur'}],
@@ -106,6 +103,17 @@
hlWeight: [{required: true,message: '此处不可为空',trigger: 'blur'}],
hlToolsName: [{required: true,message: '此处不可为空',trigger: 'blur'}]
})
+ const validateForm = async () => {
+ let flag = null
+ await hlRef.value.validate(valid=>{
+ if(valid){
+ flag = true
+ }else{
+ flag = false
+ }
+ })
+ return flag
+ }
// 折线图
const renderMenu = async (value: string) => {
Session.set('projectId',value)
@@ -114,9 +122,10 @@
};
return {
renderMenu,
- hlForm,
+ hlForm1,
hlFormRules,
- ruleFormRef,
+ hlRef,
+ validateForm,
...toRefs(state),
};
},
--
Gitblit v1.9.2