diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index 5c2d272a7..d0e6a03a3 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -1,7 +1,9 @@ import bus from '@/libs/bus' import { tableSet } from '@/components/common/js/tools' import { fromRoute } from '@/components/common/js/constants' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { + mixins: [routerPathParams], data () { return { fromRoute: fromRoute, @@ -79,6 +81,12 @@ export default { this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.tools.loading = true + const dataListParam = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.$route.fullPath.match(/\/(\S*)\?/)[1] + this.updatePath(dataListParam, path) this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => { this.tools.loading = false if (response.code === 200) { @@ -287,6 +295,24 @@ export default { } } }, + created () { + const 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' }, + id: { target: this.searchLabel, propertyName: 'id', 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' } + } + this.initQueryFromPath(searchKeys) + }, mounted () { const pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId) if (pageSize && pageSize !== 'undefined') { diff --git a/nezha-fronted/src/components/common/mixin/routerPathParams.js b/nezha-fronted/src/components/common/mixin/routerPathParams.js index cc74f127f..309202a88 100644 --- a/nezha-fronted/src/components/common/mixin/routerPathParams.js +++ b/nezha-fronted/src/components/common/mixin/routerPathParams.js @@ -2,19 +2,8 @@ import lodash from 'lodash' export default { methods: { // 解析请求参数,初始化 searchLabel - initQueryFromPath () { + initQueryFromPath (searchKeys) { const q = this.$route.query - const 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' }, - id: { target: this.searchLabel, propertyName: 'id', 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' } - } lodash.forIn(searchKeys, (val, key) => { let qv = lodash.get(q, key) if (qv && val.type == 'number') { @@ -24,8 +13,9 @@ export default { }) }, // 更新path,包含请求参数 - updatePath (param) { - this.$router.replace({ path: this.fromRoute.alertRule, query: param }).catch(err => {}) + updatePath (param, path) { + console.log(param) + this.$router.replace({ path: path, query: param }).catch(err => {}) } } } diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index 5229fd2de..40247244c 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -165,6 +165,7 @@ import chart from '@/components/page/dashboard/overview/chart' import { alertMessage as alertMessageConstant, fromRoute } from '@/components/common/js/constants' import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox' import clickSearch from '@/components/common/labelFilter/clickSearch' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'alertMessage', @@ -177,7 +178,7 @@ export default { alertSilenceBox, clickSearch }, - mixins: [dataListMixin], + mixins: [dataListMixin, routerPathParams], data () { return { chartLoading: false, @@ -394,6 +395,25 @@ export default { this.selectValue.projectIds = [Number(localStorage.getItem('alertMessageProjectId'))] this.searchCheckBox.projectIds = this.selectValue.projectIds.join(',') } + const 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: 'number' }, + endpointName: { target: this.searchLabel, propertyName: 'endpointName', type: 'string' }, + summary: { target: this.searchLabel, propertyName: 'summary', type: 'number' }, + ruleName: { target: this.searchLabel, propertyName: 'ruleName', type: 'string' }, + assetName: { target: this.searchLabel, propertyName: 'assetName', type: 'string' }, + labels: { target: this.searchLabel, propertyName: 'labels', type: 'string' }, + dcIds: { target: this.searchCheckBox, propertyName: 'dcIds', type: 'number' }, + modelIds: { target: this.searchCheckBox, propertyName: 'modelIds', type: 'number' }, + moduleIds: { target: this.searchCheckBox, propertyName: 'moduleIds', type: 'number' }, + projectIds: { target: this.searchCheckBox, propertyName: 'projectIds', type: 'number' }, + severityIds: { target: this.searchCheckBox, propertyName: 'severityIds', type: 'string' } + } + this.initQueryFromPath(searchKeys) }, mounted () { if (localStorage.getItem('alertMessageProjectId')) { @@ -782,6 +802,12 @@ export default { delete this.searchLabel.startAt delete this.searchLabel.endAt } + const param = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.fromRoute.alertMessage + this.updatePath(param, path) this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => { this.tools.loading = false if (response.code == 200) { diff --git a/nezha-fronted/src/components/page/alert/alertRule.vue b/nezha-fronted/src/components/page/alert/alertRule.vue index 3a9cba150..2eb302ab8 100644 --- a/nezha-fronted/src/components/page/alert/alertRule.vue +++ b/nezha-fronted/src/components/page/alert/alertRule.vue @@ -265,7 +265,11 @@ export default { this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.tools.loading = true - this.updatePath(this.searchLabel) + const param = { + ...this.searchLabel + } + const path = this.fromRoute.alertRule + this.updatePath(param, path) this.$get(this.url, this.searchLabel).then(response => { this.tools.loading = false if (response.code === 200) { @@ -332,7 +336,18 @@ export default { } }, created () { - this.initQueryFromPath() + const 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: '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' } + } + this.initQueryFromPath(searchKeys) }, mounted () { }, diff --git a/nezha-fronted/src/components/page/alert/alertSilence.vue b/nezha-fronted/src/components/page/alert/alertSilence.vue index 2ba09138f..978a71853 100644 --- a/nezha-fronted/src/components/page/alert/alertSilence.vue +++ b/nezha-fronted/src/components/page/alert/alertSilence.vue @@ -66,6 +66,7 @@ import deleteButton from '@/components/common/deleteButton' import nzDataList from '@/components/common/table/nzDataList' import dataListMixin from '@/components/common/mixin/dataList' import alertSilenceTable from '@/components/common/table/alert/alertSilenceTable' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'alertSilence', @@ -75,7 +76,7 @@ export default { nzDataList, alertSilenceBox }, - mixins: [dataListMixin], + mixins: [dataListMixin, routerPathParams], data () { return { url: 'alert/silence', @@ -162,6 +163,12 @@ export default { this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.tools.loading = true + const assetParam = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.fromRoute.alertSilence + this.updatePath(assetParam, path) this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => { this.tools.loading = false this.nowTime = this.utcTimeToTimezoneStr(response.time) @@ -229,6 +236,18 @@ export default { }) }) } + }, + created () { + const 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: 'number' }, + matchers: { target: this.searchLabel, propertyName: 'matchers', type: 'string' } + } + this.initQueryFromPath(searchKeys) } } diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index a5357f8b2..1c39b8c52 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -189,6 +189,7 @@ import clickSearch from '@/components/common/labelFilter/clickSearch' import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions' import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'asset', @@ -205,7 +206,7 @@ export default { assetDetail, detailViewTopSearch }, - mixins: [dataListMixin, detailViewMixin], + mixins: [dataListMixin, detailViewMixin, routerPathParams], data () { return { url: 'asset/asset', @@ -692,6 +693,12 @@ export default { delete this.searchLabel.statistics } */ this.tools.loading = true + const assetParam = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.fromRoute.asset + this.updatePath(assetParam, path) this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => { this.tools.loading = false if (response.code === 200) { @@ -750,6 +757,21 @@ export default { }) } }, + created () { + const 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: 'number' }, + sn: { target: this.searchLabel, propertyName: 'sn', type: 'number' }, + name: { target: this.searchLabel, propertyName: 'name', type: 'string' }, + manageIp: { target: this.searchLabel, propertyName: 'manageIp', type: 'number' }, + statistics: { target: this.searchLabel, propertyName: 'statistics', type: 'number' } + } + this.initQueryFromPath(searchKeys) + }, mounted () { // 初始化数据 this.getStateData() diff --git a/nezha-fronted/src/components/page/config/assetMeta.vue b/nezha-fronted/src/components/page/config/assetMeta.vue index 16c3b8e94..846dacc2c 100644 --- a/nezha-fronted/src/components/page/config/assetMeta.vue +++ b/nezha-fronted/src/components/page/config/assetMeta.vue @@ -81,6 +81,7 @@ import selectGroup from '@/components/common/popBox/selectAssetMetaGroup' import nzDataList from '@/components/common/table/nzDataList' import dataListMixin from '@/components/common/mixin/dataList' import assetMetaTable from '@/components/common/table/asset/assetMetaTable' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'assetMeta', @@ -92,7 +93,7 @@ export default { assetMetaBox, assetMetaTable }, - mixins: [dataListMixin], + mixins: [dataListMixin, routerPathParams], data () { return { url: 'asset/field/meta', @@ -187,6 +188,12 @@ export default { if (!this.searchLabel.groupIds) { delete this.searchLabel.groupIds } + const param = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.fromRoute.assetLabel + this.updatePath(param, path) this.$get(this.url, this.searchLabel).then(response => { this.tools.loading = false if (response.code == 200) { @@ -279,6 +286,19 @@ export default { this.getGroup() } } + }, + created () { + const 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: 'number' }, + name: { target: this.searchLabel, propertyName: 'name', type: 'string' }, + brandIds: { target: this.searchLabel, propertyName: 'brandIds', type: 'number' } + } + 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 28bc2d820..81b6481f1 100644 --- a/nezha-fronted/src/components/page/config/template/chartTemp.vue +++ b/nezha-fronted/src/components/page/config/template/chartTemp.vue @@ -102,6 +102,7 @@ import deleteButton from '@/components/common/deleteButton' import dataListMixin from '@/components/common/mixin/dataList' import chartTmplTable from '@/components/common/table/settings/chartTmplTable' import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'chartTemp', @@ -112,7 +113,7 @@ export default { 'export-excel': exportXLSX, topToolMoreOptions }, - mixins: [dataListMixin], + mixins: [dataListMixin, routerPathParams], data () { return { url: 'visual/panel/chart', @@ -217,6 +218,12 @@ export default { this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.tools.loading = true + const chartTempParam = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.fromRoute.chartTemp + this.updatePath(chartTempParam, path) this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox, panelId: 0, returnChildren: 0, groupId: 0 }).then(response => { this.tools.loading = false if (response.code === 200) { @@ -255,6 +262,20 @@ export default { }, panelReload () {}, panelReloadOnlyPanel () {} + }, + created () { + const 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: 'number' }, + type: { target: this.searchLabel, propertyName: 'type', type: 'string' }, + name: { target: this.searchLabel, propertyName: 'name', type: 'string' }, + varType: { target: this.searchLabel, propertyName: 'varType', type: 'number' } + } + this.initQueryFromPath(searchKeys) } } diff --git a/nezha-fronted/src/components/page/config/terminalLog.vue b/nezha-fronted/src/components/page/config/terminalLog.vue index 0a16930d8..6ef5dc675 100644 --- a/nezha-fronted/src/components/page/config/terminalLog.vue +++ b/nezha-fronted/src/components/page/config/terminalLog.vue @@ -98,6 +98,7 @@ import nzDetailView from '@/components/common/detailView/nzDetailView' import detailViewMixin from '@/components/common/mixin/detailViewMixin' import terminalLogDetail from '@/components/common/detailView/list/terminalLogDetail/terminalLogDetail' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'terminalLog', @@ -108,7 +109,7 @@ export default { terminalLogDetail, detailViewTopSearch }, - mixins: [dataListMixin, detailViewMixin], + mixins: [dataListMixin, detailViewMixin, routerPathParams], data () { return { url: 'terminal/session', @@ -176,6 +177,8 @@ export default { pageSize: this.pageObj.pageSize } this.tools.loading = true + const path = this.fromRoute.terminalLog + this.updatePath(params, path) this.$get(this.url, params).then(response => { this.tools.loading = false if (response.code === 200) { @@ -210,6 +213,23 @@ export default { }) }) } + }, + created () { + const 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' }, + host: { target: this.searchLabel, propertyName: 'host', type: 'string' }, + username: { target: this.searchLabel, propertyName: 'username', type: 'string' }, + loginUser: { target: this.searchLabel, propertyName: 'loginUser', type: 'string' }, + remoteAddr: { target: this.searchLabel, propertyName: 'remoteAddr', type: 'string' }, + uuid: { target: this.searchLabel, propertyName: 'uuid', type: 'string' }, + protocol: { target: this.searchLabel, propertyName: 'protocol', type: 'string' }, + state: { target: this.searchLabel, propertyName: 'state', type: 'number' } + } + this.initQueryFromPath(searchKeys) } } diff --git a/nezha-fronted/src/components/page/config/user.vue b/nezha-fronted/src/components/page/config/user.vue index 1c6db4b66..a8f965eae 100644 --- a/nezha-fronted/src/components/page/config/user.vue +++ b/nezha-fronted/src/components/page/config/user.vue @@ -109,6 +109,7 @@ import nzDetailView from '@/components/common/detailView/nzDetailView' import detailViewMixin from '@/components/common/mixin/detailViewMixin' import userDetail from '@/components/common/detailView/list/userDetail/userDetail' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'user', components: { @@ -120,7 +121,7 @@ export default { userDetail, detailViewTopSearch }, - mixins: [dataListMixin, detailViewMixin], + mixins: [dataListMixin, detailViewMixin, routerPathParams], data () { return { url: 'sys/user', @@ -199,6 +200,17 @@ export default { }) }) } + }, + created () { + const 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' }, + name: { target: this.searchLabel, propertyName: 'name', type: 'string' } + } + this.initQueryFromPath(searchKeys) } } diff --git a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue index f0524227a..ecf1d16d0 100644 --- a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue +++ b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue @@ -232,6 +232,7 @@ import nzDetailView from '@/components/common/detailView/nzDetailView' import detailViewMixin from '@/components/common/mixin/detailViewMixin' import endpointDetail from '@/components/common/detailView/list/endpoint/endpointDetail' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'endpointList', @@ -250,7 +251,7 @@ export default { endpointDetail, detailViewTopSearch }, - mixins: [dataListMixin, detailViewMixin], + mixins: [dataListMixin, detailViewMixin, routerPathParams], data () { return { url: 'monitor/endpoint', @@ -599,6 +600,12 @@ export default { } localStorage.removeItem('endpointProjectId') this.tools.loading = true + const param = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.fromRoute.endpoint + this.updatePath(param, path) this.$get(this.url, params).then(response => { this.tools.loading = false if (response.code === 200) { @@ -772,6 +779,42 @@ export default { this.selectValue.projectIds = [Number(localStorage.getItem('endpointProjectId'))] this.searchCheckBox.projectIds = this.selectValue.projectIds.join(',') } + // if (localStorage.getItem('endpointProjectId')) { + // const project = JSON.parse(localStorage.getItem('endpointProjectId')) + // let dataList = '' + // if (this.detailType !== 'view') { + // dataList = 'dataList' + // } else { + // dataList = 'detailList' + // } + // setTimeout(() => { + // this.$refs[dataList].$refs.searchInput.select_list.push({ + // id: 11, + // name: this.$t('overall.name'), + // type: 'project', + // label: 'projectIds', + // disabled: false, + // val: project[1], + // valnum: project[0] + // }) + // this.$refs[dataList].$refs.searchInput.sreach_num = 1 + // this.$refs[dataList].$refs.searchInput.searchLabelList = this.$refs[dataList].$refs.searchInput.searchLabelList.filter(item => item.label !== 'projectIds') + // }) + // } + const 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: 'number' }, + name: { target: this.searchLabel, propertyName: 'name', type: 'string' }, + assetName: { target: this.searchLabel, propertyName: 'assetName', type: 'string' }, + projectIds: { target: this.searchCheckBox, propertyName: 'projectIds', type: 'string' }, + logsStates: { target: this.searchCheckBox, propertyName: 'logsStates', type: 'string' }, + moduleIds: { target: this.searchCheckBox, propertyName: 'moduleIds', type: 'string' } + } + this.initQueryFromPath(searchKeys) }, mounted () { if (localStorage.getItem('endpointProjectId')) { diff --git a/nezha-fronted/src/components/page/monitor/module/moduleList.vue b/nezha-fronted/src/components/page/monitor/module/moduleList.vue index 417d4739d..e3951e1bd 100644 --- a/nezha-fronted/src/components/page/monitor/module/moduleList.vue +++ b/nezha-fronted/src/components/page/monitor/module/moduleList.vue @@ -154,6 +154,7 @@ import nzDetailView from '@/components/common/detailView/nzDetailView' import detailViewMixin from '@/components/common/mixin/detailViewMixin' import moduleDetail from '@/components/common/detailView/list/module/moduleDetail' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'moduleList', @@ -169,7 +170,7 @@ export default { moduleDetail, detailViewTopSearch }, - mixins: [dataListMixin, detailViewMixin], + mixins: [dataListMixin, detailViewMixin, routerPathParams], data () { return { url: 'monitor/module', @@ -391,6 +392,12 @@ export default { localStorage.removeItem('moduleProjectId') } this.tools.loading = true + const param = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.fromRoute.module + this.updatePath(param, path) this.$get(this.url, this.searchLabel).then(response => { this.tools.loading = false if (response.code === 200) { @@ -449,6 +456,17 @@ export default { this.$refs[dataList].$refs.searchInput.searchLabelList = this.$refs[dataList].$refs.searchInput.searchLabelList.filter(item => item.label !== 'projectIds') }) } + const 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: 'number' }, + projectIds: { target: this.searchLabel, propertyName: 'projectIds', type: 'number' }, + name: { target: this.searchLabel, propertyName: 'name', type: 'string' } + } + this.initQueryFromPath(searchKeys) }, mounted () { }, diff --git a/nezha-fronted/src/components/page/monitor/project/projectList.vue b/nezha-fronted/src/components/page/monitor/project/projectList.vue index 8d03a4828..3983773e0 100644 --- a/nezha-fronted/src/components/page/monitor/project/projectList.vue +++ b/nezha-fronted/src/components/page/monitor/project/projectList.vue @@ -58,6 +58,7 @@ import nzDataList from '@/components/common/table/nzDataList' import dataListMixin from '@/components/common/mixin/dataList' import projectTable from '@/components/common/table/settings/projectTable' import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox' +import routerPathParams from '@/components/common/mixin/routerPathParams' export default { name: 'projectList', @@ -68,7 +69,7 @@ export default { projectTable, alertSilenceBox }, - mixins: [dataListMixin], + mixins: [dataListMixin, routerPathParams], data () { return { url: 'monitor/project', @@ -129,6 +130,12 @@ export default { this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.tools.loading = true + const param = { + ...this.searchLabel, + ...this.searchCheckBox + } + const path = this.fromRoute.project + this.updatePath(param, path) this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => { this.tools.loading = false if (response.code === 200) { @@ -153,6 +160,16 @@ export default { computed: { }, created () { + const 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: 'number' }, + name: { target: this.searchLabel, propertyName: 'name', type: 'string' } + } + this.initQueryFromPath(searchKeys) }, mounted () { },