fix:详情页面优化

This commit is contained in:
zhangyu
2022-03-01 15:19:43 +08:00
parent 17586dc2bc
commit b3664b7d71
16 changed files with 60 additions and 20 deletions

View File

@@ -244,6 +244,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' },

View File

@@ -151,6 +151,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' },

View File

@@ -141,6 +141,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' },

View File

@@ -33,13 +33,13 @@
<!-- <div v-if="showLayout.indexOf('pagination') > -1" class="pagination-top pagination-top-hide display-none"></div>-->
</div>
<div :style="{ height: nzTableHeight }" class="nz-detail-view" :class="dataLength?'':'nz-detail-view-no-data'">
<div class="nz-detail-view-left" v-if="dataLength">
<div class="nz-detail-view-left" v-show="dataLength">
<slot name="nz-detail-view-list"></slot>
<div v-if="showLayout.indexOf('pagination') > -1" class="nz-detail-view-pagination">
<slot name="pagination"></slot>
</div>
</div>
<div v-else class="no-data">
<div v-if="!dataLength" class="no-data">
<svg class="icon" aria-hidden="true">
<use xlink:href="#nz-icon-no-data-list"></use>
</svg>

View File

@@ -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) {
@@ -859,14 +864,16 @@ export default {
if (pageSize && pageSize !== 'undefined') {
this.pageObj.pageSize = pageSize
}
console.log(this.$refs.dataTable, this.$refs.dataDetail)
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
})
@@ -875,7 +882,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()
}
})
}
},

View File

@@ -2,7 +2,7 @@ export default {
props: {},
data () {
return {
detailType: 'list',
detailType: localStorage.getItem('detail-view-' + this.tableId) || 'list',
detailViewRightObj: '',
detailViewLoading: false,
detailTimer: ''
@@ -16,7 +16,7 @@ export default {
if (this.detailType === flag) {
return
}
this.$refs.dataList.bottomBox.showSubList = false
// this.$refs.dataList.bottomBox.showSubList = false
if (this.orderBy) {
this.detailViewRightObj = ''
}

View File

@@ -170,6 +170,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' },

View File

@@ -176,6 +176,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' },

View File

@@ -287,6 +287,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' },

View File

@@ -73,7 +73,7 @@
</nzDetailView>
<nz-data-list
v-loading="detailViewLoading"
v-show="detailType === 'list'"
v-if="detailType === 'list'"
ref="dataList"
:api="url"
:custom-table-title.sync="tools.customTableTitle"
@@ -612,8 +612,9 @@ export default {
resolve(data)
setTimeout(() => {
const title = this.tools.customTableTitle
const originalTitle = title.slice(0, this.$refs.dataTable.tableTitle.length) // 原title
const oldLabelTitle = title.slice(this.$refs.dataTable.tableTitle.length, title.length) // 旧labelTitle
const tableTitle = this.$refs.dataTable ? this.$refs.dataTable.tableTitle : this.$refs.dataDetail.tableTitle
const originalTitle = title.slice(0, tableTitle.length) // 原title
const oldLabelTitle = title.slice(tableTitle.length, title.length) // 旧labelTitle
const newLabel = showData.filter(item => { return !oldLabelTitle.find(t => { return item.label === t.label }) })
const keepLabel = oldLabelTitle.filter(item => showData.find(t => item.label === t.label))
@@ -718,6 +719,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' },
@@ -745,7 +749,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)

View File

@@ -73,7 +73,7 @@
<nz-data-list
ref="dataList"
:api="url"
v-show="detailType === 'list'"
v-if="detailType === 'list'"
:layout="['searchInput', 'elementSet', 'pagination','detailViewSet']"
:custom-table-title.sync="tools.customTableTitle"
:from="fromRoute.dc"

View File

@@ -54,7 +54,7 @@
<nz-data-list
ref="dataList"
:api="url"
v-show="detailType === 'list'"
v-if="detailType === 'list'"
:layout="['searchInput', 'elementSet', 'pagination','detailViewSet']"
:custom-table-title.sync="tools.customTableTitle"
:from="fromRoute.terminalLog"

View File

@@ -53,7 +53,7 @@
<nz-data-list
ref="dataList"
:api="url"
v-show="detailType === 'list'"
v-if="detailType === 'list'"
:custom-table-title.sync="tools.customTableTitle"
:from="fromRoute.user"
:layout="['searchInput', 'elementSet', 'pagination','detailViewSet']"

View File

@@ -70,7 +70,7 @@
<nz-data-list
v-loading="detailViewLoading"
ref="dataList"
v-show="detailType === 'list'"
v-if="detailType === 'list'"
:api="url"
:custom-table-title.sync="tools.customTableTitle"
:from="fromRoute.endpoint"
@@ -628,6 +628,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' },

View File

@@ -71,7 +71,7 @@
ref="dataList"
:api="url"
:tableId="tableId"
v-show="detailType === 'list'"
v-if="detailType === 'list'"
:custom-table-title.sync="tools.customTableTitle"
:from="fromRoute.module"
:layout="['searchInput', 'elementSet', 'pagination','detailViewSet']"
@@ -409,6 +409,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' },

View File

@@ -147,6 +147,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' },