工程项目管理-修复新增按钮多次提交

This commit is contained in:
binbin_pan 2024-04-10 17:22:09 +08:00
parent c69a2e9f5e
commit 4ed4059fc2
2 changed files with 10 additions and 3 deletions

View File

@ -116,7 +116,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" @click="submitForm" :loading="isLoading"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -136,6 +136,7 @@ export default {
components: { Treeselect },
data() {
return {
isLoading: false,
//
loading: true,
//
@ -287,17 +288,24 @@ export default {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
this.isLoading = true;
if (this.form.proId != undefined) {
updateProject(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.isLoading = false;
this.getList();
}).catch(() => {
this.isLoading = false;
});
} else {
addProject(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.isLoading = false;
this.getList();
}).catch(() => {
this.isLoading = false;
});
}
}

View File

@ -24,7 +24,6 @@
plain
icon="el-icon-plus"
size="mini"
:loading="isLoading"
@click="handleAdd"
>新建</el-button>
</el-col>
@ -91,7 +90,7 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" @click="submitForm" :loading="isLoading"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>