fix:全局搜索 跳转 详细视图选中

This commit is contained in:
zhangyu
2022-01-18 10:06:33 +08:00
parent c86e3114dd
commit 123c60d5d8
15 changed files with 86 additions and 14 deletions

View File

@@ -141,7 +141,14 @@ export default {
})
return item
})
this.detailViewRightObj = this.tableData[0]
const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = ''
if (globalSearchId) {
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
} else {
detailViewRightObj = this.tableData[0]
}
this.detailViewRightObj = detailViewRightObj
this.inputDateQuery = this.handlerTableData(this.tableData)
this.pageObj.total = this.tableData.length
if (!this.scrollbarWrap) {

View File

@@ -20,7 +20,8 @@
<li
v-for="(item,index) in tableData"
:key="index"
class="detail-row"
class="detail-row"
:id="'globalSearch' + item.id"
:class="item.id === detailViewRightObj.id ? 'selected' : ''"
@click="detailViewRightShow(item)">
<el-popover

View File

@@ -20,7 +20,8 @@
<li
v-for="(item,index) in tableData"
:key="index"
class="detail-row"
class="detail-row"
:id="'globalSearch' + item.id"
:class="item.id === detailViewRightObj.id ? 'selected' : ''"
@click="detailViewRightShow(item)"
@mouseenter="labelHover(item, 'asset', true, $event)"

View File

@@ -20,7 +20,8 @@
<li
v-for="(item,index) in tableData"
:key="index"
class="detail-row"
class="detail-row"
:id="'globalSearch' + item.id"
:class="item.id === detailViewRightObj.id ? 'selected' : ''"
@click="detailViewRightShow(item)"
@mouseenter="labelHover(item, 'dc', true, $event)"

View File

@@ -20,7 +20,8 @@
<li
v-for="(item,index) in tableData"
:key="index"
class="detail-row"
class="detail-row"
:id="'globalSearch' + item.id"
:class="item.id === detailViewRightObj.id ? 'selected' : ''"
@click="detailViewRightShow(item)"
@mouseenter="labelHover(item, 'endpoint', true, $event)"

View File

@@ -20,7 +20,8 @@
<li
v-for="(item,index) in tableData"
:key="index"
class="detail-row"
class="detail-row"
:id="'globalSearch' + item.id"
:class="item.id === detailViewRightObj.id ? 'selected' : ''"
@click="detailViewRightShow(item)"
@mouseenter="labelHover(item, 'module', true, $event)"

View File

@@ -20,7 +20,8 @@
<li
v-for="(item,index) in tableData"
:key="index"
class="detail-row"
class="detail-row"
:id="'globalSearch' + item.id"
:class="item.id === detailViewRightObj.id ? 'selected' : ''"
@click="detailViewRightShow(item)"
>

View File

@@ -20,7 +20,8 @@
<li
v-for="(item,index) in tableData"
:key="index"
class="detail-row"
class="detail-row"
:id="'globalSearch' + item.id"
:class="item.id === detailViewRightObj.id ? 'selected' : ''"
@click="detailViewRightShow(item)"
>

View File

@@ -103,7 +103,14 @@ export default {
response.data.list[i].status = response.data.list[i].status + ''
}
this.tableData = response.data.list
this.detailViewRightObj = this.tableData[0]
const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = ''
if (globalSearchId) {
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
} else {
detailViewRightObj = this.tableData[0]
}
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap && this.$refs.dataTable.$refs.dataTable) {

View File

@@ -66,6 +66,22 @@ export default {
this.$emit('orderDetail', this.orderBy, n)
}
}
},
tableData: {
immediate: true,
handler (n) {
if (n && n.length) {
const id = this.$store.getters.getGlobalSearchId
if (id) {
setTimeout(() => {
if (document.getElementById('globalSearch' + id)) {
document.getElementById('globalSearch' + id).scrollIntoView(true)
this.$store.commit('setGlobalSearchId', '')
}
}, 500)
}
}
}
}
}
}

View File

@@ -283,7 +283,14 @@ export default {
item.receiverShow = temp
})
this.tableData = response.data.list
this.detailViewRightObj = this.tableData[0]
const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = ''
if (globalSearchId) {
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
} else {
detailViewRightObj = this.tableData[0]
}
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap) {

View File

@@ -713,7 +713,14 @@ export default {
response.data.list[i].status = response.data.list[i].status + ''
}
this.tableData = response.data.list
this.detailViewRightObj = this.tableData[0]
const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = ''
if (globalSearchId) {
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
} else {
detailViewRightObj = this.tableData[0]
}
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap && this.$refs.dataTable.$refs.dataTable) {

View File

@@ -184,7 +184,14 @@ export default {
if (response.code === 200) {
this.tableData = response.data.list
this.nowTime = this.utcTimeToTimezoneStr(response.time)
this.detailViewRightObj = this.tableData[0]
const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = ''
if (globalSearchId) {
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
} else {
detailViewRightObj = this.tableData[0]
}
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap) {

View File

@@ -624,7 +624,14 @@ export default {
})
}
this.tableData = response.data.list
this.detailViewRightObj = this.tableData[0]
const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = ''
if (globalSearchId) {
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
} else {
detailViewRightObj = this.tableData[0]
}
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap) {

View File

@@ -405,7 +405,14 @@ export default {
response.data.list[i].status = response.data.list[i].status + ''
}
this.tableData = response.data.list
this.detailViewRightObj = this.tableData[0]
const globalSearchId = this.$store.getters.getGlobalSearchId
let detailViewRightObj = ''
if (globalSearchId) {
detailViewRightObj = this.tableData.find(item => item.id === globalSearchId)
} else {
detailViewRightObj = this.tableData[0]
}
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap) {