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

206 lines
4.1 KiB

1 year ago
<template>
1 year ago
<div @click="onClick">
<BorderRadiusImage
class="Card"
borderRadius="2px"
borderColor="linear-gradient(360deg, rgba(55, 231, 255, 0.3), rgba(55, 231, 255, 0))"
borderWidth="2px"
>
<div class="info" :style="{ gap }">
<p v-for="(item, index) in keyMap" :key="index">
<span>{{ item.label }}: </span>
<span>
<slot :name="`form-${item.key}`" :data="cardData">
{{ getValue(item) }}{{ item.suffix }}
1 year ago
</slot>
</span>
</p>
</div>
1 year ago
1 year ago
<div class="bottom" v-if="hasBtn">
<slot name="button">
<Button>
{{ buttonText }}
</Button>
</slot>
</div>
<!-- <div class="status" :style="{ background: 'linear-gradient(123deg, #00B3CC 0%, rgba(0, 179, 204, 0) 100%)' }">
1 year ago
<span class="text">正常</span>
</div> -->
1 year ago
</BorderRadiusImage>
</div>
1 year ago
</template>
<script>
1 year ago
import Button from "@screen/components/Buttons/Button.vue";
1 year ago
import BorderRadiusImage from "@screen/components/BorderRadiusImage.vue";
1 year ago
import { get as pathGet } from "lodash";
1 year ago
export default {
1 year ago
name: "Card",
1 year ago
components: {
Button,
1 year ago
BorderRadiusImage,
1 year ago
},
props: {
cardData: {
type: Object,
default: () => ({
source: "济菏运管中心",
location: "长清大学城收费站",
direction: "117.123456",
direction2: "37.12234",
1 year ago
state: 1,
}),
1 year ago
},
keyMap: {
type: Array,
1 year ago
default: () => [
1 year ago
{
key: "source",
1 year ago
label: "机构名称",
1 year ago
},
{
key: "location",
1 year ago
label: "机构地址",
1 year ago
},
{
key: "direction",
1 year ago
label: "经度",
1 year ago
},
{
key: "direction2",
1 year ago
label: "纬度",
1 year ago
},
{
key: "direction3",
1 year ago
label: "救援外协单位",
},
],
1 year ago
},
buttonIcon: {
type: String,
1 year ago
default: "images/insert.svg",
1 year ago
},
buttonText: {
type: String,
1 year ago
default: "修改",
1 year ago
},
gap: {
type: String,
1 year ago
default: "6px",
},
hasBtn: {
type: Boolean,
1 year ago
default: true,
},
1 year ago
},
data() {
return {
stateMap: {
1: "confirmed",
1 year ago
2: "comfortable",
3: "congestion",
4: "normal",
},
};
1 year ago
},
methods: {
getValue(item) {
let value = pathGet(this.cardData, item.key) ?? "-";
if (item.value) {
value = item.value(this.cardData);
}
return value;
1 year ago
},
1 year ago
onClick() {
this.$emit("click", this.data);
},
1 year ago
},
};
1 year ago
</script>
1 year ago
<style lang="scss" scoped>
1 year ago
.Card {
color: #fff;
display: flex;
background: #133242;
opacity: 1;
padding: 18px 12px;
gap: 12px;
height: 100%;
overflow: hidden;
position: relative;
flex-direction: column;
.info {
flex: 1;
display: flex;
flex-direction: column;
// align-items: center;
// justify-content: space-between;
1 year ago
> p {
// height: 21px;
1 year ago
font-size: 14px;
// font-family: PingFang SC, PingFang SC;
font-weight: 400;
line-height: 21px;
display: flex;
1 year ago
& > :first-child {
1 year ago
margin-right: 6px;
flex: 1;
}
1 year ago
& > :last-child {
1 year ago
flex: 2;
1 year ago
color: #ffffff;
1 year ago
}
}
}
.bottom {
display: flex;
justify-content: end;
gap: 9px;
1 year ago
}
.status {
position: absolute;
right: 0;
top: 0;
width: 51px;
height: 51px;
clip-path: polygon(60% 0, 100% 39%, 100% 100%, 0 0);
display: flex;
justify-content: center;
font-size: 12px;
.text {
transform: rotate(42deg);
display: block;
line-height: 30px;
}
&::after {
content: "";
position: absolute;
1 year ago
background: linear-gradient(
-147deg,
#ffffff 0%,
rgba(255, 255, 255, 0) 0%,
#ffffff 46%,
rgba(255, 255, 255, 0) 100%
);
1 year ago
height: 1px;
width: 124%;
transform: rotate(45deg);
right: calc(-25% - 1px);
transform-origin: left top;
}
}
}
</style>