KeyVehicles.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <div class="menu-content">
  3. <div class="container">
  4. <div class="gradient-text title">两客一危一重货</div>
  5. <div class="box-left">
  6. <el-input v-model="queryParams.keywords" class="custom-input" placeholder="搜索" @input="initData">
  7. <template #prefix>
  8. <el-icon class="el-input__icon"><search /></el-icon>
  9. </template>
  10. </el-input>
  11. <div class="btn" @click="handleCancel">取消</div>
  12. </div>
  13. </div>
  14. <div class="custom-table">
  15. <div class="th">
  16. <div class="td">车牌号</div>
  17. <div class="td">报警标识</div>
  18. <div class="td">车辆类型</div>
  19. <div class="td">GPS定位时间</div>
  20. <div class="td" style="width: 330px; flex: unset">操作</div>
  21. </div>
  22. <div class="table-content">
  23. <div v-for="item in dataList" :key="item.id" class="tr">
  24. <div class="td">{{ item.vehicle_no }}</div>
  25. <div class="td">
  26. <dict-tag :options="alarm_identification" :value="item.alarm_flag" />
  27. </div>
  28. <div class="td">
  29. <dict-tag :options="car_type" :value="item.vehicle_type" />
  30. </div>
  31. <div class="td">{{ parseTime(item.gpsDate) }}</div>
  32. <div class="td" style="width: 330px; flex: unset">
  33. <div class="text" @click="handleConnect">连线</div>
  34. <div class="text" @click="handleCollaborate">协同</div>
  35. <div class="text" @click="handleTrack(item)">轨迹</div>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="footer">
  40. <el-pagination
  41. background
  42. :hide-on-single-page="true"
  43. layout="total, prev, pager, next"
  44. :total="total"
  45. :page-size="queryParams.size"
  46. :current-current="queryParams.current"
  47. @current-change="handleChangePage"
  48. />
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script setup lang="ts">
  54. import { Search } from '@element-plus/icons-vue';
  55. import { getVehicleList, getVehicleTrajectory } from '@/api/globalMap/KeyVehicles';
  56. import { onMounted, reactive, inject } from 'vue';
  57. import { parseTime } from '@/utils/ruoyi';
  58. const initDataToPlay = inject('initDataToPlay');
  59. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  60. const { car_type, alarm_identification } = toRefs<any>(proxy?.useDict('car_type', 'alarm_identification'));
  61. const dataList = ref([]);
  62. // 入参
  63. const queryParams = reactive({
  64. current: 1,
  65. size: 10,
  66. keywords: ''
  67. });
  68. const total = ref(0);
  69. // 调接口
  70. const initData = () => {
  71. getVehicleList({ current: queryParams.current, size: queryParams.size, query: { keywords: queryParams.keywords } }).then((res) => {
  72. dataList.value = res.rows;
  73. total.value = res.total;
  74. });
  75. };
  76. const handleChangePage = (newNum) => {
  77. queryParams.current = newNum;
  78. initData();
  79. };
  80. // 取消按钮的逻辑,搜索框清空并重新加载数据
  81. const handleCancel = () => {
  82. queryParams.keywords = '';
  83. queryParams.current = 1;
  84. initData();
  85. };
  86. const handleConnect = () => {};
  87. const handleCollaborate = () => {};
  88. // 轨迹
  89. const handleTrack = (item) => {
  90. getVehicleTrajectory(item.vehicle_no).then((res) => {
  91. const trajectory = [];
  92. res.data.list.forEach((item) => {
  93. trajectory.push({
  94. time: !!item.gpsDate ? parseTime(item.gpsDate, '{h}:{i}') : '',
  95. lnglat: [item.lng, item.lat]
  96. });
  97. });
  98. initDataToPlay({ type: 'track', data: trajectory });
  99. });
  100. };
  101. // 调用函数
  102. onMounted(() => {
  103. initData();
  104. });
  105. </script>
  106. <style lang="scss" scoped>
  107. .menu-content {
  108. width: 1579px;
  109. height: 1394px;
  110. background: url('@/assets/images/map/rightMenu/content.png') no-repeat;
  111. padding: 130px 20px 20px 20px;
  112. font-size: 36px;
  113. position: relative;
  114. color: #ffffff;
  115. }
  116. .title {
  117. font-size: 60px;
  118. position: absolute;
  119. top: 30px;
  120. left: 160px;
  121. }
  122. .box-left {
  123. display: flex;
  124. margin-top: 30px;
  125. margin-bottom: 20px;
  126. .btn {
  127. width: 140px;
  128. min-width: 140px;
  129. height: 60px;
  130. background: url('@/assets/images/map/rightMenu/potentialFloodHazard/btn.png') no-repeat;
  131. display: flex;
  132. justify-content: center;
  133. align-items: center;
  134. cursor: pointer;
  135. margin-left: 20px;
  136. color: #ffffff;
  137. font-size: 32px;
  138. }
  139. }
  140. .custom-input {
  141. height: 60px;
  142. line-height: 40px;
  143. }
  144. .custom-table {
  145. width: 100%;
  146. height: 1120px;
  147. display: flex;
  148. flex-direction: column;
  149. .table-content {
  150. flex: 1;
  151. overflow-y: auto;
  152. }
  153. .th {
  154. width: 100%;
  155. height: 151px;
  156. background: url('@/assets/images/map/rightMenu/th.png') no-repeat;
  157. background-size: 100% 100%;
  158. display: flex;
  159. }
  160. .tr {
  161. width: 100%;
  162. height: 139px;
  163. background: url('@/assets/images/map/rightMenu/td.png') no-repeat;
  164. background-size: 100% 100%;
  165. display: flex;
  166. padding-right: 20px;
  167. &:hover {
  168. background: url('@/assets/images/map/rightMenu/td_checked.png') no-repeat;
  169. background-size: 100% 100%;
  170. }
  171. }
  172. .td {
  173. flex: 1;
  174. color: #edfaff;
  175. font-size: 38px;
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. cursor: pointer;
  180. }
  181. .td-text {
  182. /* 设置字体透明 */
  183. color: transparent;
  184. /* 使用 -webkit-background-clip 属性将背景剪裁至文本形状 */
  185. -webkit-background-clip: text;
  186. /* 非Webkit内核浏览器需要使用标准前缀 */
  187. background-clip: text;
  188. font-family: 'YouSheBiaoTiHei';
  189. /* 设置线性渐变,从红色渐变到蓝色 */
  190. background-image: linear-gradient(to bottom, #ffffff 50%, #3075d3 100%);
  191. font-size: 48px;
  192. }
  193. .text-green {
  194. background-image: linear-gradient(to bottom, #ffffff 50%, #40c75f 100%);
  195. }
  196. .text-danger {
  197. background-image: linear-gradient(to bottom, #ffffff 50%, #ff2f3c 100%);
  198. }
  199. }
  200. .text {
  201. font-size: 38px;
  202. color: #00e8ff;
  203. margin-right: 20px;
  204. &:last-child {
  205. margin-right: 0;
  206. }
  207. }
  208. .flex-container {
  209. display: flex;
  210. justify-content: space-between; /* 左右两端对齐 */
  211. align-items: center; /* 垂直居中对齐 */
  212. }
  213. .text-item {
  214. font-size: 32px; /* 根据需要设置字体大小 */
  215. line-height: 1; /* 确保行高一致 */
  216. }
  217. .button-item {
  218. font-size: 32px; /* 根据需要设置字体大小 */
  219. line-height: 1; /* 确保行高一致 */
  220. }
  221. .footer {
  222. height: 64px;
  223. display: flex;
  224. justify-content: flex-end;
  225. margin-top: 25px;
  226. .pagination-container {
  227. height: 64px;
  228. margin: 0;
  229. }
  230. :deep(.el-pagination__total) {
  231. color: #a7ccdf;
  232. font-size: 32px;
  233. }
  234. :deep(.el-pagination) {
  235. .btn-next,
  236. .btn-prev {
  237. background-color: transparent;
  238. border: none;
  239. .el-icon {
  240. font-size: 22px;
  241. color: #a7ccdf;
  242. }
  243. }
  244. .btn-prev:disabled,
  245. .btn-next:disabled {
  246. background-color: transparent;
  247. border: none;
  248. }
  249. .el-pager li {
  250. width: 64px;
  251. height: 64px;
  252. line-height: 64px;
  253. text-align: center;
  254. font-size: 38px;
  255. color: #a7ccdf;
  256. background-color: #0e3064;
  257. border: 1px solid #0c57a7;
  258. margin: 0 6px;
  259. &:hover {
  260. background-color: #038dff;
  261. border: 1px solid #038dff;
  262. }
  263. }
  264. .el-pager li.is-active {
  265. background-color: #038dff;
  266. border: 1px solid #038dff;
  267. }
  268. .el-pagination__goto {
  269. font-size: 38px;
  270. color: #a7ccdf;
  271. }
  272. }
  273. }
  274. </style>