From 69e558de449bd708bc27eb2204d0e6c02d245a80 Mon Sep 17 00:00:00 2001 From: Luo Fan <44999219+fannluo@users.noreply.github.com> Date: Sun, 14 Apr 2019 18:08:14 +0800 Subject: [PATCH] =?UTF-8?q?improvement:=20=E6=95=B0=E6=8D=AE=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=A1=B5=E9=9D=A2=E6=8B=89=E5=8F=96=E6=89=80=E6=9C=89?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=20#119=20(#122)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline/blueflow/src/api/index.js | 7 +++++-- .../src/pages/statistics/Appmaker/index.vue | 12 ++++++------ .../blueflow/src/pages/statistics/Atom/index.vue | 16 ++++++++-------- .../src/pages/statistics/Instance/index.vue | 15 +++++++-------- .../src/pages/statistics/Template/index.vue | 14 +++++++------- pipeline/blueflow/src/store/index.js | 16 ++++++++++++---- 6 files changed, 45 insertions(+), 35 deletions(-) diff --git a/pipeline/blueflow/src/api/index.js b/pipeline/blueflow/src/api/index.js index 39849de147..c8062fc529 100644 --- a/pipeline/blueflow/src/api/index.js +++ b/pipeline/blueflow/src/api/index.js @@ -51,11 +51,14 @@ const api = { /** * 获取当前用户有权限业务 */ - getBizList () { + getBizList (isAll) { const prefixUrl = this.getPrefix('business') const opts = { method: 'GET', - url: prefixUrl + url: prefixUrl, + params: { + all: isAll + } } return request(opts) }, diff --git a/pipeline/blueflow/src/pages/statistics/Appmaker/index.vue b/pipeline/blueflow/src/pages/statistics/Appmaker/index.vue index 0f6c076c29..71bdb47649 100644 --- a/pipeline/blueflow/src/pages/statistics/Appmaker/index.vue +++ b/pipeline/blueflow/src/pages/statistics/Appmaker/index.vue @@ -96,7 +96,7 @@
state.bizList, + allBusinessList: state => state.allBusinessList, categorys: state => state.categorys, site_url: state => state.site_url }), businessList () { - if (this.bizList.length === 0) { - this.getBizList() + if (this.allBusinessList.length === 0) { + this.getBizList(1) } - const list = tools.deepClone(this.bizList) - list.unshift({cc_id: 'all', cc_name: i18n.choiceAllBusiness}) + const list = tools.deepClone(this.allBusinessList) + list.unshift({cc_id: undefined, cc_name: i18n.choiceAllBusiness}) return list }, categoryList () { diff --git a/pipeline/blueflow/src/pages/statistics/Atom/index.vue b/pipeline/blueflow/src/pages/statistics/Atom/index.vue index 6cfb6024f2..47b2d94d93 100644 --- a/pipeline/blueflow/src/pages/statistics/Atom/index.vue +++ b/pipeline/blueflow/src/pages/statistics/Atom/index.vue @@ -81,7 +81,7 @@
state.bizList, + allBusinessList: state => state.allBusinessList, categorys: state => state.categorys, site_url: state => state.site_url }), businessList () { - if (this.bizList.length === 0) { - this.getBizList() + if (this.allBusinessList.length === 0) { + this.getBizList(1) } - const list = tools.deepClone(this.bizList) - list.unshift({cc_id: 'all', cc_name: i18n.choiceAllBusiness}) + const list = tools.deepClone(this.allBusinessList) + list.unshift({cc_id: undefined, cc_name: i18n.choiceAllBusiness}) return list }, componentsList () { diff --git a/pipeline/blueflow/src/pages/statistics/Instance/index.vue b/pipeline/blueflow/src/pages/statistics/Instance/index.vue index a574cb34d3..c825f6d2e1 100644 --- a/pipeline/blueflow/src/pages/statistics/Instance/index.vue +++ b/pipeline/blueflow/src/pages/statistics/Instance/index.vue @@ -160,7 +160,7 @@
state.bizList, - instanceList: state => state.bizList, + allBusinessList: state => state.allBusinessList, categorys: state => state.categorys, site_url: state => state.site_url }), businessList () { - if (this.bizList.length === 0) { - this.getBizList() + if (this.allBusinessList.length === 0) { + this.getBizList(1) } - const list = tools.deepClone(this.bizList) - list.unshift({cc_id: 'all', cc_name: i18n.choiceAllBusiness}) + const list = tools.deepClone(this.allBusinessList) + list.unshift({cc_id: undefined, cc_name: i18n.choiceAllBusiness}) return list }, categoryList () { diff --git a/pipeline/blueflow/src/pages/statistics/Template/index.vue b/pipeline/blueflow/src/pages/statistics/Template/index.vue index 3b829f52f3..280e4b385e 100644 --- a/pipeline/blueflow/src/pages/statistics/Template/index.vue +++ b/pipeline/blueflow/src/pages/statistics/Template/index.vue @@ -97,7 +97,7 @@
{{i18n.choiceBusiness}} state.bizList, + allBusinessList: state => state.allBusinessList, categorys: state => state.categorys, site_url: state => state.site_url }), businessList () { - if (this.bizList.length === 0) { - this.getBizList() + if (this.allBusinessList.length === 0) { + this.getBizList(1) } - const list = tools.deepClone(this.bizList) - list.unshift({cc_id: 'all', cc_name: gettext('全部业务')}) + const list = tools.deepClone(this.allBusinessList) + list.unshift({cc_id: undefined, cc_name: gettext('全部业务')}) return list }, categoryList () { diff --git a/pipeline/blueflow/src/store/index.js b/pipeline/blueflow/src/store/index.js index 5b1cd65baf..7b4015281b 100644 --- a/pipeline/blueflow/src/store/index.js +++ b/pipeline/blueflow/src/store/index.js @@ -52,7 +52,8 @@ const store = new Vuex.Store({ isSuperUser: window.IS_SUPERUSER === 1, v1_import_flag: window.IMPORT_V1_FLAG, rsa_pub_key: window.RSA_PUB_KEY, - businessTimezone: window.BUSINESS_TIMEZONE + businessTimezone: window.BUSINESS_TIMEZONE, + allBusinessList: [] }, mutations: { setAppId (state, id) { @@ -81,12 +82,19 @@ const store = new Vuex.Store({ }, setBusinessTimezone (state, data) { state.businessTimezone = data + }, + setAllBusinessList (state, data) { + state.allBusinessList = data } }, actions: { - getBizList ({commit}) { - api.getBizList().then(response => { - commit('setBizList', response.data.objects) + getBizList ({commit}, isAll) { + api.getBizList(isAll).then(response => { + if (isAll) { + commit('setAllBusinessList', response.data.objects) + } else { + commit('setBizList', response.data.objects) + } }) }, changeDefaultBiz ({commit}, ccId) {