deviceList.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view>
  3. <ujp-navbar title="我的设备">
  4. </ujp-navbar>
  5. <view class="deviceDropdown">
  6. <u-dropdown>
  7. <u-dropdown-item v-model="value1" @change="change1" title="充电桩类型" :options="options1"></u-dropdown-item>
  8. <!-- <u-dropdown-item v-model="value2" @change="change2" title="所属站点" :options="options2"></u-dropdown-item>
  9. --> <u-dropdown-item v-model="value3" @change="change3" title="运行状态" :options="options3"></u-dropdown-item>
  10. </u-dropdown>
  11. </view>
  12. <view class="deviceList"
  13. >
  14. <view style="text-align: center;margin-top: 100px" v-if="!list.length">
  15. <img src="@/assets/img/blankpage.png">
  16. <view>查询为空</view>
  17. </view>
  18. <view v-for="(item ,index) in list" :key="item.id"
  19. @click="gotoUrl('pagesFinance/user/'+(item.type!=0?'pileManagement':'deviceDetails')+'?id='+item.id)"
  20. :class="{
  21. 'deviceList-bg1':item.type==1,
  22. 'deviceList-bg2':item.type==2,
  23. 'deviceList-bg3':item.type==0
  24. }"
  25. class="deviceList-item " >
  26. <view class="deviceList-head">{{item.name}} <span style="float: right;font-size: 12px;" class="iconfont more">详情&#xe600;</span></view>
  27. <view class="deviceList-main">{{item.deviceNo}} </view>
  28. <view class="deviceList-foot">
  29. <view class="deviceList-label">{{ options0[item.type].label}}</view>
  30. <view class="deviceList-label"
  31. :style="item.online?'':'color:red'"
  32. >{{item.online?'在线':'离线'}}</view>
  33. <!-- <view class="deviceList-label">{{item.roleName}}</view> -->
  34. </view>
  35. </view>
  36. <u-divider v-if="list.length&&list.length == recordsTotal" color="#B6BDC3" style="margin-top:20px;" bg-color="#f7f7f7">已经到底了</u-divider>
  37. <!-- <view class="deviceList-item deviceList-bg2">
  38. <view class="deviceList-head">荆鹏软件园充电站</view>
  39. <view class="deviceList-main">A0001</view>
  40. <view class="deviceList-foot">
  41. <view class="deviceList-label">直流快充</view>
  42. <view class="deviceList-label">正常运行</view>
  43. <view class="deviceList-label">市场服务 70%</view>
  44. </view>
  45. </view>
  46. <view class="deviceList-item deviceList-bg3">
  47. <view class="deviceList-head">荆鹏软件园充电站</view>
  48. <view class="deviceList-main">A0001</view>
  49. <view class="deviceList-foot">
  50. <view class="deviceList-label">直流快充</view>
  51. <view class="deviceList-label">正常运行</view>
  52. <view class="deviceList-label">市场服务 70%</view>
  53. </view>
  54. </view> -->
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import * as API from '@/apis/finance.js'
  60. export default {
  61. data() {
  62. return {
  63. form: {
  64. },
  65. startDate:'',
  66. endDate:'',
  67. pageIndex: 1,
  68. recordsTotal: 0,
  69. list: [],
  70. value1: -1,
  71. value2: -1,
  72. value3: -1,
  73. stationList:[],
  74. options0: [
  75. {
  76. label: '自行车充电',
  77. value: 0,
  78. },
  79. {
  80. label: '直流快充',
  81. value: 1,
  82. },
  83. {
  84. label: '交流慢充',
  85. value: 2,
  86. }
  87. ],
  88. options1: [{
  89. label: '全部',
  90. value: '-1',
  91. },
  92. {
  93. label: '自行车充电',
  94. value: 0,
  95. },
  96. {
  97. label: '交流慢充',
  98. value: 2,
  99. },
  100. {
  101. label: '直流快充',
  102. value: 1,
  103. }
  104. ],
  105. options2: [
  106. ],
  107. options3: [
  108. {
  109. label: '全部',
  110. value: -1,
  111. },
  112. {
  113. label: '在线',
  114. value: 1,
  115. },
  116. {
  117. label: '离线',
  118. value: 0,
  119. },
  120. ],
  121. }
  122. },
  123. onReachBottom() {
  124. if (this.list.length < this.recordsTotal) {
  125. this.myLoadmore();
  126. }
  127. },
  128. onLoad(op) {
  129. this.form.stationId=op.id
  130. },
  131. methods: {
  132. adddevice(){
  133. uni.redirectTo({
  134. url:'/pagesFinance/user/activatedChargingPile'
  135. })
  136. },
  137. change1(e){
  138. this.form.type=e
  139. if(e==-1){
  140. this.form.type=""
  141. }
  142. this.getList(true)
  143. },
  144. change2(e){
  145. this.form.stationId=e
  146. if(e==-1){
  147. this.form.stationId=""
  148. }
  149. this.getList(true)
  150. },
  151. change3(e){
  152. this.form.onlineStatus=e
  153. if(e==-1){
  154. this.form.onlineStatus=""
  155. }
  156. this.getList(true)
  157. },
  158. getStation() {
  159. API.stationList().then((res) => {
  160. this.options2.push({
  161. label: '全部',
  162. value:-1,
  163. })
  164. this.stationList = res.data.stationList
  165. this.stationList.forEach(item=>{
  166. this.options2.push({
  167. label: item.name,
  168. value: item.id,
  169. })
  170. })
  171. }).catch(error => {
  172. uni.showToast({
  173. title: error
  174. })
  175. })
  176. },
  177. myLoadmore() {
  178. this.pageIndex += 1;
  179. this.getList()
  180. },
  181. getList(bl) {
  182. uni.showLoading({
  183. title: "加载中",
  184. mask: true,
  185. })
  186. if (bl) {
  187. this.list = [];
  188. this.pageIndex = 1;
  189. }
  190. this.form.pageIndex= this.pageIndex
  191. API.devicesList(this.form).then((res) => {
  192. this.list = [
  193. ...this.list,
  194. ...res.data.data
  195. ];
  196. this.recordsTotal = res.data.recordsTotal
  197. uni.hideLoading()
  198. }).catch(error => {
  199. uni.showToast({
  200. title: error
  201. })
  202. })
  203. },
  204. onReady() {
  205. this.getStation()
  206. this.getList()
  207. }
  208. }
  209. }
  210. </script>
  211. <style>
  212. page{
  213. background-color: #F7F7F7;
  214. }
  215. </style>
  216. <style lang="scss" scoped>
  217. .deviceDropdown{
  218. background-color: #fff;
  219. }
  220. .deviceList-item{
  221. margin: 16px;
  222. border-radius: 8px;
  223. .deviceList-head{
  224. font-size: 16px;
  225. padding: 8px 16px;
  226. }
  227. .deviceList-main{
  228. overflow: hidden;
  229. text-overflow: ellipsis;
  230. white-space: nowrap;
  231. font-size: 28px;
  232. padding: 0px 16px;
  233. font-weight: bold;
  234. }
  235. .deviceList-foot{
  236. display: flex;
  237. align-items: center;
  238. flex-wrap: wrap;
  239. padding: 16px;
  240. .deviceList-label{
  241. background-color: #F0F2F4 ;
  242. padding: 4px 10px;
  243. margin: 1px;
  244. border-radius: 4px;
  245. }
  246. }
  247. }
  248. .deviceList-bg1{
  249. background:url(../../assets/img/charging_type_fast.png) no-repeat #fff;
  250. background-size:100%;
  251. }
  252. .deviceList-bg2{
  253. background:url(../../assets/img/charging_type_slow.png) no-repeat #fff;
  254. background-size:100%;
  255. }
  256. .deviceList-bg3{
  257. background:url(../../assets/img/charging_type_bike.png) no-repeat #fff;
  258. background-size:100%;
  259. }
  260. .deviceList-bg4{
  261. background:url(../../assets/img/charging_type_line.png) no-repeat #fff;
  262. background-size:100%;
  263. }
  264. </style>