integrated_traffic_vue/src/views/BI/components/personnel.vue

358 lines
8.0 KiB
Vue

<template>
<div class="container">
<div class="block1">
<layout-title title="人员类型统计" />
<div class="option">
<div
v-for="(item, index) in data.block1OptionsList"
:key="index"
class="list"
>
<img :src="item.img" alt="" class="img" />
<div class="label">{{ item.label }}</div>
<div class="num">
<count-up :end-val="item.count"></count-up>
</div>
</div>
</div>
</div>
<div class="block2">
<layout-title title="告警类型统计" />
<div class="option">
<div
v-for="(item, index) in data.block2OptionsList"
:key="index"
class="list"
@click="fnAlarmTypeClick(item)"
>
<div class="name">{{ item.label }}</div>
<div class="num">
<count-up :end-val="item.total"></count-up>
</div>
</div>
</div>
</div>
<div class="block3">
<layout-title title="人员定位情况" />
<div class="option">
<div class="table">
<div class="tr">
<div class="td">姓名</div>
<div class="td">卡号</div>
<div class="td">电量</div>
</div>
<div v-for="(item, index) in data.block3List" :key="index" class="tr">
<div class="td">{{ item.name }}</div>
<div class="td">{{ item.cardNo }}</div>
<div class="td">{{ item.stset + "%" }}</div>
</div>
</div>
</div>
</div>
<alarm-dialog
v-if="data.drawer"
v-model:visible="data.drawer"
v-model:pd="data.form"
:ele-type-num="+data.eleType"
/>
</div>
</template>
<script setup>
import LayoutTitle from "./title.vue";
import AlarmDialog from "../components/dialog/alarm_dialog.vue";
import CountUp from "vue-countup-v3";
import { nextTick, reactive } from "vue";
import {
getPersonnelTypeCount,
getAlarmTypeCount,
getPersonnelPositioningCount,
} from "@/request/bi/mapApi.js";
const data = reactive({
block1OptionsList: [
{
img: new URL("/src/assets/images/map/img1.png", import.meta.url).href,
label: "全部人员",
count: 0,
},
],
eleType: 0,
block2OptionsList: [],
block3List: [
{
name: "赵一诺",
Office: "大堂经理",
electricity: "30%",
},
{
name: "赵一诺",
Office: "大堂经理",
electricity: "30%",
},
{
name: "赵一诺",
Office: "大堂经理",
electricity: "30%",
},
{
name: "赵一诺",
Office: "大堂经理",
electricity: "30%",
},
{
name: "赵一诺",
Office: "大堂经理",
electricity: "30%",
},
{
name: "赵一诺",
Office: "大堂经理",
electricity: "30%",
},
{
name: "赵一诺",
Office: "大堂经理",
electricity: "30%",
},
{
name: "赵一诺",
Office: "大堂经理",
electricity: "30%",
},
],
form: {},
drawer: false,
});
const getPersonnelData = async () => {
const resData = await getPersonnelTypeCount();
await nextTick(() => {
data.block1OptionsList.forEach((item) => {
item.count = resData.userCount;
});
});
};
const fnAlarmTypeClick = (e) => {
data.drawer = true;
data.form.title = e.label;
data.eleType = e.type;
};
const getAlarmTypeData = async () => {
const resData = await getAlarmTypeCount();
const dataList = resData.data.data.data;
const typeList = {
1: "滞留报警",
2: "串岗报警",
3: "超员报警",
4: "缺员报警",
5: "静止报警",
6: "一键报警",
7: "越界报警",
8: "聚集告警",
};
dataList.forEach((item) => {
item.label = typeList[item.type];
});
data.block2OptionsList = dataList;
};
const getPositionData = async () => {
const resData = await getPersonnelPositioningCount();
data.block3List = resData.data.rows;
};
getPersonnelData();
getAlarmTypeData();
getPositionData();
</script>
<style scoped lang="scss">
.container {
width: 100%;
.block1 {
width: 430px;
.option {
width: 100%;
min-height: 100px;
background-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0.8)
);
border: 1px solid;
border-image: linear-gradient(
to bottom,
rgba(58, 122, 149, 0),
rgba(16, 188, 236, 1)
)
1;
border-top: none;
display: flex;
padding: 20px 0;
text-align: center;
.list {
text-align: center;
width: 33%;
.img {
animation: slideY 2s infinite;
}
.label {
margin-top: 5px;
}
.num {
font-size: 24px;
margin-top: 10px;
background: linear-gradient(to top, #ffffff, #00a8ff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: bold;
font-family: "Pingfang SC", "Microsoft YaHei", "Monospaced Number",
"Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, "PingFang SC", "Hiragino Sans GB", "Helvetica Neue",
Helvetica, Arial, sans-serif;
text-shadow: 0 0 20px #2c67ec;
}
}
}
}
.block2 {
width: 430px;
margin-top: 10px;
.option {
width: 100%;
min-height: 100px;
background-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0.8)
);
border: 1px solid;
border-image: linear-gradient(
to bottom,
rgba(58, 122, 149, 0),
rgba(16, 188, 236, 1)
)
1;
border-top: none;
display: flex;
padding: 10px;
text-align: center;
flex-wrap: wrap;
justify-content: space-between;
.list {
width: 48%;
background: rgba(20, 88, 177, 0.3);
border: 1px solid rgba(63, 145, 197, 0.5);
border-radius: 4px;
margin-top: 10px;
display: flex;
justify-content: space-between;
padding: 10px;
cursor: pointer;
}
}
}
.block3 {
width: 430px;
margin-top: 10px;
.tab_list {
}
.option {
width: 100%;
min-height: 100px;
background-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0.8)
);
border: 1px solid;
border-image: linear-gradient(
to bottom,
rgba(58, 122, 149, 0),
rgba(16, 188, 236, 1)
)
1;
border-top: none;
padding: 10px;
.tab_list {
display: flex;
background: rgba(52, 147, 245, 0.3);
border: 1px solid rgba(63, 145, 197, 0.4);
border-radius: 2px;
width: 55%;
justify-content: space-between;
.list {
padding: 8px 10px;
cursor: pointer;
&:hover,
&.active {
background-image: linear-gradient(
to bottom,
rgba(1, 168, 255, 1),
rgba(17, 74, 152, 1)
);
}
}
}
.table {
margin-top: 5px;
.tr {
display: flex;
&:nth-child(odd) {
background-color: rgba(42, 86, 158, 0.53);
}
.td {
flex: 1;
text-align: left;
font-size: 12px;
color: #fff;
padding: 6px 10px;
&:nth-child(1) {
flex-basis: 30%;
}
&:nth-child(2) {
flex-basis: 50%;
}
&:nth-child(3) {
flex-basis: 20%;
}
}
.empty {
flex: 1;
text-align: center;
font-size: 12px;
color: #fff;
padding: 5px;
}
}
}
}
}
@keyframes slideY {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-5px);
}
100% {
transform: translateY(0);
}
}
}
</style>