Newer
Older
KaiFengPC / src / views / sponeScreen / projectHM / ProjectEvaluation.vue
@jimengfei jimengfei 16 days ago 11 KB updata
<template>
  <!-- 项目监测分析 -->
  <div class="publicContainerA">
    <div class="partTitleHM">项目监测分析</div>
    <div class="ConstrucClass">
      <div class="WaterList">
        <div class="DropdownBox">
          <div class="analysis" @click="changeProject">
            <img :src="xmfx" alt="" class="ICON_zp" />
            <span>项目分析</span>
          </div>
          <div class="Selectionbox">
            <el-select v-model="areaFX" placeholder="请选择片区分析" @change="changeArea">
              <el-option v-for="item in areaList" :key="item.value" :label="item.name" :value="item.value" />
            </el-select>
            <el-select v-model="projectFx" placeholder="请选择典型项目分析" @change="changeProject">
              <el-option v-for="item in XmList" :key="item.value" :label="item.name" :value="item.value" />
            </el-select>
          </div>
        </div>

        <div class="DropdownBox">
          <div class="analysis">
            <img :src="ssfx" alt="" class="ICON_zp" />
            <span @click="changeSSFX">设施分析</span>
          </div>
          <div class="Selectionbox">
            <el-select v-model="hmssVal" @change="changeHmss" placeholder="请选择监测点" filterable>
              <el-option v-for="item in hmssList" :key="item.stCode" :label="item.stName" :value="item.stCode" />
            </el-select>
            <el-select v-model="hmssType" placeholder="请选择设施" filterable>
              <el-option v-for="item in hmssTypeList" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </div>
        </div>
        <!-- 设施分析echarts -->
        <div class="assessment" v-loading="loadingSS">
          <AssessmentEcharts :data="chartDataSS" :refresh="chartDataSS.refresh"></AssessmentEcharts>
        </div>

        <div class="DropdownBox">
          <div class="analysis">
            <img :src="WaterAnalysis_icon" alt="" class="ICON_zp" />
            <span>管网分析</span>
          </div>
          <div class="Selectionbox">
            <el-select v-model="jsdVal" placeholder="请选择积水分析" @change="changeJSD" filterable>
              <el-option v-for="item in jsdList" :key="item.stCode" :label="item.stName" :value="item.stCode" />
            </el-select>
          </div>
        </div>
        <!-- 积水分析echarts -->
        <div class="assessmentJS" v-loading="loadingJSD">
          <AssessmentjsEcharts :data="chartDataJSD" :refresh="chartDataJSD.refresh"></AssessmentjsEcharts>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import AssessmentEcharts from '@/views/sponeScreen/Echarts/AssessmentEcharts.vue'; // 设施分析
import AssessmentjsEcharts from '@/views/sponeScreen/Echarts/AssessmentjsEcharts.vue'; //积水分析
import ssfx from '@/assets/newImgs/HMScreen/ssfx.png';
import xmfx from '@/assets/newImgs/HMScreen/xmfx.png';
import bus from '@/bus';
import WaterAnalysis_icon from '@/assets/newImgs/HMScreen/WaterAnalysis_icon.png';
import { graphicReport, getStationList } from '@/api/dataAnalysis/syntherticData';
import { listrtuSiteInfo } from '@/api/dataAnalysis/rtuSiteInfo';
import { rtuWarnConfigList } from '@/api/dataAnalysis/historyGj.js';

const areaFX = ref('0');
const areaList = ref([
  { name: '古城蓝绿韧性示范片区', value: '0', lonlat: [114.35, 34.802] },
  { name: '城东南污涝共治示范片区', value: '1', lonlat: [114.37, 34.792] },
  { name: '综保区工业海绵化片区', value: '2', lonlat: [114.209, 34.782] },
  { name: '金明品质提升示范片区', value: '3', lonlat: [114.285, 34.799] },
]);
const projectFx = ref('1');
const XmList = ref([{ name: '汴京路管网及道路海绵化改造', value: '1' }]);
const hmssType = ref('1');
const hmssTypeList = ref([
  { value: '1', label: '下沉式绿地' },
  { value: '2', label: '雨水花园' },
  { value: '3', label: '调节塘' },
  { value: '4', label: '透水铺装' },
]);

const dateRain = ref('');
//海绵设施列表-汴京路
const hmssList = ref([]);
const hmssVal = ref('');
const loadingSS = ref(true);
const chartDataSS = ref({
  xAxis: [],
  inverse: true,
  yAxis: [], //降雨量
  yAxis2: [], //流量
  yAxis3: [], //ss
  refresh: 1,
});
// 海绵设施数据获取
function hmssListGet() {
  listrtuSiteInfo({ monitorTargetType: 'drain_outlet' }).then(res => {
    hmssList.value = res.data || [];
    hmssVal.value = res.data[0].stCode; //站点编号
  });
}
// 海绵设施监测站点切换
const changeHmss = () => {
  getDataSS();
};
// 海绵设施数据渲染
async function getDataSS() {
  loadingSS.value = true;
  // 关联雨量站是皮革厂雨量站,0371000003
  let params = {
    startTime: dateRain.value,
    endTime: dateRain.value,
    stCode: '0371000003',
  };
  let res = await graphicReport(params);
  if (res && res.code == 200) {
    let datas = res.data;
    chartDataSS.value.xAxis = datas.propertyMonitorXList;
    chartDataSS.value.yAxis = nameToData(datas.propertyMonitorList, '5分钟时段降水量');
  }

  // 获取监测值
  let params2 = {
    startTime: dateRain.value,
    endTime: dateRain.value,
    stCode: hmssVal.value,
  };
  let res2 = await graphicReport(params2);
  if (res2 && res2.code == 200) {
    let datas = res2.data;
    chartDataSS.value.yAxis2 = nameToData(datas.propertyMonitorList, '小时水量'); //瞬时流量
    chartDataSS.value.yAxis3 = nameToData(datas.propertyMonitorList, '水位'); //水位
  }
  chartDataSS.value.refresh = Math.random();
  loadingSS.value = false;
}

// 积水分析
const loadingJSD = ref(true);
const rainCode = ref('');
const jsdVal = ref('');
const jsdList = ref([]);
const chartDataJSD = ref({
  xAxis: [],
  yAxis: [], //降雨量
  yAxis2: [], //水深
  refresh: 1,
  controlMarkLine: [],
});
// 积水点点击切换
const changeJSD = () => {
  // 筛选查出对应的关联雨量站
  rainCode.value = jsdList.value.filter(item => item.stCode == jsdVal.value)[0].referRainStCode;
  getDataJSD();
};
// 获取积水点数据
async function getDataJSD() {
  loadingJSD.value = true;
  // 关联雨量站
  let params = {
    startTime: dateRain.value,
    endTime: dateRain.value,
    stCode: rainCode.value,
  };
  let res = await graphicReport(params);
  if (res && res.code == 200) {
    let datas = res.data;
    chartDataJSD.value.xAxis = datas.propertyMonitorXList;
    chartDataJSD.value.yAxis = nameToData(datas.propertyMonitorList, '5分钟时段降水量');
  }

  // 获取监测值
  let params2 = {
    startTime: dateRain.value,
    endTime: dateRain.value,
    stCode: jsdVal.value,
  };
  let res2 = await graphicReport(params2);
  if (res2 && res2.code == 200) {
    let datas = res2.data;
    chartDataJSD.value.yAxis2 = nameToData(datas.propertyMonitorList, '水位');
  }

  // 获取管网井深
  let res3 = await getStationList({ stCode: jsdVal.value });
  if (res3 && res3.code == 200) {
    chartDataJSD.value.controlMarkLine = [{ typeName: '井深', value: res3.data[0].bottomBuriedDepthTemp, Opacity: 1, color: '#FF4940' }];
  }
  chartDataJSD.value.refresh = Math.random();
  loadingJSD.value = false;
}
// 获取积水点列表
function getJSDList() {
  listrtuSiteInfo({ monitorTargetType: 'typical_land' }).then(res => {
    jsdList.value = res.data || [];
    jsdVal.value = res.data[0].stCode; //站点编号
    rainCode.value = res.data[0].referRainStCode; //关联雨量站站点编号
  });
  listrtuSiteInfo({ monitorTargetType: 'pipeline' }).then(res => {
    jsdList.value = jsdList.value.concat(res.data || []);
  });
}

// 公共方法,根据监测名称来匹配对应的数值
function nameToData(data, name) {
  let arr = data.filter(item => item.monitorPropertyName == name);
  return arr[0] ? arr[0].ylist : [];
}

// 片区分析点击
function changeArea(val) {
  // bus.emit('checkProjectArea', areaList.value[val]);
  newfiberMapbox.map.easeTo({
    center: areaList.value[val].lonlat,
    zoom: 13.7,
    pitch: 45,
  });
}

// 典型项目点击
function changeProject(val) {
  bus.emit('checkProjectFX', { project: XmList.value[val] });

  newfiberMapbox.map.easeTo({
    center: [114.378601, 34.793947],
    zoom: 15.2,
    pitch: 30,
  });
}

// 项目设施分析点击
function changeSSFX(val) {
  bus.emit('checkSSFX', { project: XmList.value[val] });
  newfiberMapbox.map.easeTo({
    center: [114.381601, 34.793947],
    zoom: 15.9,
    pitch: 30,
  });
}
// 历史某一天报警
function historyDataWarn() {
  rtuWarnConfigList({ startTime: dateRain.value, endTime: dateRain.value }).then(res => {
    console.log('历史告警数据---', res);
    bus.emit('removeMapDatas', ['warning_monitor']);
    let datas = res.data || [];
    if (datas.length > 0) {
      // 渲染报警图层
      let warningFeatures = [];
      datas.forEach(element => {
        let warningFeature = turf.point(element.lonLat.split(',').map(Number), element);
        warningFeature.properties.size = 500;
        warningFeature.properties.stName = '';
        warningFeatures.push(warningFeature);
      });
      let warningGeojson = turf.featureCollection(warningFeatures);
      let key = 'warning_monitor';
      bus.emit('getGeojsonByType', {
        type: key,
        callback: geojson => {
          if (!!!geojson.features.length) bus.emit('setGeoJSON', { json: warningGeojson, key: 'warning_monitor' });
          bus.emit('setLayerVisible', { layername: 'warning_monitor', isCheck: true });
        },
      });
    } else {
      bus.emit('setLayerVisible', { layername: 'warning_monitor', isCheck: false });
    }
  });
}
onMounted(() => {
  hmssListGet(); //海绵设施列表
  getJSDList(); //获取积水点数据
  bus.on('changeRainDate', val => {
    dateRain.value = val;
    historyDataWarn();
    changeHmss(); //海绵设施数据加载
    changeJSD(); //积水点数据加载
  });
  bus.emit('setLayerVisible', { layername: 'warning_monitor', isCheck: true }); //报警的站点
  // 渲染点位上图
  bus.emit('setIniteLayer', [
    { layername: 'pipeMonitor', show: false }, //管网监测点
    { layername: 'spongeFacility', show: false }, //海绵设施图层
    { layername: 'origine', show: false }, //典型项目图层
  ]);
});
onBeforeUnmount(() => {
  bus.off('changeRainDate');
  bus.emit('setIniteLayer', [
    { layername: 'pipeMonitor', show: true },
    { layername: 'spongeFacility', show: true },
    { layername: 'origine', show: true },
  ]);
});
</script>

<style lang="scss" scoped>
.publicContainerA {
  margin-top: 10px;
}
.ConstrucClass {
  width: 460px;
  height: calc(100vh - 220px);
  background: #004565;
  opacity: 0.8;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: -3px;
  .WaterAccumulation {
    width: 95%;
    // height: 270px;
    margin: auto;
    background: yellow;
    .HeadContent {
      width: 100%;
      height: 40px;
      background: #217dc8;
      border: 1px solid #61aff0;
      position: relative;
      top: 2px;
      span {
        position: relative;
        top: 8px;
        left: 15px;
        color: #ffffff;
        font-family: Source Han Sans CN;
        font-weight: 500;
      }
    }
  }
  .WaterList {
    position: relative;
    top: 8px;
    width: 95%;
    // height: calc(100vh - 720px);
    margin: auto;
    // background: yellow;
    .DropdownBox {
      height: 45px;
      background: #217dc8;
      border: 1px solid #61aff0;
      display: flex;
      justify-content: space-around;
      margin: 5px;
      .analysis {
        width: 35%;
        display: flex;
        align-items: center;
        .ICON_zp {
          width: 28px;
          height: 28px;
          position: relative;
          top: 32x;
        }
      }
      .Selectionbox {
        width: 85%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding-right: 5px;
      }
    }
    .assessment {
      width: 100%;
      height: calc(100vh - 680px);
    }
    .assessmentJS {
      width: 100%;
      height: 280px;
    }
  }
}
</style>