Newer
Older
HuangJiPC / src / pages / views / pumpStation / components / basicTuLi.vue
@zhangdeliang zhangdeliang on 21 Jun 3 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: '900px',
            border: '1px solid #4E64D6',
            borderRadius: '5px',
          }"
          :placement="item.position"
          id="rightPopover"
        >
          <template #trigger>
            <n-checkbox v-model:checked="item.isChecked">
              <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";
export default {
  name: "basicTuLi",
  setup() {
    let TuLiData = reactive([
       {
        name: "闸站",
        length: "03",
        isChecked: false,
        position: "right-start",
        data: [
          {
            ZhaName: "西渠闸门",
            ZhaId: "zha001",
          },
          {
            ZhaName: "解放大道澳门路闸",
            ZhaId: "zha002",
          },
          {
            ZhaName: "中山大道前进四路闸",
            ZhaId: "zha003",
          },
        ],
      },
      {
        name: "污水泵站",
        length: "01",
        isChecked: false,
        position: "right",
        data: [
          {
            ZhaName: "王家墩污水泵站",
            ZhaId: "wu001",
          },
        ],
      },
      {
        name: "雨水泵站",
        length: "03",
        isChecked: false,
        position: "right-end",
        data: [
          {
            ZhaName: "后湖二期泵站",
            ZhaId: "yu001",
          },
          {
            ZhaName: "铁路桥泵站",
            ZhaId: "yu002",
          },
          {
            ZhaName: "机场河补水泵站",
            ZhaId: "yu003",
          },
        ],
      },
      {
        name: "调蓄池",
        length: "03",
        isChecked: false,
        position: "right-end",
        data: [
          {
            ZhaName: "常青公园地下调蓄池",
            ZhaId: "tiao001",
          },
          {
            ZhaName: "黄孝河CSO调蓄",
            ZhaId: "tiao002",
          },
          {
            ZhaName: "机场河CSO调蓄",
            ZhaId: "tiao003",
          },
        ],
      },
    ]);
    let chechId = ref(null);
    function BtnLick(item2) {
      chechId.value = item2.ZhaId;
    }
    onMounted(() => {});
    return { TuLiData, BtnLick, chechId };
  },
  computed: {},
  methods: {},
};
</script>
<style lang="less" scoped>
#basicTuLi {
  position: absolute;
  left: 40px;
  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>