From 97c79199452f7a4969f2a2bc821089cee52657a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Tue, 17 Jan 2023 23:24:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/getters.js | 7 +- src/store/index.js | 10 +- src/store/modules/projectInfo.js | 29 --- src/store/modules/xm.js | 95 ++++++++++ src/store/modules/xmIteration.js | 29 --- src/store/modules/xmProduct.js | 29 --- src/views/xm/core/xmTestCasedb/index.vue | 69 ++++++++ src/views/xm/core/xmTestCasedb/top-nav.vue | 194 +++++++++++++++++++++ 8 files changed, 365 insertions(+), 97 deletions(-) delete mode 100644 src/store/modules/projectInfo.js create mode 100644 src/store/modules/xm.js delete mode 100644 src/store/modules/xmIteration.js delete mode 100644 src/store/modules/xmProduct.js create mode 100644 src/views/xm/core/xmTestCasedb/index.vue create mode 100644 src/views/xm/core/xmTestCasedb/top-nav.vue diff --git a/src/store/getters.js b/src/store/getters.js index ce55f5ba..174243d5 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -21,8 +21,9 @@ const getters = { added: state => state.permission.added, isLoadOk:state=>state.user.isLoadOk, noticeMsg:state=>state.noticeMsg.noticeMsg, - projectInfo:state=>state.projectInfo.projectInfo, - xmProduct:state=>state.xmProduct.xmProduct, - xmIteration:state=>state.xmIteration.xmIteration, + projectInfo:state=>state.xm.projectInfo, + xmProduct:state=>state.xm.xmProduct, + xmIteration:state=>state.xm.xmIteration, + testCasedb:state=>state.xm.testCasedb, } export default getters diff --git a/src/store/index.js b/src/store/index.js index bef0efcd..1c45a23a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -5,10 +5,8 @@ import errorLog from './modules/errorLog' import permission from './modules/permission' import tagsView from './modules/tagsView' import user from './modules/user' -import noticeMsg from './modules/noticeMsg' -import projectInfo from './modules/projectInfo' -import xmProduct from './modules/xmProduct' -import xmIteration from './modules/xmIteration' +import noticeMsg from './modules/noticeMsg' +import xm from './modules/xm' import getters from './getters' @@ -22,9 +20,7 @@ const store = new Vuex.Store({ tagsView, user, noticeMsg, - projectInfo, - xmProduct, - xmIteration, + xm, }, getters }) diff --git a/src/store/modules/projectInfo.js b/src/store/modules/projectInfo.js deleted file mode 100644 index c3d0ee94..00000000 --- a/src/store/modules/projectInfo.js +++ /dev/null @@ -1,29 +0,0 @@ - -var key='xm-project-info'; -const projectInfo = { - state: { - projectInfo: null, - }, - mutations: { - SET_PROJECT_INFO: (state, projectInfo) => { - state.projectInfo=projectInfo - if(projectInfo && projectInfo!='null' && projectInfo!='undefined' ){ - sessionStorage.setItem(key,JSON.stringify(projectInfo)) - }else{ - sessionStorage.removeItem(key) - } - - } - }, - actions: { - setProjectInfo({ commit }, projectInfo) { - commit('SET_PROJECT_INFO', projectInfo) - } - } -} -var projectStr=sessionStorage.getItem(key) -if(projectStr && projectStr!='null' && projectStr!='undefined' ){ - projectInfo.state.projectInfo=JSON.parse(projectStr) -} - -export default projectInfo diff --git a/src/store/modules/xm.js b/src/store/modules/xm.js new file mode 100644 index 00000000..8d7f24e9 --- /dev/null +++ b/src/store/modules/xm.js @@ -0,0 +1,95 @@ + +var iterationKey='xm-iteration-store'; +var productKey='xm-product-store'; +var projectKey='xm-project-info-store'; +var testCasedbKey='xm-test-casedb-store'; + +const xm = { + state: { + xmIteration: null, + xmProduct:null, + projectInfo:null, + testCasedb:null, + }, + mutations: { + SET_XM_ITERATION: (state, xmIteration) => { + state.xmIteration=xmIteration + if(xmIteration && xmIteration!='null' && xmIteration!='undefined' ){ + sessionStorage.setItem(iterationKey,JSON.stringify(xmIteration)) + }else{ + sessionStorage.removeItem(iterationKey) + } + + }, + + SET_XM_PRODUCT: (state, xmProduct) => { + state.xmProduct=xmProduct + if(xmProduct && xmProduct!='null' && xmProduct!='undefined' ){ + sessionStorage.setItem(productKey,JSON.stringify(xmProduct)) + }else{ + sessionStorage.removeItem(productKey) + } + + }, + + + SET_PROJECT_INFO: (state, projectInfo) => { + state.projectInfo=projectInfo + if(projectInfo && projectInfo!='null' && projectInfo!='undefined' ){ + sessionStorage.setItem(projectKey,JSON.stringify(projectInfo)) + }else{ + sessionStorage.removeItem(projectKey) + } + + }, + + SET_TEST_CASEDB: (state, testCasedb) => { + state.testCasedb=testCasedb + if(testCasedb && testCasedb!='null' && testCasedb!='undefined' ){ + sessionStorage.setItem(testCasedbKey,JSON.stringify(testCasedb)) + }else{ + sessionStorage.removeItem(testCasedbKey) + } + + }, + + }, + actions: { + setXmIteration({ commit }, xmIteration) { + commit('SET_XM_ITERATION', xmIteration) + }, + + setXmProduct({ commit }, xmProduct) { + commit('SET_XM_PRODUCT', xmProduct) + }, + + setProjectInfo({ commit }, projectInfo) { + commit('SET_PROJECT_INFO', projectInfo) + }, + + setTestCasedb({ commit }, testCasedb) { + commit('SET_TEST_CASEDB', testCasedb) + } + } +} +var iterationStr=sessionStorage.getItem(iterationKey) +if(iterationStr && iterationStr!='null' && iterationStr!='undefined' ){ + xm.state.xmIteration=JSON.parse(iterationStr) +} + +var xmProductStr=sessionStorage.getItem(productKey) +if(xmProductStr && xmProductStr!='null' && xmProductStr!='undefined' ){ + xm.state.xmProduct=JSON.parse(xmProductStr) +} + +var projectStr=sessionStorage.getItem(projectKey) +if(projectStr && projectStr!='null' && projectStr!='undefined' ){ + xm.state.projectInfo=JSON.parse(projectStr) +} + +var testCasedbStr=sessionStorage.getItem(testCasedbKey) +if(testCasedbStr && testCasedbStr!='null' && testCasedbStr!='undefined' ){ + xm.state.testCasedb=JSON.parse(testCasedbStr) +} + +export default xm diff --git a/src/store/modules/xmIteration.js b/src/store/modules/xmIteration.js deleted file mode 100644 index c2efcc49..00000000 --- a/src/store/modules/xmIteration.js +++ /dev/null @@ -1,29 +0,0 @@ - -var key='xm-iteration'; -const xmIteration = { - state: { - xmIteration: null, - }, - mutations: { - SET_XM_ITERATION: (state, xmIteration) => { - state.xmIteration=xmIteration - if(xmIteration && xmIteration!='null' && xmIteration!='undefined' ){ - sessionStorage.setItem(key,JSON.stringify(xmIteration)) - }else{ - sessionStorage.removeItem(key) - } - - } - }, - actions: { - setXmIteration({ commit }, xmIteration) { - commit('SET_XM_ITERATION', xmIteration) - } - } -} -var iterationStr=sessionStorage.getItem(key) -if(iterationStr && iterationStr!='null' && iterationStr!='undefined' ){ - xmIteration.state.xmIteration=JSON.parse(iterationStr) -} - -export default xmIteration diff --git a/src/store/modules/xmProduct.js b/src/store/modules/xmProduct.js deleted file mode 100644 index 1e5a0a23..00000000 --- a/src/store/modules/xmProduct.js +++ /dev/null @@ -1,29 +0,0 @@ - -var key='xm-product'; -const xmProduct = { - state: { - xmProduct: null, - }, - mutations: { - SET_XM_PRODUCT: (state, xmProduct) => { - state.xmProduct=xmProduct - if(xmProduct && xmProduct!='null' && xmProduct!='undefined' ){ - sessionStorage.setItem(key,JSON.stringify(xmProduct)) - }else{ - sessionStorage.removeItem(key) - } - - } - }, - actions: { - setXmProduct({ commit }, xmProduct) { - commit('SET_XM_PRODUCT', xmProduct) - } - } -} -var xmProductStr=sessionStorage.getItem(key) -if(xmProductStr && xmProductStr!='null' && xmProductStr!='undefined' ){ - xmProduct.state.xmProduct=JSON.parse(xmProductStr) -} - -export default xmProduct diff --git a/src/views/xm/core/xmTestCasedb/index.vue b/src/views/xm/core/xmTestCasedb/index.vue new file mode 100644 index 00000000..9e3d3428 --- /dev/null +++ b/src/views/xm/core/xmTestCasedb/index.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/views/xm/core/xmTestCasedb/top-nav.vue b/src/views/xm/core/xmTestCasedb/top-nav.vue new file mode 100644 index 00000000..f0dc5ac6 --- /dev/null +++ b/src/views/xm/core/xmTestCasedb/top-nav.vue @@ -0,0 +1,194 @@ + + + + +