云链智安app
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.vue 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view class="container">
  3. <view class="account_number">
  4. <view class="password">
  5. <input class="weui-input" confirm-type="search" :value="account" :placeholder="$t('devices.enterId')" @input="bindKeyInput1"/>
  6. <image class="login_imgae1" src="/static/search.png" mode="" @click="getmuitiStationinfo"/>
  7. </view>
  8. </view>
  9. <view class="toptabbar">
  10. <top-tabbar
  11. :tabIndex="tabIndex"
  12. :tabBars="[
  13. { name: $t('devices.allStations'), id: 0 },
  14. { name: $t('devices.onlineStations'), id: 1 },
  15. { name: $t('devices.offlineStations'), id: 2 }
  16. ]"
  17. @toggleToptab="toggleTab"
  18. selectedBottomColor="#30c58d"
  19. selectedTextColor="#343434"
  20. textColor="#7d7e80"
  21. bgColor="#ffffff"
  22. ></top-tabbar>
  23. </view>
  24. <view class="data_list">
  25. <!-- 空数据提示 -->
  26. <view v-if="muitiStationinfo.length === 0" class="empty-tip">{{$t('devices.noData')}}</view>
  27. <!-- 列表渲染 -->
  28. <view v-else v-for="(item, index) in muitiStationinfo" :key="item.id || index">
  29. <view class="card_box" v-show="tabIndex==0" @click="powerstation(item)">
  30. <image class="card_image" :src="item.absoluteStationPicUrl" mode="aspectFill" lazy-load/>
  31. <view class="card_title">
  32. <view class="card_title1">
  33. {{item.stationName}}
  34. </view>
  35. <view class="card_title2">
  36. {{item.detailedaddress}}
  37. </view>
  38. <view class="card_title3">
  39. {{item.installedCap}}kW / {{item.installedPower}}kWh
  40. </view>
  41. </view>
  42. </view>
  43. <view class="card_box" v-show="tabIndex==1&&item.onlineStatus==1">
  44. <image class="card_image" :src="item.absoluteStationPicUrl" mode="aspectFill" lazy-load/>
  45. <view class="card_title">
  46. <view class="card_title1">
  47. {{item.stationName}}
  48. </view>
  49. <view class="card_title2">
  50. {{item.detailedaddress}}
  51. </view>
  52. <view class="card_title3">
  53. {{item.installedCap}}kW / {{item.installedPower}}kWh
  54. </view>
  55. </view>
  56. </view>
  57. <view class="card_box" v-show="tabIndex==2&&item.onlineStatus==0">
  58. <image class="card_image" :src="item.absoluteStationPicUrl" mode="aspectFill" lazy-load/>
  59. <view class="card_title">
  60. <view class="card_title1">
  61. {{item.stationName}}
  62. </view>
  63. <view class="card_title2">
  64. {{item.detailedaddress}}
  65. </view>
  66. <view class="card_title3">
  67. {{item.installedCap}}kW / {{item.installedPower}}kWh
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script setup>
  76. import { ref,onMounted } from 'vue';
  77. import topTabbar from '@/components/top-tabbar.vue';
  78. import request from '@/utils/request';
  79. import { useI18n } from 'vue-i18n'
  80. import { onLoad } from '@dcloudio/uni-app';
  81. const { t } = useI18n()
  82. const account = ref('')
  83. const bindKeyInput1 = (e) => {
  84. console.log(e.detail.value);
  85. account.value = e.detail.value
  86. getmuitiStationinfo(); // 电站接口
  87. };
  88. // 选中标签的索引
  89. const tabIndex = ref(0);
  90. // 导航栏标签列表
  91. const tabBars = ref([
  92. { name: '全部电站', id: 0 },
  93. { name: '在线电站', id: 1 },
  94. { name: '离线电站', id: 2 }
  95. ]);
  96. // 切换标签
  97. const toggleTab = (index) => {
  98. tabIndex.value = index
  99. };
  100. const powerstation = (item) => {
  101. uni.navigateTo({
  102. url:`/pages/powerstation/index?stationName=${item.stationName}&id=${item.powerId}&date=${item.operationDate}`
  103. })
  104. };
  105. onLoad((options) => {
  106. console.log('页面加载,参数为:', options);
  107. tabIndex.value = options.type*1
  108. });
  109. onMounted(() => {
  110. uni.setNavigationBarTitle({
  111. title:t('devices.listTitle'),
  112. });
  113. getmuitiStationinfo(); // 电站接口
  114. });
  115. const muitiStationinfo = ref([])
  116. const getmuitiStationinfo = async ()=>{
  117. try {
  118. const response = await request({
  119. url: '/muitiStation/page/info',
  120. method: 'POST',
  121. header:{'Content-Type': 'application/x-www-form-urlencoded'},
  122. data:{
  123. state: '',
  124. city: '',
  125. country:'' ,
  126. county: '',
  127. keyword:account.value,
  128. keywordCategory: 0,
  129. countryCode: '',
  130. provinceCode: '',
  131. cityCode: '',
  132. countyCode: '',
  133. pn: 1,
  134. ps: 99,
  135. onlineStatus:''
  136. }
  137. });
  138. console.log(response.data.data.records);
  139. muitiStationinfo.value = response.data.data.records
  140. } catch (error) {
  141. console.error('登录失败:', error);
  142. }
  143. };
  144. </script>
  145. <style scoped>
  146. .uni-page{
  147. width: 100%;
  148. height: 100%;
  149. }
  150. .container {
  151. height: 100%;
  152. background: linear-gradient(to bottom, #007545 -40%, #f0f5f5 40%, #f0f5f5 100%);
  153. box-sizing: border-box;
  154. display: flex;
  155. flex-direction: column;
  156. }
  157. .account_number{
  158. width: 100%;
  159. display: flex;
  160. justify-content: center;
  161. }
  162. .account{
  163. font-size: 32rpx;
  164. }
  165. .login_imgae1{
  166. margin-right: 20rpx;
  167. width: 40rpx;
  168. height: 40rpx;
  169. }
  170. .weui-input{
  171. flex: 1;
  172. height: 80rpx;
  173. }
  174. .password{
  175. width: 90%;
  176. display: flex;
  177. align-items: center;
  178. font-size: 28rpx;
  179. padding:0rpx 20rpx;
  180. border:1rpx #cccccc solid;
  181. box-sizing: border-box;
  182. border-radius: 100rpx;
  183. background-color: #f0f5f5;
  184. }
  185. .toptabbar {
  186. width: 100%;
  187. height: 80rpx;
  188. margin-top: 20px;
  189. padding: 10rpx 20rpx;
  190. box-sizing: border-box;
  191. }
  192. .data_list {
  193. width: 100%;
  194. flex: 1;
  195. overflow-y: auto;
  196. display: flex;
  197. flex-direction: column;
  198. padding: 10px;
  199. box-sizing: border-box;
  200. }
  201. .empty-tip {
  202. text-align: center;
  203. color: #999;
  204. font-size: 14px;
  205. padding: 20px;
  206. }
  207. .card{
  208. width: 90%;
  209. }
  210. .card_image{
  211. width: 160rpx;
  212. height: 160rpx;
  213. border-radius: 10rpx;
  214. }
  215. .card_box{
  216. width: 100%;
  217. height: 200rpx;
  218. box-sizing: border-box;
  219. border-radius: 10rpx;
  220. background-color: #ffffff;
  221. display: flex;
  222. align-items: center;
  223. padding: 30rpx;
  224. margin-top: 20rpx;
  225. }
  226. .card_title{
  227. flex: 1;
  228. margin-left: 20rpx;
  229. display: flex;
  230. flex-direction: column;
  231. }
  232. .card_title1{
  233. font-size: 36rpx;
  234. }
  235. .card_title2{
  236. font-size: 28rpx;
  237. color: #ccc;
  238. margin-top: 10rpx;
  239. }
  240. .card_title3{
  241. font-size: 28rpx;
  242. color: #ccc;
  243. margin-top: 8rpx;
  244. }
  245. .uni-top-tabbar{
  246. height: 100rpx;
  247. }
  248. </style>