diff --git a/console-web/src/main.js b/console-web/src/main.js index 3017d64a..f6b129e7 100644 --- a/console-web/src/main.js +++ b/console-web/src/main.js @@ -13,11 +13,13 @@ import cloneDeep from 'lodash/cloneDeep' import './utils/directives.js' import dict from './utils/dict' import { Scrollbar } from 'element-ui' // 滚动条 +import storage from './utils/storage' // 滚动条 Vue.use(Scrollbar) Vue.use(VueCookie) Vue.config.productionTip = false Vue.prototype.dict = dict +Vue.prototype.storage = storage // 非生产环境, 适配mockjs模拟数据 // api: https://github.com/nuysoft/Mock if (process.env.NODE_ENV !== 'production') { diff --git a/console-web/src/store/index.js b/console-web/src/store/index.js index 258c9f1e..45322a68 100644 --- a/console-web/src/store/index.js +++ b/console-web/src/store/index.js @@ -13,8 +13,8 @@ export default new Vuex.Store({ }, mutations: { // 重置vuex本地储存状态 - resetStore (state) { - Object.keys(state).forEach((key) => { + resetStore(state) { + Object.keys(state).forEach(key => { state[key] = cloneDeep(window.SITE_CONFIG['storeState'][key]) }) } diff --git a/console-web/src/views/modules/opn/opn-gateway.vue b/console-web/src/views/modules/opn/opn-gateway.vue index 33347ace..4b1e8dd0 100644 --- a/console-web/src/views/modules/opn/opn-gateway.vue +++ b/console-web/src/views/modules/opn/opn-gateway.vue @@ -32,21 +32,17 @@ -
- - - - - +
+
-
- +
+
-
- +
+
-
- +
+
@@ -81,10 +77,20 @@ activated() { this.getGatewayList() }, + computed: { + gatewayId: { + get() { return this.storage.get('openapi/gatewayId') }, + set(val) { + console.log('gatewayId:' + val) + this.storage.set('openapi/gatewayId', val) + } + } + }, methods: { handleSelect(key, keyPath) { let value = key[0] this.activeIndex = value + this.gatewaySelectChange() }, getGatewayList() { // 获取网关列表 @@ -97,13 +103,24 @@ if (isGDASucc(data)) { this.gatewayList = data.data this.dataForm.gateway_id = this.gatewayList[0]['id'] - this.$refs.opnInterfaceInf.refreshGatewayId(this.dataForm.gateway_id) + this.gatewayId = this.dataForm.gateway_id + this.gatewaySelectChange() } }) }, - gatewaySelectChange(value) { - this.$refs.opnInterfaceInf.refreshGatewayId(value) - this.$refs.opnBackendServerInf.refreshGatewayId(value) + gatewaySelectChange() { + this.gatewayId = this.dataForm.gateway_id + this.$nextTick(() => { + if (this.activeIndex === '1') { + this.$refs.opnInterfaceInf.refresh(this.dataForm.gateway_id) + } else if (this.activeIndex === '2') { + this.$refs.opnBackendServerInf.refresh(this.dataForm.gateway_id) + } else if (this.activeIndex === '3') { + this.$refs.opnStrategyMng.refresh(this.dataForm.gateway_id) + } else if (this.activeIndex === '4') { + this.$refs.opnStrategyIpInf.refresh(this.dataForm.gateway_id) + } + }) } } } diff --git a/console-web/src/views/modules/opn/opninterfaceinf.vue b/console-web/src/views/modules/opn/opninterfaceinf.vue index 4450b145..d3af1412 100644 --- a/console-web/src/views/modules/opn/opninterfaceinf.vue +++ b/console-web/src/views/modules/opn/opninterfaceinf.vue @@ -8,7 +8,8 @@ - 管理 + 刷新 + 管理 @@ -78,7 +79,6 @@ import InterfaceGroupInf from './opninterfacegroupinf' import { isGDASucc } from '@/utils' - import { debug } from 'util' export default { data() { @@ -107,13 +107,21 @@ // this.getGroupList() }, methods: { + refresh(gatewayId) { + this.dataForm.gateway_id = gatewayId + this.getGroupList() + }, // 获取数据列表 getDataList01() { this.pageIndex = 1 this.$refs.pagination.lastEmittedPage = 1 this.getDataList() }, + getGatewayId() { + return this.storage.get('openapi/gatewayId') + }, getDataList() { + this.dataForm.gateway_id = this.getGatewayId() this.dataListLoading = true this.$http({ url: this.$http.adornUrl('/buiopnbpc1/opninterfaceinf/listByGatewayAndGroup.do'), @@ -146,6 +154,7 @@ this.getDataList01() }, getGroupList() { + this.dataForm.gateway_id = this.getGatewayId() // 获取接口组 this.$http({ url: this.$http.adornUrl(`/buiopnbpc1/opninterfacegroupinf/listByGateway.do?gateway_id=${this.dataForm.gateway_id}`), @@ -164,10 +173,6 @@ } }) }, - refreshGatewayId(gatewayId) { - this.dataForm.gateway_id = gatewayId - this.getGroupList() - }, // 每页数 sizeChangeHandle(val) { this.pageSize = val diff --git a/console-web/src/views/modules/opn/opnstrategyauthinf-add-or-update.vue b/console-web/src/views/modules/opn/opnstrategyauthinf-add-or-update.vue index 9c701ab9..4e453e7e 100644 --- a/console-web/src/views/modules/opn/opnstrategyauthinf-add-or-update.vue +++ b/console-web/src/views/modules/opn/opnstrategyauthinf-add-or-update.vue @@ -1,24 +1,6 @@