Newer
Older
DH_Apicture / src / views / pictureOnMap / page / WaterAssets / shuziluanshengBottom / index.vue
@wudi wudi 23 days ago 7 KB 1
<template>
  <!-- 水务资产  右侧 -->
  <div class="centerbottmBox">
    <div class="TOP_Title shuziluansheng">
      <div class="flex_sbc p56 pbottom">
        <div class="top-title">数字孪生</div>
        <div class="tabData flex">
          <div
            class="eachClick"
            :class="active == item.value ? 'active' : ''"
            v-for="item in rightTabArr"
            :key="item.value"
            @click="tabClick(item)"
          >
            {{ item.label }}
          </div>
        </div>
      </div>
    </div>
    <div class="luanshengBottom">
      <div
        class="bottomitem"
        :class="bottomactive == item.value ? 'active' : ''"
        @click="bottomClick(item)"
        v-for="item in bottomshowArr"
        :key="item"
      >
        {{ item.label }}
      </div>
    </div>
  </div>
</template>
<script setup name="shuziluanshengBox">
import bus from '@/bus';
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue';
const { proxy } = getCurrentInstance();
import { getImageUrl } from '@/utils/ruoyi';
const rightTabArr = ref([
  {
    label: '三维社区',
    value: '1',
  },
  {
    label: '三维泵站',
    value: '2',
  },
  {
    label: '三维管线',
    value: '3',
  },
  {
    label: '三维场景',
    value: '4',
  },
]);

const bottomshowArr = ref();

const shequArr = ref([
  {
    label: '水蓝郡',
    value: '1',
    easeTo: { center: [114.37237559831908, 30.465690931728275],bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  },
  {
    label: '锦绣良缘',
    value: '2',
    easeTo: { center: [114.36116641690938, 30.465031212461284],bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  },
  {
    label: '赵家池明渠',
    value: '3',
    easeTo: { center: [114.37933973676917, 30.448914882223832], bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  },
  {
    label: '三维雨水管道',
    value: '4',
  },
  {
    label: '三维污水管道',
    value: '5',
  },
]);
const bengzhanArr = ref([
  {
    label: '五家湖排江泵站',
    value: '1',
    values: 'rain_water_pump_station_info',
    easeTo: { center: [114.60260472329406, 30.55206252978222],bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  },
  {
    label: '光谷转盘鲁磨路泵站',
    value: '2',
    values: 'rain_water_pump_station_info',
    easeTo: { center: [114.39394626017497, 30.508365555418536], bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  },
  {
    label: '谷转盘珞喻路泵站',
    value: '3',
    values: 'rain_water_pump_station_info',
    easeTo: { center: [114.40368321715408, 30.507588862101528], bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  },
  {
    label: '光谷一路泵站',
    value: '4',
    values: 'rain_water_pump_station_info',
    easeTo: { center: [114.43310730417937, 30.49480696122025], bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  }
]);
const guanxianArr = ref([
  {
    label: '南湖片区三维雨水',
    value: '1',
    values: '南湖汇水区',
    easeTo: { center: [114.39293842299662, 30.482790194236813], bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  },
  {
    label: '南湖片区三维污水',
    value: '2',
    values: '龙王嘴污水系',
    easeTo: { center: [114.39293842299662, 30.482790194236813], bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17},
  },
  {
    label: '豹澥片区三维雨水',
    value: '3',
    values: '豹澥湖汇水区',
    easeTo: { center: [114.45895478865708, 30.459740968619386], bearing:-23.200000000001182,pitch:58.49999999999992,zoom:17 },
  },
  {
    label: '豹澥片区三维污水',
    value: '4',
    values: '豹澥污水系统',
    easeTo: { center: [114.45895478865708, 30.459740968619386], zoom: 13.25419672401314, pitch: 45.95516160507156 },
  },
]);
const changjingArr = ref([
  {
    label: '江南泵站',
    value: '1',
    values: '江南泵站',
    url: 'https://zhzz.hongshan.gov.cn:8865/VideoProxy/qingxiesheying/v1/tileset_v1.json',
    easeTo: { center: [114.26285547941757, 30.49905022989863], zoom: 17.5, pitch: 60.137987545556804, bearing: 108.7 },
  },
  {
    label: '陈家山闸',
    value: '2',
    values: '陈家山闸',
    url: 'https://zhzz.hongshan.gov.cn:8865/VideoProxy/qingxiesheying/v1/tileset_v2.json',
    easeTo: { center: [114.22880212973843, 30.45179545680257], zoom: 17.5, pitch: 64.69055791957466, bearing: 108.7 },
  },
  {
    label: '白沙洲长江大桥',
    value: '3',
    values: '白沙洲长江大桥',
    url: 'http://localhost:9995/3DTiles/同学广场测区/3dtile/tileset.json',
    // url: 'http://localhost:9995/3DTiles/3dtiles/tileset.json',
    // url: 'http://localhost:9995/3DTiles/3dtile1/dhgx_1/tileset.json',
    // url: 'http://localhost:9994/b3dm/3d/tileset.json',
    // url: 'https://zhzz.hongshan.gov.cn:8865/VideoProxy/qingxiesheying/v1/tileset_v3.json',
    easeTo: { center: [114.25047535415115, 30.48219212521819], zoom: 17.5, pitch: 76.24070062592385, bearing: 108.7 },
  },
]);
const active = ref(1);
const bottomactive = ref(1);

const tabClick = item => {
  active.value = item.value;
  switch (item.value) {
    case '1':
      bottomshowArr.value = shequArr.value;
      bottomactive.value = '1';
      break;
    case '2':
      bottomshowArr.value = bengzhanArr.value;
      bottomactive.value = '1';
      break;
    case '3':
      bottomshowArr.value = guanxianArr.value;
      bottomactive.value = '1';
    case '4':
      bottomshowArr.value = changjingArr.value;
      bottomactive.value = '1';
      break;
  }
};
const bottomClick = item => {
  bottomactive.value = item.value;
  if (active.value == '4') return operationScene(item);
  [...bengzhanArr.value, ...guanxianArr.value]
    .map(i => (i.values || '').split(','))
    .flat()
    .forEach(key => operationLayer(key, false));
  (item.values || '').split(',').forEach(key => operationLayer(key, true));
  item.easeTo && newfiberMap.map.easeTo(item.easeTo);
};

const operationScene = item => {
  bus.emit('load3DTiles', { id: item.label, url: item.url });
  item.easeTo && newfiberMap.map.easeTo(item.easeTo);
};

const events_params = {
  setHighlight: { key: 'setHighlight' },
  setLayerVisible: { key: 'setLayerVisible' },
};
const operationLayer = (name, visible) => {
  const { setLayerVisible, setHighlight } = events_params;
  bus.emit(setLayerVisible.key, { layername: name, isCheck: visible });
};

function change3Dtiles(e) {
  // bus.emit('change3Dtiles');
}

onMounted(() => {
  bottomshowArr.value = shequArr.value;

  bus.on('changeThreedimensional', e => {
    console.log('收到来自语音调度的修改', e);
    change3Dtiles(e);
  });
});

onBeforeUnmount(() => {
  bus.off('changeThreedimensional');

  [...bengzhanArr.value, ...guanxianArr.value]
    .map(i => (i.values || '').split(','))
    .flat()
    .forEach(key => operationLayer(key, false));

  bus.emit('remove3Dtiles');
});
</script>
<style lang="scss" scoped>
@import '@/assets/styles/WaterAssets.scss';

.luanshengBottom {
  width: 100%;
  display: -webkit-box;
  overflow: hidden;
  overflow-x: auto;
  padding-top: 15px;
  padding-left: 15px;

  .bottomitem {
    cursor: pointer;
    width: 136px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    margin-left: 10px;
    background: linear-gradient(180deg, #0c2156 0%, #2291e1 100%);
    border-radius: 15px;
    border: 1px solid #2291e1;
    // border-image: linear-gradient(0deg, #308fee, #2abffa, #308fee) 10 10;
    font-family: Source Han Sans CN;
    font-weight: bold;
    font-size: 14px;
    color: #e0e5fa;

    &.active {
      background: linear-gradient(0deg, #0c3f57 0%, #1dd0c7 100%);
      border-radius: 15px;
      border: 1px solid #27f1c6;
      font-family: Source Han Sans CN;
      font-weight: bold;
      font-size: 14px;
      color: #ffffff;
    }
  }
}
</style>