resources.vue 20 KB

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