diff --git a/nezha-fronted/src/App.vue b/nezha-fronted/src/App.vue index 10330bb29..13caa42e9 100644 --- a/nezha-fronted/src/App.vue +++ b/nezha-fronted/src/App.vue @@ -15,9 +15,6 @@ export default { browserWindowZoom }, async created () { - if (window.outerWidth <= 1024) { // outerWidth 获取设备宽度 - document.querySelector('meta[name=viewport]').setAttribute('content', `width=device-width, initial-scale=${window.outerWidth / (1024 * window.devicePixelRatio)}, maximum-scale=1.0, user-scalable=0`) - } const herfSpiltArr = window.location.href.split('/') if (herfSpiltArr[3] !== '#') { herfSpiltArr[3] = '#' @@ -28,6 +25,7 @@ export default { const result = await this.$http.get(url) this.$axios.defaults.baseURL = result.body.baseUrl const version = result.body.version + const defaultWindowWidth = result.body.width || 1024 if (version !== localStorage.getItem('nz-version')) { localStorage.clear() localStorage.clear() @@ -35,6 +33,9 @@ export default { herfSpiltArr[2] = herfSpiltArr[2] + '?t=' + new Date().getTime() window.location.href = herfSpiltArr[0] + '//' + herfSpiltArr[2] } + if (window.outerWidth <= defaultWindowWidth) { // outerWidth 获取设备宽度 + document.querySelector('meta[name=viewport]').setAttribute('content', `width=device-width, initial-scale=${window.outerWidth / (defaultWindowWidth * window.devicePixelRatio)}, maximum-scale=1.0, user-scalable=0`) + } } } diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index b7b02279a..4f1732faa 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -105,9 +105,9 @@ export default { if (this.needAlertDaysData) { response.data.list.forEach(item => { item.trendLoading = true - item.left= 0 - item.top= 0 - item.alertNumtooltipShow= false + item.left = 0 + item.top = 0 + item.alertNumtooltipShow = false item.alertDaysData = [ { metric: { priority: 'P1' }, @@ -337,6 +337,10 @@ export default { }, created () { const path = this.$route.fullPath.match(/\/(\S*)\?/)[1] + if (this.$route.query.orderBy) { + this.orderBy = this.$route.query.orderBy + console.log('asdasdadsadsa') + } let searchKeys = {} if (path === 'dc') { searchKeys = { diff --git a/nezha-fronted/src/components/common/mixin/table.js b/nezha-fronted/src/components/common/mixin/table.js index 5be856c43..cfc5a597c 100644 --- a/nezha-fronted/src/components/common/mixin/table.js +++ b/nezha-fronted/src/components/common/mixin/table.js @@ -26,7 +26,7 @@ export default { data () { return { operationWidth: '165', // 操作列宽 - orderBy: {}, + orderBy: null, severityDataWeight: this.$store.getters.severityDataWeight } }, @@ -131,10 +131,12 @@ export default { if (n) { const index = n.indexOf('-') if (index !== -1) { - this.orderBy[n.slice(index + 1)] = 'descending' + this.orderBy = { prop: n.slice(index + 1), order: 'descending' } } else { - this.orderBy[n] = 'descending' + this.orderBy = { prop: n, order: 'ascending' } } + // this.orderBy = JSON.parse(JSON.stringify(this.orderBy)) + console.log(n, this.orderBy) } } }, diff --git a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue index 94c1bb53b..de6a974c6 100644 --- a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue @@ -8,6 +8,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/alert/alertRuleTable.vue b/nezha-fronted/src/components/common/table/alert/alertRuleTable.vue index 338f5ba95..131ff72dc 100644 --- a/nezha-fronted/src/components/common/table/alert/alertRuleTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertRuleTable.vue @@ -6,6 +6,7 @@ :height="height" tooltip-effect="light" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/alert/alertSilenceTable.vue b/nezha-fronted/src/components/common/table/alert/alertSilenceTable.vue index 831084023..505b924ba 100644 --- a/nezha-fronted/src/components/common/table/alert/alertSilenceTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertSilenceTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/asset/assetMetaTable.vue b/nezha-fronted/src/components/common/table/asset/assetMetaTable.vue index f6af0510a..31554b87d 100644 --- a/nezha-fronted/src/components/common/table/asset/assetMetaTable.vue +++ b/nezha-fronted/src/components/common/table/asset/assetMetaTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/agentTable.vue b/nezha-fronted/src/components/common/table/settings/agentTable.vue index 526f7d71a..760e6e41f 100644 --- a/nezha-fronted/src/components/common/table/settings/agentTable.vue +++ b/nezha-fronted/src/components/common/table/settings/agentTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue b/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue index d81f3f347..db05f5a38 100644 --- a/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue +++ b/nezha-fronted/src/components/common/table/settings/chartTmplTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/dcTable.vue b/nezha-fronted/src/components/common/table/settings/dcTable.vue index 18bcc102d..1669840b1 100644 --- a/nezha-fronted/src/components/common/table/settings/dcTable.vue +++ b/nezha-fronted/src/components/common/table/settings/dcTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/endpointTable.vue b/nezha-fronted/src/components/common/table/settings/endpointTable.vue index 9437c3910..45c252000 100644 --- a/nezha-fronted/src/components/common/table/settings/endpointTable.vue +++ b/nezha-fronted/src/components/common/table/settings/endpointTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/exprTmplTable.vue b/nezha-fronted/src/components/common/table/settings/exprTmplTable.vue index bc909bee4..a5503fae5 100644 --- a/nezha-fronted/src/components/common/table/settings/exprTmplTable.vue +++ b/nezha-fronted/src/components/common/table/settings/exprTmplTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/modelTable.vue b/nezha-fronted/src/components/common/table/settings/modelTable.vue index 8f8952b1c..86afd065b 100644 --- a/nezha-fronted/src/components/common/table/settings/modelTable.vue +++ b/nezha-fronted/src/components/common/table/settings/modelTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/moduleTable.vue b/nezha-fronted/src/components/common/table/settings/moduleTable.vue index 61d83bde5..693d21aa1 100644 --- a/nezha-fronted/src/components/common/table/settings/moduleTable.vue +++ b/nezha-fronted/src/components/common/table/settings/moduleTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/operationLogTable.vue b/nezha-fronted/src/components/common/table/settings/operationLogTable.vue index 6c0d8b42c..54a39f284 100644 --- a/nezha-fronted/src/components/common/table/settings/operationLogTable.vue +++ b/nezha-fronted/src/components/common/table/settings/operationLogTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" class="no-operation" @header-dragend="dragend" @sort-change="tableDataSort" diff --git a/nezha-fronted/src/components/common/table/settings/projectTable.vue b/nezha-fronted/src/components/common/table/settings/projectTable.vue index a43350c32..69255da5a 100644 --- a/nezha-fronted/src/components/common/table/settings/projectTable.vue +++ b/nezha-fronted/src/components/common/table/settings/projectTable.vue @@ -6,6 +6,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/roleTable.vue b/nezha-fronted/src/components/common/table/settings/roleTable.vue index 4eafe72ff..5d685c702 100644 --- a/nezha-fronted/src/components/common/table/settings/roleTable.vue +++ b/nezha-fronted/src/components/common/table/settings/roleTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/terminalLogTable.vue b/nezha-fronted/src/components/common/table/settings/terminalLogTable.vue index baaf935f4..abcbab9c5 100644 --- a/nezha-fronted/src/components/common/table/settings/terminalLogTable.vue +++ b/nezha-fronted/src/components/common/table/settings/terminalLogTable.vue @@ -5,6 +5,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/common/table/settings/userTable.vue b/nezha-fronted/src/components/common/table/settings/userTable.vue index 96fff508a..59abdb306 100644 --- a/nezha-fronted/src/components/common/table/settings/userTable.vue +++ b/nezha-fronted/src/components/common/table/settings/userTable.vue @@ -6,6 +6,7 @@ :data="tableData" :height="height" border + :default-sort="orderBy" @header-dragend="dragend" @sort-change="tableDataSort" @selection-change="selectionChange" diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index 08722bf22..fbbee775f 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -31,6 +31,7 @@