KeyVehicles.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. <el-button class="btn" @click="handleCancel">取消</el-button>
  12. </div>
  13. </div>
  14. <div>移动指挥车</div>
  15. <div class="custom-table">
  16. <div class="th">
  17. <div class="td">车牌号</div>
  18. <div class="td">报警标识</div>
  19. <div class="td">车辆类型</div>
  20. <div class="td">操作</div>
  21. </div>
  22. <div class="table-content">
  23. <div v-for="(item, index) in dataList" :key="item.id" class="tr">
  24. <div class="td">{{ item.name }}</div>
  25. <div class="td">{{ item.work_unit }}</div>
  26. <div class="td">{{ item.position }}</div>
  27. <div class="td">
  28. <div class="text" @click="handleConnect(index, item)">连线</div>
  29. <div class="text" size="small" @click="handleCollaborate(index, item)">协同</div>
  30. <div class="text" size="small" @click="handleTrack(item)">轨迹</div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script setup lang="ts">
  38. import { Search } from '@element-plus/icons-vue';
  39. import { getMobileWorkstationList } from '@/api/globalMap/MobilePlatform';
  40. import { onMounted, reactive } from 'vue';
  41. const trackPlayback = inject('trackPlayback');
  42. // 数据列表,直接定义为数组
  43. const dataList = reactive([]);
  44. //入参
  45. const queryParams = reactive({
  46. keywords: ''
  47. });
  48. //调接口
  49. const initData = () => {
  50. getMobileWorkstationList({
  51. query: {
  52. keywords: queryParams.keywords
  53. }
  54. }).then((res) => {
  55. if (res.code === 0 && Array.isArray(res.rows)) {
  56. dataList.splice(0, dataList.length, ...res.rows); // 使用 splice 替换数组内容,保持响应性
  57. } else {
  58. console.error('Invalid response from server:', res);
  59. // 可以选择清空数据列表或显示错误消息
  60. dataList.splice(0, dataList.length); // 清空数据列表
  61. }
  62. });
  63. };
  64. // 取消按钮的逻辑,搜索框清空并重新加载数据
  65. const handleCancel = () => {
  66. queryParams.keywords = '';
  67. initData();
  68. };
  69. //调用函数
  70. onMounted(() => {
  71. initData();
  72. });
  73. </script>
  74. <style lang="scss" scoped>
  75. .menu-content {
  76. width: 1579px;
  77. height: 1394px;
  78. background: url('@/assets/images/map/rightMenu/content.png') no-repeat;
  79. padding: 130px 20px 20px 20px;
  80. font-size: 36px;
  81. position: relative;
  82. color: #ffffff;
  83. }
  84. .title {
  85. font-size: 60px;
  86. position: absolute;
  87. top: 30px;
  88. left: 160px;
  89. }
  90. .box-left {
  91. display: flex;
  92. margin-top: 30px;
  93. margin-bottom: 20px;
  94. .btn {
  95. width: 140px;
  96. min-width: 140px;
  97. height: 60px;
  98. background: url('@/assets/images/map/rightMenu/potentialFloodHazard/btn.png') no-repeat;
  99. display: flex;
  100. justify-content: center;
  101. align-items: center;
  102. cursor: pointer;
  103. margin-left: 20px;
  104. color: #ffffff;
  105. }
  106. }
  107. .custom-input {
  108. height: 60px;
  109. line-height: 40px;
  110. }
  111. .custom-table {
  112. width: 100%;
  113. height: 1030px;
  114. overflow-y: auto;
  115. overflow-x: hidden;
  116. .table-content {
  117. height: 880px;
  118. overflow-y: auto;
  119. overflow-x: hidden;
  120. }
  121. .th {
  122. width: 100%;
  123. height: 151px;
  124. background: url('@/assets/images/map/rightMenu/th.png') no-repeat;
  125. background-size: 100% 100%;
  126. display: flex;
  127. }
  128. .tr {
  129. width: 100%;
  130. height: 139px;
  131. background: url('@/assets/images/map/rightMenu/td.png') no-repeat;
  132. background-size: 100% 100%;
  133. display: flex;
  134. padding-right: 20px;
  135. &:hover {
  136. background: url('@/assets/images/map/rightMenu/td_checked.png') no-repeat;
  137. background-size: 100% 100%;
  138. }
  139. }
  140. .td {
  141. flex: 1;
  142. color: #edfaff;
  143. font-size: 38px;
  144. display: flex;
  145. justify-content: center;
  146. align-items: center;
  147. cursor: pointer;
  148. }
  149. .td-text {
  150. /* 设置字体透明 */
  151. color: transparent;
  152. /* 使用 -webkit-background-clip 属性将背景剪裁至文本形状 */
  153. -webkit-background-clip: text;
  154. /* 非Webkit内核浏览器需要使用标准前缀 */
  155. background-clip: text;
  156. font-family: 'YouSheBiaoTiHei';
  157. /* 设置线性渐变,从红色渐变到蓝色 */
  158. background-image: linear-gradient(to bottom, #ffffff 50%, #3075d3 100%);
  159. font-size: 48px;
  160. }
  161. .text-green {
  162. background-image: linear-gradient(to bottom, #ffffff 50%, #40c75f 100%);
  163. }
  164. .text-danger {
  165. background-image: linear-gradient(to bottom, #ffffff 50%, #ff2f3c 100%);
  166. }
  167. }
  168. </style>