diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index bc758dcdb..0d944a17a 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -4,6 +4,12 @@ import { fromRoute } from '@/components/common/js/constants' import routerPathParams from '@/components/common/mixin/routerPathParams' export default { mixins: [routerPathParams], + props: { + showTab: { + type: String, + default: '' + } + }, data () { return { fromRoute: fromRoute, @@ -81,11 +87,14 @@ export default { this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.tools.loading = true - if (this.$route.fullPath.match(/\/(\S*)\?/)[1] !== 'snmp' || this.$route.fullPath.match(/\/(\S*)\?/)[1] !== 'template') { + if (this.$route.fullPath.match(/\/(\S*)\?/)[1] !== 'snmp') { const dataListParam = { ...this.searchLabel, ...this.searchCheckBox } + if (this.showTab) { + dataListParam.showTab = this.showTab + } const path = this.$route.fullPath.match(/\/(\S*)\?/)[1] this.updatePath(dataListParam, path) } @@ -298,21 +307,6 @@ export default { } }, created () { - // { - // // key: path 键 - // // value: vue set 参数 - // pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' }, - // pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' }, - // orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' }, - // ids: { target: this.searchLabel, propertyName: 'ids', type: 'number' }, - // severityIds: { target: this.searchLabel, propertyName: 'severityIds', type: 'string' }, - // type: { target: this.searchLabel, propertyName: 'type', type: 'number' }, - // name: { target: this.searchLabel, propertyName: 'name', type: 'string' }, - // typeIds: { target: this.searchCheckBox, propertyName: 'typeIds', type: 'number' }, - // ping: { target: this.searchCheckBox, propertyName: 'ping', type: 'string' }, - // modelIds: { target: this.searchCheckBox, propertyName: 'modelIds', type: 'number' }, - // fields: { target: this.searchCheckBox, propertyName: 'fields', type: 'json' } - // } const path = this.$route.fullPath.match(/\/(\S*)\?/)[1] let searchKeys = {} if (path === 'dc') { @@ -675,6 +669,54 @@ export default { jsonKey: 'val' } } + } else if (path === 'template' && this.$route.query.showTab) { + searchKeys = { + // key: path 键 + // value: vue set 参数 + pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' }, + pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' }, + orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' }, + ids: { + target: this.searchLabel, + propertyName: 'ids', + type: 'string', + defaultJson: { + disabled: false, + label: 'ids', + name: 'ID', + type: 'input', + val: '' + }, + jsonKey: 'val' + }, + name: { + target: this.searchLabel, + propertyName: 'name', + type: 'string', + defaultJson: { + disabled: false, + id: 'name', + label: 'name', + name: 'Name', + type: 'input', + val: '' + }, + jsonKey: 'val' + }, + gname: { + target: this.searchLabel, + propertyName: 'gname', + type: 'string', + defaultJson: { + disabled: false, + label: 'gname', + name: 'Group', + type: 'input', + val: '' + }, + jsonKey: 'val' + } + } } this.initQueryFromPath(searchKeys) }, diff --git a/nezha-fronted/src/components/page/config/system.vue b/nezha-fronted/src/components/page/config/system.vue index 80413ca50..f82461250 100644 --- a/nezha-fronted/src/components/page/config/system.vue +++ b/nezha-fronted/src/components/page/config/system.vue @@ -340,13 +340,13 @@ - + - + - +
@@ -385,9 +385,11 @@ import linkTab from './system/linkTab' import apiKeyTab from './system/apiKeyTab' import moment from 'moment-timezone' import License from './system/license' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'system', components: { draggable, latlngPicker, notifyMethod, linkTab, apiKeyTab, License }, + mixins: [routerPathParams], data () { return { imageFormatErr: false, @@ -612,6 +614,10 @@ export default { console.error('type is required') return } + if (type !== 'link' && type !== 'notification' && type !== 'apiKey') { + const t = +new Date() + this.updatePath({ t }) + } if (type == 'reset' || type == 'link' || type == 'notification' || type == 'apiKey' || type == 'license') { return } @@ -1041,6 +1047,9 @@ export default { mounted () { this.querySetInfo(this.activeTab) this.queryTimezone() + }, + created () { + this.activeTab = this.$route.query.activeTab || 'basic' } } diff --git a/nezha-fronted/src/components/page/config/system/apiKeyTab.vue b/nezha-fronted/src/components/page/config/system/apiKeyTab.vue index 5342ea164..32bc9eacc 100644 --- a/nezha-fronted/src/components/page/config/system/apiKeyTab.vue +++ b/nezha-fronted/src/components/page/config/system/apiKeyTab.vue @@ -48,6 +48,9 @@ export default { name: 'apiKeyTab', components: { nzDataList, apiKeyTable }, mixins: [dataListMixin, parentTableCommon], + props: { + activeTab: String + }, data () { return { url: '/sys/apiKey', diff --git a/nezha-fronted/src/components/page/config/system/linkTab.vue b/nezha-fronted/src/components/page/config/system/linkTab.vue index fea352578..2d68d85f5 100644 --- a/nezha-fronted/src/components/page/config/system/linkTab.vue +++ b/nezha-fronted/src/components/page/config/system/linkTab.vue @@ -48,6 +48,9 @@ export default { name: 'linkTab', components: { nzDataList, linkTable }, mixins: [dataListMixin, parentTableCommon], + props: { + activeTab: String + }, data () { return { url: '/link', diff --git a/nezha-fronted/src/components/page/config/system/notifyMethodTab.vue b/nezha-fronted/src/components/page/config/system/notifyMethodTab.vue index 05382ef3c..014b8bcea 100644 --- a/nezha-fronted/src/components/page/config/system/notifyMethodTab.vue +++ b/nezha-fronted/src/components/page/config/system/notifyMethodTab.vue @@ -85,6 +85,9 @@ export default { name: 'notifyMethodTab', components: { nzDataList, notifyMethodTable }, mixins: [dataListMixin, parentTableCommon], + props: { + activeTab: String + }, data () { return { url: 'alert/notify/method', diff --git a/nezha-fronted/src/components/page/config/system/systemCommon.js b/nezha-fronted/src/components/page/config/system/systemCommon.js index 26e5c5585..c7161caf1 100644 --- a/nezha-fronted/src/components/page/config/system/systemCommon.js +++ b/nezha-fronted/src/components/page/config/system/systemCommon.js @@ -1,4 +1,5 @@ import { file } from '@topology/core/src/middles/nodes/file' +import routerPathParams from '@/components/common/mixin/routerPathParams' export const tableCommon = { data () { @@ -93,10 +94,25 @@ export const tableCommon = { } } export const parentTableCommon = { + mixins: [routerPathParams], + props: { + activeTab: { + type: String, + default: '' + } + }, methods: { getTableData: function () { this.searchLabel.pageSize = -1 this.tools.loading = true + const systemParam = { + ...this.searchLabel + } + if (this.activeTab) { + systemParam.activeTab = this.activeTab + } + const path = this.$route.fullPath.match(/\/(\S*)\?/)[1] + this.updatePath(systemParam, path) this.$get(this.url, this.searchLabel).then(response => { this.tools.loading = false if (response.code === 200) { @@ -111,5 +127,128 @@ export const parentTableCommon = { } }) } + }, + created () { + const path = this.$route.fullPath.match(/\/(\S*)\?/)[1] + let searchKeys = {} + if (path === 'system' && this.$route.query.activeTab == 'link') { + searchKeys = { + // key: path 键 + // value: vue set 参数 + pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' }, + pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' }, + orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' }, + ids: { + target: this.searchLabel, + propertyName: 'ids', + type: 'string', + defaultJson: { + disabled: false, + label: 'ids', + name: 'ID', + type: 'input', + val: '' + }, + jsonKey: 'val' + }, + name: { + target: this.searchLabel, + propertyName: 'name', + type: 'string', + defaultJson: { + disabled: false, + id: 'name', + label: 'name', + name: 'Name', + type: 'input', + val: '' + }, + jsonKey: 'val' + } + } + } else if (path === 'system' && this.$route.query.activeTab == 'apiKey') { + searchKeys = { + // key: path 键 + // value: vue set 参数 + pageNo: { target: this.pageObj, propertyName: 'pageNo', type: 'number' }, + pageSize: { target: this.pageObj, propertyName: 'pageSize', type: 'number' }, + orderBy: { target: this.$data, propertyName: 'orderBy', type: 'string' }, + ids: { + target: this.searchLabel, + propertyName: 'ids', + type: 'string', + defaultJson: { + disabled: false, + label: 'ids', + name: 'ID', + type: 'input', + val: '' + }, + jsonKey: 'val' + }, + name: { + target: this.searchLabel, + propertyName: 'name', + type: 'string', + defaultJson: { + disabled: false, + id: 'name', + label: 'name', + name: 'Name', + type: 'input', + val: '' + }, + jsonKey: 'val' + } + } + } else if (path === 'system' && this.$route.query.activeTab == 'notification') { + searchKeys = { + // key: path 键 + // value: vue set 参数 + pageNo: { + target: this.pageObj, + propertyName: 'pageNo', + type: 'number' + }, + pageSize: { + target: this.pageObj, + propertyName: 'pageSize', + type: 'number' + }, + orderBy: { + target: this.$data, + propertyName: 'orderBy', + type: 'string' + }, + ids: { + target: this.searchLabel, + propertyName: 'ids', + type: 'string', + defaultJson: { + disabled: false, + label: 'ids', + name: 'ID', + type: 'input', + val: '' + }, + jsonKey: 'val' + }, + name: { + target: this.searchLabel, + propertyName: 'name', + type: 'string', + defaultJson: { + disabled: false, + id: 'name', + label: 'name', + name: 'Name', + type: 'input', + val: '' + }, + jsonKey: 'val' + } + } + } + this.initQueryFromPath(searchKeys) } } diff --git a/nezha-fronted/src/components/page/config/template/chartTemp.vue b/nezha-fronted/src/components/page/config/template/chartTemp.vue index 0ddfdf2f1..a927a4636 100644 --- a/nezha-fronted/src/components/page/config/template/chartTemp.vue +++ b/nezha-fronted/src/components/page/config/template/chartTemp.vue @@ -95,7 +95,6 @@ diff --git a/nezha-fronted/src/components/page/config/template/index.vue b/nezha-fronted/src/components/page/config/template/index.vue index 2e170b653..af282fdb3 100644 --- a/nezha-fronted/src/components/page/config/template/index.vue +++ b/nezha-fronted/src/components/page/config/template/index.vue @@ -8,15 +8,17 @@