123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <template>
- <div class="tuli">
- <div class="title">
- <el-checkbox class="yse-events" v-model="checked" label="" size="small" />
- <span>状态图例</span>
- </div>
- <div class="list">
- <div class="item" v-for="item in list" :key="item.id">
- <template v-if="item.outerType === 3">
- <img
- :src="require(`@/assets/status/status_${item.icon}.png`)"
- width="15"
- />
- <div class="text">
- {{ item.name }}
- </div>
- </template>
- <template v-else>
- <div :class="item.style" :style="iconStyle(item.style, index, item)"></div>
- <span class="text">{{ item.name }}</span>
- </template>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { toRefs, ref, onMounted, watch } from "vue";
- const list = ref([]);
- const checked = ref(true);
- onMounted(async () => {
- list.value = arr;
- });
- const arr = [
- {
- name: "病虫异常",
- icon: "bcyc",
- outerType: 3,
- },
- {
- name: "生长异常",
- icon: "szyc",
- outerType: 3,
- },
- {
- name: "待复核",
- icon: "dfh",
- outerType: 3,
- },
- {
- name: "巡飞点位",
- icon: "xfdw",
- outerType: 3,
- },
- ];
- const props = defineProps({
- tabValue: {
- type: Object,
- default: () => {},
- },
- });
- const iconStyle = (type, index, item) => {
- if (type === "triangle") {
- return { borderBottomColor: item.color };
- }
- if (type === "circular") {
- return { background: item.color };
- }
- };
- watch(
- () => props.tabValue,
- (newValue, oldValue) => {
- if (newValue) {
- console.log("newValue", newValue);
- if (newValue.type === 3) {
- list.value = arr;
- } else {
- list.value = newValue.items.map(item =>{
- return {
- ...item,
- outerType:newValue.type,
- style:newValue.style
- }
- });
- }
- }
- }
- );
- </script>
- <style lang="scss" scoped>
- .tuli {
- width: 108px;
- background: rgba(3, 44, 57, 0.9);
- border-radius: 4px;
- border: 1px solid rgba(81, 233, 240, 0.3);
- .title {
- height: 30px;
- text-align: center;
- line-height: 30px;
- background: rgba(205, 243, 255, 0.15);
- border-radius: 4px 4px 0px 0px;
- border: 1px solid rgba(81, 233, 240, 0.3);
- font-size: 14px;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #00fff0;
- }
- .list {
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-around;
- padding: 10px 10px 10px 10px;
- .item {
- width: 100%;
- padding: 5px 5px 0px 5px;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- .circular {
- width: 12px;
- height: 12px;
- border-radius: 50px;
- background: #b0e000;
- }
- .triangle {
- width: 0;
- height: 0;
- border-left: 6px solid transparent; /* 左边框设置为透明 */
- border-right: 6px solid transparent; /* 右边框设置为透明 */
- border-bottom: 12px solid #d63f3c; /* 下边框设置为你想要的颜色和大小,这将形成三角形的底部 */
- }
- .color {
- width: 20%;
- height: 14px;
- }
- .text {
- margin-left: 5px;
- width: 76%;
- font-size: 12px;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #ffffff;
- line-height: 17px;
- }
- }
- }
- }
- </style>
|