提交提单前的验证

This commit is contained in:
xing 2020-06-18 16:53:19 +08:00
parent 12ffc656a6
commit 2b94112e48

View File

@ -56,7 +56,7 @@
</el-card> </el-card>
<el-dialog title="添加用户" :visible.sync="dialogVisible"> <el-dialog title="添加用户" :visible.sync="dialogVisible" @close="formClose">
<!--内在主体区--> <!--内在主体区-->
<el-form :model="addForm" :rules="rules" ref="addFormRef" label-width="70px" > <el-form :model="addForm" :rules="rules" ref="addFormRef" label-width="70px" >
@ -72,16 +72,13 @@
<el-form-item label="手机" prop="mobile"> <el-form-item label="手机" prop="mobile">
<el-input v-model="addForm.mobile"></el-input> <el-input v-model="addForm.mobile"></el-input>
</el-form-item> </el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
<el-button @click="resetForm('ruleForm')">重置</el-button>
</el-form-item>
</el-form> </el-form>
<!--底部区--> <!--底部区-->
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -141,8 +138,16 @@ export default {
} }
}, },
methods: { methods: {
submitForm (form) { formClose () {
this.resetForm()
},
submitForm () {
this.$refs.addFormRef.validate(validate => {
if (!validate) {
return
}
this.dialogVisible = false
})
}, },
resetForm () { resetForm () {
this.$refs.addFormRef.resetFields() this.$refs.addFormRef.resetFields()