NEZ-1631 fix:列表页面 默认排序字段 初始化状态修复

This commit is contained in:
zhangyu
2022-03-04 13:59:25 +08:00
parent 5e8964932f
commit be959ad26b
37 changed files with 54 additions and 13 deletions

View File

@@ -15,9 +15,6 @@ export default {
browserWindowZoom browserWindowZoom
}, },
async created () { 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('/') const herfSpiltArr = window.location.href.split('/')
if (herfSpiltArr[3] !== '#') { if (herfSpiltArr[3] !== '#') {
herfSpiltArr[3] = '#' herfSpiltArr[3] = '#'
@@ -28,6 +25,7 @@ export default {
const result = await this.$http.get(url) const result = await this.$http.get(url)
this.$axios.defaults.baseURL = result.body.baseUrl this.$axios.defaults.baseURL = result.body.baseUrl
const version = result.body.version const version = result.body.version
const defaultWindowWidth = result.body.width || 1024
if (version !== localStorage.getItem('nz-version')) { if (version !== localStorage.getItem('nz-version')) {
localStorage.clear() localStorage.clear()
localStorage.clear() localStorage.clear()
@@ -35,6 +33,9 @@ export default {
herfSpiltArr[2] = herfSpiltArr[2] + '?t=' + new Date().getTime() herfSpiltArr[2] = herfSpiltArr[2] + '?t=' + new Date().getTime()
window.location.href = herfSpiltArr[0] + '//' + herfSpiltArr[2] 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`)
}
} }
} }
</script> </script>

View File

@@ -337,6 +337,10 @@ export default {
}, },
created () { created () {
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1] const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
if (this.$route.query.orderBy) {
this.orderBy = this.$route.query.orderBy
console.log('asdasdadsadsa')
}
let searchKeys = {} let searchKeys = {}
if (path === 'dc') { if (path === 'dc') {
searchKeys = { searchKeys = {

View File

@@ -26,7 +26,7 @@ export default {
data () { data () {
return { return {
operationWidth: '165', // 操作列宽 operationWidth: '165', // 操作列宽
orderBy: {}, orderBy: null,
severityDataWeight: this.$store.getters.severityDataWeight severityDataWeight: this.$store.getters.severityDataWeight
} }
}, },
@@ -131,10 +131,12 @@ export default {
if (n) { if (n) {
const index = n.indexOf('-') const index = n.indexOf('-')
if (index !== -1) { if (index !== -1) {
this.orderBy[n.slice(index + 1)] = 'descending' this.orderBy = { prop: n.slice(index + 1), order: 'descending' }
} else { } else {
this.orderBy[n] = 'descending' this.orderBy = { prop: n, order: 'ascending' }
} }
// this.orderBy = JSON.parse(JSON.stringify(this.orderBy))
console.log(n, this.orderBy)
} }
} }
}, },

View File

@@ -8,6 +8,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -6,6 +6,7 @@
:height="height" :height="height"
tooltip-effect="light" tooltip-effect="light"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
class="no-operation" class="no-operation"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"

View File

@@ -6,6 +6,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -5,6 +5,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -6,6 +6,7 @@
:data="tableData" :data="tableData"
:height="height" :height="height"
border border
:default-sort="orderBy"
@header-dragend="dragend" @header-dragend="dragend"
@sort-change="tableDataSort" @sort-change="tableDataSort"
@selection-change="selectionChange" @selection-change="selectionChange"

View File

@@ -31,6 +31,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<alert-message-table <alert-message-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
:api="url" :api="url"
:custom-table-title="tools.customTableTitle" :custom-table-title="tools.customTableTitle"
:height="mainTableHeight" :height="mainTableHeight"

View File

@@ -109,6 +109,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<alert-rule-table <alert-rule-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -19,6 +19,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<alert-silence-table <alert-silence-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -739,6 +739,7 @@ export default {
}) })
} }
this.tableData = response.data.list this.tableData = response.data.list
console.log(this.$refs.dataTable.$refs.dataTable)
const globalSearchId = this.$store.getters.getGlobalSearchId const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = '' let detailViewRightObj = ''
if (globalSearchId) { if (globalSearchId) {

View File

@@ -22,6 +22,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<agent-table <agent-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -40,6 +40,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<asset-meta-table <asset-meta-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -19,6 +19,7 @@
<template v-slot="slotProps"> <template v-slot="slotProps">
<asset-type-table <asset-type-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -115,6 +115,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<dc-table <dc-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -41,6 +41,7 @@
<template v-slot="slotProps"> <template v-slot="slotProps">
<model-table <model-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -11,6 +11,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<operation-log-table <operation-log-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -19,6 +19,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<role-table <role-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -46,6 +46,7 @@
<template v-slot="slotProps"> <template v-slot="slotProps">
<chartTmplTable <chartTmplTable
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -38,6 +38,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<expr-tmpl-table <expr-tmpl-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -67,6 +67,7 @@
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<terminal-log-table <terminal-log-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -73,6 +73,7 @@
<template v-slot="slotProps"> <template v-slot="slotProps">
<user-table <user-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"

View File

@@ -127,6 +127,7 @@
<endpoint-table <endpoint-table
ref="dataTable" ref="dataTable"
v-loading="tools.loading" v-loading="tools.loading"
:orderByFa="orderBy"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"
:custom-table-title="tools.customTableTitle" :custom-table-title="tools.customTableTitle"

View File

@@ -112,6 +112,7 @@
<module-table <module-table
ref="dataTable" ref="dataTable"
v-loading="tools.loading" v-loading="tools.loading"
:orderByFa="orderBy"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"
:tableId="tableId" :tableId="tableId"

View File

@@ -20,6 +20,7 @@
<template v-slot="slotProps"> <template v-slot="slotProps">
<project-table <project-table
ref="dataTable" ref="dataTable"
:orderByFa="orderBy"
v-loading="tools.loading" v-loading="tools.loading"
:loading="tools.loading" :loading="tools.loading"
:api="url" :api="url"