123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511 |
- <template>
- <div>
- <section class="mainbox">
- <!-- topBox start -->
- <div class="topBox">
- <div class="column statisSec">
- <statis-top
- :falarmCount="alarmCount"
- :fpersonalCount="personalCount"
- :fsiteCount="siteCount"
- :fepLoad="epLoad"
- ></statis-top>
- <statis-bottom :fhtAnalogData="htAnalogData"></statis-bottom>
- </div>
- <div class="column mapBox" style="position: relative">
- <map-static-top :fsiteCount="siteCount"></map-static-top>
- <div id="pickerBox">
- <input
- id="pickerInput"
- placeholder="输入关键字选取站点"
- v-model="name"
- @keyup.enter="siteList_api({ name: this.name })"
- />
- <i
- class="el-icon-search"
- @click="siteList_api({ name: this.name })"
- ></i>
- <div id="poiInfo"></div>
- </div>
- <div class="panel-footer"></div>
- <div
- class="map panel"
- id="mapF"
- style="height: 100%; z-index: 1; width: 100%"
- ></div>
- </div>
- <div class="column">
- <div class="panel deviceSum">
- <h2>设备运行状态</h2>
- <div class="filterSec" style="top: 0.7rem">
- <el-date-picker
- v-model="dDefaultTime"
- type="datetimerange"
- range-separator="~"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- @change="deviceTypeCount_api()"
- >
- </el-date-picker>
- </div>
- <pie-chart
- :fdeviceTypeCount="deviceTypeCount"
- v-if="this.deviceTypeCount"
- ></pie-chart>
- <div class="panel-footer"></div>
- </div>
- <div class="panel line1 operStatus">
- <h2>负载率</h2>
- <triangle-chart
- :frtAnalogData="rtAnalogData"
- v-if="this.rtAnalogData.heavyLoad"
- ></triangle-chart>
- <div class="panel-footer"></div>
- </div>
- </div>
- </div>
- <!-- topBox end -->
- <!-- bottomBox start -->
- <div class="bottomBox">
- <div class="column">
- <div class="panel currentUsage" style="height: 100%">
- <h2>总能耗</h2>
- <div class="filterSec">
- <select name="" id="" v-model="dayType">
- <option value="0">当日用量趋势</option>
- <option value="1">当月用量趋势</option>
- </select>
- <!-- <img src="../../assets/images/markIcon.png" alt=""> -->
- </div>
- <bar-chart
- :feptrendIco="eptrendIco"
- v-if="this.eptrendIco[0]"
- ></bar-chart>
- <div class="panel-footer"></div>
- </div>
- </div>
- <div class="column">
- <div class="panel currentUsage" style="height: 100%">
- <h2>运维管理</h2>
- <div class="filterSec">
- <el-date-picker
- v-model="fDefaultTime"
- type="datetimerange"
- range-separator="~"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- @change="trendIcoCount_api()"
- >
- </el-date-picker>
- </div>
- <line-chart
- :ftrendIcoCount="trendIcoCount"
- v-if="this.trendIcoCount[0]"
- ></line-chart>
- <div class="panel-footer"></div>
- </div>
- </div>
- </div>
- <!-- bottomBox end -->
- </section>
- </div>
- </template>
- <script>
- import statisTop from "./components/statisTop";
- import statisBottom from "./components/statisBottom";
- import pieChart from "./components/pieChart";
- import barChart from "./components/barChart";
- import lineChart from "./components/lineChart";
- import mapStaticTop from "./components/mapStaticTop";
- import triangleChart from "./components/triangleChart";
- import markIconPath from "../../assets/images/markIcon.png";
- // 地图
- import AMap from "AMap";
- // import AMapUI from "AMapUI";
- import api from "../../api/home/home.js";
- export default {
- name: "index",
- components: {
- statisTop,
- statisBottom,
- pieChart,
- barChart,
- lineChart,
- mapStaticTop,
- triangleChart,
- },
- data() {
- return {
- dDefaultTime: this.$store.state.se_defaultTime,
- // fDefaultTime: [
- // new Date("2021-6-23 00:00:00"),
- // new Date("2021-7-12 00:00:00"),
- // ],
- fDefaultTime:this.$store.state.th_defaultTime,
-
- map: null,
- alarmCount: {},
- personalCount: {},
- siteCount: {},
- deviceTypeCount: {},
- trendIcoCount: [],
- rtAnalogData: {},
- htAnalogData: {},
- dayType: 0,
- eptrendIco: {},
- eptrendIcoMonth: {},
- epLoad: "",
- siteOne: {},
- name: "",
- };
- },
- watch: {
- dayType(val) {
- if (val == 0) {
- this.eptrendIco_api();
- } else {
- this.eptrendIcoMonth_api();
- }
- },
- },
- created() {},
- mounted() {
- this.alarmCount_api();
- this.personalCount_api();
- this.epLoad_api();
- this.siteCount_api();
- this.deviceTypeCount_api();
- this.trendIcoCount_api();
- this.rtAnalogData_api();
- this.siteList_api();
- this.htAnalogData_api();
- this.eptrendIco_api();
- },
- methods: {
- // searchSite(){
- // this.siteList_api({"name":this.name});
- // },
- //告警总数数据对接
- alarmCount_api() {
- api.alarmCount_api().then((requset) => {
- this.alarmCount = requset.data;
- });
- },
- //运维人员
- personalCount_api() {
- api.personalCount_api().then((requset) => {
- this.personalCount = requset.data;
- });
- },
- //总实时负荷
- epLoad_api() {
- api.epLoad_api().then((requset) => {
- this.epLoad = requset.data;
- });
- },
- //站点总数
- siteCount_api() {
- api.siteCount_api().then((requset) => {
- this.siteCount = requset.data;
- });
- },
- //设备数量echarts饼图
- deviceTypeCount_api() {
- var _this = this;
- _this.$store.commit("TimeAll_function", this.dDefaultTime);
- var time = _this.$store.state.Time_Data;
- api
- .deviceTypeCount_api({
- startTime: time[0],
- endTime: time[1],
- })
- .then((requset) => {
- this.deviceTypeCount = requset.data;
- });
- },
- //故障抢修echarts折线图
- trendIcoCount_api() {
- var _this = this;
- _this.$store.commit("TimeAll_function", this.fDefaultTime);
- var time = _this.$store.state.Time_Data;
- api
- .trendIco_api({
- startTime: time[0],
- endTime: time[1],
- })
- .then((requset) => {
- this.$store.state.trendIcoCount = requset.data;
- this.trendIcoCount = requset.data;
- });
- },
- //重载运行echarts锥形图
- rtAnalogData_api() {
- api.rtAnalogData_api().then((requset) => {
- this.rtAnalogData = requset.data;
- });
- },
- //地图撒点
- siteList_api(query = {}) {
- api.siteList_api(query).then((requset) => {
- this.siteList = requset.data;
- this.initMap();
- });
- },
- //地图撒点
- // 日月年用电量
- htAnalogData_api() {
- api.htAnalogData_api().then((requset) => {
- this.htAnalogData = requset.data;
- });
- },
- // 今日昨日用电量趋势
- eptrendIco_api() {
- api.eptrendIco_api().then((requset) => {
- this.eptrendIco = requset.data;
- // console.log("this.eptrendIco");
- // console.log(this.eptrendIco[0].name);
- });
- },
- // 今日昨日用电量趋势
- eptrendIcoMonth_api() {
- api.eptrendIcoMonth_api().then((requset) => {
- this.eptrendIco = requset.data;
- console.log("this.eptrendIco");
- // console.log(this.eptrendIco);
- });
- },
- Overview() {
- // this.$router.push({ path: "/Overview" }); //, query: { title: title }
- },
- async initMap() {
- this.map = await new AMap.Map("mapF", {
- mapStyle: "amap://styles/blue", //设置地图的显示样式
- resizeEnable: true,
- zoom: 13,
- zooms: [3, 16],
- // features: [] //清空背景道路等
- });
- // this.initMapUi();
- var con = `<div class="siteModelBox" >
- <h2>
- {siteName}
- </h2>
- <div >
- <div class="siteDetailInfo" >
- <div class="infoLine">
- <span>站点状态:</span>
- <p>{status}</p>
- </div>
- <div class="infoLine">
- <span>设备总数:</span>
- <p>{deviceCount}</p >
- </div>
- <div class="infoLine">
- <span>告警数:</span>
- <p>{alarmPowerCount}</p >
- </div>
- <div class="infoLine">
- <span>监控类型:</span>
- <p>{deviceType}</p >
- </div>
- <div class="infoLine">
- <span>电话:</span>
- <p>{phone}</p >
- </div>
- <div class="infoLine">
- <span>地址:</span>
- <p>{siteAddress}</p >
- </div>
- </div>
- </div>
- </div>`;
- var dataList = this.siteList;
- dataList.forEach(function (item) {
- let conNew = con;
- // console.log(item.siteAddress);
- conNew = conNew.replace(/{siteAddress}/g, item.siteAddress);
- conNew = conNew.replace(/{phone}/g, item.phone);
- conNew = conNew.replace(/{siteName}/g, item.siteName);
- item.content = conNew;
- });
- this.addMarker(dataList, "water");
- },
- addMarker(lnglats) {
- // 创建标点和点击事件
- let markers = lnglats.map((val, ind) => {
- let marker = new AMap.Marker({
- position: new AMap.LngLat(val.longitude, val.latitude),
- icon: markIconPath,
- // icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/dir-via-marker.png',
- zIndex: 9,
- extData: {
- id: ind + 1,
- },
- });
- marker.on("mouseover", async () => {
- // console.log([val.latitude, val.longitude], null, val);
- await api.siteOne_api({ siteId: val.id }).then((requset) => {
- this.siteOne = requset.data;
- });
- if (this.siteOne) {
- val.content = val.content.replace(
- /{alarmPowerCount}/g,
- this.siteOne.alarmPowerCount ? this.siteOne.alarmPowerCount : "0"
- );
- val.content = val.content.replace(
- /{status}/g,
- this.siteOne.status ? this.siteOne.status : "-"
- );
- val.content = val.content.replace(
- /{deviceCount}/g,
- this.siteOne.deviceCount ? this.siteOne.deviceCount : "0"
- );
- val.content = val.content.replace(
- /{deviceType}/g,
- this.siteOne.deviceType ? this.siteOne.deviceType : "-"
- );
- }
- await this.addMarkerInfo(
- [val.longitude, val.latitude],
- val.content,
- val
- );
- });
- marker.on("mouseout", async () => {
- this.map.clearInfoWindow();
- });
- marker.on("click", async () => {
- localStorage.clear();
- this.$router.push({ path: "/Overview" });
- this.$store.commit("increment", val.id);
- localStorage.setItem("Overview", [val.id, val.siteName]);
- });
- return marker;
- });
- this.map.add(new AMap.OverlayGroup(markers));
- this.map.setFitView(); // 根据所有点自适应
- },
- // 添加标点
- addMarkerInfo(position, content, value = "") {
- value;
- // console.log("value");
- // console.log(value);
- this.map.clearInfoWindow();
- var infoWindow = new AMap.InfoWindow({
- isCustom: true, //使用自定义窗体
- closeWhenClickMap: true,
- content: content,
- offset: new AMap.Pixel(16, -30),
- });
- infoWindow.open(this.map, position);
- },
- poiPickerReady(poiPicker) {
- // console.log(poiPicker);
- var marker = new AMap.Marker();
- var infoWindow = new AMap.InfoWindow({
- offset: new AMap.Pixel(0, -20),
- });
- //选取了某个POI
- poiPicker.on("poiPicked", (poiResult) => {
- var source = poiResult.source,
- poi = poiResult.item,
- info = {
- source: source,
- id: poi.id,
- name: poi.name,
- location: poi.location.toString(),
- address: poi.address,
- };
- marker.setMap(this.map);
- infoWindow.setMap(this.map);
- marker.setPosition(poi.location);
- infoWindow.setPosition(poi.location);
- infoWindow.setContent(
- "POI信息: <pre>" + JSON.stringify(info, null, 2) + "</pre>"
- );
- // infoWindow.open(this.map, marker.getPosition());
- this.map.setCenter(marker.getPosition());
- });
- poiPicker.onCityReady(() => {
- // poiPicker.suggest("美食");
- });
- },
- // initMapUi() {
- // AMapUI.load(["ui/misc/PoiPicker"], (PoiPicker) => {
- // // console.log(PoiPicker);
- // let poiPickers = new PoiPicker({
- // input: "pickerInput",
- // });
- // this.poiPickerReady(poiPickers);
- // });
- // },
- },
- };
- </script>
- <style lang="scss">
- #pickerBox {
- position: absolute;
- z-index: 9;
- top: 0.15rem;
- right: 0.15rem;
- width: 3rem;
- height: 0.425rem;
- font-size: 0.15rem;
- }
- .el-icon-search {
- position: absolute;
- right: 0.1375rem;
- top: 0.1rem;
- font-size: 0.2125rem;
- color: #00f4fd;
- cursor: pointer;
- }
- #pickerInput {
- width: 3rem;
- line-height: 0.425rem;
- padding: 0 0.125rem;
- outline: none;
- border: 1px solid #00f4fd;
- border-radius: 18px;
- background: rgba(0, 0, 0, 0);
- color: #fff;
- }
- #poiInfo {
- background: #fff;
- }
- </style>
|