Commit 309aac73 authored by chenjianxing's avatar chenjianxing Committed by BugKing
Browse files

refactor: 场景跨项目导入导出置空所属项目

parent dc674611
Showing with 23 additions and 7 deletions
+23 -7
......@@ -70,6 +70,10 @@ public class MsScenarioParser extends MsAbstractParser<ScenarioImport> {
if (scenarioDefinition != null) {
JSONArray hashTree = scenarioDefinition.getJSONArray("hashTree");
setCopy(hashTree);
JSONObject environmentMap = scenarioDefinition.getJSONObject("environmentMap");
if (environmentMap != null) {
scenarioDefinition.put("environmentMap", new HashMap<>());
}
item.setScenarioDefinition(JSONObject.toJSONString(scenarioDefinition));
}
}
......@@ -93,6 +97,11 @@ public class MsScenarioParser extends MsAbstractParser<ScenarioImport> {
if (StringUtils.isNotBlank(referenced) && StringUtils.equals(referenced, "REF")) {
object.put("referenced", "Copy");
}
object.put("projectId", "");
JSONObject environmentMap = object.getJSONObject("environmentMap");
if (environmentMap != null) {
object.put("environmentMap", new HashMap<>());
}
if (CollectionUtils.isNotEmpty(object.getJSONArray("hashTree"))) {
setCopy(object.getJSONArray("hashTree"));
}
......
......@@ -106,15 +106,20 @@
};
},
watch: {
'body.format'() {
'body.format'(oldValue, newValue) {
if (!oldValue) {
return;
}
const MsConvert = new Convert();
if (this.body.format === 'JSON-SCHEMA') {
this.body.jsonSchema = MsConvert.format(JSON.parse(this.body.raw));
} else {
MsConvert.schemaToJsonStr(this.body.jsonSchema, (result) => {
this.$set(this.body, 'raw', result);
this.reloadCodeEdit();
});
if (this.body.jsonSchema) {
MsConvert.schemaToJsonStr(this.body.jsonSchema, (result) => {
this.$set(this.body, 'raw', result);
this.reloadCodeEdit();
});
}
}
}
},
......
......@@ -82,7 +82,7 @@ export default {
},
props: {
screenHeight: {
type: Number,
type: [String, Number],
default: 400,
},
selectNodeIds: {
......
......@@ -4,7 +4,9 @@ export function _handleSelectAll(component, selection, tableData, selectRows, co
if (selection.length > 0) {
if (selection.length === 1) {
selection.hashTree = [];
selectRows.add(selection[0]);
tableData.forEach(item => {
component.$set(item, "showMore", true);
});
} else {
tableData.forEach(item => {
item.hashTree = [];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment