fix(接口定义): 修改默认模块

This commit is contained in:
fit2-zhao 2021-03-30 11:46:22 +08:00
parent 61f7a82371
commit e0182038b9
6 changed files with 14 additions and 15 deletions

View File

@ -243,7 +243,7 @@ public class ApiAutomationService {
scenario.setUserId(request.getUserId()); scenario.setUserId(request.getUserId());
} }
if (StringUtils.isEmpty(request.getApiScenarioModuleId()) || StringUtils.isEmpty(request.getModulePath())) { if (StringUtils.isEmpty(request.getApiScenarioModuleId()) || StringUtils.isEmpty(request.getModulePath())) {
scenario.setApiScenarioModuleId("root"); scenario.setApiScenarioModuleId("default-module");
scenario.setModulePath("/默认模块"); scenario.setModulePath("/默认模块");
} }
return scenario; return scenario;

View File

@ -264,7 +264,7 @@ public class ApiDefinitionService {
test.setTags(request.getTags()); test.setTags(request.getTags());
if (StringUtils.isEmpty(request.getModulePath()) || StringUtils.isEmpty(request.getModuleId())) { if (StringUtils.isEmpty(request.getModulePath()) || StringUtils.isEmpty(request.getModuleId())) {
test.setModulePath("/默认模块"); test.setModulePath("/默认模块");
test.setModuleId("root"); test.setModuleId("default-module");
} }
apiDefinitionMapper.updateByPrimaryKeySelective(test); apiDefinitionMapper.updateByPrimaryKeySelective(test);
return test; return test;
@ -292,7 +292,7 @@ public class ApiDefinitionService {
test.setModuleId(request.getModuleId()); test.setModuleId(request.getModuleId());
if (StringUtils.isEmpty(request.getModulePath()) || StringUtils.isEmpty(request.getModuleId())) { if (StringUtils.isEmpty(request.getModulePath()) || StringUtils.isEmpty(request.getModuleId())) {
test.setModulePath("/默认模块"); test.setModulePath("/默认模块");
test.setModuleId("root"); test.setModuleId("default-module");
} }
test.setResponse(JSONObject.toJSONString(request.getResponse())); test.setResponse(JSONObject.toJSONString(request.getResponse()));
test.setEnvironmentId(request.getEnvironmentId()); test.setEnvironmentId(request.getEnvironmentId());
@ -605,7 +605,7 @@ public class ApiDefinitionService {
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
ApiDefinitionWithBLOBs item = data.get(i); ApiDefinitionWithBLOBs item = data.get(i);
if (StringUtils.isEmpty(item.getModuleId()) || StringUtils.isEmpty(item.getModulePath())) { if (StringUtils.isEmpty(item.getModuleId()) || StringUtils.isEmpty(item.getModulePath())) {
item.setModuleId("root"); item.setModuleId("default-module");
item.setModulePath("/默认模块"); item.setModulePath("/默认模块");
} }
if (item.getName().length() > 255) { if (item.getName().length() > 255) {

View File

@ -296,7 +296,7 @@
} }
let api = { let api = {
status: "Underway", method: "GET", userId: getCurrentUser().id, status: "Underway", method: "GET", userId: getCurrentUser().id,
url: "", protocol: this.currentProtocol, environmentId: "", moduleId: 'root', modulePath: "/" + this.$t("commons.module_title") url: "", protocol: this.currentProtocol, environmentId: "", moduleId: 'default-module', modulePath: "/" + this.$t("commons.module_title")
}; };
if (this.nodeTree && this.nodeTree.length > 0) { if (this.nodeTree && this.nodeTree.length > 0) {
api.moduleId = this.nodeTree[0].id; api.moduleId = this.nodeTree[0].id;

View File

@ -275,7 +275,7 @@
} }
}, },
addModule(row) { addModule(row) {
this.saveApi(row, "root"); this.saveApi(row, "default-module");
}, },
saveApi(row, module) { saveApi(row, module) {
let data = this.api; let data = this.api;

View File

@ -20,7 +20,7 @@
:condition="condition" :condition="condition"
:current-module="currentModule" :current-module="currentModule"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:moduleOptions="extendTreeNodes" :moduleOptions="data"
@exportAPI="exportAPI" @exportAPI="exportAPI"
@saveAsEdit="saveAsEdit" @saveAsEdit="saveAsEdit"
@refreshTable="$emit('refreshTable')" @refreshTable="$emit('refreshTable')"
@ -62,7 +62,6 @@
}, },
data: [], data: [],
currentModule: {}, currentModule: {},
extendTreeNodes: [],
} }
}, },
props: { props: {
@ -131,17 +130,17 @@
this.result = this.$get(url, response => { this.result = this.$get(url, response => {
if (response.data != undefined && response.data != null) { if (response.data != undefined && response.data != null) {
this.data = response.data; this.data = response.data;
this.extendTreeNodes = []; this.data.unshift({
this.extendTreeNodes.unshift({ "id": "default-module",
"id": "root",
"name": this.$t('commons.module_title'), "name": this.$t('commons.module_title'),
"level": 0, "level": 0,
"children": this.data, "path": "/" + this.$t('commons.module_title'),
"children": [],
}); });
this.extendTreeNodes.forEach(node => { this.data.forEach(node => {
buildTree(node, {path: ''}); buildTree(node, {path: ''});
}); });
this.$emit('setModuleOptions', this.extendTreeNodes); this.$emit('setModuleOptions', this.data);
this.$emit('setNodeTree', this.data); this.$emit('setNodeTree', this.data);
if (this.$refs.nodeTree) { if (this.$refs.nodeTree) {
this.$refs.nodeTree.filter(this.condition.filterText); this.$refs.nodeTree.filter(this.condition.filterText);

View File

@ -92,7 +92,7 @@ export default {
allLabel: { allLabel: {
type: String, type: String,
default() { default() {
return this.$t('commons.module_title'); return this.$t("commons.all_label.case");
} }
}, },
nameLimit: { nameLimit: {