代码调整

This commit is contained in:
joylink_cuiweidong 2022-09-29 16:59:38 +08:00
parent c2c746406e
commit dcfbe22510
2 changed files with 41 additions and 39 deletions

View File

@ -84,21 +84,21 @@ export default {
if (valid) { if (valid) {
this.loading = true; this.loading = true;
const data = Object.assign({}, this.formModel); const data = Object.assign({}, this.formModel);
if (data.id) { // markKey
// checkFrontProjectExist({markKey:data.markKey}).then(res=>{
updateFrontProjectConfig(data).then(resp => { if (!res.data) {
this.$message.success('修改前端配置成功!'); if (data.id) {
this.handleClose(); //
this.$emit('reloadTable'); updateFrontProjectConfig(data).then(resp => {
}).catch(error => { this.$message.success('修改前端配置成功!');
this.$message.error(error.message); this.handleClose();
this.loading = false; this.$emit('reloadTable');
}); }).catch(error => {
} else { this.$message.error(error.message);
delete data.id; this.loading = false;
// markKey });
checkFrontProjectExist({markKey:data.markKey}).then(res=>{ } else {
if (!res.data) { delete data.id;
// //
saveFrontProjectConfig(data).then(resp => { saveFrontProjectConfig(data).then(resp => {
this.$message.success('创建前端配置成功!'); this.$message.success('创建前端配置成功!');
@ -108,13 +108,13 @@ export default {
this.$message.error(error.message); this.$message.error(error.message);
this.loading = false; this.loading = false;
}); });
} else {
this.$message.success('此前端配置已存在,请修改配置编码');
} }
} else {
this.loading = false;
this.$message.error('此前端配置已存在,请修改配置编码');
}
});
});
}
} }
}); });
} }

View File

@ -89,20 +89,22 @@ export default {
this.loading = true; this.loading = true;
const data = Object.assign({}, this.formModel); const data = Object.assign({}, this.formModel);
data.viewShow = data.viewShow ? 1 : 0; data.viewShow = data.viewShow ? 1 : 0;
if (data.id) { // code
updateBackProjectConfig(data).then(resp => { checkBackProjectExist({code:data.code}).then(res=>{
this.$message.success('修改项目成功!'); if (!res.data) {
this.handleClose(); if (data.id) {
this.$emit('reloadTable'); //
}).catch(error => { updateBackProjectConfig(data).then(resp => {
this.$message.error(error.message); this.$message.success('修改项目成功!');
this.loading = false; this.handleClose();
}); this.$emit('reloadTable');
} else { }).catch(error => {
delete data.id; this.$message.error(error.message);
// code this.loading = false;
checkBackProjectExist({code:data.code}).then(res=>{ });
if (!res.data) { } else {
delete data.id;
//
saveBackProjectConfig(data).then(resp => { saveBackProjectConfig(data).then(resp => {
this.$message.success('创建项目成功!'); this.$message.success('创建项目成功!');
this.handleClose(); this.handleClose();
@ -111,12 +113,12 @@ export default {
this.$message.error(error.message); this.$message.error(error.message);
this.loading = false; this.loading = false;
}); });
} else {
this.$message.success('此项目已存在,请修改项目编码');
} }
}); } else {
this.loading = false;
} this.$message.error('此项目已存在,请修改项目编码');
}
});
} }
}); });
} }