SatellitePhone.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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>卫星电话</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>
  21. <div class="table-content">
  22. <div v-for="(item, index) in dataList" :key="item.id" class="tr">
  23. <div class="td">{{ item.name }}</div>
  24. <div class="td">{{ item.unit_name }}</div>
  25. <div class="td">
  26. <div class="text" @click="handleConnect(index, item)">连线</div>
  27. <div class="text" size="small" @click="handleCollaborate(index, item)">电话</div>
  28. <div class="text" size="small" @click="handleTrack(item)">轨迹</div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. <script setup lang="ts">
  36. import { Search } from '@element-plus/icons-vue';
  37. import { onMounted, reactive } from 'vue';
  38. import { getSatellitePhoneList, getSatellitePhoneTrajectory } from "@/api/globalMap/SatellitePhone";
  39. const trackPlayback = inject('trackPlayback');
  40. // 数据列表,直接定义为数组
  41. const dataList = reactive([]);
  42. //入参
  43. const queryParams = reactive({
  44. keywords: '',
  45. unit_name: ''
  46. });
  47. //调接口
  48. const initData = () => {
  49. getSatellitePhoneList({
  50. query: {
  51. keywords: queryParams.keywords,
  52. unit_name: queryParams.unit_name
  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. const handleConnect = () => {};
  70. const handleCollaborate = () => {};
  71. // 轨迹
  72. const handleTrack = (item) => {
  73. getSatellitePhoneTrajectory(item.id).then((res) => {
  74. const trajectory = [];
  75. res.rows.forEach((item) => {
  76. trajectory.push([item.longitude, item.latitude]);
  77. });
  78. trackPlayback(trajectory);
  79. });
  80. };
  81. //调用函数
  82. onMounted(() => {
  83. initData();
  84. });
  85. </script>
  86. <style lang="scss" scoped>
  87. .menu-content {
  88. width: 1579px;
  89. height: 1394px;
  90. background: url('@/assets/images/map/rightMenu/content.png') no-repeat;
  91. padding: 130px 20px 20px 20px;
  92. font-size: 36px;
  93. position: relative;
  94. color: #ffffff;
  95. }
  96. .title {
  97. font-size: 60px;
  98. position: absolute;
  99. top: 30px;
  100. left: 160px;
  101. }
  102. .box-left {
  103. display: flex;
  104. margin-top: 30px;
  105. margin-bottom: 20px;
  106. .btn {
  107. width: 140px;
  108. min-width: 140px;
  109. height: 60px;
  110. background: url('@/assets/images/map/rightMenu/potentialFloodHazard/btn.png') no-repeat;
  111. display: flex;
  112. justify-content: center;
  113. align-items: center;
  114. cursor: pointer;
  115. margin-left: 20px;
  116. color: #ffffff;
  117. font-size: 32px;
  118. }
  119. }
  120. .custom-input {
  121. height: 60px;
  122. line-height: 40px;
  123. }
  124. .custom-table {
  125. width: 100%;
  126. height: 1030px;
  127. overflow-y: auto;
  128. overflow-x: hidden;
  129. .table-content {
  130. height: 880px;
  131. overflow-y: auto;
  132. overflow-x: hidden;
  133. }
  134. .th {
  135. width: 100%;
  136. height: 151px;
  137. background: url('@/assets/images/map/rightMenu/th.png') no-repeat;
  138. background-size: 100% 100%;
  139. display: flex;
  140. }
  141. .tr {
  142. width: 100%;
  143. height: 139px;
  144. background: url('@/assets/images/map/rightMenu/td.png') no-repeat;
  145. background-size: 100% 100%;
  146. display: flex;
  147. padding-right: 20px;
  148. &:hover {
  149. background: url('@/assets/images/map/rightMenu/td_checked.png') no-repeat;
  150. background-size: 100% 100%;
  151. }
  152. }
  153. .td {
  154. flex: 1;
  155. color: #edfaff;
  156. font-size: 38px;
  157. display: flex;
  158. justify-content: center;
  159. align-items: center;
  160. cursor: pointer;
  161. }
  162. .td-text {
  163. /* 设置字体透明 */
  164. color: transparent;
  165. /* 使用 -webkit-background-clip 属性将背景剪裁至文本形状 */
  166. -webkit-background-clip: text;
  167. /* 非Webkit内核浏览器需要使用标准前缀 */
  168. background-clip: text;
  169. font-family: 'YouSheBiaoTiHei';
  170. /* 设置线性渐变,从红色渐变到蓝色 */
  171. background-image: linear-gradient(to bottom, #ffffff 50%, #3075d3 100%);
  172. font-size: 48px;
  173. }
  174. .text-green {
  175. background-image: linear-gradient(to bottom, #ffffff 50%, #40c75f 100%);
  176. }
  177. .text-danger {
  178. background-image: linear-gradient(to bottom, #ffffff 50%, #ff2f3c 100%);
  179. }
  180. }
  181. .text {
  182. font-size: 38px;
  183. color: #247dff;
  184. margin-right: 20px;
  185. &:last-child {
  186. margin-right: 0;
  187. }
  188. }
  189. </style>