济菏高速业务端
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.

240 lines
5.8 KiB

1 year ago
<template>
<BorderRadiusImage class="RoadStateCard" borderRadius="2px"
borderColor="linear-gradient(360deg, rgba(55, 231, 255, 0.3), rgba(55, 231, 255, 0))" borderWidth="2px">
<div class="left" v-if="isShowLeft">
<ElImage style="width: 212px; height: 159px" v-if="cardData.pictures && cardData.pictures.length>0" class="imgPicture"
:src="cardData.pictures[0]"
:preview-src-list="cardData.pictures || []">
1 year ago
<div slot="error">
<i class="el-icon-picture-outline icon"></i>
</div>
</ElImage>
<div style="width: 212px; height: 159px;" v-else class="imgPicture"
:preview-src-list="cardData.pictures || []">
<img :src=getDeviceSource(cardData) style="width: auto; height: 80px">
</div>
1 year ago
</div>
<div class="right">
<div class="info">
1 year ago
<p class="linText" v-for="(item, index) in keyMap" :key="index">
1 year ago
<span>{{ item.label }}: </span>
<span>{{ cardData[item.key] }}</span>
</p>
</div>
<div class="controls">
<Button :style="{ background: firstBtnColor, width: isShowLeft ? '50%' : '30%' }"
@click.native="$emit('firstBtnClick', cardData.id)">{{ getFirstBtnText(cardData.state) }}</Button>
<Button v-if="cardData.state == 4" :style="{ background: lastBtnColor, width: isShowLeft ? '50%' : '25%' }"
@click.native="$emit('lastBtnClick', cardData.id)">{{ getLastBtnText(cardData.state) }}</Button>
1 year ago
</div>
</div>
<img v-if="cardData.state" class="status" :src="require(`./images/${statusMap[cardData.state]}.svg`)" />
1 year ago
</BorderRadiusImage>
</template>
<script>
import Button from "@screen/components/Buttons/Button.vue";
import BorderRadiusImage from "@screen/components/BorderRadiusImage.vue";
1 year ago
import { statusMap } from "./data.js";
1 year ago
export default {
1 year ago
name: "RoadStateCard",
1 year ago
props: {
cardData: {
type: Object,
default: () => ({
time: "2023.12.22 13:00:00",
source: "视频智能识别",
location: "k100+000",
direction: "济南方向",
1 year ago
}),
1 year ago
},
firstBtnText: {
type: String,
1 year ago
default: "详情",
1 year ago
},
lastBtnText: {
type: String,
1 year ago
default: "调度记录",
1 year ago
},
firstBtnColor: {
type: String,
1 year ago
default: "#00B3CC",
1 year ago
},
lastBtnColor: {
type: String,
1 year ago
default: "#CB7A00",
1 year ago
},
keyMap: {
type: Array,
1 year ago
default: () => [
1 year ago
{
key: "stringEventType",
1 year ago
label: "事件",
1 year ago
},
1 year ago
{
1 year ago
key: "stringEventSource",
1 year ago
label: "来源",
1 year ago
},
{
1 year ago
key: "stakeMark",
1 year ago
label: "位置",
1 year ago
},
{
1 year ago
key: "stringDirection",
1 year ago
label: "方向",
1 year ago
},
{
1 year ago
key: "startTime",
1 year ago
label: "时间",
1 year ago
},
1 year ago
],
},
isShowLeft: {
type: Boolean,
default: true
}
1 year ago
},
data() {
1 year ago
return {
1 year ago
picUrl: "./test.png",
};
1 year ago
},
1 year ago
emit: ["firstBtnClick", "lastBtnClick"],
1 year ago
components: {
Button,
1 year ago
BorderRadiusImage,
1 year ago
},
created() {
this.statusMap = statusMap;
},
methods: {
getDeviceSource(data){
const {warningSource, pictures} = data;
if(warningSource === 2){
return require(`@screen/images/device/毫米波雷达B.png`)
} else if(warningSource ===3){
return require(`@screen/images/device/锥桶B.png`)
} else if(warningSource ===4){
return require(`@screen/images/device/护栏碰撞预警系统B.png`)
} else if(warningSource ===5 && (!pictures || pictures.length === 0)){
return require(`@screen/images/device/扫码报警B.png`)
} else if(warningSource ===7){
return require(`@screen/images/device/气象监测器B.png`)
} else {
return require(`@screen/images/device/view.png`)
}
},
getFirstBtnText(state) {
1 year ago
let text = "详情";
if (state == 5) text = "去确认";
if (state == 4) text = "详情";
if (state == 3) text = "处置记录";
return text;
},
getLastBtnText(state) {
1 year ago
let text = "去处置";
return text;
},
1 year ago
},
};
1 year ago
</script>
1 year ago
<style lang="scss" scoped>
1 year ago
.RoadStateCard {
color: #fff;
display: flex;
background: #133242;
border-radius: 2px 2px 2px 2px;
opacity: 1;
// border: 1px solid;
// border-image: linear-gradient(360deg, rgba(55, 231, 255, 0.3), rgba(55, 231, 255, 0)) 1 1;
padding: 18px 12px;
gap: 12px;
height: 100%;
overflow: hidden;
position: relative;
.left {
img {
width: 212px;
1 year ago
height: 159px;
1 year ago
}
1 year ago
.icon {
1 year ago
display: inline-block;
1 year ago
width: 212px;
height: 159px;
line-height: 157px;
text-align: center;
border: 1px solid #fff;
}
1 year ago
}
.right {
display: flex;
flex-direction: column;
flex: 1;
gap: 12px;
height: 159px;
1 year ago
width: 201px;
1 year ago
.info {
flex: 1;
display: flex;
flex-direction: column;
1 year ago
>p {
1 year ago
font-size: 12px;
color: #f4f4f4;
line-height: 24px;
1 year ago
1 year ago
&:nth-child(-n + 2) {
color: #37e7ff;
1 year ago
font-size: 16px;
font-weight: bold;
}
1 year ago
&:nth-child(2) {
margin-bottom: 3px;
}
}
.linText {
/*不换行*/
white-space: nowrap;
/*超出的显示省略号*/
text-overflow: ellipsis;
/*超出部分隐藏*/
overflow: hidden;
/*长单词不换行-兼容ie*/
// word-wrap: normal;
1 year ago
}
}
.controls {
display: flex;
gap: 9px;
>div {
1 year ago
// flex: 1;
1 year ago
}
}
}
.status {
position: absolute;
right: 0;
top: 0;
}
}
.imgPicture{
background: linear-gradient(to top, #104864 0%, #133242 100%);
border: 1px solid #20627e;
display: flex;
justify-content: center;
align-items: center;
}
1 year ago
</style>