datacenter.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <!--信息中心-->
  2. <template>
  3. <div class="visual-con">
  4. <!--头部-->
  5. <vheader></vheader>
  6. <!--主体-->
  7. <div class="visual-body">
  8. <!-- 左侧 -->
  9. <div class="leftbar w-10" ref="left" style="width:12rem !important;height: 80vh;overflow-y: hidden;">
  10. <div class="forthis">
  11. <dv-border-box-13
  12. backgroundColor="rgba(12, 19, 38, .90)"
  13. style="padding-bottom: 1rem;height: 80vh;"
  14. >
  15. <img
  16. src="../assets/images/integrated/light.png"
  17. style="width: 100%; margin-top: 0.4rem"
  18. />
  19. <div class="sj-search">
  20. <el-input
  21. v-model="searchName"
  22. placeholder="请输入名称"
  23. @keyup.enter.native="searchByName()"
  24. size="small"
  25. prefix-icon="el-icon-search"
  26. />
  27. </div>
  28. <div class="i-list-con" style="height: 71vh;">
  29. <div class="d-l-con-icon">
  30. <div
  31. class="icon-con"
  32. :class="{ on: iconCurrentIndex == item.type }"
  33. v-for="(item, index) in resourcesList"
  34. v-on:click="fireControlViewPoint(item.type, searchName)"
  35. >
  36. <div
  37. class="iconfont icon icon-normal"
  38. :class="item.icon"
  39. :style="'background:' + item.bg"
  40. ></div>
  41. <div class="icon-text">
  42. <h6>{{ item.num }}</h6>
  43. <h5>{{ item.name }}</h5>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </dv-border-box-13>
  49. </div>
  50. </div>
  51. <!-- 地图 -->
  52. <supermap
  53. ref="supermap"
  54. style="width: 100%; height: 100vh"
  55. @sewageOutletClick="sewageOutletClick"
  56. @fatherMethod="fatherMethod"
  57. ></supermap>
  58. <!-- <button @click="showEventInfo1" style="position: absolute; right: 50%;top: 45%;z-index: 1000;">弹层事件演示用按钮-->
  59. <!-- </button>-->
  60. <!-- 右侧 -->
  61. <div class="rightbar" ref="right" v-if="showSearch == true">
  62. <div class="forthis">
  63. <dv-border-box-13
  64. backgroundColor="rgba(12, 19, 38, .90)"
  65. style="padding-bottom: 1rem"
  66. >
  67. <img
  68. src="../assets/images/integrated/light.png"
  69. style="width: 100%; margin-top: 0.4rem"
  70. />
  71. <div class="this-title">
  72. <span>数据分布</span>
  73. <dv-decoration-3
  74. style="width: 150px; height: 15px; margin-right: 1rem"
  75. />
  76. </div>
  77. <div class="i-list-con h-73">
  78. <div class="overflow-y" style="height: 39vh">
  79. <div
  80. class="d-l-con"
  81. :class="{ on: listCurrentIndex == item.deptId }"
  82. v-for="(item, index) in deptGroupList"
  83. v-on:click="indentleftByDeptIdSetMarkers(item.deptId)"
  84. >
  85. <div class="d-l-l-text">
  86. <i class="i-small"></i>
  87. <h4>{{ item.deptName }}</h4>
  88. </div>
  89. <div class="d-l-l-count">{{ item.count }}</div>
  90. </div>
  91. </div>
  92. <div class="overflow-y" style="height: 34vh">
  93. <div id="data-chart" style="width: 100%; height: 34vh"></div>
  94. </div>
  95. </div>
  96. </dv-border-box-13>
  97. </div>
  98. </div>
  99. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  100. </div>
  101. <eventLocation ref="eventLocation"></eventLocation>
  102. <TVWall ref="TVWall"></TVWall>
  103. <TVWalls ref="TVWalls"></TVWalls>
  104. </div>
  105. </template>
  106. <script>
  107. import {
  108. fireControlViewList,
  109. fireControlViewPoint,
  110. } from "@/api/datacenter";
  111. import supermap from "@/components/supermap-2.5d"; //超图
  112. import vheader from "@/components/v-header.vue"; //一体化共用头部
  113. import vBottomMenu from "@/components/vBottomMenu.vue"; //一体化公共底部菜单
  114. import eventLocation from "@/components/eventLocation.vue"; //事件定位弹窗
  115. import TVWall from "@/components/TVWall.vue"; //电视墙弹窗
  116. import TVWalls from "@/components/TVWalls.vue"; //电视墙弹窗
  117. import {esViewDetail} from "@/api/forest"; //资源底色控制文件
  118. import { getIconBg } from "@/api/components/sookaMapIcon";
  119. import {getUserProfile} from "@/api/system/user";
  120. import { Button } from '@/dahua/TVWalllib/iview' //资源底色控制文件
  121. // import echarts from 'echarts'
  122. let echarts = require("echarts");
  123. export default {
  124. components: {
  125. Button,
  126. supermap,
  127. vheader,
  128. vBottomMenu,
  129. eventLocation,
  130. TVWall,
  131. TVWalls,
  132. },
  133. created() {
  134. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  135. window.showDialog = this.showDialog;
  136. window.choseLayerSwitching = this.choseLayerSwitching;
  137. window.choseLayerSwitchingList = this.choseLayerSwitchingList;
  138. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  139. },
  140. mounted() {
  141. // 初始化地图数据
  142. this.getSuperMapUrl();
  143. setTimeout(() => {
  144. this.fireControlViewList();
  145. }, 2000)
  146. this.bottomMenuList(); //获取底部公共组件消息和任务
  147. },
  148. data() {
  149. return {
  150. // 搜索框
  151. showSearch: true,
  152. // 搜索名称
  153. searchName: "",
  154. // 搜索类型
  155. iconCurrentIndex: "",
  156. listCurrentIndex: "",
  157. markersList: [],
  158. iframeBoo: true,
  159. open: false,
  160. iframeVue: null,
  161. activeName: "info",
  162. radio: "1",
  163. //类型
  164. resourceTable: "",
  165. //左侧资源
  166. resourcesList: [],
  167. //右侧资源
  168. deptGroupList: [],
  169. source: [],
  170. };
  171. },
  172. watch: {
  173. },
  174. methods: {
  175. //初始化地图数据
  176. getSuperMapUrl(){
  177. getUserProfile().then(response => {
  178. let mapDeptId=response.mapDeptId
  179. let num = 0;
  180. if (mapDeptId == "365") {
  181. num = 0;
  182. } else if (mapDeptId == "369") {
  183. num = 1;
  184. } else if (mapDeptId == "371") {
  185. num = 2;
  186. } else if (mapDeptId == "373") {
  187. num = 3;
  188. } else if (mapDeptId == "372") {
  189. num = 4;
  190. } else if (mapDeptId == "370") {
  191. num = 5;
  192. }
  193. this.$refs.supermap.removeAllviewer(num, -1);
  194. });
  195. },
  196. // 根据名称筛选资源点位
  197. searchByName() {
  198. this.$modal.msgSuccess("正在查询,请稍后...");
  199. this.fireControlViewPoint(this.resourceTable, this.searchName,"search");
  200. },
  201. fatherMethod(dianshiqiang, longitude, latitude, item) {
  202. this.$refs.TVWalls.showTVWall(
  203. dianshiqiang, {
  204. longitude: longitude,
  205. latitude: latitude,
  206. },
  207. item
  208. );
  209. },
  210. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  211. bottomMenuList() {
  212. this.$refs.bottomMenu.selectTaskList(); //获取任务列表
  213. this.$refs.bottomMenu.selectMessageList(); //获取消息列表
  214. },
  215. showDialog(click) {
  216. if (click == "eventLocation") {
  217. this.$refs.eventLocation.showEventLocation();
  218. this.$refs.bottomMenu.showMeasure = false;
  219. this.$refs.bottomMenu.showChild = false;
  220. } else if (click == "editableLayers") {
  221. this.$refs.bottomMenu.showChild = false;
  222. if (!this.$refs.bottomMenu.showMeasure) {
  223. this.$refs.bottomMenu.showMeasure = true;
  224. } else {
  225. this.$refs.bottomMenu.showMeasure = false;
  226. }
  227. } else if (click == "layerSwitching") {
  228. this.$refs.bottomMenu.showMeasure = false;
  229. if (!this.$refs.bottomMenu.showChild) {
  230. this.$refs.bottomMenu.showChild = true;
  231. } else {
  232. this.$refs.bottomMenu.showChild = false;
  233. }
  234. } else if (click == "TVWall") {
  235. this.$refs.TVWall.showTVWall();
  236. this.$refs.bottomMenu.showMeasure = false;
  237. this.$refs.bottomMenu.showChild = false;
  238. }
  239. },
  240. //选择图层
  241. choseLayerSwitching(url, isClear) {
  242. this.$refs.supermap.layerSwitching(url, isClear);
  243. },
  244. //选择图层(传递数组)
  245. choseLayerSwitchingList(urlList) {
  246. this.$refs.supermap.layerSwitchingList(urlList);
  247. },
  248. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  249. //数据分布chart
  250. dataChat() {
  251. // 基于准备好的dom,初始化echarts实例
  252. let myChart = echarts.init(document.getElementById("data-chart"));
  253. // 绘制图表
  254. const dfColor = ["#92E1FF", "#0097FB", "#30ECA6", "#FFC227", "#FF4848"];
  255. myChart.setOption({
  256. dataset: {
  257. source: this.source,
  258. },
  259. tooltip: {
  260. trigger: "item",
  261. },
  262. dataZoom: [
  263. {
  264. show: this.source.length > 8 ? true : false,
  265. // show: true,
  266. type: "slider",
  267. yAxisIndex: 0,
  268. left: 0,
  269. start: 0,
  270. end: this.source.length > 8 ? 8 : 100,
  271. width: 15,
  272. },
  273. ],
  274. grid: {
  275. top: "5%",
  276. left: "12%",
  277. // right: "4%",
  278. bottom: "-15%",
  279. width: "75%",
  280. containLabel: true,
  281. },
  282. xAxis: {
  283. show: false,
  284. type: "value",
  285. },
  286. yAxis: {
  287. type: "category", // 不设置类目轴,抽离的dataset数据展示不出来
  288. inverse: true,
  289. axisLabel: {
  290. show: true,
  291. textStyle: {
  292. color: "#5deaff",
  293. fontSize: "12",
  294. },
  295. },
  296. splitLine: {
  297. show: false,
  298. },
  299. axisTick: {
  300. show: false,
  301. },
  302. axisLine: {
  303. show: false,
  304. },
  305. },
  306. series: [
  307. {
  308. type: "bar",
  309. animationCurve: "easeOutBack",
  310. barWidth: 5,
  311. label: {
  312. show: true,
  313. position: "right",
  314. offset: [0, 0],
  315. color: "#88dfd5",
  316. // fontSize: "12",
  317. style: {
  318. fill: "#fff",
  319. },
  320. },
  321. backgroundBar: {
  322. show: true,
  323. style: {
  324. fill: "rgba(97,152,255,0.20)",
  325. },
  326. },
  327. barStyle: {
  328. stroke: "rgba(41,244,236,1)",
  329. },
  330. gradient: {
  331. color: ["rgba(41,244,236,1)", "rgba(41,244,236,0)"],
  332. },
  333. itemStyle: {
  334. label: {
  335. show: true,
  336. },
  337. labelLine: {
  338. show: false,
  339. },
  340. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  341. {
  342. offset: 0,
  343. color: "rgba(41,244,236,0)",
  344. },
  345. {
  346. offset: 1,
  347. color: "rgba(41,244,236,.5)",
  348. },
  349. ]),
  350. borderColor: "#a2f9f7",
  351. shadowBlur: 16,
  352. shadowColor: "#a2f9f7",
  353. },
  354. },
  355. ],
  356. });
  357. },
  358. fireControlViewList() {
  359. let that = this;
  360. fireControlViewList("yingji").then(function (res) {
  361. for (let i = 0; i < res.data.length; i++) {
  362. if(res.data[i].type !='centerdata_t_forest_fireteam'){
  363. that.resourcesList.push(res.data[i]);
  364. }
  365. }
  366. //截取data.resourceTable字段中“_”分隔符最后一个作为关键字,重新拼接成前端需要的图标:class,格式sj-icon-xxxx,将其set回原数组
  367. that.resourcesList.forEach(function (data, index) {
  368. let icon =
  369. "sj" +
  370. "-" +
  371. "icon" +
  372. "-" +
  373. data.type.replaceAll("_", "-").replaceAll("@", "-");
  374. console.log("icon_" + (index + 1) + "=", icon);
  375. that.$set(that.resourcesList[index], "icon", icon);
  376. //每个图标对应固定颜色
  377. that.$set(that.resourcesList[index], "bg", getIconBg(icon));
  378. });
  379. that.fireControlViewPoint("yingji", "");
  380. });
  381. },
  382. fireControlViewPoint(resourceTable, name, search) {
  383. if(resourceTable == this.resourceTable && search != "search"){
  384. resourceTable = "yingji"
  385. }
  386. this.iconCurrentIndex = resourceTable;
  387. // 搜索框
  388. if (name == "" || name == null || name == undefined) {
  389. name = "";
  390. } else {
  391. this.showSearch = true;
  392. }
  393. console.log("name=", name);
  394. console.log("this.showSearch=", this.showSearch);
  395. let that = this;
  396. that.resourceTable = resourceTable;
  397. that.markersList = [];
  398. that.source = [];
  399. fireControlViewPoint(resourceTable, name,"").then((res) => {
  400. let pointList = res.data.pointList;
  401. that.deptGroupList = res.data.deptList;
  402. if (res.data.deptList != null && res.data.deptList.length > 0) {
  403. for (let i = 0; i < res.data.deptList.length; i++) {
  404. let aa = [
  405. res.data.deptList[i].deptName,
  406. res.data.deptList[i].count,
  407. ];
  408. that.source.push(aa);
  409. }
  410. }
  411. if (res.data.pointList != null && res.data.pointList.length > 0) {
  412. for (let i = 0; i < res.data.pointList.length; i++) {
  413. if(res.data.pointList[i].indexName != 'centerdata_t_forest_fireteam'){
  414. let markersMap = {
  415. lng: res.data.pointList[i].longitude,
  416. lat: res.data.pointList[i].latitude,
  417. icon: "marker",
  418. bindPopupHtml: "",
  419. click: "",
  420. name: i,
  421. keepBindPopup: false,
  422. isAggregation: false,
  423. };
  424. that.markersList.push(
  425. this.getMarkersMap(
  426. resourceTable == "yingji" ? res.data.pointList[i].indexName:resourceTable,
  427. markersMap,
  428. res.data.pointList[i]
  429. )
  430. );
  431. }
  432. }
  433. }
  434. if (this.showSearch == true) {
  435. this.dataChat();
  436. }
  437. that.$refs.supermap.clearM(false);
  438. that.$refs.supermap.setMarkers(that.markersList);
  439. });
  440. },
  441. getMarkersMap(resourceTable, markersMap, item) {
  442. let icon = "sj-icon-map-"+resourceTable.replaceAll("_", "-");
  443. markersMap.lng = item.longitude;
  444. markersMap.lat = item.latitude;
  445. markersMap.click = "sewageOutletClick";
  446. markersMap.parameter = item;
  447. markersMap.icon = icon;
  448. markersMap.bindPopupHtml =
  449. '<div class="map-tip">' +
  450. "<span>" +
  451. ' <div class="d-l-con">' +
  452. ' <div class="d-l-l-text">' +
  453. " <h4>经纬度:" +
  454. (item.longitude ? item.longitude : "") +
  455. "," +
  456. (item.latitude ? item.latitude : "") +
  457. "</h4>" +
  458. " </div>" +
  459. " </div>" +
  460. " </span>" +
  461. "<span>" +
  462. ' <div class="d-l-con">' +
  463. ' <div class="d-l-l-text">' +
  464. " <h4>名称:" +
  465. (item.name ? item.name : "") +
  466. "</h4>" +
  467. " </div>" +
  468. " </div>" +
  469. " </span>" +
  470. "<span>" +
  471. ' <div class="d-l-con">' +
  472. ' <div class="d-l-l-text">' +
  473. " <h4>地址:" +
  474. (item.address ? item.address : "") +
  475. "</h4>" +
  476. " </div>" +
  477. " </div>" +
  478. " </span>" +
  479. "<span>" +
  480. ' <div class="d-l-con">' +
  481. ' <div class="d-l-l-text">' +
  482. " <h4>联系人:" +
  483. (item.contacts ? item.contacts : "") +
  484. "</h4>" +
  485. " </div>" +
  486. " </div>" +
  487. " </span>" +
  488. "<span>" +
  489. ' <div class="d-l-con">' +
  490. ' <div class="d-l-l-text">' +
  491. " <h4>联系电话:" +
  492. (item.phone ? item.phone : "") +
  493. "</h4>" +
  494. " </div>" +
  495. " </div>" +
  496. " </span></div>";
  497. return markersMap;
  498. },
  499. async sewageOutletClick(data) {
  500. console.log('data',data);
  501. const params = Object.assign({});
  502. params.longitude = data.longitude;
  503. params.latitude = data.latitude;
  504. params.id = data.id;
  505. params.type = data.indexName;
  506. let result = await esViewDetail(params);
  507. const treeLabels = [
  508. {
  509. id: null,
  510. labelCode: "999",
  511. labelName: "电视墙",
  512. cameraType: null,
  513. parentLabelCode: "",
  514. },
  515. ];
  516. const labelChannels = [];
  517. for (let i in result.data.cameras) {
  518. treeLabels.push({
  519. id: null,
  520. labelCode: result.data.cameras[i].cameraCode,
  521. labelName: result.data.cameras[i].cameraName,
  522. cameraType: result.data.cameras[i].cameraType,
  523. parentLabelCode: "999",
  524. });
  525. labelChannels.push({
  526. labelCode: result.data.cameras[i].cameraCode,
  527. channelDates: [
  528. {
  529. channelCode: result.data.cameras[i].cameraCode,
  530. channelName: result.data.cameras[i].cameraName,
  531. channelSn: null,
  532. cameraType: result.data.cameras[i].cameraType,
  533. online: "1",
  534. cameraCode: "1",
  535. },
  536. ],
  537. });
  538. }
  539. const dianshiqiang = [
  540. {
  541. switchTab: "2",
  542. treeLabels: treeLabels,
  543. labelChannels: labelChannels,
  544. },
  545. ];
  546. if (result.data.cameras.length > 0) {
  547. this.$refs.TVWalls.showTVWall(
  548. dianshiqiang, {
  549. longitude: data.longitude,
  550. latitude: data.latitude,
  551. },
  552. result.data.detail,1
  553. );
  554. }
  555. },
  556. indentleftByDeptIdSetMarkers(deptId) {
  557. this.listCurrentIndex = deptId;
  558. let that = this;
  559. //点击左侧地图落点
  560. fireControlViewPoint(that.resourceTable,that.searchName, deptId).then((res) => {
  561. that.markersList = [];
  562. if (res.data != null && res.data.pointList.length>0) {
  563. for (let i = 0; i < res.data.pointList.length; i++) {
  564. let markersMap = {
  565. lng: res.data.pointList[i].longitude,
  566. lat: res.data.pointList[i].latitude,
  567. icon: "marker",
  568. bindPopupHtml: "",
  569. click: "",
  570. name: i,
  571. keepBindPopup: false,
  572. isAggregation: false,
  573. };
  574. console.log("resourceTable=", that.resourceTable);
  575. console.log("res.data[i]=", res.data.pointList[i]);
  576. that.markersList.push(
  577. that.getMarkersMap(
  578. that.resourceTable == "yingji" ? res.data.pointList[i].indexName:that.resourceTable,
  579. markersMap, res.data.pointList[i])
  580. );
  581. }
  582. }
  583. that.$refs.supermap.clearM();
  584. that.$refs.supermap.setMarkers(that.markersList);
  585. });
  586. },
  587. },
  588. };
  589. </script>
  590. <style rel="stylesheet/scss" lang="scss" scoped>
  591. @import "@/assets/styles/base.scss";
  592. </style>