NEZ-1400 feat: 初始版本页面路由使用 url path 传递参数

This commit is contained in:
@changcode
2021-12-22 14:20:13 +08:00
parent 8c21906fa2
commit 74521c5d1f
13 changed files with 275 additions and 26 deletions

View File

@@ -1,7 +1,9 @@
import bus from '@/libs/bus' import bus from '@/libs/bus'
import { tableSet } from '@/components/common/js/tools' import { tableSet } from '@/components/common/js/tools'
import { fromRoute } from '@/components/common/js/constants' import { fromRoute } from '@/components/common/js/constants'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
mixins: [routerPathParams],
data () { data () {
return { return {
fromRoute: fromRoute, fromRoute: fromRoute,
@@ -79,6 +81,12 @@ export default {
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true 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.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { 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 () { mounted () {
const pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId) const pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId)
if (pageSize && pageSize !== 'undefined') { if (pageSize && pageSize !== 'undefined') {

View File

@@ -2,19 +2,8 @@ import lodash from 'lodash'
export default { export default {
methods: { methods: {
// 解析请求参数,初始化 searchLabel // 解析请求参数,初始化 searchLabel
initQueryFromPath () { initQueryFromPath (searchKeys) {
const q = this.$route.query 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) => { lodash.forIn(searchKeys, (val, key) => {
let qv = lodash.get(q, key) let qv = lodash.get(q, key)
if (qv && val.type == 'number') { if (qv && val.type == 'number') {
@@ -24,8 +13,9 @@ export default {
}) })
}, },
// 更新path包含请求参数 // 更新path包含请求参数
updatePath (param) { updatePath (param, path) {
this.$router.replace({ path: this.fromRoute.alertRule, query: param }).catch(err => {}) console.log(param)
this.$router.replace({ path: path, query: param }).catch(err => {})
} }
} }
} }

View File

@@ -165,6 +165,7 @@ import chart from '@/components/page/dashboard/overview/chart'
import { alertMessage as alertMessageConstant, fromRoute } from '@/components/common/js/constants' import { alertMessage as alertMessageConstant, fromRoute } from '@/components/common/js/constants'
import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox' import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox'
import clickSearch from '@/components/common/labelFilter/clickSearch' import clickSearch from '@/components/common/labelFilter/clickSearch'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'alertMessage', name: 'alertMessage',
@@ -177,7 +178,7 @@ export default {
alertSilenceBox, alertSilenceBox,
clickSearch clickSearch
}, },
mixins: [dataListMixin], mixins: [dataListMixin, routerPathParams],
data () { data () {
return { return {
chartLoading: false, chartLoading: false,
@@ -394,6 +395,25 @@ export default {
this.selectValue.projectIds = [Number(localStorage.getItem('alertMessageProjectId'))] this.selectValue.projectIds = [Number(localStorage.getItem('alertMessageProjectId'))]
this.searchCheckBox.projectIds = this.selectValue.projectIds.join(',') 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 () { mounted () {
if (localStorage.getItem('alertMessageProjectId')) { if (localStorage.getItem('alertMessageProjectId')) {
@@ -782,6 +802,12 @@ export default {
delete this.searchLabel.startAt delete this.searchLabel.startAt
delete this.searchLabel.endAt 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.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code == 200) { if (response.code == 200) {

View File

@@ -265,7 +265,11 @@ export default {
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true 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.$get(this.url, this.searchLabel).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { if (response.code === 200) {
@@ -332,7 +336,18 @@ export default {
} }
}, },
created () { 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 () { mounted () {
}, },

View File

@@ -66,6 +66,7 @@ import deleteButton from '@/components/common/deleteButton'
import nzDataList from '@/components/common/table/nzDataList' import nzDataList from '@/components/common/table/nzDataList'
import dataListMixin from '@/components/common/mixin/dataList' import dataListMixin from '@/components/common/mixin/dataList'
import alertSilenceTable from '@/components/common/table/alert/alertSilenceTable' import alertSilenceTable from '@/components/common/table/alert/alertSilenceTable'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'alertSilence', name: 'alertSilence',
@@ -75,7 +76,7 @@ export default {
nzDataList, nzDataList,
alertSilenceBox alertSilenceBox
}, },
mixins: [dataListMixin], mixins: [dataListMixin, routerPathParams],
data () { data () {
return { return {
url: 'alert/silence', url: 'alert/silence',
@@ -162,6 +163,12 @@ export default {
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true 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.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false this.tools.loading = false
this.nowTime = this.utcTimeToTimezoneStr(response.time) 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)
} }
} }
</script> </script>

View File

@@ -189,6 +189,7 @@ import clickSearch from '@/components/common/labelFilter/clickSearch'
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions' import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox' import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox'
import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'asset', name: 'asset',
@@ -205,7 +206,7 @@ export default {
assetDetail, assetDetail,
detailViewTopSearch detailViewTopSearch
}, },
mixins: [dataListMixin, detailViewMixin], mixins: [dataListMixin, detailViewMixin, routerPathParams],
data () { data () {
return { return {
url: 'asset/asset', url: 'asset/asset',
@@ -692,6 +693,12 @@ export default {
delete this.searchLabel.statistics delete this.searchLabel.statistics
} */ } */
this.tools.loading = true 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.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { 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 () { mounted () {
// 初始化数据 // 初始化数据
this.getStateData() this.getStateData()

View File

@@ -81,6 +81,7 @@ import selectGroup from '@/components/common/popBox/selectAssetMetaGroup'
import nzDataList from '@/components/common/table/nzDataList' import nzDataList from '@/components/common/table/nzDataList'
import dataListMixin from '@/components/common/mixin/dataList' import dataListMixin from '@/components/common/mixin/dataList'
import assetMetaTable from '@/components/common/table/asset/assetMetaTable' import assetMetaTable from '@/components/common/table/asset/assetMetaTable'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'assetMeta', name: 'assetMeta',
@@ -92,7 +93,7 @@ export default {
assetMetaBox, assetMetaBox,
assetMetaTable assetMetaTable
}, },
mixins: [dataListMixin], mixins: [dataListMixin, routerPathParams],
data () { data () {
return { return {
url: 'asset/field/meta', url: 'asset/field/meta',
@@ -187,6 +188,12 @@ export default {
if (!this.searchLabel.groupIds) { if (!this.searchLabel.groupIds) {
delete 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.$get(this.url, this.searchLabel).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code == 200) { if (response.code == 200) {
@@ -279,6 +286,19 @@ export default {
this.getGroup() 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)
} }
} }
</script> </script>

View File

@@ -102,6 +102,7 @@ import deleteButton from '@/components/common/deleteButton'
import dataListMixin from '@/components/common/mixin/dataList' import dataListMixin from '@/components/common/mixin/dataList'
import chartTmplTable from '@/components/common/table/settings/chartTmplTable' import chartTmplTable from '@/components/common/table/settings/chartTmplTable'
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions' import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'chartTemp', name: 'chartTemp',
@@ -112,7 +113,7 @@ export default {
'export-excel': exportXLSX, 'export-excel': exportXLSX,
topToolMoreOptions topToolMoreOptions
}, },
mixins: [dataListMixin], mixins: [dataListMixin, routerPathParams],
data () { data () {
return { return {
url: 'visual/panel/chart', url: 'visual/panel/chart',
@@ -217,6 +218,12 @@ export default {
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true 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.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox, panelId: 0, returnChildren: 0, groupId: 0 }).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { if (response.code === 200) {
@@ -255,6 +262,20 @@ export default {
}, },
panelReload () {}, panelReload () {},
panelReloadOnlyPanel () {} 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)
} }
} }
</script> </script>

View File

@@ -98,6 +98,7 @@ import nzDetailView from '@/components/common/detailView/nzDetailView'
import detailViewMixin from '@/components/common/mixin/detailViewMixin' import detailViewMixin from '@/components/common/mixin/detailViewMixin'
import terminalLogDetail from '@/components/common/detailView/list/terminalLogDetail/terminalLogDetail' import terminalLogDetail from '@/components/common/detailView/list/terminalLogDetail/terminalLogDetail'
import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'terminalLog', name: 'terminalLog',
@@ -108,7 +109,7 @@ export default {
terminalLogDetail, terminalLogDetail,
detailViewTopSearch detailViewTopSearch
}, },
mixins: [dataListMixin, detailViewMixin], mixins: [dataListMixin, detailViewMixin, routerPathParams],
data () { data () {
return { return {
url: 'terminal/session', url: 'terminal/session',
@@ -176,6 +177,8 @@ export default {
pageSize: this.pageObj.pageSize pageSize: this.pageObj.pageSize
} }
this.tools.loading = true this.tools.loading = true
const path = this.fromRoute.terminalLog
this.updatePath(params, path)
this.$get(this.url, params).then(response => { this.$get(this.url, params).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { 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)
} }
} }
</script> </script>

View File

@@ -109,6 +109,7 @@ import nzDetailView from '@/components/common/detailView/nzDetailView'
import detailViewMixin from '@/components/common/mixin/detailViewMixin' import detailViewMixin from '@/components/common/mixin/detailViewMixin'
import userDetail from '@/components/common/detailView/list/userDetail/userDetail' import userDetail from '@/components/common/detailView/list/userDetail/userDetail'
import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'user', name: 'user',
components: { components: {
@@ -120,7 +121,7 @@ export default {
userDetail, userDetail,
detailViewTopSearch detailViewTopSearch
}, },
mixins: [dataListMixin, detailViewMixin], mixins: [dataListMixin, detailViewMixin, routerPathParams],
data () { data () {
return { return {
url: 'sys/user', 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)
} }
} }
</script> </script>

View File

@@ -232,6 +232,7 @@ import nzDetailView from '@/components/common/detailView/nzDetailView'
import detailViewMixin from '@/components/common/mixin/detailViewMixin' import detailViewMixin from '@/components/common/mixin/detailViewMixin'
import endpointDetail from '@/components/common/detailView/list/endpoint/endpointDetail' import endpointDetail from '@/components/common/detailView/list/endpoint/endpointDetail'
import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'endpointList', name: 'endpointList',
@@ -250,7 +251,7 @@ export default {
endpointDetail, endpointDetail,
detailViewTopSearch detailViewTopSearch
}, },
mixins: [dataListMixin, detailViewMixin], mixins: [dataListMixin, detailViewMixin, routerPathParams],
data () { data () {
return { return {
url: 'monitor/endpoint', url: 'monitor/endpoint',
@@ -599,6 +600,12 @@ export default {
} }
localStorage.removeItem('endpointProjectId') localStorage.removeItem('endpointProjectId')
this.tools.loading = true 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.$get(this.url, params).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { if (response.code === 200) {
@@ -772,6 +779,42 @@ export default {
this.selectValue.projectIds = [Number(localStorage.getItem('endpointProjectId'))] this.selectValue.projectIds = [Number(localStorage.getItem('endpointProjectId'))]
this.searchCheckBox.projectIds = this.selectValue.projectIds.join(',') 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 () { mounted () {
if (localStorage.getItem('endpointProjectId')) { if (localStorage.getItem('endpointProjectId')) {

View File

@@ -154,6 +154,7 @@ import nzDetailView from '@/components/common/detailView/nzDetailView'
import detailViewMixin from '@/components/common/mixin/detailViewMixin' import detailViewMixin from '@/components/common/mixin/detailViewMixin'
import moduleDetail from '@/components/common/detailView/list/module/moduleDetail' import moduleDetail from '@/components/common/detailView/list/module/moduleDetail'
import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch' import detailViewTopSearch from '@/components/common/detailView/detailViewTopSearch'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'moduleList', name: 'moduleList',
@@ -169,7 +170,7 @@ export default {
moduleDetail, moduleDetail,
detailViewTopSearch detailViewTopSearch
}, },
mixins: [dataListMixin, detailViewMixin], mixins: [dataListMixin, detailViewMixin, routerPathParams],
data () { data () {
return { return {
url: 'monitor/module', url: 'monitor/module',
@@ -391,6 +392,12 @@ export default {
localStorage.removeItem('moduleProjectId') localStorage.removeItem('moduleProjectId')
} }
this.tools.loading = true 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.$get(this.url, this.searchLabel).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { 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') 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 () { mounted () {
}, },

View File

@@ -58,6 +58,7 @@ import nzDataList from '@/components/common/table/nzDataList'
import dataListMixin from '@/components/common/mixin/dataList' import dataListMixin from '@/components/common/mixin/dataList'
import projectTable from '@/components/common/table/settings/projectTable' import projectTable from '@/components/common/table/settings/projectTable'
import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox' import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox'
import routerPathParams from '@/components/common/mixin/routerPathParams'
export default { export default {
name: 'projectList', name: 'projectList',
@@ -68,7 +69,7 @@ export default {
projectTable, projectTable,
alertSilenceBox alertSilenceBox
}, },
mixins: [dataListMixin], mixins: [dataListMixin, routerPathParams],
data () { data () {
return { return {
url: 'monitor/project', url: 'monitor/project',
@@ -129,6 +130,12 @@ export default {
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true 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.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { if (response.code === 200) {
@@ -153,6 +160,16 @@ export default {
computed: { computed: {
}, },
created () { 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 () { mounted () {
}, },