homeTable.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. <template>
  2. <div style="width:100%;height:100%;background-color:rgb(0, 9, 40)">
  3. <mapdiv ref="mapv" :deviceList='deviceList'></mapdiv>
  4. <div class="shipInCount">
  5. <img src="@/assets/picture/img_wgcb.png" style="margin-top:5rem;margin-left:5rem"/>
  6. <div style="margin-top:5rem" @click="dialogVisibleShip = true">
  7. <div style="float:left">
  8. <div class="lcbBackground">
  9. <div style="margin-top:12rem">
  10. {{ so2Count }}
  11. <br/>
  12. <span style="font-size:5rem">艘</span>
  13. </div>
  14. </div>
  15. <div style="text-align: center;color: #ffffff;margin-left:14rem;margin-top:43rem">硫含量超标</div>
  16. </div>
  17. <div style="float:left">
  18. <div class="hyzpBackground">
  19. <div style="margin-top:12rem">
  20. {{ blackCount }}
  21. <br/>
  22. <span style="font-size:5rem">艘</span>
  23. </div>
  24. </div>
  25. <div style="text-align: center;color: #ffffff;margin-left:7rem;margin-top:43rem">黑烟抓拍</div>
  26. </div>
  27. </div>
  28. <img src="@/assets/picture/img_sbtj.png" style="margin-top:5rem;margin-left:5rem"/>
  29. <div class="totalContent" style="padding-right:15rem">
  30. <div style="float:left;margin-top:3rem">
  31. <i class="el-icon-pie-chart" style="font-size:9rem;float:left;margin-left:5rem"/>
  32. <span style="font-size:6rem;float:left;margin-left:5rem">总数</span>
  33. </div>
  34. <div style="float:right;font-size:9rem;margin-top:1rem">{{ deviceTotal }}个</div>
  35. </div>
  36. <div style="padding-left:5rem;padding-top:1rem">
  37. <div style="color:white" @click="dialogVisible = true">
  38. <div style="float:left"><img src="@/assets/picture/location.png" style="margin-left:5rem"/></div>
  39. <div style="float:left;background-image: linear-gradient(transparent 90%,white);font-size:6rem;margin-top:14rem">安装位置</div>
  40. </div>
  41. <div style="color:white" @click="dialogVisibleType = true">
  42. <div style="float:left"><img src="@/assets/picture/device_type.png" style="margin-left:5rem"/></div>
  43. <div style="float:left;background-image: linear-gradient(transparent 90%,white);font-size:6rem;margin-top:14rem">设备类型</div>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="shipInformation">
  48. <img src="@/assets/picture/img_xycbxx.png" style="margin-top:5rem;margin-left:5rem"/>
  49. <scroll illegalStatus=2></scroll>
  50. <img src="@/assets/picture/img_wgcbxx.png" style="margin-top:5rem;margin-left:5rem"/>
  51. <scroll illegalStatus=3></scroll>
  52. </div>
  53. <div class="equipmentContent">
  54. <el-dialog
  55. title=""
  56. :visible.sync="dialogVisible"
  57. @open="openChart">
  58. <div id="equipmentChart" style="width:260rem;height:100rem"></div>
  59. </el-dialog>
  60. </div>
  61. <div class="equipmentTypeContent">
  62. <el-dialog
  63. title=""
  64. :visible.sync="dialogVisibleType"
  65. @open="openTypeChart">
  66. <div id="equipmentTypeChart" style="width:160rem;height:100rem"></div>
  67. </el-dialog>
  68. </div>
  69. <div class="wfcbContent">
  70. <el-dialog
  71. title=""
  72. :visible.sync="dialogVisibleShip"
  73. @open="openShipChart">
  74. <div style="position:absolute;z-index:3001">
  75. <div style="float:left;color:#ffffff">开始</div>
  76. <div style="float:left;margin-left:3rem">
  77. <el-date-picker
  78. @change='getSo2Time'
  79. value-format='yyyy-MM'
  80. v-model="shipDate.startMonth"
  81. type="month"
  82. placeholder="选择月份">
  83. </el-date-picker>
  84. </div>
  85. <div style="float:left;margin-left:3rem;color:#ffffff">结束</div>
  86. <div style="float:left;margin-left:3rem">
  87. <el-date-picker
  88. v-model="shipDate.endMonth"
  89. @change='getSo2Time'
  90. value-format='yyyy-MM'
  91. type="month"
  92. placeholder="选择月份">
  93. </el-date-picker>
  94. </div>
  95. </div>
  96. <div id="shipChart" style="width:280rem;height:120rem;position:absolute;z-index:3000"></div>
  97. </el-dialog>
  98. </div>
  99. <!--
  100. <div class="azwzContent">
  101. <el-dialog
  102. title=""
  103. :visible.sync="dialogVisibleAzwz"
  104. :before-close="handleClose"
  105. @open="openShipChart">
  106. <div id="shipChart" style="width:220rem;height:100rem;"></div>
  107. </el-dialog>
  108. </div> -->
  109. </div>
  110. </template>
  111. <script>
  112. import scroll from "./scroll.vue"
  113. import {getDeviceType, getIllegalShipStatic, getSo2Time, getStaticDevice} from "@/api/data/staticalData";
  114. import {getdeviceList, queryShipData,queryallShipData} from "@/api/data/deviceData";
  115. import mapdiv from '../../../components/map/index.vue'
  116. import {getThresholdList} from "@/api/data/liuData";
  117. export default {
  118. name: "homeTable",
  119. components: {
  120. scroll,
  121. mapdiv
  122. },
  123. data() {
  124. return {
  125. total: 100,
  126. shipShow: true,
  127. activeName: 'first',
  128. normalPer: 0.1,
  129. so2Count: 0,
  130. blackCount: 0,
  131. dialogVisible: false,
  132. dialogVisibleAzwz: false,
  133. dialogVisibleType: false,
  134. normalCount: 1,
  135. dialogVisibleShip: false,
  136. beginTime: '',
  137. lastdatep:0,
  138. isstart:false,
  139. so2TimeData: {},
  140. endTime: '',
  141. deviceList: [],
  142. deviceTotal: 0,
  143. queryParams: {
  144. pageNum: 1,
  145. pageSize: 10,
  146. roleName: undefined,
  147. roleKey: undefined,
  148. status: undefined,
  149. mmsi: undefined,
  150. radio: 1
  151. },
  152. tableData: [],
  153. shipDate: {
  154. startMonth: '',
  155. endMonth: ''
  156. },
  157. shipDateArry: [],
  158. heyDeviceData: [
  159. {"name": "南京三桥黑烟1", "locations": [[118.643133, 31.969894]], "data": {'监测点': "南京三桥", '类型': '黑烟检测'}},
  160. {"name": "南京三桥黑烟2", "locations": [[118.642232, 31.970804]], "data": {'监测点': "南京三桥", '类型': '黑烟检测'}},
  161. {"name": "南京三桥黑烟3", "locations": [[118.6503, 31.965016]]},
  162. {"name": "南京三桥黑烟4", "locations": [[118.638434, 31.973189]]},
  163. {"name": "南京三桥黑烟5", "locations": [[118.643283, 31.970076]]},
  164. {"name": "南京三桥黑烟6", "locations": [[118.647403, 31.967309]]},
  165. {"name": "苏通大桥黑烟1", "locations": [[121.001581, 31.78503]]},
  166. {"name": "苏通大桥黑烟2", "locations": [[120.997083, 31.76303]]},
  167. {"name": "苏通大桥黑烟3", "locations": [[120.998929, 31.771094]]},
  168. {"name": "苏通大桥黑烟4", "locations": [[121.002491, 31.791012]]},
  169. {"name": "江阴大桥黑烟1", "locations": [[120.27317, 31.945522]]},
  170. {"name": "江阴大桥黑烟2", "locations": [[120.274763, 31.942572]]},
  171. {"name": "润扬大桥黑烟1", "locations": [[119.366033, 32.210959]]},
  172. {"name": "润扬大桥黑烟2", "locations": [[119.370324, 32.202425]]},
  173. ],
  174. so2DeviceData: [
  175. {"name": "南京三桥嗅探1", "locations": [[118.640237, 31.971992]]},
  176. {"name": "南京三桥嗅探2", "locations": [[118.647447, 31.967359]]},
  177. {"name": "南京三桥嗅探3", "locations": [[118.641632, 31.971064]]},
  178. {"name": "苏通大桥嗅探1", "locations": [[121.003306, 31.792982]]},
  179. {"name": "苏通大桥嗅探2", "locations": [[120.999529, 31.775326]]},
  180. {"name": "江阴大桥嗅探1", "locations": [[120.272167, 31.947384]]},
  181. {"name": "江阴大桥嗅探2", "locations": [[120.274441, 31.943087]]},
  182. {"name": "润扬大桥嗅探1", "locations": [[119.367277, 32.209071]]},
  183. {"name": "润扬大桥嗅探2", "locations": [[119.369466, 32.204568]]},
  184. ],
  185. aisDeviceData: [
  186. {"name": "南京三桥光谱1", "locations": [[118.642876, 31.970445]]},
  187. {"name": "南京三桥光谱2", "locations": [[118.648949, 31.966386]]},
  188. {"name": "南京三桥光谱3", "locations": [[118.651223, 31.964747]]},
  189. {"name": "苏通大桥光谱1", "locations": [[121.003134, 31.789772]]},
  190. {"name": "苏通大桥光谱2", "locations": [[120.997985, 31.762921]]},
  191. {"name": "江阴大桥光谱1", "locations": [[120.272044, 31.947069]]},
  192. {"name": "江阴大桥光谱2", "locations": [[120.276078, 31.940587]]},
  193. {"name": "润扬大桥光谱1", "locations": [[119.367235, 32.209107]]},
  194. {"name": "润扬大桥光谱2", "locations": [[119.369724, 32.204459]]},
  195. ],
  196. allship:[],
  197. ship:[],
  198. ship1: [
  199. {"name": "一号船", "mmsi": "s", "locations": [[118.643133, 31.969894]], 'type': 1, "head": 0, "lnglats": [[118.649711, 31.98602], [118.639711, 31.98602], [118.629711, 31.98602], [118.619711, 31.98602]]},
  200. // {"name": "二号船", "locations": [[118.639711, 31.96602]], 'type': 2,"head":60},
  201. {"name": "三号船", "mmsi": "s1", "locations": [[118.639711, 31.96622]], 'type': 1, "head": 90},
  202. {"name": "三号船", "mmsi": "s2", "locations": [[118.639711, 31.93662]], 'type': 1, "head": 180},
  203. // {"name": "四号船", "locations": [[118.639711, 31.96602]], 'type': 3,"head":180},
  204. // {"name": "五号船", "locations": [[118.639711, 31.96602]], 'type': 2,"head":270},
  205. // {"name": "五号船", "locations": [[118.639711, 31.96602]], 'type': 2,"head":360},
  206. ]
  207. }
  208. }, mounted() {
  209. this.getMonthDate();
  210. this.getdeviceList();
  211. this.getStaticDevice();
  212. this.getIllegalShipStatic();
  213. this.getshipData();
  214. // this.getallshipData();
  215. var that = this;
  216. setInterval(() => {
  217. that.getshipData();
  218. }, 120000);
  219. setInterval(() => {
  220. if(that.isstart){
  221. that.getallshipData();
  222. }
  223. }, 5*60*1000);
  224. this.getThresholdList();
  225. // this.addDevicePoint();
  226. // this.addAisPoint();
  227. // this.addSo2Point();
  228. // this.addshipPoint();
  229. // console.log(111111111111)
  230. // this.getChart();
  231. },
  232. methods: {
  233. stopgetall(){
  234. this.isstart = false;
  235. },
  236. startgetall(){
  237. this.isstart = true;
  238. this.getallshipData();
  239. },
  240. getThresholdList() {
  241. getThresholdList({type: 'bridge'}).then(response => {
  242. // console.log(response);
  243. for (var index in response.rows) {
  244. var obj = response.rows[index];
  245. var points = '[' + obj.configValue + ']';
  246. // console.log(JSON.parse(points));
  247. this.$refs.mapv.addline(JSON.parse(points));
  248. }
  249. });
  250. },
  251. getdeviceList() {
  252. var dlist = [];
  253. getdeviceList().then(data => {
  254. // console.log(data);
  255. var deviceList = [];
  256. this.deviceList = data.data;
  257. for (var key in data.data) {
  258. if (data.data[key] != undefined && data.data[key].length > 0) {
  259. dlist.push({name: key, location: JSON.parse("[[" + data.data[key][0].latilongti + "]]")});
  260. this.$refs.mapv.setaddrlist(dlist);
  261. }
  262. for (var index in data.data[key]) {
  263. var obj = data.data[key][index]
  264. // console.log(data.data[key][index].source);
  265. // deviceList.push(data.data[key][index]);
  266. var locationArry = JSON.parse("[[" + obj.latilongti + "]]");
  267. var icons = "";
  268. if (obj.source.indexOf("so2") != -1) {
  269. icons = "so2.png"
  270. }
  271. if (obj.source.indexOf("ais") != -1) {
  272. icons = "ais.png"
  273. }
  274. if (obj.source.indexOf("heiyan") != -1) {
  275. icons = "hy.png"
  276. }
  277. this.$refs.mapv.addpoint(locationArry, obj, icons, 'device');
  278. }
  279. }
  280. // console.log(deviceList);
  281. });
  282. },
  283. getshipData() {
  284. // for(var i=0;i<10000;i++){
  285. // this.ship.push( {"name": "三号船", "mmsi": "s1"+i, "locations": [[118.639711+i%10/5, 31.96622-i%10/5]], 'type': 1, "head": 90},)
  286. // }
  287. queryShipData().then(data => {
  288. var shipdatalist = [];
  289. for (var key in data.data) {
  290. var ship = data.data[key];
  291. ship["name"] = ship.shipName;
  292. ship["locations"] = [[ship.lng, ship.lat]];
  293. ship["type"] = ship.illegalStatus;
  294. shipdatalist.push(ship);
  295. }
  296. this.ship = shipdatalist;
  297. this.addshipPoint();
  298. });
  299. },
  300. getallshipData() {
  301. if(!this.isstart) return;
  302. var cdatep = new Date().valueOf();
  303. if(cdatep-this.lastdatep>10000){
  304. this.lastdatep = cdatep;
  305. }else{
  306. return;
  307. }
  308. // this.allship = this.ship1;
  309. // for (let i = 0; i < 100000; i++) {
  310. // let ran = Math.random() * 360;
  311. // let ran2 = Math.random() * 360;
  312. // let lon = -180 + ran;
  313. // let lat = -90 + ran2;
  314. // this.allship.push({"name": "三号船", "mmsi": "s2", "locations": [[lon, lat]], 'type': 1, "head": 180})
  315. // // let feature = new Feature({
  316. // // geometry: new Point([lon, lat])
  317. // // })
  318. // // features.push(feature);
  319. // }
  320. // this.addshipPointall();
  321. // console.log( this.$refs.mapv.map.getView().calculateExtent( this.$refs.mapv.map.getSize()));
  322. var sc = window.getmapviewlatlng();
  323. var urlc = `areaLatitude1=${sc[0][1]}&areaLatitude2=${sc[1][1]}&areaLongitude1=${sc[0][0]}&areaLongitude2=${sc[1][0]}`;
  324. queryallShipData({},urlc).then(data => {
  325. var shipdatalist = [];
  326. for (var key in data.data) {
  327. var ship = data.data[key];
  328. ship["name"] = ship.shipname_cn;
  329. ship["locations"] = [[ship.lng, ship.lat]];
  330. ship["type"] = 1;
  331. shipdatalist.push(ship);
  332. }
  333. // this.allship = this.ship1;
  334. this.allship = shipdatalist;
  335. this.addshipPointall();
  336. });
  337. },
  338. // addDevicePoint(){
  339. // for(var index in this.heyDeviceData){
  340. // var obj = this.heyDeviceData[index]
  341. // this.$refs.mapv.addpoint(obj.locations,obj.name,'hy.png','device');
  342. // }
  343. // },
  344. // addAisPoint(){
  345. // for(var index in this.aisDeviceData){
  346. // var obj = this.aisDeviceData[index]
  347. // this.$refs.mapv.addpoint(obj.locations,obj.name,'ais.png','device');
  348. // }
  349. // },
  350. // addSo2Point(){
  351. // for(var index in this.so2DeviceData){
  352. // var obj = this.so2DeviceData[index]
  353. // this.$refs.mapv.addpoint(obj.locations,obj.name,'so2.png','device');
  354. // }
  355. // },
  356. addshipPoint() {
  357. var tt = [];
  358. for (var index in this.ship) {
  359. var obj = this.ship[index]
  360. var img = 'zc.png'
  361. if (obj.type == 2) {
  362. img = 'xy.png'
  363. } else if (obj.type == 3) {
  364. img = 'wg.png'
  365. }
  366. tt.push([obj.locations, obj, img, 'ship', ((obj.head == null ? 0 : parseFloat(obj.head)) - 90) * Math.PI / 180,1]);
  367. }
  368. this.$refs.mapv.addpoints(tt,"ship");
  369. },
  370. addshipPointall() {
  371. var tt = [];
  372. for (var index in this.allship) {
  373. var obj = this.allship[index]
  374. var img = 'zc.png'
  375. if (obj.type == 2) {
  376. img = 'xy.png'
  377. } else if (obj.type == 3) {
  378. img = 'wg.png'
  379. }
  380. tt.push([obj.locations, obj, img, 'ship', ((obj.head == null ? 0 : parseFloat(obj.head)) - 90) * Math.PI / 180,1,"ship_normal_"]);
  381. }
  382. this.$refs.mapv.addpoints(tt)
  383. },
  384. getSo2Time() {
  385. // console.log(111);
  386. getSo2Time(this.shipDate).then(data => {
  387. this.getMonthArry(this.shipDate.startMonth, this.shipDate.endMonth);
  388. this.so2TimeData = data.data
  389. this.getShipChart();
  390. });
  391. },
  392. getMonthArry(start, end) {
  393. this.shipDateArry = [];
  394. var startYear = start.split('-')[0];
  395. var startMonth = parseInt(start.split('-')[1]);
  396. var endYear = end.split('-')[0];
  397. var endMonth = parseInt(end.split('-')[1]);
  398. if (startYear == endYear) {
  399. for (var i = startMonth; i < endMonth + 1; i++) {
  400. if (i < 10) {
  401. this.shipDateArry.push(startYear + '-' + "0" + i);
  402. } else {
  403. this.shipDateArry.push(startYear + '-' + i);
  404. }
  405. }
  406. } else {
  407. for (var i = startMonth; i < 13; i++) {
  408. if (i < 10) {
  409. this.shipDateArry.push(startYear + '-' + "0" + i);
  410. } else {
  411. this.shipDateArry.push(startYear + '-' + i);
  412. }
  413. }
  414. for (var i = 1; i < endMonth; i++) {
  415. if (i < 10) {
  416. this.shipDateArry.push(endYear + '-' + "0" + i);
  417. } else {
  418. this.shipDateArry.push(endYear + '-' + i);
  419. }
  420. }
  421. }
  422. // console.log(this.shipDateArry);
  423. },
  424. getMonthDate() {
  425. var time = new Date();
  426. var year = time.getFullYear();
  427. var month = time.getMonth();
  428. if (month > 9) {
  429. this.shipDate.endMonth = year + "-" + month
  430. } else if (month > 0) {
  431. this.shipDate.endMonth = year + "-" + "0" + month
  432. } else {
  433. this.shipDate.endMonth = (year - 1) + "-" + '12';
  434. }
  435. if (month == 6) {
  436. this.shipDate.startMonth = year + "-" + '01';
  437. } else if (month > 6) {
  438. this.shipDate.startMonth = year + "-" + '0' + (month - 6);
  439. } else if (month < 6) {
  440. if (month >= 3) {
  441. this.shipDate.startMonth = (year - 1) + "-" + (month + 7);
  442. } else {
  443. this.shipDate.startMonth = (year - 1) + "-" + "0" + (month + 7);
  444. }
  445. }
  446. },
  447. openShipChart() {
  448. const t = this;
  449. setTimeout(() => {
  450. // 执行echarts画图方法
  451. t.getSo2Time();
  452. }, 0);
  453. },
  454. handleClick(tab, event) {
  455. // console.log(tab, event);
  456. },
  457. openChart() {
  458. const t = this;
  459. setTimeout(() => {
  460. // 执行echarts画图方法
  461. t.getStaticDevice();
  462. }, 0);
  463. },
  464. openTypeChart() {
  465. const t = this;
  466. setTimeout(() => {
  467. // 执行echarts画图方法
  468. t.getTypeData();
  469. }, 0);
  470. },
  471. getStaticDevice() {
  472. getStaticDevice().then(response => {
  473. let nameArry = [];
  474. let dataArry = [];
  475. this.deviceTotal = 0;
  476. for (var key in response.data) {
  477. this.deviceTotal += response.data[key]
  478. nameArry.push(key);
  479. dataArry.push(response.data[key]);
  480. }
  481. this.getChart(nameArry, dataArry);
  482. });
  483. },
  484. getIllegalShipStatic() {
  485. getIllegalShipStatic().then(data => {
  486. this.blackCount = data.data.blackCount;
  487. this.so2Count = data.data.so2Count;
  488. });
  489. },
  490. getShipChart() {
  491. var so2Arry = [];
  492. var aisArry = [];
  493. var hyArry = [];
  494. // console.log(data);
  495. for (var index in this.shipDateArry) {
  496. // console.log(this.shipDateArry[index]+'-01T00:00:00Z');
  497. // console.log(this.so2TimeData.so2['2021-01-01T00:00:00Z']);
  498. if (this.so2TimeData.so2[this.shipDateArry[index] + '-01T00:00:00Z']) {
  499. so2Arry.push(this.so2TimeData.so2[this.shipDateArry[index] + '-01T00:00:00Z']);
  500. } else {
  501. so2Arry.push(0);
  502. }
  503. if (this.so2TimeData.ais[this.shipDateArry[index] + '-01T00:00:00Z']) {
  504. aisArry.push(this.so2TimeData.ais[this.shipDateArry[index] + '-01T00:00:00Z']);
  505. } else {
  506. aisArry.push(0);
  507. }
  508. if (this.so2TimeData.ais[this.shipDateArry[index] + '-01T00:00:00Z']) {
  509. hyArry.push(this.so2TimeData.black[this.shipDateArry[index] + '-01T00:00:00Z']);
  510. } else {
  511. hyArry.push(0);
  512. }
  513. }
  514. var myChart = this.$echarts.init(document.getElementById('shipChart'));
  515. var option = {
  516. color: ['#FF2D3C', '#FFA647', '#61FAFB'],
  517. legend: {
  518. data: ['黑烟抓拍', '光谱', '嗅探'],
  519. right: '10%',
  520. textStyle: {
  521. color: '#ffffff'
  522. }
  523. },
  524. xAxis: {
  525. type: 'category',
  526. data: this.shipDateArry,
  527. axisLabel: {
  528. show: true, //这里的show用于设置是否显示x轴下的字体 默认为true
  529. interval: 0, //可以设置成 0 强制显示所有标签。如果设置为 1,表示『隔一个标签显示一个标签』,如果值为 2,表示隔两个标签显示一个标签,以此类推。
  530. textStyle: { //textStyle里面写x轴下的字体的样式
  531. color: '#ffffff',
  532. fontSize: 13
  533. }
  534. },
  535. axisLine: {
  536. show: true, //这里的show用于设置是否显示x轴那一条线 默认为true
  537. lineStyle: { //lineStyle里面写x轴那一条线的样式
  538. color: '#ffffff',
  539. width: 2, //轴线的粗细 我写的是2 最小为0,值为0的时候线隐藏
  540. }
  541. }
  542. },
  543. yAxis: {
  544. type: 'value',
  545. axisLabel: {
  546. show: true, //这里的show用于设置是否显示x轴下的字体 默认为true
  547. interval: 0, //可以设置成 0 强制显示所有标签。如果设置为 1,表示『隔一个标签显示一个标签』,如果值为 2,表示隔两个标签显示一个标签,以此类推。
  548. textStyle: { //textStyle里面写x轴下的字体的样式
  549. color: '#ffffff',
  550. fontSize: 13
  551. }
  552. },
  553. axisLine: {
  554. show: true, //这里的show用于设置是否显示x轴那一条线 默认为true
  555. lineStyle: { //lineStyle里面写x轴那一条线的样式
  556. color: '#ffffff',
  557. width: 2, //轴线的粗细 我写的是2 最小为0,值为0的时候线隐藏
  558. }
  559. }
  560. },
  561. series: [{
  562. name: '黑烟抓拍',
  563. data: hyArry,
  564. type: 'line',
  565. smooth: true,
  566. itemStyle: {
  567. normal: {
  568. lineStyle: {
  569. color: '#FF2D3C',
  570. width: 5
  571. }
  572. }
  573. },
  574. }, {
  575. name: '光谱',
  576. data: so2Arry,
  577. type: 'line',
  578. smooth: true,
  579. itemStyle: {
  580. normal: {
  581. lineStyle: {
  582. color: '#FFA647',
  583. width: 5
  584. }
  585. }
  586. },
  587. }, {
  588. name: '嗅探',
  589. data: aisArry,
  590. type: 'line',
  591. smooth: true,
  592. itemStyle: {
  593. normal: {
  594. lineStyle: {
  595. color: '#61FAFB',
  596. width: 5
  597. }
  598. }
  599. },
  600. }]
  601. };
  602. myChart.setOption(option);
  603. },
  604. getChart(nameArry, dataArry) {
  605. var myChart = this.$echarts.init(document.getElementById('equipmentChart'));
  606. var option = {
  607. tooltip: {
  608. trigger: 'axis',
  609. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  610. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  611. }
  612. },
  613. grid: {
  614. left: '3%',
  615. right: '4%',
  616. bottom: '3%',
  617. containLabel: true
  618. },
  619. xAxis: [
  620. {
  621. type: 'category',
  622. data: nameArry,
  623. axisTick: {
  624. alignWithLabel: true
  625. },
  626. axisLine: {
  627. lineStyle: {
  628. color: 'white'
  629. }
  630. },
  631. axisLabel: {
  632. interval: 0,
  633. show: true,
  634. textStyle: {
  635. color: 'white' //x轴data 的颜色
  636. }
  637. },
  638. },
  639. ],
  640. yAxis: [
  641. {
  642. type: 'value',
  643. splitLine: {
  644. show: true,
  645. lineStyle: {
  646. color: ['#435886'],
  647. width: 1,
  648. type: 'solid'
  649. }
  650. },
  651. axisLine: {
  652. lineStyle: {
  653. color: '#435886'
  654. }
  655. },
  656. axisLabel: {
  657. interval: 0,
  658. show: true,
  659. textStyle: {
  660. color: 'white' //x轴data 的颜色
  661. }
  662. },
  663. }
  664. ],
  665. series: [
  666. {
  667. name: '数量',
  668. type: 'bar',
  669. barWidth: '30%',
  670. data: dataArry,
  671. itemStyle: {
  672. normal: {
  673. label: {
  674. show: true, //开启显示
  675. position: 'top', //在上方显示
  676. textStyle: { //数值样式
  677. color: 'white',
  678. fontSize: 10
  679. }
  680. },
  681. color: new this.$echarts.graphic.LinearGradient(
  682. 0, 0, 0, 1,
  683. [
  684. {offset: 1, color: '#2275E4'}, //柱图渐变色
  685. {offset: 0, color: '#56CCF2'}, //柱图渐变色
  686. ]
  687. )
  688. },
  689. }
  690. }
  691. ]
  692. };
  693. myChart.setOption(option);
  694. },
  695. getTypeData() {
  696. getDeviceType().then(response => {
  697. let nameArry = [];
  698. let dataArry = [];
  699. for (var key in response.data) {
  700. nameArry.push(key);
  701. dataArry.push(response.data[key]);
  702. }
  703. this.getTypeChart(nameArry, dataArry);
  704. });
  705. },
  706. getTypeChart(nameArry, dataArry) {
  707. // this.dialogVisible = true;
  708. var myChart = this.$echarts.init(document.getElementById('equipmentTypeChart'));
  709. var option = {
  710. tooltip: {
  711. trigger: 'axis',
  712. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  713. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  714. }
  715. },
  716. grid: {
  717. left: '3%',
  718. right: '4%',
  719. bottom: '3%',
  720. containLabel: true
  721. },
  722. xAxis: [
  723. {
  724. type: 'category',
  725. data: nameArry,
  726. axisTick: {
  727. alignWithLabel: true
  728. },
  729. axisLine: {
  730. lineStyle: {
  731. color: 'white'
  732. }
  733. },
  734. axisLabel: {
  735. interval: 0,
  736. show: true,
  737. textStyle: {
  738. color: 'white' //x轴data 的颜色
  739. }
  740. },
  741. },
  742. ],
  743. yAxis: [
  744. {
  745. type: 'value',
  746. splitLine: {
  747. show: true,
  748. lineStyle: {
  749. color: ['#435886'],
  750. width: 1,
  751. type: 'solid'
  752. }
  753. },
  754. axisLine: {
  755. lineStyle: {
  756. color: '#435886'
  757. }
  758. },
  759. axisLabel: {
  760. interval: 0,
  761. show: true,
  762. textStyle: {
  763. color: 'white' //x轴data 的颜色
  764. }
  765. },
  766. }
  767. ],
  768. series: [
  769. {
  770. name: '数量',
  771. type: 'bar',
  772. barWidth: '30%',
  773. data: dataArry,
  774. itemStyle: {
  775. normal: {
  776. label: {
  777. show: true, //开启显示
  778. position: 'top', //在上方显示
  779. textStyle: { //数值样式
  780. color: 'white',
  781. fontSize: 10
  782. }
  783. },
  784. color: new this.$echarts.graphic.LinearGradient(
  785. 0, 0, 0, 1,
  786. [
  787. {offset: 1, color: '#2275E4'}, //柱图渐变色
  788. {offset: 0, color: '#56CCF2'}, //柱图渐变色
  789. ]
  790. )
  791. },
  792. }
  793. }
  794. ]
  795. };
  796. myChart.setOption(option);
  797. }
  798. }
  799. }
  800. </script>
  801. <style scoped>
  802. .shipDiv {
  803. position: absolute;
  804. top: 250rem;
  805. left: 140rem;
  806. width: 220rem;
  807. height: 130rem;
  808. background-color: white;
  809. }
  810. .shipTitle {
  811. padding-top: 4rem;
  812. padding-left: 10rem;
  813. padding-right: 10rem;
  814. width: 100%;
  815. height: 20rem;
  816. background-color: #0d25a5;
  817. color: white;
  818. font-size: 7rem
  819. }
  820. .contentFont {
  821. font-size: 5rem;
  822. }
  823. .shipInformation {
  824. background: url("./assets/bg_information.png") no-repeat;
  825. background-size: 100% 100%;
  826. width: 120rem;
  827. height: 160rem;
  828. position: absolute;
  829. top: 225rem;
  830. right: 30rem;
  831. }
  832. .shipInCount {
  833. background: url("./assets/bg_count.png") no-repeat;
  834. background-size: 100% 100%;
  835. width: 120rem;
  836. height: 160rem;
  837. position: absolute;
  838. top: 55rem;
  839. right: 30rem;
  840. }
  841. .lcbBackground {
  842. background: url("./assets/img_lcb.png") no-repeat;
  843. background-size: 100% 100%;
  844. width: 40rem;
  845. height: 40rem;
  846. float: left;
  847. margin-left: 15rem;
  848. text-align: center;
  849. color: #45AAF0;
  850. font-size: 7rem;
  851. font-weight: Bold;
  852. }
  853. .hyzpBackground {
  854. background: url("./assets/img_hyzp.png") no-repeat;
  855. background-size: 100% 100%;
  856. width: 40rem;
  857. height: 40rem;
  858. float: left;
  859. margin-left: 8rem;
  860. text-align: center;
  861. color: #2EF9B3;
  862. font-size: 7rem;
  863. font-weight: Bold;
  864. }
  865. .totalContent {
  866. background: url("./assets/img_total.png") no-repeat;
  867. background-size: 100% 100%;
  868. width: 100rem;
  869. height: 15rem;
  870. margin-left: 10rem;
  871. margin-top: 5rem;
  872. color: white;
  873. }
  874. .shipContent >>> .el-tabs__item {
  875. font-weight: bold;
  876. color: #A8A8A8
  877. }
  878. .shipContent >>> .el-tabs__item.is-active {
  879. color: #0d25a5
  880. }
  881. .shipContent >>> .el-tabs__active-bar {
  882. margin-left: 10rem
  883. }
  884. .shipContent >>> .el-tabs__nav {
  885. padding-left: 10rem
  886. }
  887. .shipContent >>> .el-tabs__active-bar {
  888. background-color: #0d25a5
  889. }
  890. .tableSc >>> tr {
  891. padding: 0;
  892. height: 3rem;
  893. line-height: 3rem;
  894. font-size: 5rem;
  895. }
  896. .tableSc >>> td {
  897. padding: 0;
  898. height: 3rem;
  899. line-height: 3rem
  900. }
  901. .azwzContent >>> .el-dialog {
  902. background: url("./assets/pop_azwz.png") no-repeat;
  903. background-size: 100% 100%;
  904. height: 150rem;
  905. width: 280rem;
  906. border: none;
  907. top: 100rem;
  908. }
  909. .wfcbContent >>> .el-dialog {
  910. background: url("./assets/pop_wgcbtj.png") no-repeat;
  911. background-size: 100% 100%;
  912. height: 150rem;
  913. width: 280rem;
  914. border: none;
  915. top: 100rem;
  916. }
  917. .equipmentContent >>> .el-dialog {
  918. background: url("./assets/pop_azwz.png") no-repeat;
  919. background-size: 100% 100%;
  920. height: 150rem;
  921. width: 280rem;
  922. border: none;
  923. top: 100rem;
  924. }
  925. .equipmentTypeContent >>> .el-dialog {
  926. background: url("./assets/pop_sblx.png") no-repeat;
  927. background-size: 100% 100%;
  928. height: 150rem;
  929. width: 200rem;
  930. border: none;
  931. top: 100rem;
  932. }
  933. .wfcbContent >>> .el-date-editor.el-input, .el-date-editor.el-input__inner {
  934. width: 50rem;
  935. }
  936. /* .dialogContent >>> .el-input--medium .el-input__inner{
  937. height:10rem;
  938. text-align: center
  939. } */
  940. </style>