TransControlPage.vue 7.33 KB

<template>
  <el-card class="card-contianer">
        <label>{{radioTitle}}</label>
        <el-radio-group v-model="activeRadio" style="margin-left: 50px;">
          <el-radio
            v-for="(option, index) in options"
            :key="index"
            :label="option.value"
            >
            {{ option.lable }}
          </el-radio>
        </el-radio-group>
  </el-card>
  <el-tabs :tab-position="tabPosition" style="height: 100%" class="demo-tabs">
    <el-tab-pane label="换热站状态" v-if="isTransferStatus">
      <TransferStatusControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="远程寄存器" v-if="isTransferRegControl">
      <TransferRegControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="节假日参数组" v-if="isHolidayControl">
      <HolidayControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="夜间参数组" v-if="isNightControl">
      <NightControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="二次网供水温度" v-if="isSecTempControl">
      <SecTempControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="曲线对应" v-if="isCurveControl">
      <CurveControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="气象仪" v-if="isWeatherControl">
      <WeatherControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="温度上下限" v-if="isLimitControl">
      <LimitControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="风向控制" v-if="isWinDirectionControl">
      <WinDirectionControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="热量" v-if="isHeatControl">
      <HeatControl :activeRadio="activeRadio"/>
    </el-tab-pane>
    <el-tab-pane label="循环泵夜间降频" v-if="isNightFrequency">
      <NightFrequency :activeRadio="activeRadio"/>
    </el-tab-pane>
  </el-tabs>
  <!-- <el-tabs v-model="activeTab" @tab-click="handleClick" :tab-position="tabPosition" style="height: 100%" class="demo-tabs">
    <el-tab-pane
      v-for="item in editableTabs"
      :key="item.name"
      :label="item.title"
      :name="item.name"
    ></el-tab-pane> -->
    <!-- <el-tab-pane name="TransferStatusControl" label="换热站状态" v-if="isTransferStatus"></el-tab-pane>
    <el-tab-pane name="TransferRegControl" label="远程寄存器" v-if="isTransferRegControl"></el-tab-pane> -->
  <!-- </el-tabs> -->
  <!-- <router-view /> -->
</template>

<script lang="ts" setup>
  import { ref, reactive, onMounted, onUnmounted, watch } from 'vue';
  import http from '../../api/http';
  import store from "../../store/index";
 // import { useRoute, useRouter } from 'vue-router';
  import TransferStatusControl from '../../components/Remote/TransferStatusControl.vue';
  import TransferRegControl from '../../components/Remote/TransferRegControl.vue';
  import HolidayControl from '../../components/Remote/HolidayControl.vue';
  import NightControl from '../../components/Remote/NightControl.vue';
  import SecTempControl from '../../components/Remote/SecTempControl.vue';
  import CurveControl from '../../components/Remote/CurveControl.vue';
  import WinDirectionControl from '../../components/Remote/WinDirectionControl.vue';
  import WeatherControl from '../../components/Remote/WeatherControl.vue';
  import LimitControl from '../../components/Remote/LimitControl.vue';
  import HeatControl from '../../components/Remote/HeatControl.vue';
  //import OutdoorTempControl from '../../components/Remote/OutdoorTempControl.vue';
  import NightFrequency from '../../components/Remote/NightFrequency.vue';

  const radioTitle = ref('供热站');
  const options = reactive([]);
  const enterpriseId = ref(null);
  const tabPosition = ref('left');
  const activeRadio = ref(null);
  const isTransferStatus = ref(false);
  const isTransferRegControl = ref(false);
  const isHolidayControl = ref(false);
  const isNightControl = ref(false);
  const isSecTempControl = ref(false);
  const isCurveControl = ref(false);
  const isWeatherControl = ref(false);
  const isLimitControl = ref(false);
  const isWinDirectionControl = ref(false);
  const isHeatControl = ref(false);
  const isNightFrequency = ref(false);

  //初始化页面
  function initPage(){
    initRadioList();
    initRomateList();
  }

  //根据权限初始化单选列表
  function initRadioList(){

    var result = store.getters.getEnterprise();
    if (result) {
      enterpriseId.value = result[0].enterpriseId;
      result.forEach(element=>{
        if(element.enterpriseId=== enterpriseId.value){
          if(element.enterpriseId ===  "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
            radioTitle.value = "片区";
            element.serviceCenterList.forEach(center=>{
              center.supplyList.forEach(supply => {
                supply.jurisdictionList.forEach(jurisdiction => {
                  options.push({value: jurisdiction.jurisdictionId, lable: jurisdiction.jurisdictionName});
                });
              });
            })
          }else{
            radioTitle.value = "供热站";
            element.supplyList.forEach(element => {
              options.push({ value: element.supplyId, lable: element.supplyName});
            })
          }
        }
      });
      activeRadio.value = options[0].value;
      console.log("activeRadio.value:"+activeRadio.value);
    }
  }

  //根据权限初始化远程控制页列表
  function initRomateList(){
    http.post("/api/module/RemoteModules", '').then((result) => {
      if(result.data !== null){
        //console.log(result.data);
        result.data.forEach(item =>{
          if(item.moduleCode ==="RemoteTransferStatus"){
            isTransferStatus.value = true;
          }
          if(item.moduleCode ==="RemoteTransferReg"){
            isTransferRegControl.value = true;
          }
          if(item.moduleCode ==="HolidayControl"){
            isHolidayControl.value = true;
          }
          if(item.moduleCode ==="NightControl"){
            isNightControl.value = true;
          }
          if(item.moduleCode ==="SecTempControl"){
            isSecTempControl.value = true;
          }
          if(item.moduleCode ==="CurveControl"){
            isCurveControl.value = true;
          }
          if(item.moduleCode ==="WeatherControl"){
            isWeatherControl.value = true;
          }
          if(item.moduleCode ==="LimitControl"){
            isLimitControl.value = true;
          }
          if(item.moduleCode ==="WinDirectionControl"){
            isWinDirectionControl.value = true;
          }
          if(item.moduleCode ==="HeatControl"){
            isHeatControl.value = true;
          }
          if(item.moduleCode ==="NightFrequency"){
            isNightFrequency.value = true;
          }
        })
      }
    });
  }

  initPage();

  // 当选中项变化时,这里会打印新的值
  watch(activeRadio, (newValue) => {
   // console.log('Selected value changed:', newValue);
  });
</script>

<style lang="less" scoped>

.card-contianer {
  display: flex;
  width: 100%;
  height: 50px;
  align-items: center; 
  vertical-align: middle;
  margin: 0;
  padding: 0;
}

.demo-tabs > .el-tabs__content {
  padding: 32px;
  color: #6b778c;
  font-size: 32px;
  font-weight: 600;
}

.el-tabs--right .el-tabs__content,
.el-tabs--left .el-tabs__content {
  height: 100%;
}

</style>