老产品前端代码
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.
 
 
 
 

359 lines
8.2 KiB

<template>
<div>
<!-- <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]"
>
<div v-if="item.type && item.type == 'btn'">
<a @click="handleClickBtn(item)">{{ item.name }}</a>
</div>
<span v-else>{{ item }}</span>
</div>
</div>
<screen-loading v-if="visibleLoading">加载中</screen-loading>
<div class="no-data" v-if="tableData.length == 0 && !visibleLoading">
<img
src="../../../../../../assets/img/modules/visual/noData.png"
alt=""
srcset=""
class="no-data-img"
/>
</div>
</div>
</div>
</div> -->
<cpt-tb
:highlight-top3="true"
:col-list="tableContentStyle"
:loading="visibleLoading"
:header="headerList.map((item) => item.title)"
:list="cptTbData"
@operate="handleOperate"
></cpt-tb>
<people-list
v-if="showedPeopleList && buildingId"
:buildingId="buildingId"
:configId="configId"
:gridName="gridName"
@close="showedPeopleList = false"
/>
</div>
</template>
<script>
import ScreenLoading from "../screen-loading/index";
import peopleList from "./people-list";
import cptTb from "@/views/modules/visual/cpts/tb";
export default {
name: "warning-table",
components: {
ScreenLoading,
peopleList,
cptTb,
},
props: {
headerList: {
type: Array,
required: false,
default: () => {
return [
{ title: "序号" },
{ title: "所属网格" },
{ title: "所属小区" },
{ title: "楼号" },
{ title: "预警人数" },
{ title: "操作" },
];
},
},
tableData: {
type: Array,
required: false,
default: () => {
return [
// [
// 1,
// "商丘路社区第一网格",
// "商丘路小区",
// "2号楼",
// "杨颖、王平、刘佳敏、丁辉、杨萍",
// ],
// [
// 2,
// "商丘路社区第一网格",
// "商丘路小区",
// "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'
// }
];
},
},
visibleLoading: {
type: Boolean,
default: true,
},
},
data() {
return {
// 显示人员详情
showedPeopleList: false,
buildingId: "",
configId: "",
gridName: "",
};
},
computed: {
cptTbData() {
return this.tableData.map((item) => {
return item.map((subitem) => {
if (subitem.type && subitem.type == "btn") {
subitem.type = "operate";
subitem.list = [subitem.name];
}
console.log(subitem);
return subitem;
});
});
},
},
watch: {},
mounted() {},
created() {},
methods: {
handleOperate(index) {
let item = this.tableData[index];
this.handleClickBtn(item[item.length - 1]);
},
handleClickBtn(item) {
this.showedPeopleList = true;
this.buildingId = item.buildingId;
this.configId = item.configId;
this.gridName = item.gridName;
},
toUserInfo(uid) {
this.$router.push({ path: `/main-shuju/visual-basicinfo-people/${uid}` });
},
},
};
</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: 20%;
&:nth-child(1) {
width: 5%;
}
&:nth-child(2) {
width: 25%;
}
&:nth-child(3) {
width: 25%;
}
&:nth-child(4) {
width: 15%;
}
&:nth-child(5) {
width: 15%;
}
&:nth-child(6) {
width: 15%;
}
}
}
&-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: 20%;
display: flex;
justify-content: center;
&:nth-child(1) {
width: 5%;
}
&:nth-child(2) {
width: 25%;
}
&:nth-child(3) {
width: 25%;
}
&:nth-child(4) {
width: 15%;
}
&:nth-child(5) {
width: 15%;
}
&:nth-child(6) {
width: 15%;
}
a {
cursor: pointer;
}
.more {
margin: 0 10px;
font-size: 18px;
font-weight: 400;
color: #e4dc00;
position: relative;
cursor: pointer;
&-pop {
box-sizing: border-box;
display: block;
box-sizing: border-box;
width: 600px;
max-height: 300px;
height: auto;
overflow-y: auto;
line-height: 20px;
border: 1px solid red;
position: absolute;
right: 0;
bottom: 150%;
background: #06186d;
border: 1px solid #1a64cc;
border-radius: 5px;
font-size: 18px;
font-weight: 400;
color: #ffffff;
padding: 16px 8px 10px 9px;
z-index: 1;
cursor: default;
// &::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%;
}
// 暂无数据
.no-data {
width: 100%;
height: calc(100% - 50px);
display: flex;
align-items: center;
justify-content: center;
&-img {
width: 249px;
height: 172px;
}
}
}
}
}
</style>