创建接口测试时,带入最后选择的项目

This commit is contained in:
q4speed 2020-06-02 16:12:20 +08:00
parent 74a49ae13f
commit 2d118712a2
6 changed files with 28 additions and 7 deletions

View File

@ -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 => {

View File

@ -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) {

View File

@ -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
}
})

View File

@ -4,6 +4,7 @@ export default {
'organization': 'Organization',
'setting': 'Setting',
'project': 'Project',
current_project: 'Current Project',
'name': 'Name',
'description': 'Description',
'clear': 'Clear',

View File

@ -4,6 +4,7 @@ export default {
'organization': '组织',
'setting': '设置',
'project': '项目',
current_project: '当前项目',
'name': '名称',
'description': '描述',
'clear': '清空',

View File

@ -4,6 +4,7 @@ export default {
'organization': '組織',
'setting': '設置',
'project': '項目',
current_project: '當前項目',
'name': '名稱',
'description': '描述',
'clear': '清空',