Newer
Older
HuangJiPC / src / pages / views / oneMap / components / oneMapTuLi.vue
@zhangdeliang zhangdeliang on 21 Jun 4 KB update
<template>
  <div id="basicTuLi">
    <n-space vertical>
      <div class="TuliBox" v-for="(item, index) in TuLiData" :key="index">
        <n-popover
          trigger="hover"
          :style="{
            width: 'auto',
            height: 'auto',
            maxWidth: '850px',
            border: '1px solid #4E64D6',
            borderRadius: '5px',
          }"
          :placement="item.position"
          id="rightPopover"
        >
          <template #trigger>
            <n-checkbox
              v-model:checked="item.isChecked"
              @update:checked="CheckChange(item)"
            >
              <span class="rightPopoverSpan"
                >{{ item.name }}({{ item.length }})</span
              >
            </n-checkbox>
          </template>
          <div class="DuoXuanKuang">
            <n-space>
              <span
                v-for="(item2, index2) in item.data"
                :key="index2"
                @click="BtnLick(item2)"
                class="DouXuanBtn"
                :class="{ DouXuanBtnCheck: chechId == item2.ZhaId }"
              >
                {{ item2.ZhaName }}
              </span>
            </n-space>
          </div>
        </n-popover>
      </div>
    </n-space>
  </div>
</template>
<script>
import { ref, reactive, toRefs, onMounted } from "vue";
import bus from "@/utils/util";
export default {
  name: "basicTuLi",
  setup() {
    let TuLiData = reactive([
      {
        name: "闸站",
        length: "03",
        id:"1",
        isChecked: true,
        position: "right-start",
        data: [
          {
            ZhaName: "西渠闸门",
            ZhaId: "0",
          },
          {
            ZhaName: "解放大道澳门路闸",
            ZhaId: "1",
          },
          {
            ZhaName: "中山大道前进四路闸",
            ZhaId: "2",
          },
        ],
      },
      {
        name: "污水泵站",
        length: "01",
        id:"2",
        isChecked: true,
        position: "right",
        data: [
          {
            ZhaName: "王家墩污水泵站",
            ZhaId: "3",
          },
        ],
      },
      {
        name: "雨水泵站",
        length: "03",
        id:"3",
        isChecked: true,
        position: "right-end",
        data: [
          {
            ZhaName: "后湖二期泵站",
            ZhaId: "4",
          },
          {
            ZhaName: "铁路桥泵站",
            ZhaId: "5",
          },
          {
            ZhaName: "机场河补水泵站",
            ZhaId: "6",
          },
        ],
      },
      {
        name: "调蓄池",
        length: "03",
        id:"4",
        isChecked: true,
        position: "right-end",
        data: [
          {
            ZhaName: "常青公园地下调蓄池",
            ZhaId: "7",
          },
          {
            ZhaName: "黄孝河CSO调蓄",
            ZhaId: "8",
          },
          {
            ZhaName: "机场河CSO调蓄",
            ZhaId: "9",
          },
        ],
      },
    ]);
    let chechId = ref(null);
    function BtnLick(item2) {
      chechId.value = item2.ZhaId;
      console.log(item2);
      bus.emit("siteClick", item2);
    }
    function CheckChange(item) {
      console.log(item.isChecked);
      bus.emit("groupClick", item);
    }
    onMounted(() => {});
    return { TuLiData, BtnLick, chechId, CheckChange };
  },
  computed: {},
  methods: {},
};
</script>
<style lang="less" scoped>
#basicTuLi {
  position: absolute;
  left: 440px;
  top: 40px;
  width: auto;
  height: auto;
  .TuliBox {
    width: 110px;
    height: 40px;
    line-height: 40px;
  }

  .DuoXuanKuang {
    width: 100%;
    height: 100%;
    display: inline-block;
    overflow: auto;
  }
}
.rightPopoverSpan {
  display: inline-block;
  width: 90px;
}
.DouXuanBtn {
  background: rgba(189, 218, 230, 0.6);
  height: 36px;
  float: left;
  line-height: 36px;
  padding: 0 15px;
  border-radius: 7px;
  cursor: pointer;
  box-sizing: border-box;
}
// .DouXuanBtn:hover {
//   background: rgba(189, 218, 230, 1);
// }
.DouXuanBtnCheck {
  background: #1f78f7;
  color: white;
}
.DuoXuanKuang {
  width: 100%;
  height: 100%;
  //   overflow: auto;
}
</style>