2022-02-14 22:22:31 +08:00
|
|
|
<template>
|
2022-02-18 17:54:22 +08:00
|
|
|
<div class="detection-list" id="detectionList">
|
2022-05-27 12:14:24 +08:00
|
|
|
<loading :loading="loading"></loading>
|
2022-02-18 17:54:22 +08:00
|
|
|
<div class="detection-list__content">
|
|
|
|
|
<div class="detection-list--list">
|
2022-02-14 22:22:31 +08:00
|
|
|
<div class="no-data" v-if="noData">No data</div>
|
2022-02-18 17:54:22 +08:00
|
|
|
<div v-if="!isCollapse" @click="collapse" class="cn-detection__shadow"></div>
|
2022-02-14 22:22:31 +08:00
|
|
|
<detection-row
|
|
|
|
|
v-for="(data, index) in listData"
|
|
|
|
|
:detection="data"
|
2022-02-25 13:33:54 +08:00
|
|
|
:page-type="pageType"
|
2022-02-14 22:22:31 +08:00
|
|
|
:timeFilter="timeFilter"
|
|
|
|
|
:key="index"
|
|
|
|
|
:ref="`detectionRow${index}`"
|
|
|
|
|
:index="index"
|
|
|
|
|
@switchCollapse="switchCollapse"
|
|
|
|
|
></detection-row>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import DetectionRow from '@/views/detections/DetectionRow'
|
2022-05-27 12:14:24 +08:00
|
|
|
import Loading from '@/components/common/Loading'
|
2022-02-14 22:22:31 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'DetectionList',
|
|
|
|
|
components: {
|
2022-05-27 12:14:24 +08:00
|
|
|
Loading,
|
2022-02-14 22:22:31 +08:00
|
|
|
DetectionRow
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
listData: Array,
|
|
|
|
|
from: String,
|
|
|
|
|
pageObj: Object,
|
|
|
|
|
loading: Boolean,
|
2022-02-25 13:33:54 +08:00
|
|
|
timeFilter: Object,
|
|
|
|
|
pageType: String // 安全事件、服务质量
|
2022-02-14 22:22:31 +08:00
|
|
|
},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
showDetail: false,
|
|
|
|
|
typeName: '',
|
|
|
|
|
detectionList: [],
|
|
|
|
|
isCollapse: true,
|
|
|
|
|
collapseIndex: 0,
|
|
|
|
|
tableId: 'detectionList',
|
|
|
|
|
listDataCopy: [],
|
|
|
|
|
noData: false
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-06-09 21:55:28 +08:00
|
|
|
mounted () {
|
|
|
|
|
// 监听⿏标滚动事件
|
|
|
|
|
window.addEventListener('mousewheel', this.handleScroll)
|
|
|
|
|
},
|
|
|
|
|
unmounted () {
|
|
|
|
|
window.removeEventListener('mousewheel', this.handleScroll)
|
|
|
|
|
},
|
2022-02-14 22:22:31 +08:00
|
|
|
methods: {
|
|
|
|
|
switchCollapse (isCollapse, index) {
|
|
|
|
|
this.isCollapse = isCollapse
|
|
|
|
|
this.collapseIndex = index
|
2022-05-24 15:23:55 +08:00
|
|
|
if (isCollapse) {
|
|
|
|
|
this.emitter.emit('switch-collapse')
|
|
|
|
|
}
|
2022-02-14 22:22:31 +08:00
|
|
|
},
|
|
|
|
|
collapse () {
|
|
|
|
|
this.isCollapse = true
|
|
|
|
|
this.$refs[`detectionRow${this.collapseIndex}`].collapse()
|
2022-06-09 21:55:28 +08:00
|
|
|
},
|
|
|
|
|
handleScroll (e) {
|
|
|
|
|
if(e.target.className==="cn-detection__shadow"){
|
|
|
|
|
let container = document.getElementById("cnContainer")
|
|
|
|
|
container.scrollTop += e.deltaY/2
|
|
|
|
|
}
|
2022-02-14 22:22:31 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
listData: {
|
|
|
|
|
deep: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
if (!n || n.length === 0) {
|
|
|
|
|
this.timeout = setTimeout(() => {
|
|
|
|
|
this.noData = true
|
|
|
|
|
}, 500)
|
|
|
|
|
} else {
|
|
|
|
|
clearTimeout(this.timeout)
|
|
|
|
|
this.noData = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|