index.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
  1. <template>
  2. <div style="width:100%;height:100%">
  3. <div id="map" ref="rootmap"></div>
  4. <div class="shipDiv" v-show="deviceShow">
  5. <div class="shipTitle">
  6. <span style="float:left">{{ deviceData.name }}</span>
  7. <i class="el-icon-close" style="font-size:9rem;margin-top:2rem;float:right" @click="deviceShow=false"></i>
  8. </div>
  9. <div style="padding—left:10rem" class="shipContent">
  10. <el-tabs v-model="d_activeName" @tab-click="handleClick1">
  11. <el-tab-pane label="设备信息" name="d_first">
  12. <el-row :gutter="3" style="margin-top:5rem">
  13. <el-col :span="4">
  14. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595;">设备名称:</div>
  15. </el-col>
  16. <el-col :span="8">
  17. <div class="grid-content bg-purple contentFont" style="float:left">{{ deviceData.name }}</div>
  18. </el-col>
  19. <el-col :span="4">
  20. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">监测点:</div>
  21. </el-col>
  22. <el-col :span="8">
  23. <div class="grid-content bg-purple contentFont" style="float:left">{{ deviceData.monitorName }}</div>
  24. </el-col>
  25. </el-row>
  26. <el-row :gutter="3" style="margin-top:3rem">
  27. <el-col :span="4">
  28. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">设备状态:</div>
  29. </el-col>
  30. <el-col :span="8">
  31. <div class="grid-content bg-purple contentFont" style="float:left">{{ deviceData.status }}</div>
  32. </el-col>
  33. <el-col :span="4">
  34. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">管辖机构:</div>
  35. </el-col>
  36. <el-col :span="8">
  37. <div class="grid-content bg-purple contentFont" style="float:left">{{ deviceData.orgName }}</div>
  38. </el-col>
  39. </el-row>
  40. <el-row :gutter="3" style="margin-top:3rem">
  41. <el-col :span="4">
  42. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">更新时间:</div>
  43. </el-col>
  44. <el-col :span="8">
  45. <div class="grid-content bg-purple contentFont" style="float:left">{{ deviceData.updateTime }}</div>
  46. </el-col>
  47. <el-col :span="4">
  48. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">经纬度:</div>
  49. </el-col>
  50. <el-col :span="8">
  51. <div class="grid-content bg-purple contentFont" style="float:left">{{ deviceData.latilongti }}</div>
  52. </el-col>
  53. </el-row>
  54. </el-tab-pane>
  55. <el-tab-pane label="嫌疑船舶" name="d_second">
  56. <el-table :header-cell-style="{ background: '#e4eafc'}" ref="singleTable" :data="tabledatas" height="200px" highlight-current-row style="width: 100%;" class="tableSc">
  57. <el-table-column type="index" label="序号" width="50">
  58. </el-table-column>
  59. <el-table-column property="mmsi" label="MMSI" width="100">
  60. </el-table-column>
  61. <el-table-column property="shipName" label="船名" width="100">
  62. </el-table-column>
  63. <el-table-column property="values" label="监测值" width="100">
  64. </el-table-column>
  65. <el-table-column property="createTime" label="监测时间">
  66. </el-table-column>
  67. </el-table>
  68. </el-tab-pane>
  69. <el-tab-pane label="违规船舶" name="d_thrid">
  70. <el-table :header-cell-style="{ background: '#e4eafc'}" ref="singleTable" :data="tabledatas" height="200px" highlight-current-row style="width: 100%;" class="tableSc">
  71. <el-table-column type="index" label="序号" width="50">
  72. </el-table-column>
  73. <el-table-column property="mmsi" label="MMSI" width="100">
  74. </el-table-column>
  75. <el-table-column property="shipName" label="船名" width="100">
  76. </el-table-column>
  77. <el-table-column property="values" label="监测值" width="100">
  78. </el-table-column>
  79. <el-table-column property="createTime" label="监测时间">
  80. </el-table-column>
  81. </el-table>
  82. </el-tab-pane>
  83. </el-tabs>
  84. <!-- <el-row :gutter="3" style="margin-top:3rem">
  85. <el-col :span="4">
  86. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">对地航速:</div>
  87. </el-col>
  88. <el-col :span="8">
  89. <div class="grid-content bg-purple contentFont" style="float:left">11111</div>
  90. </el-col>
  91. <el-col :span="4">
  92. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">对地航向:</div>
  93. </el-col>
  94. <el-col :span="8">
  95. <div class="grid-content bg-purple contentFont" style="float:left">11111</div>
  96. </el-col>
  97. </el-row>
  98. <el-row :gutter="3" style="margin-top:3rem">
  99. <el-col :span="4">
  100. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">风向:</div>
  101. </el-col>
  102. <el-col :span="8">
  103. <div class="grid-content bg-purple contentFont" style="float:left">11111</div>
  104. </el-col>
  105. <el-col :span="4">
  106. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">风速:</div>
  107. </el-col>
  108. <el-col :span="8">
  109. <div class="grid-content bg-purple contentFont" style="float:left">11111</div>
  110. </el-col> -->
  111. <!-- <el-button style="margin-top:5rem;margin-left:10rem;background-color:#0d25a5;color:white;font-size:7rem" icon="el-icon-location-information">历史轨迹</el-button> -->
  112. </div>
  113. </div>
  114. <div class="shipDiv" v-show="shipShow">
  115. <div class="shipTitle">
  116. <span style="float:left">{{ shipName.shipName }}</span>
  117. <i class="el-icon-close" style="font-size:9rem;margin-top:2rem;float:right" @click="shipShow=false"></i>
  118. </div>
  119. <div style="padding—left:10rem" class="shipContent">
  120. <el-tabs v-model="activeName" @tab-click="handleClick">
  121. <el-tab-pane label="AIS信息" name="first">
  122. <el-row :gutter="3" style="margin-top:3rem">
  123. <el-col :span="4">
  124. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">MMSI:</div>
  125. </el-col>
  126. <el-col :span="8">
  127. <div class="grid-content bg-purple contentFont" style="float:left">{{ shipName.mmsi }}</div>
  128. </el-col>
  129. <el-col :span="4">
  130. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">监测点:</div>
  131. </el-col>
  132. <el-col :span="8">
  133. <div class="grid-content bg-purple contentFont" style="float:left">{{shipName.monitorPointName}}</div>
  134. </el-col>
  135. </el-row>
  136. <el-row :gutter="3" style="margin-top:3rem">
  137. <el-col :span="4">
  138. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">经度:</div>
  139. </el-col>
  140. <el-col :span="8">
  141. <div class="grid-content bg-purple contentFont" style="float:left">{{shipName.lng}}</div>
  142. </el-col>
  143. <el-col :span="4">
  144. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">纬度:</div>
  145. </el-col>
  146. <el-col :span="8">
  147. <div class="grid-content bg-purple contentFont" style="float:left">{{shipName.lat}}</div>
  148. </el-col>
  149. </el-row>
  150. <el-row :gutter="3" style="margin-top:3rem">
  151. <el-col :span="4">
  152. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">对地航速:</div>
  153. </el-col>
  154. <el-col :span="8">
  155. <div class="grid-content bg-purple contentFont" style="float:left">{{shipName.speed}}</div>
  156. </el-col>
  157. <el-col :span="4">
  158. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">实际航向:</div>
  159. </el-col>
  160. <el-col :span="8">
  161. <div class="grid-content bg-purple contentFont" style="float:left">{{shipName.head}}</div>
  162. </el-col>
  163. </el-row>
  164. <el-row :gutter="3" style="margin-top:3rem">
  165. <el-col :span="4">
  166. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">地面航线:</div>
  167. </el-col>
  168. <el-col :span="8">
  169. <div class="grid-content bg-purple contentFont" style="float:left">{{shipName.course}}</div>
  170. </el-col>
  171. <el-col :span="4">
  172. <div class="grid-content bg-purple contentFont" style="float:right;color:#959595">位置接收时间:</div>
  173. </el-col>
  174. <el-col :span="8">
  175. <div class="grid-content bg-purple contentFont" style="float:left">{{shipName.receive}}</div>
  176. </el-col>
  177. </el-row>
  178. <el-button style="margin-top:5rem;margin-left:10rem;background-color:#0d25a5;color:white;font-size:7rem;display:none" icon="el-icon-location-information">历史轨迹</el-button>
  179. </el-tab-pane>
  180. <el-tab-pane label="主要监测数据" name="second">
  181. <el-table :header-cell-style="{ background: '#e4eafc'}" ref="singleTable" :data="tableData.main" highlight-current-row height="200px" style="width: 100%" class="tableSc">
  182. <el-table-column type="index" label="序号" width="50">
  183. </el-table-column>
  184. <el-table-column property="monitorPointName" label="监测点" width="100">
  185. </el-table-column>
  186. <el-table-column :label="'硫含量'">
  187. <template slot-scope="scope">
  188. <div v-if="scope.row.so2Percent!=null && scope.row.so2Percent > normalPer" style="color:red">{{ scope.row.so2Percent }}% ↑ {{ ((scope.row.so2Percent - normalPer) / normalPer * 100).toFixed(0) }}%</div>
  189. <div v-if="scope.row.so2Percent!=null && scope.row.so2Percent <= normalPer">{{ scope.row.so2Percent }}%</div>
  190. </template>
  191. </el-table-column>
  192. <el-table-column
  193. :label="'黑度'">
  194. <template slot-scope="scope">
  195. <div v-if="scope.row.rcgSoot!=null && scope.row.rcgSoot > normalCount" style="color:red">
  196. {{ scope.row.rcgSoot }}度 ↑ {{ ((scope.row.rcgSoot - normalCount) / normalCount * 100).toFixed(0) }}%</div>
  197. <div v-if="scope.row.rcgSoot!=null && scope.row.rcgSoot <= normalCount">{{ scope.row.rcgSoot }}度</div>
  198. </template>
  199. </el-table-column>
  200. <el-table-column
  201. property="createTime"
  202. label="监测时间">
  203. </el-table-column>
  204. </el-table>
  205. </el-tab-pane>
  206. <el-tab-pane label="其它监测数据" name="thrid">
  207. <el-table
  208. :header-cell-style="{ background: '#e4eafc'}"
  209. ref="singleTable"
  210. :data="tableData.minor"
  211. highlight-current-row height="200px"
  212. style="width: 100%"
  213. class="tableSc"
  214. >
  215. <el-table-column
  216. type="index"
  217. label="序号"
  218. width="50">
  219. </el-table-column>
  220. <el-table-column
  221. property="monitorPointName"
  222. label="监测点"
  223. >
  224. </el-table-column>
  225. <el-table-column
  226. :label="'SO2浓度'"
  227. >
  228. <template slot-scope="scope">
  229. <div v-if="scope.row.so2Concentration!=null && scope.row.so2Concentration > normalPer" style="color:red">
  230. {{ scope.row.so2Concentration }}% ↑</div>
  231. <div v-if="scope.row.so2Concentration!=null && scope.row.so2Concentration <= normalPer">{{ scope.row.so2Concentration }}%</div>
  232. </template>
  233. </el-table-column>
  234. <el-table-column
  235. :label="'NO2浓度'"
  236. >
  237. <template slot-scope="scope">
  238. <div v-if="scope.row.no2Concentration!=null && scope.row.no2Concentration > normalPer" style="color:red">
  239. {{ scope.row.no2Concentration }}% ↑</div>
  240. <div v-if="scope.row.no2Concentration!=null && scope.row.no2Concentration <= normalPer">{{ scope.row.no2Concentration }}%</div>
  241. </template>
  242. </el-table-column>
  243. <el-table-column
  244. :label="'CO2浓度'"
  245. >
  246. <template slot-scope="scope">
  247. <div v-if="scope.row.co2Concentration!=null && scope.row.co2Concentration > normalPer" style="color:red">
  248. {{ scope.row.co2Concentration }}% ↑</div>
  249. <div v-if=" scope.row.co2Concentration!=null && scope.row.co2Concentration <= normalPer">{{ scope.row.co2Concentration }}%</div>
  250. </template>
  251. </el-table-column>
  252. <el-table-column
  253. :label="'硫碳比'">
  254. <template slot-scope="scope">
  255. <div v-if="scope.row.so2Percent!=null && scope.row.so2Percent > normalCount" style="color:red">
  256. {{ scope.row.so2Percent }}度 ↑</div>
  257. <div v-if="scope.row.so2Percent!=null && scope.row.so2Percent <= normalCount">{{ scope.row.so2Percent }}度</div>
  258. </template>
  259. </el-table-column>
  260. <el-table-column
  261. property="createTime"
  262. label="监测时间">
  263. </el-table-column>
  264. </el-table>
  265. </el-tab-pane>
  266. </el-tabs>
  267. </div>
  268. </div>
  269. <div class="icon_div">
  270. <div style="margin-top:5rem">
  271. <div style="float:left;margin-left:5rem"><img src="../../assets/images/icon/zc.png"></img></div>
  272. <div style="float:left;margin-left:8rem"><span class="line_font">正常船舶</span></div>
  273. </div>
  274. <br/>
  275. <div style="margin-top:8rem">
  276. <div style="float:left;margin-left:5rem"><img src="../../assets/images/icon/xy.png"></img></div>
  277. <div style="float:left;margin-left:8rem"><span class="line_font">嫌疑船舶</span></div>
  278. </div>
  279. <br/>
  280. <div style="margin-top:8rem">
  281. <div style="float:left;margin-left:5rem"><img src="../../assets/images/icon/wg.png"></img></div>
  282. <div style="float:left;margin-left:8rem"><span class="line_font">违规船舶</span></div>
  283. </div>
  284. <!-- <div style="margin-top:75rem"><div></div><span class="line_font">支路</span></div> -->
  285. </div>
  286. <div class="icon_div" style="right: 263rem;">
  287. <div style="margin-top:5rem">
  288. <div style="float:left;margin-left:5rem"><img src="../../assets/images/icon/hy.png"></img></div>
  289. <div style="float:left;margin-left:8rem"><span class="line_font">黑烟设备</span></div>
  290. </div>
  291. <br/>
  292. <div style="margin-top:8rem">
  293. <div style="float:left;margin-left:5rem"><img src="../../assets/images/icon/ais.png"></img></div>
  294. <div style="float:left;margin-left:8rem"><span class="line_font">嗅探设备</span></div>
  295. </div>
  296. <br/>
  297. <div style="margin-top:8rem">
  298. <div style="float:left;margin-left:5rem"><img src="../../assets/images/icon/so2.png"></img></div>
  299. <div style="float:left;margin-left:8rem"><span class="line_font">光谱设备</span></div>
  300. </div>
  301. <br/>
  302. <!-- <div style="margin-top:75rem"><div></div><span class="line_font">支路</span></div> -->
  303. </div>
  304. <div class="radio_div" style="max-width:44rem">
  305. <el-radio-group v-model="caddr" @change="clickcg">
  306. <el-radio v-for="item in addrlist" :key="item.name" :label="item.name"></el-radio>
  307. </el-radio-group>
  308. </div>
  309. <div class="shipDiv" v-show="deviceTableShow">
  310. <div class="shipTitle">
  311. <span style="float:left">{{ pointDevice.name }}</span>
  312. <i class="el-icon-close" style="font-size:9rem;margin-top:2rem;float:right" @click="deviceTableShow=false"></i>
  313. </div>
  314. <div style="padding—left:10rem" class="shipContent">
  315. <el-table :header-cell-style="{ background: '#e4eafc'}" ref="singleTable" :data="pointDevice.list" height="200px" highlight-current-row style="width: 100%;" class="tableSc">
  316. <el-table-column type="index" label="序号" width="50">
  317. </el-table-column>
  318. <el-table-column property="monitorName" label="设备位置" width="100">
  319. </el-table-column>
  320. <el-table-column property="name" label="设备名称" width="100">
  321. </el-table-column>
  322. <el-table-column property="deviceType" label="设备类型" width="100">
  323. </el-table-column>
  324. <el-table-column property="status" label="设备状态">
  325. </el-table-column>
  326. <el-table-column property="orgName" label="管辖机构">
  327. </el-table-column>
  328. </el-table>
  329. </div>
  330. </div>
  331. </div>
  332. </template>
  333. <script>
  334. import "ol/ol.css";
  335. import Map from "ol/Map";
  336. import TileLayer from "ol/layer/Tile";
  337. import ImageLayer from "ol/layer/Image";
  338. import View from "ol/View";
  339. import { getTopLeft, getWidth } from "ol/extent";
  340. import ImageWMS from "ol/source/ImageWMS";
  341. import WMTS from "ol/source/WMTS";
  342. import TileWMS from "ol/source/TileWMS";
  343. import WMTSTileGrid from "ol/tilegrid/WMTS";
  344. import { get as getProjection, transform } from "ol/proj";
  345. import { Vector as SourceVec } from "ol/source";
  346. import { Feature } from "ol";
  347. import { LineString, Point } from "ol/geom";
  348. import { Icon, Stroke, Style } from "ol/style";
  349. import { Vector as LayerVec } from "ol/layer";
  350. import { queryShipByDeviceId, queryDatabymmsi } from "@/api/data/deviceData";
  351. let ispro = process.env.NODE_ENV === "production";
  352. let that = null;
  353. let mapv = null;
  354. // ispro = false;
  355. export default {
  356. props: {
  357. src: {
  358. type: String,
  359. required: false
  360. }
  361. },
  362. data() {
  363. return {
  364. map: null,
  365. shipName: '',
  366. deviceShow: false,
  367. deviceData: '',
  368. checkList: [],
  369. drawLayer: null,
  370. draw: null,
  371. normalPer: 0.1,
  372. normalCount: 1,
  373. activeName: 'first',
  374. tabledatas: [],
  375. deviceTableShow:false,
  376. pointDevice:{
  377. name:'',
  378. list:[],
  379. },
  380. // deviceList:[],
  381. d_activeName: 'd_first',
  382. tableData: { minor: [], main: [] },
  383. addrlist: [{ name: "南京四桥", location: [1, 1] }],
  384. caddr: "南京四桥",
  385. shipShow: false,
  386. shipdata: {},
  387. };
  388. },
  389. props:['deviceList'],
  390. mounted() {
  391. that = this;
  392. if (ispro) {
  393. this.initprod();
  394. } else {
  395. this.initdev();
  396. }
  397. mapv = this.map;
  398. this.map.on("click", function(e) {
  399. console.log(e)
  400. var feature = that.map.forEachFeatureAtPixel(e.pixel,
  401. function(feature) {
  402. return feature;
  403. });
  404. if (feature) { //这里说明我们点击的是点标记,
  405. let tadata = feature.get("tadata"); //我们可以通过给点标记传不同的值,来判断点击不同的点标记触发的事件。
  406. if (tadata) {
  407. if (tadata.sectionId == "line") {
  408. // alert("我是线:" + tadata.towerNumber)
  409. }
  410. if (tadata.sectionId == "point") {
  411. console.log(tadata);
  412. if (tadata.type == "ship") {
  413. that.shipShow = true;
  414. that.deviceShow = false;
  415. that.deviceTableShow = false
  416. that.shipName = tadata.data;
  417. that.activeName = "first";
  418. } else if (tadata.type == "device") {
  419. that.deviceShow = true;
  420. that.shipShow = false;
  421. that.deviceTableShow = false
  422. that.deviceData = tadata.data;
  423. that.d_activeName = 'd_first';
  424. }
  425. // alert("我是点:"+tadata.data)
  426. }
  427. //含有lnglat 参数的点标记触发事件
  428. }
  429. }
  430. });
  431. // this.addpoint();
  432. // this.addline();
  433. },
  434. methods: {
  435. //[[1111,1111]]
  436. handleClick1: function(tab, event) {
  437. var sect = tab.name;
  438. if (sect == "d_first") {
  439. return;
  440. }
  441. var q = {
  442. deviceId: this.deviceData.deviceId,
  443. illegalStatus: sect == "d_second" ? 2 : 3,
  444. index: this.deviceData.source
  445. }
  446. this.tabledatas = [];
  447. queryShipByDeviceId(q).then(data => {
  448. console.log(data);
  449. data.data.forEach(element => {
  450. element["values"] = element.illegalType == "heiyan" ? element.rcgSoot : (element.illegalType == "guangpu" ? element.so2Percent : (element.illegalType == "xiutan" ? element.so2Percent : 0));
  451. this.tabledatas.push(element);
  452. });
  453. });
  454. //dd
  455. },
  456. clickcg: (value) => {
  457. console.log(that.deviceList);
  458. that.pointDevice.list = that.deviceList[value];
  459. console.log(that.pointDevice);
  460. that.deviceTableShow = true;
  461. that.pointDevice.name = value;
  462. that.addrlist.forEach(element => {
  463. if (element.name == value) {
  464. var lo = that.transpoints(element.location, 0)[0];
  465. console.log(lo)
  466. mapv.getView().setCenter(lo);
  467. }
  468. });
  469. },
  470. setaddrlist(list) {
  471. this.addrlist = list;
  472. this.caddr = list[0].name;
  473. var lo = that.transpoints(list[0].location, 0)[0];
  474. mapv.getView().setCenter(lo);
  475. },
  476. addshipData(list) {
  477. },
  478. handleClick(tab, event) {
  479. console.log(tab, event);
  480. var sect = tab.name;
  481. if (sect == "first") {
  482. return;
  483. }
  484. var q = {
  485. mmsi: this.shipName.mmsi
  486. }
  487. this.tableData = { minor: [], main: [] };
  488. queryDatabymmsi(q).then(data => {
  489. console.log(data);
  490. this.tableData = data.data;
  491. // console.log(deviceList);
  492. });
  493. },
  494. transpoints: function(points, type) {
  495. if (false) {
  496. return points;
  497. } else {
  498. if (type == 1) {
  499. var pp = [];
  500. points.forEach(point => {
  501. pp.push(transform(point, "EPSG:3857", "EPSG:4326"));
  502. });
  503. return pp;
  504. } else {
  505. var pp = [];
  506. points.forEach(point => {
  507. pp.push(transform(point, "EPSG:4326", "EPSG:3857"));
  508. });
  509. return pp;
  510. }
  511. }
  512. },
  513. initdev: function() {
  514. function getWMTSLayer(url, layer) {
  515. let key = "98ec3e37b32974c2d58ea1a790640fe7"
  516. let projection = getProjection("EPSG:3857");
  517. let projectionExtent = projection.getExtent();
  518. let size = getWidth(projectionExtent) / 256;
  519. function getResolutions() {
  520. let resolutions = [];
  521. for (let z = 1; z < 19; ++z) {
  522. resolutions[z] = size / Math.pow(2, z);
  523. }
  524. return resolutions
  525. }
  526. return new TileLayer({
  527. source: new WMTS({
  528. url: url,
  529. layer: layer,
  530. style: "default",
  531. matrixSet: "w",
  532. format: "tiles",
  533. tileGrid: new WMTSTileGrid({
  534. origin: getTopLeft(projectionExtent),
  535. resolutions: getResolutions(),
  536. matrixIds: [ 0,1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15,16,17,18,19],
  537. }),
  538. }),
  539. })
  540. }
  541. var projection = getProjection("EPSG:3857");
  542. var format = 'image/png';
  543. var bounds = [13325725.763124488, 3757032.814272983,
  544. 13345293.642365493, 3776600.693513988
  545. ];
  546. var untiled = new ImageLayer({
  547. source: new ImageWMS({
  548. ratio: 1,
  549. url: 'http://36.156.155.131:8090/geoserver/wms',
  550. params: {
  551. 'FORMAT': format,
  552. 'VERSION': '1.1.1',
  553. "STYLES": '',
  554. "CJAUTH": 'CJUSER',
  555. "LAYERS": 'CJ:G_CJ_NJ',
  556. "TRANSPARENT": 'true',
  557. "exceptions": 'application/vnd.ogc.se_inimage',
  558. }
  559. })
  560. });
  561. const ign = getWMTSLayer('https://t{0-7}.tianditu.gov.cn/vec_w/wmts?tk=98ec3e37b32974c2d58ea1a790640fe7', 'vec');
  562. var tiled = new TileLayer({
  563. visible: false,
  564. source: new TileWMS({
  565. url: 'http://36.156.155.131:8090/geoserver/wms',
  566. params: {
  567. 'FORMAT': format,
  568. 'VERSION': '1.1.1',
  569. tiled: true,
  570. "STYLES": '',
  571. "CJAUTH": 'CJUSER',
  572. "LAYERS": 'CJ:G_CJ_NJ',
  573. "TRANSPARENT": 'true',
  574. "exceptions": 'application/vnd.ogc.se_inimage',
  575. tilesOrigin: 13325725.763124488 + "," + 3757032.814272983
  576. }
  577. })
  578. });
  579. var map = new Map({
  580. target: 'map',
  581. layers: [
  582. ign,
  583. getWMTSLayer('https://t{0-7}.tianditu.gov.cn/cva_w/wmts?tk=98ec3e37b32974c2d58ea1a790640fe7', 'cva'),
  584. untiled,
  585. tiled
  586. ],
  587. view: new View({
  588. projection: projection
  589. })
  590. });
  591. // map.getView().fit([75.0, 20.0, 135.0, 50.0], map.getSize());
  592. this.map = map;
  593. // map.getView().setCenter(
  594. // [118.642876, 31.970445]
  595. // );
  596. map.getView().setCenter(this.transpoints([
  597. [118.642876, 31.970445]
  598. ], 0)[0]);
  599. map.getView().setZoom(13);
  600. },
  601. initdev1: function() {
  602. const proj3857 = getProjection("EPSG:3857");
  603. const tileGrid = new WMTSTileGrid({
  604. tileSize: [256, 256],
  605. origin: [-2.003750834e7, 2.003750834e7],
  606. extent: [-2.003750834e7, -2.003750834e7, 2.003750834e7, 2.003750834e7],
  607. resolutions: [
  608. 76.43702827453613,
  609. 38.218514137268066,
  610. 19.109257068634033,
  611. 9.554628534317017,
  612. 4.777314267158508
  613. ],
  614. matrixIds: [
  615. "EPSG:3857:10",
  616. "EPSG:3857:11",
  617. "EPSG:3857:12",
  618. "EPSG:3857:13",
  619. "EPSG:3857:14"
  620. ]
  621. });
  622. const ign_source = new WMTS({
  623. url: "http://geo.xt.wenhq.top:8083/geoserver/gwc/service/wmts?",
  624. layer: "test:nj10",
  625. matrixSet: "EPSG:3857",
  626. format: "image/png",
  627. projection: proj3857,
  628. tileGrid: tileGrid,
  629. style: ""
  630. });
  631. const ign = new TileLayer({
  632. source: ign_source
  633. });
  634. const map = new Map({
  635. target: "map",
  636. layers: [ign],
  637. view: new View({
  638. center: [0, 0],
  639. zoom: 2
  640. })
  641. });
  642. map
  643. .getView()
  644. .fit(
  645. [
  646. 13149614.849955281,
  647. 3639625.538826909,
  648. 13306157.88388332,
  649. 3874440.0897189667
  650. ],
  651. map.getSize()
  652. );
  653. this.map = map;
  654. map.getView().setCenter(this.transpoints([
  655. [118.642876, 31.970445]
  656. ], 0)[0]);
  657. map.getView().setZoom(13);
  658. },
  659. initprod: function() {
  660. // const proj3857 = getProjection("EPSG:4326");
  661. function getWMTSLayer(url, layer) {
  662. let key = "98ec3e37b32974c2d58ea1a790640fe7"
  663. let projection = getProjection("EPSG:3857");
  664. let projectionExtent = projection.getExtent();
  665. let size = getWidth(projectionExtent) / 256;
  666. function getResolutions() {
  667. let resolutions = [];
  668. for (let z = 1; z < 19; ++z) {
  669. resolutions[z] = size / Math.pow(2, z);
  670. }
  671. return resolutions
  672. }
  673. return new TileLayer({
  674. source: new WMTS({
  675. url: url,
  676. layer: layer,
  677. style: "default",
  678. matrixSet: "w",
  679. format: "tiles",
  680. tileGrid: new WMTSTileGrid({
  681. origin: getTopLeft(projectionExtent),
  682. resolutions: getResolutions(),
  683. matrixIds: [ 0,1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15,16,17,18,19],
  684. }),
  685. }),
  686. })
  687. }
  688. var projection = getProjection("EPSG:3857");
  689. var format = 'image/png';
  690. var bounds = [13325725.763124488, 3757032.814272983,
  691. 13345293.642365493, 3776600.693513988
  692. ];
  693. var untiled = new ImageLayer({
  694. source: new ImageWMS({
  695. ratio: 1,
  696. url: 'http://198.17.188.64/geoserver/gwc/service/wms',
  697. params: {
  698. 'FORMAT': format,
  699. 'VERSION': '1.1.1',
  700. "STYLES": '',
  701. "CJAUTH": 'CJUSER',
  702. "LAYERS": 'CJ:G_CJ',
  703. "TRANSPARENT": 'true',
  704. "exceptions": 'application/vnd.ogc.se_inimage',
  705. }
  706. })
  707. });
  708. var tiled = new TileLayer({
  709. visible: false,
  710. source: new TileWMS({
  711. url: 'http://198.17.188.64/geoserver/gwc/service/wms',
  712. params: {
  713. 'FORMAT': format,
  714. 'VERSION': '1.1.1',
  715. tiled: true,
  716. "STYLES": '',
  717. "CJAUTH": 'CJUSER',
  718. "LAYERS": 'CJ:G_CJ',
  719. "TRANSPARENT": 'true',
  720. "exceptions": 'application/vnd.ogc.se_inimage',
  721. tilesOrigin: 13325725.763124488 + "," + 3757032.814272983
  722. }
  723. })
  724. });
  725. const map = new Map({
  726. target: "map",
  727. layers: [getWMTSLayer('http://198.17.188.64:9879/vec_w/wmts?tk=98ec3e37b32974c2d58ea1a790640fe7', 'vec'),getWMTSLayer('http://198.17.188.64:9879/cva_w/wmts?tk=98ec3e37b32974c2d58ea1a790640fe7', 'cva'),
  728. untiled,
  729. tiled],
  730. view: new View({
  731. projection: projection
  732. })
  733. });
  734. map.getView().fit([75.0, 20.0, 135.0, 50.0], map.getSize());
  735. this.map = map;
  736. map.getView().setCenter(this.transpoints([
  737. [118.642876, 31.970445]
  738. ], 0)[0]);
  739. map.getView().setZoom(13);
  740. },
  741. addline: function(linePoint) {
  742. var points = this.transpoints(linePoint, 0)
  743. let line = new Feature({
  744. tadata: {
  745. sectionId: "line",
  746. towerNumber: 22
  747. },
  748. geometry: new LineString(points)
  749. }); //这里要注意写fromLonLat,很重要
  750. line.setStyle(new Style({
  751. stroke: new Stroke({
  752. width: 3,
  753. color: "#008000"
  754. })
  755. }));
  756. this.linevectorLayer = new LayerVec({
  757. source: new SourceVec({
  758. features: [line] //要绘制多段线,直接push到这里面就行了
  759. })
  760. });
  761. this.map.addLayer(this.linevectorLayer); //这里是执行,执行之后点就出来了
  762. },
  763. addpoint: function(addrArry, data, img, type,rotation=0) {
  764. var lnglat = this.transpoints(addrArry, 0)[0];
  765. let tamarker = new Feature({
  766. tadata: {
  767. sectionId: "point",
  768. towerNumber: 22,
  769. data: data,
  770. type: type
  771. }, //这里是用来传值用的,在接下来的一章里(事件)中我会讲到。
  772. geometry: new Point(lnglat) //这里是点坐标的位置,这里要注意fromLonLat
  773. });
  774. tamarker.setStyle(
  775. new Style({
  776. image: new Icon({
  777. color: "#eee",
  778. rotation:rotation,
  779. crossOrigin: "anonymous",
  780. src: require("../../assets/images/icon/" + img) //本地的样式
  781. })
  782. })
  783. ); //这里是样式
  784. var markerta = new LayerVec({
  785. source: new SourceVec({
  786. features: [tamarker] //这里放的就是之前的那个点,如果要放置多个点直接push到这里面就行了
  787. })
  788. });
  789. this.map.addLayer(markerta); //这里是执行,执行之后点就出来了
  790. }
  791. }
  792. };
  793. </script>
  794. <style scoped>
  795. #map {
  796. height: 100%;
  797. }
  798. /*隐藏ol的一些自带元素*/
  799. .ol-attribution,
  800. .ol-zoom {
  801. display: none;
  802. }
  803. .contentFont {
  804. font-size: 6rem;
  805. line-height: 16rem;
  806. }
  807. .shipDiv {
  808. position: absolute;
  809. top: 250rem;
  810. left: 140rem;
  811. width: 240rem;
  812. min-height: 130rem;
  813. background-color: white;
  814. }
  815. .el-tabs__header {
  816. margin: 0 !important;
  817. }
  818. .shipTitle {
  819. padding-top: 4rem;
  820. padding-left: 10rem;
  821. padding-right: 10rem;
  822. width: 100%;
  823. height: 20rem;
  824. background-color: #0d25a5;
  825. color: white;
  826. font-size: 7rem
  827. }
  828. .shipContent>>>.el-tabs__item {
  829. font-weight: bold;
  830. color: #A8A8A8
  831. }
  832. .shipContent>>>.el-tabs__item.is-active {
  833. color: #0d25a5
  834. }
  835. .shipContent>>>.el-tabs__active-bar {
  836. margin-left: 10rem
  837. }
  838. .shipContent>>>.el-tabs__nav {
  839. padding-left: 10rem
  840. }
  841. .shipContent>>>.el-tabs__active-bar {
  842. background-color: #0d25a5
  843. }
  844. .tableSc>>>tr {
  845. padding: 0;
  846. height: 3rem;
  847. line-height: 3rem;
  848. font-size: 5rem;
  849. }
  850. .tableSc>>>td {
  851. padding: 0;
  852. height: 3rem;
  853. line-height: 3rem
  854. }
  855. .icon_div {
  856. position: absolute;
  857. top: 330rem;
  858. right: 160rem;
  859. width: 70rem;
  860. min-height: 40rem;
  861. background-color: white;
  862. }
  863. .radio_div {
  864. position: absolute;
  865. top: 50rem;
  866. left: 120rem;
  867. padding-top: 4rem;
  868. padding-left: 5rem;
  869. background-color: white;
  870. padding-right: 4rem;
  871. }
  872. .radio_div>div {
  873. line-height: 10rem;
  874. }
  875. .el-tabs__header {
  876. margin: 0 !important;
  877. }
  878. </style>