1382c0335c4f0afc86ea91dfe5a8b07b7088d0f2.svn-base 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div class="app-container">
  3. <!-- <h1>牧场</h1> -->
  4. <div class="search">
  5. <el-date-picker v-model="table.getdataListParm.parammaps.date" type="date" placeholder="选择日期" />
  6. <el-select v-model="table.getdataListParm.parammaps.lpplantype" placeholder="设备类型" class="filter-item" style="width: 120px;" clearable>
  7. <el-option v-for="item in equipmentTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  8. </el-select>
  9. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  10. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  11. </div>
  12. <el-row :gutter="20">
  13. <el-col :span="8">
  14. <h4>设备列表</h4>
  15. <div class="table">
  16. <el-table
  17. :key="table.tableKey"
  18. v-loading="table.listLoading"
  19. element-loading-text="给我一点时间"
  20. :data="table.list"
  21. border
  22. fit
  23. highlight-current-row
  24. style="width: 100%;"
  25. :row-style="rowStyle"
  26. :cell-style="cellStyle"
  27. class="elTable table-fixed"
  28. :height="table1Height"
  29. @row-click="rowClick1"
  30. >
  31. <el-table-column label="设备类型" min-width="90px" align="center" prop="intime" />
  32. <el-table-column label="设备名称" min-width="80px" align="center" prop="lpplantype" />
  33. <el-table-column label="GPS设备名称" min-width="90px" align="center" prop="remark" />
  34. <el-table-column label="总时长(分钟)" min-width="100px" align="center" prop="tmrtname" />
  35. </el-table>
  36. </div>
  37. <h4>设备详情</h4>
  38. <div class="table">
  39. <el-table
  40. :key="table.tableKey"
  41. v-loading="table.listLoading"
  42. element-loading-text="给我一点时间"
  43. :data="table.list"
  44. border
  45. fit
  46. highlight-current-row
  47. style="width: 100%;"
  48. :row-style="rowStyle"
  49. :cell-style="cellStyle"
  50. class="elTable table-fixed"
  51. :height="table1Height"
  52. @row-click="rowClick2"
  53. >
  54. <el-table-column label="设备名称" min-width="90px" align="center" prop="intime" />
  55. <el-table-column label="开始时间" min-width="80px" align="center" prop="lpplantype" />
  56. <el-table-column label="结束时间" min-width="90px" align="center" prop="remark" />
  57. <el-table-column label="时长(分钟)" min-width="100px" align="center" prop="tmrtname" />
  58. </el-table>
  59. </div>
  60. </el-col>
  61. <el-col :span="16" class="map">
  62. <h4>设备轨迹图</h4>
  63. <div id="yzMap" />
  64. </el-col>
  65. </el-row>
  66. </div>
  67. </template>
  68. <script>
  69. import MapInit from '@/components/show/MapInit.js'
  70. import { GetDataByName } from '@/api/common'
  71. import Cookies from 'js-cookie'
  72. import { parseTime } from '@/utils/index.js'
  73. export default {
  74. name: 'EquipmentRunningTrack',
  75. data() {
  76. return {
  77. equipmentTypeList: [{ id: 0, name: '设备01' }, { id: 1, name: '设备02' }],
  78. // TMR设备列表
  79. table: {
  80. getdataListParm: {
  81. name: 'getprocessAnalysis',
  82. page: 1,
  83. offset: 1,
  84. pagecount: '',
  85. returntype: 'Map',
  86. parammaps: {
  87. pastureid: Cookies.get('pastureid'),
  88. date: parseTime(new Date(), '{y}-{m}-{d}'),
  89. iscompleted: '',
  90. tmrtname: '',
  91. lpplantype: ''
  92. }
  93. },
  94. tableKey: 0,
  95. list: [],
  96. total: 0,
  97. listLoading: true
  98. },
  99. table2: {
  100. getdataListParm: {
  101. name: 'getprocessAnalysisStr',
  102. page: 1,
  103. offset: 1,
  104. pagecount: 1,
  105. returntype: 'Map',
  106. parammaps: {
  107. pastureid: Cookies.get('pastureid'),
  108. id: ''
  109. }
  110. },
  111. tableKey: 0,
  112. list: [],
  113. total: 0,
  114. listLoading: true
  115. },
  116. table1Height: (document.documentElement.clientHeight - 85 - 250) / 2,
  117. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  118. cellStyle: { padding: 0 + 'px' },
  119. map: '', drivingRoute: '', drivingRoute1: '',
  120. zoom: 12,
  121. myCarTrack: '',
  122. config: '',
  123. startIcon: 'http://lbs.tianditu.gov.cn/images/bus/start.png', // 起点图标
  124. endIcon: 'http://lbs.tianditu.gov.cn/images/bus/end.png' // 终点图标
  125. }
  126. },
  127. created() {
  128. this.getList()
  129. console.log(document.documentElement.clientHeight - 85 - 250)
  130. this.roadMap()
  131. },
  132. methods: {
  133. getList() {
  134. this.table.listLoading = true
  135. GetDataByName(this.table.getdataListParm).then(response => {
  136. console.log('TMR设备列表table数据', response.data.list)
  137. if (response.data.list !== null) {
  138. this.table.list = response.data.list
  139. } else {
  140. this.table.list = []
  141. }
  142. setTimeout(() => {
  143. this.table.listLoading = false
  144. }, 100)
  145. })
  146. },
  147. handleSearch() {
  148. this.table.getdataListParm.offset = 1
  149. this.getList()
  150. },
  151. handleRefresh() {
  152. console.log('点击了重置')
  153. this.table.getdataListParm.offset = 1
  154. this.getList()
  155. },
  156. rowClick1(row, column, event) { },
  157. rowClick2(row, column, event) { },
  158. getList2() {
  159. this.table2.listLoading = false
  160. GetDataByName(this.table2.getdataListParm).then(response => {
  161. console.log('过程详情table数据', response.data.list)
  162. if (response.data.list !== null) {
  163. this.table2.list = response.data.list
  164. } else {
  165. this.table2.list = []
  166. }
  167. setTimeout(() => {
  168. this.table2.listLoading = false
  169. }, 100)
  170. })
  171. },
  172. roadMap() {
  173. MapInit.init().then(
  174. T => {
  175. this.T = T
  176. this.map = new T.Map('yzMap', config)
  177. const ctrl = new T.Control.MapType()
  178. this.map.addControl(ctrl)
  179. this.map.centerAndZoom(new T.LngLat(116.40769, 39.91945), 12)
  180. var config = {
  181. policy: 0, // 驾车策略
  182. onSearchComplete: this.searchResult // 检索完成后的回调函数
  183. }
  184. this.drivingRoute = new T.DrivingRoute(this.map, config)
  185. this.drivingRoute1 = new T.DrivingRoute(this.map, config)
  186. this.searchDrivingRoute()
  187. }).catch()
  188. },
  189. searchDrivingRoute() {
  190. this.map.clearOverLays()
  191. var startLngLat = new T.LngLat(116.354060, 39.905650)
  192. var endLngLat = new T.LngLat(116.428130, 39.903550)
  193. // 驾车路线搜索
  194. this.drivingRoute.search(startLngLat, endLngLat)
  195. var startLngLat1 = new T.LngLat(116.380967, 39.953285)
  196. var endLngLat1 = new T.LngLat(116.424374, 39.914668)
  197. // 驾车路线搜索
  198. this.drivingRoute1.search(startLngLat1, endLngLat1)
  199. },
  200. createRoute(lnglats, lineColor) {
  201. this.myCarTrack = new this.T.CarTrack(this.map, {
  202. interval: 20,
  203. speed: 10,
  204. dynamicLine: false,
  205. Datas: lnglats,
  206. polylinestyle: { color: '#2C64A7', width: 5, opacity: 0.9 }
  207. })
  208. this.myCarTrack.start()
  209. },
  210. createStartMarker(result) {
  211. var startMarker = new T.Marker(result.getStart(), {
  212. icon: new T.Icon({
  213. iconUrl: this.startIcon,
  214. iconSize: new T.Point(44, 34),
  215. iconAnchor: new T.Point(12, 31)
  216. })
  217. })
  218. this.map.addOverLay(startMarker)
  219. var endMarker = new T.Marker(result.getEnd(), {
  220. icon: new T.Icon({
  221. iconUrl: this.endIcon,
  222. iconSize: new T.Point(44, 34),
  223. iconAnchor: new T.Point(12, 31)
  224. })
  225. })
  226. this.map.addOverLay(endMarker)
  227. },
  228. searchResult(result) {
  229. // 添加起始点
  230. this.createStartMarker(result)
  231. var obj = result
  232. // 获取方案个数
  233. var routes = result.getNumPlans()
  234. for (var i = 0; i < routes; i++) {
  235. // 获得单条驾车方案结果对象
  236. var plan = result.getPlan(i)
  237. this.createRoute(plan.getPath())
  238. }
  239. }
  240. }
  241. }
  242. </script>
  243. <style lang="scss" scoped>
  244. .search{padding-top:10px;clear: both;}
  245. .table{margin-top:10px;}
  246. .detail{
  247. height:84px;border: 1px solid #EBEEF5;padding-left:10px;font:16px/32px '';color:#333;
  248. .detail-t{margin-top: 10px;}
  249. .detail-b{margin-bottom: 10px;}
  250. }
  251. .map{position: relative;min-height: 480px;}
  252. #yzMap {
  253. width: 95%;
  254. height: 100%;
  255. position: absolute;
  256. }
  257. </style>