Merge branch 'dev-3.2' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.3

This commit is contained in:
zhangyu
2022-03-14 16:23:16 +08:00
130 changed files with 1171 additions and 809 deletions

View File

@@ -23,7 +23,7 @@ export default {
pages: 1,
total: 0
},
orderBy: '',
orderBy: 'id',
/* 工具参数 */
tools: {
loading: true, // 是否显示table加载动画
@@ -105,6 +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.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -132,7 +135,7 @@ export default {
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap && this.$refs.dataTable.$refs.dataTable) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)
@@ -214,7 +217,9 @@ export default {
},
dragend () {
this.$nextTick(() => {
this.$refs.dataTable.$refs.dataTable && this.$refs.dataTable.$refs.dataTable.doLayout()
if (this.$refs.dataTable) {
this.$refs.dataTable.$refs.dataTable && this.$refs.dataTable.$refs.dataTable.doLayout()
}
})
},
search (searchObj) {
@@ -332,6 +337,9 @@ export default {
},
created () {
const path = this.$route.fullPath.match(/\/(\S*)\?/)[1]
if (this.$route.query.orderBy && !this.isSubList) {
this.orderBy = this.$route.query.orderBy
}
let searchKeys = {}
if (path === 'dc') {
searchKeys = {
@@ -969,14 +977,18 @@ export default {
if (pageSize && pageSize !== 'undefined') {
this.pageObj.pageSize = pageSize
}
if (!this.$refs.dataTable && !this.$refs.dataDetail) {
return
}
const tableTitle = this.$refs.dataTable ? this.$refs.dataTable.tableTitle : this.$refs.dataDetail.tableTitle
let localStorageTableTitle = localStorage.getItem('nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.tableId)
localStorageTableTitle = localStorageTableTitle ? JSON.parse(localStorageTableTitle) : this.$refs.dataTable.tableTitle
this.tools.customTableTitle = this.$refs.dataTable.tableTitle.map((item, index) => { // 修复切换中英文的问题
localStorageTableTitle = localStorageTableTitle ? JSON.parse(localStorageTableTitle) : tableTitle
this.tools.customTableTitle = tableTitle.map((item, index) => { // 修复切换中英文的问题
item.show = localStorageTableTitle[index].show
return item
})
if (localStorageTableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) {
const arr = localStorageTableTitle.splice(this.$refs.dataTable.tableTitle.length, localStorageTableTitle.length)
if (localStorageTableTitle && (localStorageTableTitle.length > tableTitle.length)) {
const arr = localStorageTableTitle.splice(tableTitle.length, localStorageTableTitle.length)
arr.forEach(item => {
item.minWidth = item.label.length * 16 + 20
})
@@ -985,7 +997,9 @@ export default {
if (!this.fromBottom) {
this.getTableData()
this.$nextTick(() => {
this.$refs.dataTable.$refs.dataTable && this.$refs.dataTable.$refs.dataTable.doLayout()
if (this.$refs.dataTable) {
this.$refs.dataTable.$refs.dataTable && this.$refs.dataTable.$refs.dataTable.doLayout()
}
})
}
},