From 0d78623ad767cc507e6442066905255d56e6d027 Mon Sep 17 00:00:00 2001
From: yz_08 <yz_0812@outlook.com>
Date: 星期四, 04 二月 2021 01:27:16 +0800
Subject: [PATCH] 添加提交信息验证
---
src/views/user/Informationinput.vue | 86 +++++++++++++++++++++++-------------------
1 files changed, 47 insertions(+), 39 deletions(-)
diff --git a/src/views/user/Informationinput.vue b/src/views/user/Informationinput.vue
index bbf0435..2b48fa9 100644
--- a/src/views/user/Informationinput.vue
+++ b/src/views/user/Informationinput.vue
@@ -381,7 +381,7 @@
</el-main>
</el-container>
<el-dialog title="基本信息" :visible.sync="dialogshowArr[0].show" width="50%">
- <el-form :model="empBaseInfoForm" :rules="rules" label-position="right" label-width="120px">
+ <el-form ref="empBaseInfoForm" :model="empBaseInfoForm" :rules="rules" label-position="right" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="档案号">
@@ -543,7 +543,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="护卫点" required prop="deptNeme">
+ <el-form-item label="护卫点" required message="请选择护卫点" prop="deptNeme">
<treeselect
v-model="empBaseInfoForm.deptId"
:multiple="false"
@@ -635,8 +635,8 @@
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="putEmpBase()">保 存</el-button>
- <el-button type="primary" @click="putEmpBaseContinue()">保存并继续新增</el-button>
+ <el-button type="primary" @click="putEmpBase('empBaseInfoForm')">保 存</el-button>
+ <el-button type="primary" @click="putEmpBaseContinue('empBaseInfoForm')">保存并继续新增</el-button>
<el-button @click="dialogIsShow()">取 消</el-button>
</div>
</el-dialog>
@@ -2760,42 +2760,50 @@
this.empBaseInfoForm.version = row.version
this.dialogshowArr[0].show = true
},
- putEmpBase() {
- if (this.isAdd) {
- this.$post('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
- this.buttonLoading = false
- this.$message({
- message: this.$t('tips.createSuccess'),
- type: 'success'
- })
- this.cleanEmpBase()
- this.selectEmpBase()
- })
- } else {
- this.$put('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
- this.$message({
- message: this.$t('tips.updateSuccess'),
- type: 'success'
- })
- this.$emit('success')
- this.cleanEmpBase()
- this.selectEmpBase()
- })
- }
- this.dialogIsShow()
+ putEmpBase(formName) {
+ this.$refs[formName].validate((valid) => {
+ if (valid) {
+ if (this.isAdd) {
+ this.$post('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
+ this.buttonLoading = false
+ this.$message({
+ message: this.$t('tips.createSuccess'),
+ type: 'success'
+ })
+ this.cleanEmpBase()
+ this.selectEmpBase()
+ })
+ } else {
+ this.$put('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
+ this.$message({
+ message: this.$t('tips.updateSuccess'),
+ type: 'success'
+ })
+ this.$emit('success')
+ this.cleanEmpBase()
+ this.selectEmpBase()
+ })
+ }
+ this.dialogIsShow()
+ }
+ })
},
- putEmpBaseContinue() {
- if (this.isAdd) {
- this.$post('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
- this.buttonLoading = false
- this.$message({
- message: this.$t('tips.createSuccess'),
- type: 'success'
- })
- this.cleanEmpBase()
- this.selectEmpBase()
- })
- }
+ putEmpBaseContinue(formName) {
+ this.$refs[formName].validate((valid) => {
+ if (valid) {
+ if (this.isAdd) {
+ this.$post('hr/empBaseInfo', { ...this.empBaseInfoForm }).then(() => {
+ this.buttonLoading = false
+ this.$message({
+ message: this.$t('tips.createSuccess'),
+ type: 'success'
+ })
+ this.cleanEmpBase()
+ this.selectEmpBase()
+ })
+ }
+ }
+ })
},
selectWorkExperience() {
this.$get('hr/empWorkExperience/list')
--
Gitblit v1.8.0