datacenter.vue 19 KB

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