校验 项目和前端项目配置 是否存在
This commit is contained in:
parent
e29fdb0cb3
commit
c2c746406e
@ -125,3 +125,21 @@ export function getAllFrontProjectConfigByLogin(markKey) {
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 检查项目code */
|
||||
export function checkBackProjectExist(params) {
|
||||
return request({
|
||||
url: `/api/project/check/code`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/** 检查项目markKey */
|
||||
export function checkFrontProjectExist(params) {
|
||||
return request({
|
||||
url: `/api/project/check/markKey`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { updateFrontProjectConfig, saveFrontProjectConfig} from '@/api/projectConfig';
|
||||
import { updateFrontProjectConfig, saveFrontProjectConfig, checkFrontProjectExist} from '@/api/projectConfig';
|
||||
export default {
|
||||
name:'AddProjectConfig',
|
||||
data() {
|
||||
@ -96,6 +96,9 @@ export default {
|
||||
});
|
||||
} else {
|
||||
delete data.id;
|
||||
// 检查项目markKey
|
||||
checkFrontProjectExist({markKey:data.markKey}).then(res=>{
|
||||
if (!res.data) {
|
||||
// 保存前端项目配置
|
||||
saveFrontProjectConfig(data).then(resp => {
|
||||
this.$message.success('创建前端配置成功!');
|
||||
@ -105,6 +108,12 @@ export default {
|
||||
this.$message.error(error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.$message.success('此前端配置已存在,请修改配置编码');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -21,7 +21,7 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { saveBackProjectConfig, updateBackProjectConfig} from '@/api/projectConfig';
|
||||
import { saveBackProjectConfig, updateBackProjectConfig, checkBackProjectExist} from '@/api/projectConfig';
|
||||
export default {
|
||||
name: 'AddProject',
|
||||
data() {
|
||||
@ -100,6 +100,9 @@ export default {
|
||||
});
|
||||
} else {
|
||||
delete data.id;
|
||||
// 检查项目code
|
||||
checkBackProjectExist({code:data.code}).then(res=>{
|
||||
if (!res.data) {
|
||||
saveBackProjectConfig(data).then(resp => {
|
||||
this.$message.success('创建项目成功!');
|
||||
this.handleClose();
|
||||
@ -108,6 +111,11 @@ export default {
|
||||
this.$message.error(error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.$message.success('此项目已存在,请修改项目编码');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user