资源池添加 loading

This commit is contained in:
W23123 2020-03-23 17:08:27 +08:00
parent 7a04d8f47a
commit 172688f3e1
1 changed files with 13 additions and 4 deletions

View File

@ -69,7 +69,8 @@
</div> </div>
</el-card> </el-card>
<el-dialog title="创建资源池" :visible.sync="createVisible" width="70%" @closed="closeFunc" :destroy-on-close="true"> <el-dialog v-loading="testLoading" title="创建资源池" :visible.sync="createVisible" width="70%" @closed="closeFunc"
:destroy-on-close="true">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" <el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="createTestResourcePoolForm"> ref="createTestResourcePoolForm">
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
@ -143,7 +144,8 @@
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="修改资源池" :visible.sync="updateVisible" width="70%" :destroy-on-close="true" @close="closeFunc"> <el-dialog v-loading="testLoading" title="修改资源池" :visible.sync="updateVisible" width="70%" :destroy-on-close="true"
@close="closeFunc">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" <el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="updateTestResourcePoolForm"> ref="updateTestResourcePoolForm">
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
@ -225,6 +227,7 @@
data() { data() {
return { return {
loading: false, loading: false,
testLoading: false,
createVisible: false, createVisible: false,
infoList: [], infoList: [],
updateVisible: false, updateVisible: false,
@ -363,6 +366,7 @@
if (valide) { if (valide) {
let vri = this.validateResourceInfo(); let vri = this.validateResourceInfo();
if (vri.validate) { if (vri.validate) {
this.testLoading = true;
this.form.info = JSON.stringify(this.infoList); this.form.info = JSON.stringify(this.infoList);
this.$post("/testresourcepool/add", this.form) this.$post("/testresourcepool/add", this.form)
.then(() => { .then(() => {
@ -371,13 +375,15 @@
message: '添加成功!' message: '添加成功!'
}, },
this.createVisible = false, this.createVisible = false,
this.initTableData()) this.initTableData());
this.testLoading = false;
}); });
} else { } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',
message: vri.msg message: vri.msg
}); });
this.testLoading = false;
return false; return false;
} }
@ -389,6 +395,7 @@
updateTestResourcePool(updateTestResourcePoolForm) { updateTestResourcePool(updateTestResourcePoolForm) {
this.$refs[updateTestResourcePoolForm].validate(valide => { this.$refs[updateTestResourcePoolForm].validate(valide => {
if (valide) { if (valide) {
this.testLoading = true;
let vri = this.validateResourceInfo(); let vri = this.validateResourceInfo();
if (vri.validate) { if (vri.validate) {
this.form.info = JSON.stringify(this.infoList); this.form.info = JSON.stringify(this.infoList);
@ -400,13 +407,15 @@
}, },
this.updateVisible = false, this.updateVisible = false,
this.initTableData(), this.initTableData(),
self.loading = false) self.loading = false);
this.testLoading = false;
}); });
} else { } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',
message: vri.msg message: vri.msg
}); });
this.testLoading = false;
return false; return false;
} }
} else { } else {