homeTable.vue 34 KB

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