| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 | <template>  <div    v-show="activeKey == 'monitor' && !loading"     class="bg"    style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">    <a-spin :spinning="loading" />        <div id="workFace3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden; z-index: 1; top: 0"> </div>    <div          id="workFace3DCSS"          class="threejs-Object-CSS"          v-show="!loading"          style="width: 100%; height: 100%; position: absolute; pointer-events: none; overflow: hidden; z-index: 1; top: 0"        >      </div>  </div>  <div class="scene-box">    <customHeader :fieldNames="{ label: 'systemname', value: 'id', options: 'children' }" :options = 'options' @change="getSelectRow" :optionValue="optionValue">回采工作面智能管控</customHeader>    <div class="center-container">      <template v-if="activeKey == 'monitor'">        <div class="monitor-nav">          <template  v-for="(nav, index) in monitorNavData" :key="index">            <div class="nav-item" :class="{'nav-item-active': nav.isShow}" @click="changeMonitor(nav)">{{ nav.title }} </div>            <a-divider v-if="index !== monitorNav.length - 1" type="vertical" style="height: 10px; background-color: #00e1ff;" />          </template>        </div>        <workFaceHome v-if="monitorActive == 0" :deviceId = 'optionValue' />        <workFaceVentHome v-if="monitorActive == 1" :deviceId = 'optionValue' />        <workFaceFireHome v-if="monitorActive == 2" :deviceId = 'optionValue'/>        <workFaceDustHome v-if="monitorActive == 3" :deviceId = 'optionValue'/>        <workFaceGasHome v-if="monitorActive == 4" :deviceId = 'optionValue' :gas-unit-num="gasUnitNum"/>      </template>      <div v-else class="history-group">        <div class="device-button-group" v-if="deviceList.length > 0 && activeKey !== 'faultRecord'">          <div class="device-button" :class="{ 'device-active': deviceActive == device.deviceType }" v-for="(device, index) in deviceList" :key="index" @click="deviceChange(index)">{{ device.deviceName }}</div>        </div>        <div class="history-container">          <workFaceHistory v-if="activeKey == 'monitor_history' && isRefresh" ref="historyTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>          <workFaceHandleHistory v-if="activeKey == 'handler_history' && isRefresh" ref="alarmHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType" />          <workFaceAlarmHistory v-if="activeKey == 'faultRecord' && isRefresh" ref="handlerHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>        </div>      </div>    </div>    <BottomMenu @change="changeActive"/>  </div></template><script setup lang="ts">import { onBeforeMount, ref, onMounted, onUnmounted, nextTick } from 'vue';import { mountedThree, destroy, setModelType, clearCss3D, showOrHideGasPlane } from './wokeFace.threejs';import { getTableList, systemList } from './workFace.api';import { monitorNav } from './workFace.data'import customHeader from '/@/components/vent/customHeader.vue';import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';import workFaceVentHome from './components/workFaceVentHome.vue';import workFaceHome from './components/workFaceHome.vue';import workFaceFireHome from './components/workFaceFireHome.vue'import workFaceDustHome from './components/workFaceDustHome.vue';import workFaceGasHome from './components/workFaceGasHome.vue';import workFaceHistory from './components/workFaceHistory.vue';import workFaceHandleHistory from './components/workFaceHandleHistory.vue';import workFaceAlarmHistory from './components/workFaceAlarmHistory.vue';import { useRouter } from 'vue-router';type DeviceType = { deviceType: string, deviceName: string, datalist: any[] };const { currentRoute } = useRouter();const activeKey = ref('monitor');const loading = ref(false);const monitorNavData = ref(monitorNav)const monitorActive = ref(0)let modalType = '' //模型类型const historyTable = ref()const alarmHistoryTable = ref()const handlerHistoryTable = ref()//关联设备const deviceList = ref<DeviceType[]>([])const deviceActive = ref('')const deviceType = ref('')const options = ref()const optionValue = ref('')const gasUnitNum = ref(0)const isRefresh = ref(true)function changeActive(activeValue) {  activeKey.value = activeValue  loading.value = true  if(activeKey.value === 'monitor'){    // gasUnitNum.value = Math.ceil(Math.random() * 10)    gasUnitNum.value = 4    setTimeout(() =>{      loading.value = false    }, 600)      }else{    loading.value = false    clearCss3D()  }  nextTick(() => {    setModelType(modalType, gasUnitNum.value, monitorActive.value == 4 ? true : false)  })}function deviceChange(index) {  deviceActive.value = deviceType.value = deviceList.value[index].deviceType  isRefresh.value = false  nextTick(() => {    isRefresh.value = true  })}async function getDeviceList() {  const res = await systemList({ devicetype: 'sys', systemID: optionValue.value });  const result = res.msgTxt;  const deviceArr = <DeviceType[]>[]  result.forEach(item => {    const data = item['datalist'].filter((data: any) => {      const readData = data.readData;      return Object.assign(data, readData);    })    if (item.type != 'sys') {      deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'], datalist: data })    }  })  deviceList.value = deviceArr  deviceActive.value = deviceArr[0].deviceType  deviceChange(0)};async function getSysDataSource() {  const res = await getTableList({ strtype: 'sys_surface_caimei', pagetype: 'normal' });  if (!options.value) {    // 初始时选择第一条数据    options.value = res.records || [];    if (!optionValue.value) {      optionValue.value = options.value[0]['id']      getDeviceList()      changeModalType(options.value[0])    }  }};// 切换检测数据async function getSelectRow(deviceID) {  const currentData = options.value.find((item: any) => {    return item.id == deviceID  })  optionValue.value = deviceID  changeModalType(currentData)  getDeviceList()}// 获取模型类型function changeModalType(currentData) {  if (currentData['strsystype'] === 'sys_surface_caimei_modal_1') {    // 单进单回    modalType = 'workFace1'  } else if (currentData['strsystype'] === 'sys_surface_caimei_modal_2') {    // 单进双回    modalType = 'workFace2'  } else if (currentData['strsystype'] === 'sys_surface_caimei_modal_3') {    // 双进单回    modalType = 'workFace3'  } else if (currentData['strsystype'] === 'sys_surface_caimei_modal_4') {    // 双进双回    modalType = 'workFace4'  }  // gasUnitNum.value = Math.ceil(Math.random() * 4)  gasUnitNum.value = 4  setModelType(modalType, gasUnitNum.value, monitorActive.value == 4 ? true : false)}function changeMonitor(nav) {  nav.isShow = true  monitorNav.forEach((item, index) => {    if(item.title !== nav.title) {      item.isShow = false    }else{      monitorActive.value = index      if (monitorActive.value != 4) {        clearCss3D()      }    }  })  showOrHideGasPlane(monitorActive.value == 4 ? true : false)}onBeforeMount(() => {});onMounted(async() => {  if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id']  await getSysDataSource()  loading.value = true;  mountedThree().then(async () => {    // gasUnitNum.value = Math.ceil(Math.random() * 10)    gasUnitNum.value = 4    loading.value = false;    nextTick(() => {      setModelType(modalType, gasUnitNum.value, monitorActive.value == 4 ? true : false)    })  });});onUnmounted(() => {  destroy();});</script><style lang="less" scoped>@import '/@/design/vent/modal.less';@ventSpace: zxm;:deep(.@{ventSpace}-tabs-tabpane-active) {  overflow: auto;}.scene-box{  width: 100%;  height: 100%;}.monitor-nav{  width: 860px;  height: 42px;  display: flex;  justify-content: center;  align-items: center;  // border: 1px solid #73e8fe;  color: #fff;  position: absolute;  top: 88px;  left: 50% !important;  transform: translateX(-50%) !important;  pointer-events: auto;  background: linear-gradient(45deg, #96c5ca38, #156c7d4a);  clip-path: polygon(    14px 0,    calc(100% - 14px) 0,    100% 14px,    100% calc(100% - 14px),    calc(100% - 14px) 100%,    14px 100%,    0 calc(100% - 14px),    0 14px  );  // background: url('/@/assets/images/vent/wokeFaca-nav.png') no-repeat !important;  .nav-item{    padding: 1px 10px;    cursor: pointer;      }  .nav-item-active{    color: #00fbff;  }}.history-group{  padding: 0 20px;  margin-top: 90px;  .history-container{    position: relative;    background: #6195af1a;    width: calc(100% + 10px);    left: -10px;    border: 1px solid #00fffd22;    padding: 10px 0;    box-shadow: 0 0 20px #44b4ff33 inset;  }}.device-button-group{  // margin: 0 20px;  display: flex;  pointer-events: auto;  position: relative;  &::after{    position:absolute;    content: '';    width: calc(100% + 10px);    height: 2px;    top: 30px;    left: -10px;    border-bottom: 1px solid #0efcff;  }  .device-button{    padding: 4px 15px;    position: relative;    display: flex;    justify-content: center;    align-items: center;    font-size: 14px;        color: #fff;    cursor: pointer;    margin: 0 3px;    &::before{      content: '';      position: absolute;      top: 0;      right: 0;      bottom: 0;      left: 0;      border: 1px solid #6176AF;      transform: skewX(-38deg);      background-color: rgba(0, 77, 103,85%);      z-index: -1;    }  }  .device-active{    // color: #0efcff;    &::before{      border-color: #0efcff;      box-shadow: 1px 1px 3px 1px #0efcff inset;    }  }}.input-box {  display: flex;  align-items: center;  padding-left: 10px;  .input-title {    color: #73e8fe;    width: auto;  }  .@{ventSpace}-input-number {    border-color: #ffffff88 !important;  }  margin-right: 10px;}.monitor-msg-box {  width: 170px;  margin-top: 100px;  .monitor-msg-container {    width: 170px;    height: 150px;    box-shadow: rgba(128, 128, 128, 0.3) 0px 0px 40px inset;    border: 1px solid rgba(128, 128, 128, 0.3);    background-color: transparent;  }  .errorColor {    box-shadow: #F73B2440 0px 0px 40px inset;    border: 1px solid #F73B2440;  }  .warningColor {    box-shadow: #FF9B1740 0px 0px 40px inset;    border: 1px solid #FF9B1740;  }  .monitor-item {    padding: 10px 10px 0px 10px;    color: #fff;    letter-spacing: 2px;    .item-title {      color: #73e8fe;    }    .num {      color: #FFA500;    }  }}</style>
 |