创建接口测试时,带入最后选择的项目
This commit is contained in:
parent
74a49ae13f
commit
2d118712a2
|
@ -85,9 +85,7 @@
|
|||
|
||||
methods: {
|
||||
init() {
|
||||
this.result = this.$get("/project/listAll", response => {
|
||||
this.projects = response.data;
|
||||
})
|
||||
let projectId;
|
||||
if (this.id) {
|
||||
this.create = false;
|
||||
this.getTest(this.id);
|
||||
|
@ -97,7 +95,14 @@
|
|||
if (this.$refs.config) {
|
||||
this.$refs.config.reset();
|
||||
}
|
||||
// 仅创建时获取选择的项目
|
||||
projectId = this.$store.state.common.projectId;
|
||||
}
|
||||
this.result = this.$get("/project/listAll", response => {
|
||||
this.projects = response.data;
|
||||
// 等待项目列表加载完
|
||||
if (projectId) this.test.projectId = projectId;
|
||||
})
|
||||
},
|
||||
getTest(id) {
|
||||
this.result = this.$get("/api/get/" + id, response => {
|
||||
|
|
|
@ -148,6 +148,9 @@
|
|||
},
|
||||
init() {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
if (this.projectId && this.projectId !== "all") {
|
||||
this.$store.commit('setProjectId', this.projectId);
|
||||
}
|
||||
this.search();
|
||||
},
|
||||
filter(value, row) {
|
||||
|
|
|
@ -3,6 +3,17 @@ import Vuex from 'vuex'
|
|||
|
||||
Vue.use(Vuex);
|
||||
|
||||
const Common = {
|
||||
state: {
|
||||
projectId: ""
|
||||
},
|
||||
mutations: {
|
||||
setProjectId(state, projectId) {
|
||||
state.projectId = projectId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const API = {
|
||||
state: {
|
||||
test: {}
|
||||
|
@ -14,13 +25,12 @@ const API = {
|
|||
clearTest(state) {
|
||||
state.test = {};
|
||||
}
|
||||
},
|
||||
actions: {},
|
||||
getters: {}
|
||||
}
|
||||
}
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
api: API
|
||||
api: API,
|
||||
common: Common
|
||||
}
|
||||
})
|
||||
|
|
|
@ -4,6 +4,7 @@ export default {
|
|||
'organization': 'Organization',
|
||||
'setting': 'Setting',
|
||||
'project': 'Project',
|
||||
current_project: 'Current Project',
|
||||
'name': 'Name',
|
||||
'description': 'Description',
|
||||
'clear': 'Clear',
|
||||
|
|
|
@ -4,6 +4,7 @@ export default {
|
|||
'organization': '组织',
|
||||
'setting': '设置',
|
||||
'project': '项目',
|
||||
current_project: '当前项目',
|
||||
'name': '名称',
|
||||
'description': '描述',
|
||||
'clear': '清空',
|
||||
|
|
|
@ -4,6 +4,7 @@ export default {
|
|||
'organization': '組織',
|
||||
'setting': '設置',
|
||||
'project': '項目',
|
||||
current_project: '當前項目',
|
||||
'name': '名稱',
|
||||
'description': '描述',
|
||||
'clear': '清空',
|
||||
|
|
Loading…
Reference in New Issue