fix(接口自动化): 环境配置列表显示不准确的问题
This commit is contained in:
parent
c8c96d8919
commit
d18c1aa9ed
|
@ -48,7 +48,8 @@
|
|||
"vuedraggable": "^2.24.3",
|
||||
"vuex": "^3.1.2",
|
||||
"xml-js": "^1.6.11",
|
||||
"yan-progress": "^1.0.3"
|
||||
"yan-progress": "^1.0.3",
|
||||
"jsonpath": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.1.0",
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
<!-- 步骤组件-->
|
||||
<ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId" :node="node" :project-list="projectList" :env-map="projectEnvMap"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="reload"/>
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload"/>
|
||||
</span>
|
||||
</el-tree>
|
||||
</div>
|
||||
|
@ -215,8 +215,8 @@
|
|||
import ScenarioRelevance from "./api/ScenarioRelevance";
|
||||
import MsComponentConfig from "./component/ComponentConfig";
|
||||
import {handleCtrlSEvent} from "../../../../../common/js/utils";
|
||||
import {getProject} from "@/business/components/api/automation/scenario/event";
|
||||
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
|
||||
let jsonPath = require('jsonpath');
|
||||
export default {
|
||||
name: "EditApiScenario",
|
||||
props: {
|
||||
|
@ -295,12 +295,6 @@
|
|||
this.getApiScenario();
|
||||
this.addListener(); // 添加 ctrl s 监听
|
||||
},
|
||||
mounted() {
|
||||
getProject.$on('addProjectEnv', (projectId, projectEnv) => {
|
||||
this.projectIds.add(projectId);
|
||||
// this.projectEnvMap.set(projectId, projectEnv);
|
||||
})
|
||||
},
|
||||
directives: {OutsideClick},
|
||||
computed: {
|
||||
buttons() {
|
||||
|
@ -583,6 +577,7 @@
|
|||
}
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
this.scenarioVisible = false;
|
||||
},
|
||||
setApiParameter(item, refType, referenced) {
|
||||
|
@ -624,6 +619,7 @@
|
|||
});
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
|
@ -647,15 +643,10 @@
|
|||
const parent = node.parent
|
||||
const hashTree = parent.data.hashTree || parent.data;
|
||||
const index = hashTree.findIndex(d => d.resourceId != undefined && row.resourceId != undefined && d.resourceId === row.resourceId)
|
||||
if (hashTree[index] && hashTree[index].projectId) {
|
||||
this.projectIds.delete(hashTree[index].projectId);
|
||||
if (this.projectEnvMap.has(hashTree[index].projectId)) {
|
||||
this.projectEnvMap.delete(hashTree[index].projectId);
|
||||
}
|
||||
}
|
||||
hashTree.splice(index, 1);
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -992,9 +983,6 @@
|
|||
}
|
||||
return size;
|
||||
},
|
||||
beforeDestroy() {
|
||||
getProject.$off('addProjectEnv');
|
||||
},
|
||||
handleEnv() {
|
||||
this.$refs.apiScenarioEnv.open();
|
||||
},
|
||||
|
@ -1006,6 +994,17 @@
|
|||
this.projectList = res.data;
|
||||
})
|
||||
},
|
||||
refReload() {
|
||||
this.initProjectIds();
|
||||
this.reload();
|
||||
},
|
||||
initProjectIds() {
|
||||
this.projectIds.clear();
|
||||
this.scenarioDefinition.forEach(data=>{
|
||||
let arr = jsonPath.query(data, "$..projectId");
|
||||
arr.forEach(a => this.projectIds.add(a));
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -62,7 +62,9 @@ export default {
|
|||
// 固定环境列表渲染顺序
|
||||
let temp = this.data.find(dt => dt.id === id);
|
||||
temp.envs = envs;
|
||||
temp.selectEnv = this.envMap.get(id);
|
||||
let envId = this.envMap.get(id);
|
||||
// 选中环境是否存在
|
||||
temp.selectEnv = envs.filter(e =>e.id === envId).length === 0 ? null : envId;
|
||||
})
|
||||
})
|
||||
},
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import ApiResponseComponent from "./ApiResponseComponent";
|
||||
import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo";
|
||||
import {getProject} from "@/business/components/api/automation/scenario/event";
|
||||
|
||||
export default {
|
||||
name: "MsApiComponent",
|
||||
|
@ -123,7 +122,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
getProject.$emit('addProjectEnv', this.request.projectId, this.currentEnvironmentId);
|
||||
},
|
||||
computed: {
|
||||
displayColor() {
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters";
|
||||
import MsApiRequestForm from "../../../definition/components/request/http/ApiHttpRequestForm";
|
||||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import {getProject} from "@/business/components/api/automation/scenario/event";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
|
@ -49,7 +48,6 @@
|
|||
if (!this.scenario.projectId) {
|
||||
this.scenario.projectId = getCurrentProjectID();
|
||||
}
|
||||
getProject.$emit('addProjectEnv', this.scenario.projectId, this.currentEnvironmentId);
|
||||
if (this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded) {
|
||||
this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => {
|
||||
if (response.data) {
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
import Vue from 'vue';
|
||||
export const getProject = new Vue();
|
Loading…
Reference in New Issue