diff --git a/src/views/system/frontProjectConfigManage/add.vue b/src/views/system/frontProjectConfigManage/add.vue index bca2de56d..d9ac4302e 100644 --- a/src/views/system/frontProjectConfigManage/add.vue +++ b/src/views/system/frontProjectConfigManage/add.vue @@ -84,21 +84,21 @@ export default { if (valid) { this.loading = true; const data = Object.assign({}, this.formModel); - if (data.id) { - // 更新前端项目配置 - updateFrontProjectConfig(data).then(resp => { - this.$message.success('修改前端配置成功!'); - this.handleClose(); - this.$emit('reloadTable'); - }).catch(error => { - this.$message.error(error.message); - this.loading = false; - }); - } else { - delete data.id; - // 检查项目markKey - checkFrontProjectExist({markKey:data.markKey}).then(res=>{ - if (!res.data) { + // 检查项目markKey + checkFrontProjectExist({markKey:data.markKey}).then(res=>{ + if (!res.data) { + if (data.id) { + // 更新前端项目配置 + updateFrontProjectConfig(data).then(resp => { + this.$message.success('修改前端配置成功!'); + this.handleClose(); + this.$emit('reloadTable'); + }).catch(error => { + this.$message.error(error.message); + this.loading = false; + }); + } else { + delete data.id; // 保存前端项目配置 saveFrontProjectConfig(data).then(resp => { this.$message.success('创建前端配置成功!'); @@ -108,13 +108,13 @@ export default { this.$message.error(error.message); this.loading = false; }); - } else { - this.$message.success('此前端配置已存在,请修改配置编码'); } + } else { + this.loading = false; + this.$message.error('此前端配置已存在,请修改配置编码'); + } + }); - }); - - } } }); } diff --git a/src/views/system/projectManage/add.vue b/src/views/system/projectManage/add.vue index 2c649dc8d..5f8b4efd6 100644 --- a/src/views/system/projectManage/add.vue +++ b/src/views/system/projectManage/add.vue @@ -89,20 +89,22 @@ export default { this.loading = true; const data = Object.assign({}, this.formModel); data.viewShow = data.viewShow ? 1 : 0; - if (data.id) { - updateBackProjectConfig(data).then(resp => { - this.$message.success('修改项目成功!'); - this.handleClose(); - this.$emit('reloadTable'); - }).catch(error => { - this.$message.error(error.message); - this.loading = false; - }); - } else { - delete data.id; - // 检查项目code - checkBackProjectExist({code:data.code}).then(res=>{ - if (!res.data) { + // 检查项目code + checkBackProjectExist({code:data.code}).then(res=>{ + if (!res.data) { + if (data.id) { + // 更新后端项目配置 + updateBackProjectConfig(data).then(resp => { + this.$message.success('修改项目成功!'); + this.handleClose(); + this.$emit('reloadTable'); + }).catch(error => { + this.$message.error(error.message); + this.loading = false; + }); + } else { + delete data.id; + // 保存后端项目配置 saveBackProjectConfig(data).then(resp => { this.$message.success('创建项目成功!'); this.handleClose(); @@ -111,12 +113,12 @@ export default { this.$message.error(error.message); this.loading = false; }); - } else { - this.$message.success('此项目已存在,请修改项目编码'); } - }); - - } + } else { + this.loading = false; + this.$message.error('此项目已存在,请修改项目编码'); + } + }); } }); }