sprh.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365
  1. <template>
  2. <div style="background-color: #32435A">
  3. <div class="map">
  4. <supermap ref="supermap" style="height: 100%;width: 100%;position: absolute;z-index: 0;"
  5. :yxtSltProps="sltProps"></supermap>
  6. </div>
  7. <!-- 阴影背景 -->
  8. <div class="bj_left"><img src="@/assets/images/sprhbj-left.png"/></div>
  9. <div class="bj_right"><img src="@/assets/images/sprhbj-right.png"/></div>
  10. <div class="bj_bottom"><img src="@/assets/images/sprhbj-bottom.png"/></div>
  11. <!--头部开始-->
  12. <div class="header">
  13. <h1>城市运行一网统管指挥中心</h1>
  14. <div class="map_tab">
  15. <button @click="sltHandle" :class="{ 'on': btnOne }">矢量图</button>
  16. <button @click="yxtHandle" :class="{ 'on': btnTwo }">影像图</button>
  17. </div>
  18. </div>
  19. <!--头部结束-->
  20. <!--左侧开始-->
  21. <div class="left_con sprh-left">
  22. <div class="top_txt">
  23. <b>汽开区</b>
  24. <span>小雨</span>
  25. <span>9~16℃</span>
  26. </div>
  27. <!-- 设备tab开始-->
  28. <div class="facility_tab">
  29. <div class="div_tab">
  30. <a class="on">单屏</a>
  31. <a>电视墙</a>
  32. </div>
  33. <div class="clear"></div>
  34. <form class="qkq_ss">
  35. <input type="text" placeholder="请输入搜索词" class="inp_ss"/>
  36. <input type="button" class="inp_btn" value="搜索"/>
  37. </form>
  38. <div class="tab_cont">
  39. <div class="qkq_tdzy">
  40. <div class="qkq_tit ">设备列表</div>
  41. <div class="selectDate">
  42. <span class="_selectData">锦程街道</span>
  43. <a class="icon_more" @click="toggleDropdown($event)"><img src="@/assets/images/down.png"/></a>
  44. <div class="_moreMenu" v-if="dropdownVisible">
  45. <ul>
  46. <li class="change">东风街道</li>
  47. <li>锦程街道</li>
  48. </ul>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="scrollbar" style="height: 510px;">
  53. <ul id="accordion" class="accordion">
  54. <!-- lx_on 离线 zx_on在线 -->
  55. <li v-for="(camera, index) in cameras" :key="index" class="zx_on">
  56. <div class="link">{{ camera.cameraName }}</div>
  57. </li>
  58. </ul>
  59. </div>
  60. </div>
  61. <div class="tab_cont"></div>
  62. </div>
  63. <!-- 设备tab结束-->
  64. </div>
  65. <!--左侧结束-->
  66. <!--右侧开始-->
  67. <div class="right_con sprh-left">
  68. <div class="top_txt">
  69. <span>{{ currentTime }}</span>
  70. <!-- <span>星期六</span>-->
  71. <!-- <b>11:16:58</b>-->
  72. </div>
  73. <!-- 资源分布-->
  74. <div class="qkq_tdzy">
  75. <div class="qkq_tit ">资源分布</div>
  76. <div class="selectDate">
  77. <span class="_selectData">锦程街道</span>
  78. <a class="icon_more" @click="toggleDropdown($event)"><img src="@/assets/images/down.png"/></a>
  79. <div class="_moreMenu" v-if="dropdownVisible">
  80. <ul>
  81. <li class="change">东风街道</li>
  82. <li>锦程街道</li>
  83. </ul>
  84. </div>
  85. </div>
  86. </div>
  87. <div id="sprh-zyfb" style="margin:-5px auto 10px auto; width: 350px; height:150px;"></div>
  88. <!-- 资源分布-->
  89. <div class="qkq_tdzy">
  90. <div class="qkq_tit" style="margin-top: -35px">设备实时在线情况</div>
  91. </div>
  92. <div class="sbzs">
  93. <p>设备总数:</p>
  94. <span>1</span>
  95. <span>6</span>
  96. <span>4</span>
  97. <span>0</span>
  98. <p>个</p>
  99. </div>
  100. <div class="sb_cont">
  101. <div class="sb_in">
  102. <div id="sprh-zxfb" style="width:130px; height:140px;margin: 0 auto;"></div>
  103. <span class="zxsb">在线设备</span>
  104. <h2 class="zxsb_sl">1234<i>个</i></h2>
  105. </div>
  106. <div class="sb_in">
  107. <div id="sprh-lxfb" style="width:130px; height:140px;margin: 0 auto;"></div>
  108. <span class="lxsb">离线设备</span>
  109. <h2 class="lxsb_sl">234<i>个</i></h2>
  110. </div>
  111. </div>
  112. <div class="qkq_bmfw">
  113. <div class="qkq_tit ">摄像头统计</div>
  114. <div id="jczl-bmfw" style="margin: 20px auto 0px auto; width: 350px; height: 160px"></div>
  115. <div class="sb_cont sb_cont_sxt">
  116. <div class="sb_in">
  117. <span class="lxsb">小区内部</span>
  118. <h2 class="zxsb_sl">704<i>个</i></h2>
  119. </div>
  120. <div class="sb_in">
  121. <span class="lxsb">街道路面</span>
  122. <h2 class="lxsb_sl">230<i>个</i></h2>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <!--右侧结束-->
  128. <!-- 点位图例 开始 -->
  129. <div class="dwtl">
  130. <p><span class="xqnb"></span>街道路面(<i class="zx"></i>50个/<i class="lx"></i>10个)</p>
  131. <p><span class="jdlm"></span>小区内部(<i class="zx"></i>50个/<i class="lx"></i>10个)</p>
  132. </div>
  133. <!-- 点位图例 结束 -->
  134. <!--底部开始-->
  135. <div class="footer">
  136. <div class="nav-bottom">
  137. <div class="nav-bottom-left">
  138. <div class="nav-li-left">
  139. <span>经济运行</span>
  140. </div>
  141. <div class="nav-li-left">
  142. <span>城市管理</span>
  143. </div>
  144. <div class="nav-li-left" @click="handleNavigation('jtzl')">
  145. <span>交通治理</span>
  146. </div>
  147. <div class="nav-li-left" @click="handleNavigation('jczl')">
  148. <span>基层治理</span>
  149. </div>
  150. </div>
  151. <div class="nav-home-middle" @click="homePage('weather')">
  152. <img src="@/assets/images/home-btn.png"/>
  153. <a>返回首页</a>
  154. </div>
  155. <div class="nav-bottom-right">
  156. <div class="nav-li-right">
  157. <span>营商环境</span>
  158. </div>
  159. <div class="nav-li-right" @click="handleNavigation('yshj')">
  160. <span>政务运行</span>
  161. </div>
  162. <div class="nav-li-right on" @click="handleNavigation('sprh')">
  163. <span>安全应急</span>
  164. </div>
  165. <div class="nav-li-right">
  166. <span>服务一汽</span>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. <!--底部开始-->
  172. </div>
  173. </template>
  174. <script>
  175. import * as echarts from 'echarts'
  176. import $ from 'jquery'
  177. import jQuery from 'jquery'
  178. import "@/assets/images/qkq_body.css";
  179. import "@/assets/images/qkq_index.css";
  180. import "@/assets/images/qkq_sprh.css";
  181. import {getCameraList} from "@/api/system/camera";
  182. import supermap from "@/views/supermap/supermap";
  183. export default {
  184. name: "sprh",
  185. components: {
  186. supermap
  187. },
  188. data() {
  189. return {
  190. dropdownVisible: false,
  191. cameras: [],
  192. sltProps: null,
  193. currentTime: '',
  194. btnOne: true,
  195. btnTwo: false
  196. };
  197. // 可根据实际情况添加更多设备列表
  198. },
  199. created() {
  200. },
  201. mounted() {
  202. this.resourceDistribution();
  203. this.deviceOnline();
  204. this.deviceOffline();
  205. this.cameraList();
  206. this.regionTop();
  207. // 每秒刷新时间
  208. setInterval(() => {
  209. this.getCurrentTime();
  210. }, 1000);
  211. },
  212. methods: {
  213. sltHandle() {
  214. this.btnOne = true
  215. this.btnTwo = false
  216. this.$refs.supermap.getSupermap(null, null, null, "slt", null, null)
  217. },
  218. yxtHandle() {
  219. this.btnTwo = true
  220. this.btnOne = false
  221. this.$refs.supermap.getSupermap(null, null, null, "yxt", null, null)
  222. },
  223. handleNavigation(route) {
  224. this.$router.push({path: route});
  225. },
  226. homePage(route) {
  227. this.$router.push({path: route});
  228. },
  229. cameraList() {
  230. getCameraList().then(response => {
  231. this.cameras = response.data;
  232. })
  233. },
  234. toggleDropdown(event) {
  235. this.dropdownVisible = !this.dropdownVisible;
  236. },
  237. resourceDistribution() {
  238. //资源分布
  239. var myChart = echarts.init(document.getElementById('sprh-zyfb'));
  240. var salvProName = ['前程街道', '富民街道', '广兴街道', '东风街道', '锦绣街道', '锦程街道'];
  241. var salvProValue = [239, 181, 154, 144, 135, 117, 124];
  242. var salvProMax = [];//背景按最大值
  243. for (let i = 0; i < salvProValue.length; i++) {
  244. salvProMax.push(salvProValue[0])
  245. }
  246. let option = {
  247. grid: {
  248. top: 0,
  249. left: 33,
  250. right: 20,
  251. bottom: 0,
  252. containLabel: true
  253. },
  254. tooltip: {
  255. trigger: 'axis',
  256. axisPointer: {
  257. type: 'none'
  258. },
  259. formatter: function (params) {
  260. return params[0].name + ' : ' + params[0].value
  261. }
  262. },
  263. xAxis: {
  264. show: false,
  265. type: 'value'
  266. },
  267. yAxis: [{
  268. type: 'category',
  269. inverse: true,
  270. axisLabel: {
  271. show: true,
  272. textStyle: {
  273. color: '#fff'
  274. },
  275. },
  276. splitLine: {
  277. show: false
  278. },
  279. axisTick: {
  280. show: false
  281. },
  282. axisLine: {
  283. show: false
  284. },
  285. data: salvProName
  286. }, {
  287. type: 'category',
  288. inverse: true,
  289. axisTick: 'none',
  290. axisLine: 'none',
  291. show: true,
  292. axisLabel: {
  293. textStyle: {
  294. color: '#ffffff',
  295. fontSize: '12'
  296. },
  297. },
  298. data: salvProValue.map((item) => {
  299. return item + "个";
  300. })
  301. }],
  302. series: [{
  303. name: '值',
  304. type: 'bar',
  305. zlevel: 1,
  306. itemStyle: {
  307. normal: {
  308. barBorderRadius: 30,
  309. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
  310. offset: 0,
  311. color: '#0e3eaf'
  312. }, {
  313. offset: 1,
  314. color: '#00ffff'
  315. }]),
  316. },
  317. },
  318. barWidth: 20,
  319. data: salvProValue
  320. },
  321. {
  322. type: 'lines',
  323. coordinateSystem: 'cartesian2d',
  324. data: salvProValue.map((item, index) => {
  325. return {
  326. coords: [
  327. [0, index],
  328. [item - 4, index]
  329. ]
  330. };
  331. }),
  332. effect: {
  333. show: true,
  334. period: 2.5,
  335. trailLength: 0.5, //控制拖尾长度
  336. symbolSize: [20, 2],
  337. symbol: this.$store.state.common.echarts_baseStreamer,
  338. loop: true,
  339. color: '#fff' //流光颜色
  340. },
  341. lineStyle: {
  342. width: 0,
  343. opacity: 0.6,
  344. curveness: 0
  345. },
  346. zlevel: 10,
  347. },
  348. {
  349. name: '背景',
  350. type: 'bar',
  351. barWidth: 20,
  352. barGap: '-100%',
  353. data: salvProMax,
  354. itemStyle: {
  355. normal: {
  356. color: 'rgba(24,31,68,1)',
  357. barBorderRadius: 30,
  358. }
  359. },
  360. },
  361. ]
  362. };
  363. if (option) {
  364. myChart.setOption(option);
  365. }
  366. },
  367. deviceOnline() {
  368. //在线设备
  369. var myChart = echarts.init(document.getElementById('sprh-zxfb'));
  370. let angle = 0; //角度,用来做简单的动画效果的
  371. let value = 80;
  372. var timerId;
  373. let option = {
  374. title: {
  375. text: '{a|' + value + '}{c|%}',
  376. x: 'center',
  377. y: 'center',
  378. textStyle: {
  379. rich: {
  380. a: {
  381. fontSize: 24,
  382. color: '#29EEF3'
  383. },
  384. c: {
  385. fontSize: 16,
  386. color: '#ffffff',
  387. // padding: [5,0]
  388. }
  389. }
  390. }
  391. },
  392. series: [
  393. // 紫色
  394. {
  395. name: "ring5",
  396. type: 'custom',
  397. coordinateSystem: "none",
  398. renderItem: function (params, api) {
  399. return {
  400. type: 'arc',
  401. shape: {
  402. cx: api.getWidth() / 2,
  403. cy: api.getHeight() / 2,
  404. r: Math.min(api.getWidth(), api.getHeight()) * 0.42,
  405. startAngle: (0 + angle) * Math.PI / 180,
  406. endAngle: (90 + angle) * Math.PI / 180
  407. },
  408. style: {
  409. stroke: "#8383FA",
  410. fill: "transparent",
  411. lineWidth: 1.5
  412. },
  413. silent: true
  414. };
  415. },
  416. data: [0]
  417. }, {
  418. name: "ring5", //紫点
  419. type: 'custom',
  420. coordinateSystem: "none",
  421. renderItem: function (params, api) {
  422. let x0 = api.getWidth() / 2;
  423. let y0 = api.getHeight() / 2;
  424. let r = Math.min(api.getWidth(), api.getHeight()) * 0.42;
  425. let point = getCirlPoint(x0, y0, r, (90 + angle))
  426. return {
  427. type: 'circle',
  428. shape: {
  429. cx: point.x,
  430. cy: point.y,
  431. r: 4
  432. },
  433. style: {
  434. stroke: "#8450F9", //绿
  435. fill: "#8450F9"
  436. },
  437. silent: true
  438. };
  439. },
  440. data: [0]
  441. },
  442. // 蓝色
  443. {
  444. name: "ring5",
  445. type: 'custom',
  446. coordinateSystem: "none",
  447. renderItem: function (params, api) {
  448. return {
  449. type: 'arc',
  450. shape: {
  451. cx: api.getWidth() / 2,
  452. cy: api.getHeight() / 2,
  453. r: Math.min(api.getWidth(), api.getHeight()) * 0.42,
  454. startAngle: (180 + angle) * Math.PI / 180,
  455. endAngle: (270 + angle) * Math.PI / 180
  456. },
  457. style: {
  458. stroke: "#4386FA",
  459. fill: "transparent",
  460. lineWidth: 1.5
  461. },
  462. silent: true
  463. };
  464. },
  465. data: [0]
  466. },
  467. {
  468. name: "ring5", // 蓝色
  469. type: 'custom',
  470. coordinateSystem: "none",
  471. renderItem: function (params, api) {
  472. let x0 = api.getWidth() / 2;
  473. let y0 = api.getHeight() / 2;
  474. let r = Math.min(api.getWidth(), api.getHeight()) * 0.42;
  475. let point = getCirlPoint(x0, y0, r, (180 + angle))
  476. return {
  477. type: 'circle',
  478. shape: {
  479. cx: point.x,
  480. cy: point.y,
  481. r: 4
  482. },
  483. style: {
  484. stroke: "#4386FA", //绿
  485. fill: "#4386FA"
  486. },
  487. silent: true
  488. };
  489. },
  490. data: [0]
  491. },
  492. {
  493. name: "ring5",
  494. type: 'custom',
  495. coordinateSystem: "none",
  496. renderItem: function (params, api) {
  497. return {
  498. type: 'arc',
  499. shape: {
  500. cx: api.getWidth() / 2,
  501. cy: api.getHeight() / 2,
  502. r: Math.min(api.getWidth(), api.getHeight()) * 0.47,
  503. startAngle: (270 + -angle) * Math.PI / 180,
  504. endAngle: (40 + -angle) * Math.PI / 180
  505. },
  506. style: {
  507. stroke: "#0CD3DB",
  508. fill: "transparent",
  509. lineWidth: 1.5
  510. },
  511. silent: true
  512. };
  513. },
  514. data: [0]
  515. },
  516. // 橘色
  517. {
  518. name: "ring5",
  519. type: 'custom',
  520. coordinateSystem: "none",
  521. renderItem: function (params, api) {
  522. return {
  523. type: 'arc',
  524. shape: {
  525. cx: api.getWidth() / 2,
  526. cy: api.getHeight() / 2,
  527. r: Math.min(api.getWidth(), api.getHeight()) * 0.47,
  528. startAngle: (90 + -angle) * Math.PI / 180,
  529. endAngle: (220 + -angle) * Math.PI / 180
  530. },
  531. style: {
  532. stroke: "#FF8E89",
  533. fill: "transparent",
  534. lineWidth: 1.5
  535. },
  536. silent: true
  537. };
  538. },
  539. data: [0]
  540. }, {
  541. name: "ring5",
  542. type: 'custom',
  543. coordinateSystem: "none",
  544. renderItem: function (params, api) {
  545. let x0 = api.getWidth() / 2;
  546. let y0 = api.getHeight() / 2;
  547. let r = Math.min(api.getWidth(), api.getHeight()) * 0.47;
  548. let point = getCirlPoint(x0, y0, r, (90 + -angle))
  549. return {
  550. type: 'circle',
  551. shape: {
  552. cx: point.x,
  553. cy: point.y,
  554. r: 4
  555. },
  556. style: {
  557. stroke: "#FF8E89", //粉
  558. fill: "#FF8E89"
  559. },
  560. silent: true
  561. };
  562. },
  563. data: [0]
  564. }, {
  565. name: "ring5", //绿点
  566. type: 'custom',
  567. coordinateSystem: "none",
  568. renderItem: function (params, api) {
  569. let x0 = api.getWidth() / 2;
  570. let y0 = api.getHeight() / 2;
  571. let r = Math.min(api.getWidth(), api.getHeight()) * 0.47;
  572. let point = getCirlPoint(x0, y0, r, (270 + -angle))
  573. return {
  574. type: 'circle',
  575. shape: {
  576. cx: point.x,
  577. cy: point.y,
  578. r: 4
  579. },
  580. style: {
  581. stroke: "#0CD3DB", //绿
  582. fill: "#0CD3DB"
  583. },
  584. silent: true
  585. };
  586. },
  587. data: [0]
  588. }, {
  589. name: '设备在线率',
  590. type: 'pie',
  591. radius: ['72%', '55%'],
  592. silent: true,
  593. clockwise: true,
  594. startAngle: 90,
  595. z: 0,
  596. zlevel: 0,
  597. label: {
  598. normal: {
  599. position: "center",
  600. }
  601. },
  602. data: [{
  603. value: value,
  604. name: "",
  605. itemStyle: {
  606. normal: {
  607. color: { // 完成的圆环的颜色
  608. colorStops: [{
  609. offset: 0,
  610. color: '#A098FC' // 0% 处的颜色
  611. },
  612. {
  613. offset: 0.3,
  614. color: '#4386FA' // 0% 处的颜色
  615. },
  616. {
  617. offset: 0.6,
  618. color: '#4FADFD' // 0% 处的颜色
  619. },
  620. {
  621. offset: 0.8,
  622. color: '#0CD3DB' // 100% 处的颜色
  623. }, {
  624. offset: 1,
  625. color: '#646CF9' // 100% 处的颜色
  626. }
  627. ]
  628. },
  629. }
  630. }
  631. },
  632. {
  633. value: 100 - value,
  634. name: "",
  635. label: {
  636. normal: {
  637. show: false
  638. }
  639. },
  640. itemStyle: {
  641. normal: {
  642. color: "#173164"
  643. }
  644. }
  645. }
  646. ]
  647. },
  648. {
  649. name: '设备在线率',
  650. type: 'pie',
  651. radius: ['52%', '45%'],
  652. silent: true,
  653. clockwise: true,
  654. startAngle: 270,
  655. z: 0,
  656. zlevel: 0,
  657. label: {
  658. normal: {
  659. position: "center",
  660. }
  661. },
  662. data: [{
  663. value: value,
  664. name: "",
  665. itemStyle: {
  666. normal: {
  667. color: { // 完成的圆环的颜色
  668. colorStops: [{
  669. offset: 0,
  670. color: '#00EDF3' // 0% 处的颜色
  671. }, {
  672. offset: 1,
  673. color: '#646CF9' // 100% 处的颜色
  674. }]
  675. },
  676. }
  677. }
  678. },
  679. {
  680. value: 100 - value,
  681. name: "",
  682. label: {
  683. normal: {
  684. show: false
  685. }
  686. },
  687. itemStyle: {
  688. normal: {
  689. color: "#173164"
  690. }
  691. }
  692. }
  693. ]
  694. },
  695. ]
  696. };
  697. //获取圆上面某点的坐标(x0,y0表示坐标,r半径,angle角度)
  698. function getCirlPoint(x0, y0, r, angle) {
  699. let x1 = x0 + r * Math.cos(angle * Math.PI / 180)
  700. let y1 = y0 + r * Math.sin(angle * Math.PI / 180)
  701. return {
  702. x: x1,
  703. y: y1
  704. }
  705. }
  706. function draw() {
  707. angle = angle + 3
  708. myChart.setOption(option, true)
  709. //window.requestAnimationFrame(draw);
  710. }
  711. if (timerId) {
  712. clearInterval(timerId);
  713. }
  714. timerId = setInterval(function () {
  715. //用setInterval做动画感觉有问题
  716. draw()
  717. }, 100);
  718. myChart.setOption(option);
  719. },
  720. deviceOffline() {
  721. // 视频融合--离线设备
  722. // 基于准备好的dom,初始化echarts实例
  723. var myChart = echarts.init(document.getElementById('sprh-lxfb'));
  724. let angle = 0; //角度,用来做简单的动画效果的
  725. let value = 20;
  726. var timerId;
  727. let option = {
  728. title: {
  729. text: '{a|' + value + '}{c|%}',
  730. x: 'center',
  731. y: 'center',
  732. textStyle: {
  733. rich: {
  734. a: {
  735. fontSize: 24,
  736. color: '#29EEF3'
  737. },
  738. c: {
  739. fontSize: 16,
  740. color: '#ffffff',
  741. // padding: [5,0]
  742. }
  743. }
  744. }
  745. },
  746. series: [
  747. // 紫色
  748. {
  749. name: "ring5",
  750. type: 'custom',
  751. coordinateSystem: "none",
  752. renderItem: function (params, api) {
  753. return {
  754. type: 'arc',
  755. shape: {
  756. cx: api.getWidth() / 2,
  757. cy: api.getHeight() / 2,
  758. r: Math.min(api.getWidth(), api.getHeight()) * 0.42,
  759. startAngle: (0 + angle) * Math.PI / 180,
  760. endAngle: (90 + angle) * Math.PI / 180
  761. },
  762. style: {
  763. stroke: "#8383FA",
  764. fill: "transparent",
  765. lineWidth: 1.5
  766. },
  767. silent: true
  768. };
  769. },
  770. data: [0]
  771. }, {
  772. name: "ring5", //紫点
  773. type: 'custom',
  774. coordinateSystem: "none",
  775. renderItem: function (params, api) {
  776. let x0 = api.getWidth() / 2;
  777. let y0 = api.getHeight() / 2;
  778. let r = Math.min(api.getWidth(), api.getHeight()) * 0.42;
  779. let point = getCirlPoint(x0, y0, r, (90 + angle))
  780. return {
  781. type: 'circle',
  782. shape: {
  783. cx: point.x,
  784. cy: point.y,
  785. r: 4
  786. },
  787. style: {
  788. stroke: "#8450F9", //绿
  789. fill: "#8450F9"
  790. },
  791. silent: true
  792. };
  793. },
  794. data: [0]
  795. },
  796. // 蓝色
  797. {
  798. name: "ring5",
  799. type: 'custom',
  800. coordinateSystem: "none",
  801. renderItem: function (params, api) {
  802. return {
  803. type: 'arc',
  804. shape: {
  805. cx: api.getWidth() / 2,
  806. cy: api.getHeight() / 2,
  807. r: Math.min(api.getWidth(), api.getHeight()) * 0.42,
  808. startAngle: (180 + angle) * Math.PI / 180,
  809. endAngle: (270 + angle) * Math.PI / 180
  810. },
  811. style: {
  812. stroke: "#4386FA",
  813. fill: "transparent",
  814. lineWidth: 1.5
  815. },
  816. silent: true
  817. };
  818. },
  819. data: [0]
  820. },
  821. {
  822. name: "ring5", // 蓝色
  823. type: 'custom',
  824. coordinateSystem: "none",
  825. renderItem: function (params, api) {
  826. let x0 = api.getWidth() / 2;
  827. let y0 = api.getHeight() / 2;
  828. let r = Math.min(api.getWidth(), api.getHeight()) * 0.42;
  829. let point = getCirlPoint(x0, y0, r, (180 + angle))
  830. return {
  831. type: 'circle',
  832. shape: {
  833. cx: point.x,
  834. cy: point.y,
  835. r: 4
  836. },
  837. style: {
  838. stroke: "#4386FA", //绿
  839. fill: "#4386FA"
  840. },
  841. silent: true
  842. };
  843. },
  844. data: [0]
  845. },
  846. {
  847. name: "ring5",
  848. type: 'custom',
  849. coordinateSystem: "none",
  850. renderItem: function (params, api) {
  851. return {
  852. type: 'arc',
  853. shape: {
  854. cx: api.getWidth() / 2,
  855. cy: api.getHeight() / 2,
  856. r: Math.min(api.getWidth(), api.getHeight()) * 0.47,
  857. startAngle: (270 + -angle) * Math.PI / 180,
  858. endAngle: (40 + -angle) * Math.PI / 180
  859. },
  860. style: {
  861. stroke: "#0CD3DB",
  862. fill: "transparent",
  863. lineWidth: 1.5
  864. },
  865. silent: true
  866. };
  867. },
  868. data: [0]
  869. },
  870. // 橘色
  871. {
  872. name: "ring5",
  873. type: 'custom',
  874. coordinateSystem: "none",
  875. renderItem: function (params, api) {
  876. return {
  877. type: 'arc',
  878. shape: {
  879. cx: api.getWidth() / 2,
  880. cy: api.getHeight() / 2,
  881. r: Math.min(api.getWidth(), api.getHeight()) * 0.47,
  882. startAngle: (90 + -angle) * Math.PI / 180,
  883. endAngle: (220 + -angle) * Math.PI / 180
  884. },
  885. style: {
  886. stroke: "#FF8E89",
  887. fill: "transparent",
  888. lineWidth: 1.5
  889. },
  890. silent: true
  891. };
  892. },
  893. data: [0]
  894. }, {
  895. name: "ring5",
  896. type: 'custom',
  897. coordinateSystem: "none",
  898. renderItem: function (params, api) {
  899. let x0 = api.getWidth() / 2;
  900. let y0 = api.getHeight() / 2;
  901. let r = Math.min(api.getWidth(), api.getHeight()) * 0.47;
  902. let point = getCirlPoint(x0, y0, r, (90 + -angle))
  903. return {
  904. type: 'circle',
  905. shape: {
  906. cx: point.x,
  907. cy: point.y,
  908. r: 4
  909. },
  910. style: {
  911. stroke: "#FF8E89", //粉
  912. fill: "#FF8E89"
  913. },
  914. silent: true
  915. };
  916. },
  917. data: [0]
  918. }, {
  919. name: "ring5", //绿点
  920. type: 'custom',
  921. coordinateSystem: "none",
  922. renderItem: function (params, api) {
  923. let x0 = api.getWidth() / 2;
  924. let y0 = api.getHeight() / 2;
  925. let r = Math.min(api.getWidth(), api.getHeight()) * 0.47;
  926. let point = getCirlPoint(x0, y0, r, (270 + -angle))
  927. return {
  928. type: 'circle',
  929. shape: {
  930. cx: point.x,
  931. cy: point.y,
  932. r: 4
  933. },
  934. style: {
  935. stroke: "#0CD3DB", //绿
  936. fill: "#0CD3DB"
  937. },
  938. silent: true
  939. };
  940. },
  941. data: [0]
  942. }, {
  943. name: '设备离线率',
  944. type: 'pie',
  945. radius: ['72%', '55%'],
  946. silent: true,
  947. clockwise: true,
  948. startAngle: 90,
  949. z: 0,
  950. zlevel: 0,
  951. label: {
  952. normal: {
  953. position: "center",
  954. }
  955. },
  956. data: [{
  957. value: value,
  958. name: "",
  959. itemStyle: {
  960. normal: {
  961. color: { // 完成的圆环的颜色
  962. colorStops: [{
  963. offset: 0,
  964. color: '#A098FC' // 0% 处的颜色
  965. },
  966. {
  967. offset: 0.3,
  968. color: '#4386FA' // 0% 处的颜色
  969. },
  970. {
  971. offset: 0.6,
  972. color: '#4FADFD' // 0% 处的颜色
  973. },
  974. {
  975. offset: 0.8,
  976. color: '#0CD3DB' // 100% 处的颜色
  977. }, {
  978. offset: 1,
  979. color: '#646CF9' // 100% 处的颜色
  980. }
  981. ]
  982. },
  983. }
  984. }
  985. },
  986. {
  987. value: 100 - value,
  988. name: "",
  989. label: {
  990. normal: {
  991. show: false
  992. }
  993. },
  994. itemStyle: {
  995. normal: {
  996. color: "#173164"
  997. }
  998. }
  999. }
  1000. ]
  1001. },
  1002. {
  1003. name: '设备离线率',
  1004. type: 'pie',
  1005. radius: ['52%', '45%'],
  1006. silent: true,
  1007. clockwise: true,
  1008. startAngle: 270,
  1009. z: 0,
  1010. zlevel: 0,
  1011. label: {
  1012. normal: {
  1013. position: "center",
  1014. }
  1015. },
  1016. data: [{
  1017. value: value,
  1018. name: "",
  1019. itemStyle: {
  1020. normal: {
  1021. color: { // 完成的圆环的颜色
  1022. colorStops: [{
  1023. offset: 0,
  1024. color: '#00EDF3' // 0% 处的颜色
  1025. }, {
  1026. offset: 1,
  1027. color: '#646CF9' // 100% 处的颜色
  1028. }]
  1029. },
  1030. }
  1031. }
  1032. },
  1033. {
  1034. value: 100 - value,
  1035. name: "",
  1036. label: {
  1037. normal: {
  1038. show: false
  1039. }
  1040. },
  1041. itemStyle: {
  1042. normal: {
  1043. color: "#173164"
  1044. }
  1045. }
  1046. }
  1047. ]
  1048. },
  1049. ]
  1050. };
  1051. //获取圆上面某点的坐标(x0,y0表示坐标,r半径,angle角度)
  1052. function getCirlPoint(x0, y0, r, angle) {
  1053. let x1 = x0 + r * Math.cos(angle * Math.PI / 180)
  1054. let y1 = y0 + r * Math.sin(angle * Math.PI / 180)
  1055. return {
  1056. x: x1,
  1057. y: y1
  1058. }
  1059. }
  1060. function draw() {
  1061. angle = angle + 3
  1062. myChart.setOption(option, true)
  1063. //window.requestAnimationFrame(draw);
  1064. }
  1065. if (timerId) {
  1066. clearInterval(timerId);
  1067. }
  1068. timerId = setInterval(function () {
  1069. //用setInterval做动画感觉有问题
  1070. draw()
  1071. }, 100);
  1072. myChart.setOption(option);
  1073. },
  1074. getCurrentTime() {
  1075. const now = new Date();
  1076. const year = now.getFullYear();
  1077. const month = now.getMonth() + 1;
  1078. const date = now.getDate();
  1079. const day = now.getDay();
  1080. const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
  1081. const hour = now.getHours();
  1082. const minute = now.getMinutes();
  1083. const second = now.getSeconds();
  1084. const formattedMonth = month < 10 ? `0${month}` : month;
  1085. const formattedDate = date < 10 ? `0${date}` : date;
  1086. const formattedHour = hour < 10 ? `0${hour}` : hour;
  1087. const formattedMinute = minute < 10 ? `0${minute}` : minute;
  1088. const formattedSecond = second < 10 ? `0${second}` : second;
  1089. this.currentTime = `${year}年${formattedMonth}月${formattedDate}日 ${weekDays[day]} ${formattedHour}:${formattedMinute}:${formattedSecond}`;
  1090. },
  1091. regionTop() {
  1092. //摄像头统计
  1093. var myChart = echarts.init(document.getElementById('jczl-bmfw'));
  1094. let data = ['小区内部', '街道路面']
  1095. let valueData = [];
  1096. let labelData = []
  1097. for (var i = 0; i < data.length; i++) {
  1098. labelData.push(data[i]);
  1099. var lineNumber = Math.floor(Math.random() * 1000);
  1100. valueData.push(lineNumber);
  1101. }
  1102. var option = {
  1103. "backgroundColor": "rgba(0, 0, 0, 0)",
  1104. title: {
  1105. show: true,
  1106. text: '',
  1107. textStyle: {
  1108. color: '#fff',
  1109. fontSize: '14',
  1110. },
  1111. top: '0%',
  1112. left: 'bottom',
  1113. bottm: '-10%'
  1114. },
  1115. tooltip: {
  1116. trigger: 'axis',
  1117. axisPointer: {
  1118. type: 'shadow',
  1119. }
  1120. },
  1121. grid: {
  1122. top: '10%',
  1123. left: '15%',
  1124. right: '5%',
  1125. buttom: '-10',
  1126. },
  1127. xAxis: [{
  1128. type: 'category',
  1129. data: labelData,
  1130. axisTick: {
  1131. show: false, //隐藏X轴刻度
  1132. alignWithLabel: true
  1133. },
  1134. axisLabel: {
  1135. margin: 10,
  1136. color: '#e2e9ff',
  1137. textStyle: {
  1138. fontSize: 14
  1139. },
  1140. },
  1141. axisLine: {
  1142. lineStyle: {
  1143. color: 'rgba(255,255,255,0.12)',
  1144. },
  1145. },
  1146. }],
  1147. yAxis: {
  1148. name: '',
  1149. nameTextStyle: {
  1150. color: '#fff',
  1151. },
  1152. type: 'value',
  1153. axisLine: {
  1154. show: false,
  1155. lineStyle: {
  1156. color: 'rgba(255,255,255,0.12)'
  1157. },
  1158. },
  1159. axisLabel: {
  1160. formatter: '{value}',
  1161. color: '#e2e9ff',
  1162. },
  1163. splitLine: {
  1164. lineStyle: {
  1165. color: 'rgba(255,255,255,0.12)'
  1166. }
  1167. },
  1168. axisTick: {
  1169. show: true,
  1170. lineStyle: {
  1171. color: '#fff',
  1172. },
  1173. },
  1174. },
  1175. // 切片
  1176. series: [
  1177. {
  1178. type: 'lines',
  1179. coordinateSystem: 'cartesian2d',
  1180. data: valueData.map((item, index) => {
  1181. return {
  1182. coords: [
  1183. [index, 0],
  1184. [index, item - 4]
  1185. ]
  1186. };
  1187. }),
  1188. effect: {
  1189. show: true,
  1190. period: 3.5,// 周期 速度 2.5
  1191. trailLength: 0.5, //控制拖尾长度
  1192. symbolSize: 25, // ⭐⭐星星大小
  1193. symbol:
  1194. 'path://M307.46000719101244,524.9919417770187 L320.064963732395,524.9919417770187 L323.95999229701675,510.4772043087195 L327.8550230764027,524.9919417770187 L340.45997740302056,524.9919417770187 L330.26237201075065,533.9624401818169 L334.15760211881354,548.4771776501146 L323.95999229701675,539.506434950185 L313.76238468998207,548.4771776501146 L317.6576159054294,533.9624401818169 L307.46000719101244,524.9919417770187 z',
  1195. loop: true,
  1196. color: '#ffffff' //流光颜色
  1197. },
  1198. lineStyle: {
  1199. width: 0,
  1200. opacity: 0.6,
  1201. curveness: 0
  1202. },
  1203. z: 999
  1204. },
  1205. {
  1206. type: 'bar',
  1207. data: valueData,
  1208. barWidth: '20px',
  1209. itemStyle: {
  1210. normal: {
  1211. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  1212. offset: 0,
  1213. color: 'rgba(0,244,255,1)' // 0% 处的颜色
  1214. }, {
  1215. offset: 1,
  1216. color: 'rgba(0,77,167,1)' // 100% 处的颜色
  1217. }], false),
  1218. barBorderRadius: [30, 30, 30, 30],
  1219. shadowColor: 'rgba(0,160,221,1)',
  1220. shadowBlur: 4,
  1221. }
  1222. },
  1223. }]
  1224. };
  1225. if (option) {
  1226. myChart.setOption(option);
  1227. }
  1228. },
  1229. }
  1230. };
  1231. // import '@/assets/images/TL_Tab.js';
  1232. (function ($) {
  1233. $.fn.TL_Tab = function (options) {
  1234. var defaults = {
  1235. tab: ".df_67 ol li",
  1236. box: ".df_67 ul li",
  1237. events: "over",
  1238. num: 3,
  1239. speed: 300
  1240. };
  1241. var setting = $.extend(defaults, options);
  1242. var tl_tab = setting.tab;
  1243. var tl_box = setting.box;
  1244. var tl_events = setting.events;
  1245. var tl_num = setting.num;
  1246. var tl_speed = setting.speed;
  1247. var tl_time_out = null;
  1248. $(tl_box).css({
  1249. display: 'none'
  1250. });
  1251. $(tl_tab).removeClass('df_on');
  1252. $(tl_tab).eq(tl_num - 1).addClass('df_on');
  1253. $(tl_box).eq(tl_num - 1).css({
  1254. display: 'block'
  1255. });
  1256. if (tl_events === 'click') {
  1257. $(tl_tab).click(function () {
  1258. $(tl_tab).removeClass('df_on');
  1259. $(tl_tab).eq($(this).index()).addClass('df_on');
  1260. $(tl_box).stop().fadeOut(tl_speed);
  1261. $(tl_box).eq($(this).index()).stop().fadeIn(tl_speed);
  1262. });
  1263. }
  1264. if (tl_events === 'over') {
  1265. $(tl_tab).hover(function () {
  1266. var _this = this;
  1267. clearTimeout(tl_num);
  1268. tl_time_out = setTimeout(function () {
  1269. $(tl_tab).removeClass('df_on');
  1270. $(tl_tab).eq($(_this).index()).addClass('df_on');
  1271. $(tl_box).stop().fadeOut(tl_speed);
  1272. $(tl_box).eq($(_this).index()).stop().fadeIn(tl_speed);
  1273. }, 30);
  1274. }, function () {
  1275. clearTimeout(tl_time_out);
  1276. });
  1277. }
  1278. };
  1279. })(jQuery);
  1280. // import '@/assets/images/leftnav.js';
  1281. $(function () {
  1282. var Accordion = function (el, multiple) {
  1283. this.el = el || {};
  1284. this.multiple = multiple || false;
  1285. // Variables privadas
  1286. var links = this.el.find('.link');
  1287. // Evento
  1288. links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
  1289. };
  1290. Accordion.prototype.dropdown = function (e) {
  1291. var $el = e.data.el;
  1292. let $this = $(this);
  1293. let $next = $this.next();
  1294. $next.slideToggle();
  1295. $this.parent().toggleClass('open');
  1296. if (!e.data.multiple) {
  1297. $el.find('.submenu').not($next).slideUp().parent().removeClass('open');
  1298. }
  1299. };
  1300. var accordion = new Accordion($('#accordion'), false);
  1301. $('.submenu li').click(function () {
  1302. $(this).addClass('current').siblings('li').removeClass('current');
  1303. });
  1304. });
  1305. //切换单屏电视墙
  1306. $(function () {
  1307. $(this.$el).find('.facility_tab .div_tab a').TL_Tab({
  1308. tab: ".facility_tab .div_tab a",
  1309. box: ".facility_tab .tab_cont",
  1310. events: "click",
  1311. num: 1,
  1312. speed: 10
  1313. });
  1314. });
  1315. </script>
  1316. <style>
  1317. /* 添加你的CSS样式 */
  1318. </style>