城阳pc工作端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
6.9 KiB

<template>
<div class="warning-table">
<div class="table">
<div class="table-header">
<div class="table-header-th" v-for="(item,index) in headerList" :key='item.title' :style="headerStyle[index]">{{item.title}}</div>
</div>
<div class="table-body">
<div class="table-body-tr" v-for="(value,index) in tableData" :key='index'>
<div class="td" v-for="(item,indexs) in value" :key="indexs" :style="tableContentStyle[indexs]">{{item}}
<span v-if="indexs+1==value.length" class="more" @click="onClickMorePop(index)" ref='morePop'>
更多>
<span class="more-pop" v-if="visiblePopList[index]">
李佳琪刘阳赵欣丁一嘉敏李岩何嘉慧
李易峰赵敏何军曲树惠
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
export default {
name: 'warning-table',
props: {
headerList: {
type: Array,
required: false,
default: () => {
return [
{ title: '序号' },
{ title: '所属网格'},
{ title: '所属小区'},
{ title: '楼号'},
{ title: '姓名' },
]
}
},
tableData: {
type: Array,
required: false,
default: () => {
return [
[1,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[2,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[3,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[4,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[5,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[6,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[7,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[8,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[9,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
[10,'商丘路社区第一网格','商丘路小区','2号楼','杨颖、王平、刘佳敏、丁辉、杨萍'],
]
}
},
// 单独给头部设置样式
headerStyle: {
type: Array,
default: () => {
return [
// {
// width:'200px',
// border:'1px solid red'
// },
// {
// width:'200px'
// }
]
}
},
// 单独给内容设置样式
tableContentStyle: {
type: Array,
default: () => {
return [
// {
// width:'200px',
// border:'1px solid red'
// },
// {
// width:'200px'
// }
]
}
},
// // 表格平均分的份数
// ava: {
// type: Number,
// default: 8
// },
// // 表头高度--默认占比10%
// headerHeightAva: {
// type: String,
// default: '10%'
// },
// // 表格主体平均分成的份数
// tableContentAva: {
// type: Number,
// default: 5
// },
},
data() {
return {
visiblePopList:[false,false,false,false,false,false,false,false,false,false],
};
},
mounted () {
// window.addEventListener('click', e => {
// if (this.$refs.morePop && !this.$refs.morePop.contains(e.target)) {
// this.visiblePopList.forEach((item,indexs)=>{
// Vue.set(this.visiblePopList, indexs, false)
// })
// }
// })
},
created(){
},
methods: {
onClickMorePop(index) {
this.visiblePopList.forEach((item,indexs)=>{
if(index==indexs){
Vue.set(this.visiblePopList, index, true)
}else{
Vue.set(this.visiblePopList, indexs, false)
}
})
}
},
};
</script>
<style lang="scss" scoped>
.warning-table{
box-sizing: border-box;
width: 100%;
height: 100%;
.table {
width: 100%;
height: 100%;
&-header {
width: 100%;
height: 50px;
display: flex;
justify-content: space-around;
align-items: center;
background: rgba(8, 37, 134, 0.85);
font-size: 16px;
font-weight: 400;
color: #FFFFFF;
&-th {
text-align: center;
width: calc(100% / 5);
}
}
&-body {
box-sizing: border-box;
width: 100%;
height: calc(100% - 50px);
font-size: 18px;
font-weight: 400;
color: #FFFFFF;
&-tr {
width: 100%;
// height: 50px;
height: calc(100% / 10);
display: flex;
justify-content: space-around;
align-items: center;
.td {
text-align: center;
width: calc(100% / 5);
.more {
font-size: 18px;
font-weight: 400;
color: #E4DC00;
position: relative;
&-pop{
box-sizing: border-box;
display: block;
box-sizing: border-box;
width: 215px;
height: auto;
line-height: 20px;
border: 1px solid red;
position: absolute;
left: -100%;
top: 150%;
background: #06186D;
border: 1px solid #1A64CC;
border-radius: 5px;
font-size: 9px;
font-weight: 400;
color: #FFFFFF;
padding:16px 8px 10px 9px;
z-index: 1;
&::after{
position: absolute;
left: 30%;
top: -30%;
display: flex;
content:'';
width: 0;
height: 0;
border-width: 13px;
border-style: solid;
border-color: transparent transparent rgba(26, 100, 204,0.5) transparent;
// border-color: transparent transparent red transparent;
transform: translate(-50%,0);
}
}
}
}
}
&-tr:nth-child(2n) {
background: rgba(16, 75, 164, 0.24);
}
&-tr:hover {
background: url('../../../../../../assets/img/modules/visual/hover-bac.png') no-repeat center;
background-size: 100% 100%;
}
}
}
}
</style>