You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

470 lines
12 KiB

  1. <template>
  2. <view class="cented">
  3. <view style="width: 690rpx;margin: 0 auto;margin-top: 20rpx;">
  4. <u-search @search='shecs()' :show-action='false' placeholder="请输入设备编号或领用人进行搜索" v-model="imei"></u-search>
  5. </view>
  6. <view class="tab-box">
  7. <!-- <view class="tab-item-wrap">
  8. <view v-for="(item, index) in tablist" :key="index" :class="activeClass == index ? 'bottom' : ''" @tap="clocktab(index)">
  9. {{item.names}}( {{item.num}} )
  10. <view class="bottomLine" v-if="activeClass == index"></view>
  11. </view>
  12. </view> -->
  13. <u-tabs-swiper ref="tabs" font-size="30" :bold="true" swiper-width="700" :current="activeClass" @change="clocktab()"
  14. inactive-color="#b1b1b1" active-color="#008ef2" :list="tablist" :is-scroll="true">
  15. </u-tabs-swiper>
  16. </view>
  17. <view class="infoet">
  18. <view class="infoviewbox" v-for="(item,index) in newListdata" :key="index">
  19. <view class="infobox1">
  20. <view class="box1-zuo u-line-1">领用人:{{item.accName}}</view>
  21. <view class="box1-you">
  22. <view class="you1" v-if="item.electricity>20">
  23. <view class="youimg" :style="{ height: item.electricity + '%' }"></view>
  24. </view>
  25. <view class="you11" v-if="item.electricity<20">
  26. <view class="youimg" :style="{ height: item.electricity + '%' }"></view>
  27. </view>
  28. <view class="you2">电量:
  29. <text v-if="item.electricity>20">{{item.electricity}}%</text>
  30. <text v-if="item.electricity<20" style="color: red;">{{item.electricity}}%</text>
  31. </view>
  32. <view class="you3">
  33. <image v-if="item.signalDevice==''" class="youimg" src="../../../static/images/newimg/xinhao0.png" mode=""></image>
  34. <image v-if="item.signalDevice<20 && item.signalDevice>0" class="youimg" src="../../../static/images/newimg/xinhao1.png" mode=""></image>
  35. <image v-if="item.signalDevice<50 && item.signalDevice>=20" class="youimg" src="../../../static/images/newimg/xinhao2.png" mode=""></image>
  36. <image v-if="item.signalDevice<70 && item.signalDevice>=50" class="youimg" src="../../../static/images/newimg/xinhao3.png" mode=""></image>
  37. <image v-if="item.signalDevice<90 && item.signalDevice>=70" class="youimg" src="../../../static/images/newimg/xinhao4.png" mode=""></image>
  38. <image v-if="item.signalDevice<=100 && item.signalDevice>=90" class="youimg" src="../../../static/images/newimg/xinhao5.png" mode=""></image>
  39. </view>
  40. <view class="you4" v-if="item.signalDevice=='' ">信号:0</view>
  41. <view class="you4" v-else>信号:{{item.signalDevice}}</view>
  42. </view>
  43. </view>
  44. <view class="infobox2">
  45. <view class="box2-zuo">设备编号</view>
  46. <view class="box2-you">{{item.imei}}</view>
  47. </view>
  48. <view class="infobox2">
  49. <view class="box2-zuo">录音状态</view>
  50. <view class="box2-you" v-if="item.audioStatus=='false'">关闭</view>
  51. <view class="box2-you" v-if="item.audioStatus=='true'">开启</view>
  52. <view class="box2-you" v-if="item.audioStatus=='' ">关闭</view>
  53. </view>
  54. <view class="infobox2">
  55. <view class="box2-zuo">待上传</view>
  56. <view class="box2-you"><!--
  57. <template v-if="item.audioUploadStatus=='false'">无上传</template>
  58. <template v-if="item.audioUploadStatus=='true'">上传中</template>
  59. <template v-if="item.audioUploadStatus=='' ">无上传</template> -->
  60. <template v-if="item.fileCount && item.fileCount > 0">
  61. <text class="stayupload">{{ item.fileCount }}条</text>
  62. </template>
  63. <template v-else>
  64. 0
  65. </template>
  66. </view>
  67. </view>
  68. <view class="infobox2">
  69. <view class="box2-zuo">更新时间</view>
  70. <view class="box2-you">{{item.updateTime}}</view>
  71. </view>
  72. <view class="infobox2" v-if="activeClass==1">
  73. <view class="box2-zuo">最后在线时间</view>
  74. <view class="box2-you" style="font-size: 28rpx;color: red;">{{item.updateTime | formatDate}}</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. var util = require("../../../utils/util.js");
  82. export default {
  83. data() {
  84. return {
  85. tablist: [
  86. {
  87. name: "全部(0)",
  88. },
  89. {
  90. name: "在线(0)",
  91. },
  92. {
  93. name: "低电量(0)",
  94. },
  95. {
  96. name: "今日活跃(0)",
  97. },
  98. {
  99. name: "离线(0)",
  100. },
  101. {
  102. name: '待上传(0)'
  103. }
  104. ],
  105. activeClass: 0,
  106. pageNum:1,
  107. pageSize:20,
  108. imei:"",
  109. orgcode:"",
  110. newListdata:[],
  111. buildingID:'',
  112. jump:''
  113. };
  114. },
  115. onReachBottom() {
  116. this.pageNum +=1;
  117. this.init()
  118. },
  119. onPullDownRefresh(){
  120. this.init()
  121. setTimeout(function () {
  122. uni.stopPullDownRefresh();
  123. }, 1000);
  124. },
  125. onLoad(options) {
  126. if(options.active){
  127. this.activeClass=options.active
  128. }else{
  129. this.activeClass=0
  130. }
  131. this.newListdata=[]
  132. this.pageNum=1;
  133. this.pageSize=20;
  134. this.init()
  135. },
  136. filters: {
  137. formatDate: (dateTimeStamp) => {
  138. var newDate = new Date(dateTimeStamp.replace(/-/g, '/')).getTime();
  139. var minute = 1000 * 60;
  140. var hour = minute * 60;
  141. var day = hour * 24;
  142. var halfamonth = day * 15;
  143. var month = day * 30;
  144. var now = new Date().getTime();
  145. var diffValue = now - newDate;
  146. if(diffValue < 0){return;}
  147. var monthC =diffValue/month;
  148. var weekC =diffValue/(7*day);
  149. var dayC =diffValue/day;
  150. var hourC =diffValue/hour;
  151. var minC =diffValue/minute;
  152. var result = '';
  153. if(weekC>=1){
  154. result= "1周前";
  155. }else if(dayC>=1){
  156. result=""+ parseInt(dayC) +"天前";
  157. } else if(hourC>=1){
  158. result=""+ parseInt(hourC) +"小时前";
  159. }
  160. else if(minC>=1){
  161. result=""+ parseInt(minC) +"分钟前";
  162. }else{
  163. result="刚刚";
  164. }
  165. return result;
  166. }
  167. },
  168. methods: {
  169. shecs(){
  170. this.newListdata=[]
  171. this.pageNum=1;
  172. this.pageSize=20;
  173. this.init()
  174. },
  175. // tab
  176. clocktab(index) {
  177. this.activeClass=index;
  178. this.newListdata=[]
  179. this.pageNum=1;
  180. this.pageSize=20;
  181. this.init()
  182. },
  183. init(){
  184. this.buildingID=uni.getStorageSync('buildingID').id;
  185. const parames = {
  186. pageNum: this.pageNum,
  187. pageSize: this.pageSize,
  188. query:{
  189. imei:this.imei,
  190. onLine:this.activeClass,
  191. propertyId:this.buildingID,
  192. orderType:1
  193. }
  194. }
  195. if(this.activeClass==0){
  196. parames.query.onLine=null
  197. }
  198. this.$u.post("/equipment/apiFindByPage", parames).then(res => {
  199. this.tablist[0].name="全部("+res.allCount+")";
  200. this.tablist[1].name="在线("+res.eqOnLineCount+")";
  201. this.tablist[2].name="低电量("+res.lowElectricityCount+")";
  202. this.tablist[3].name="今日活跃("+res.activeCount+")";
  203. this.tablist[4].name="离线("+res.eqOffLineCount+")";
  204. this.tablist[5].name="待上传("+res.fileCount+")";
  205. if(res.obj.list.results==null){
  206. if (this.pageNum == 1){
  207. return
  208. }else{
  209. uni.showToast({
  210. title: '已经到底了!',
  211. duration: 2000
  212. });
  213. }
  214. }else{
  215. res.obj.list.results.forEach(item=>{
  216. if(item.onLine==0){
  217. item.signalDevice=0
  218. }
  219. if(item.electricity==''){
  220. item.electricity=0
  221. }
  222. if(item.electricity>100){
  223. item.electricity=100
  224. }
  225. let num=this.ascformatDate(item.updateTime)
  226. if(num>12){
  227. item.electricity=0
  228. }
  229. })
  230. if (this.pageNum == 1) {
  231. this.newListdata=res.obj.list.results
  232. } else {
  233. this.newListdata = [...this.newListdata, ...res.obj.list.results];
  234. }
  235. }
  236. })
  237. },
  238. ascformatDate(dateTimeStamp){
  239. let newDate = new Date(dateTimeStamp.replace(/-/g, '/')).getTime();
  240. let minute = 1000 * 60;
  241. let hour = minute * 60;
  242. let day = hour * 24;
  243. let halfamonth = day * 15;
  244. let month = day * 30;
  245. let now = new Date().getTime();
  246. let diffValue = now - newDate;
  247. let result =diffValue/hour;
  248. return result;
  249. }
  250. },
  251. }
  252. </script>
  253. <style lang="scss">
  254. .cented {
  255. width: 100%;
  256. height: 100vh;
  257. background: #FFFFFF;
  258. }
  259. // .infoinputbox {
  260. // width: 100%;
  261. // height: 61rpx;
  262. // position: relative;
  263. // .infoinput {
  264. // width: 690rpx;
  265. // height: 61rpx;
  266. // background: #DEDEDE;
  267. // border-radius: 31rpx;
  268. // margin: 0 auto;
  269. // color: #999999;
  270. // font-size: 26rpx;
  271. // padding-left: 20rpx;
  272. // }
  273. // .dingweiinfo {
  274. // width: 40rpx;
  275. // height: 61rpx;
  276. // background-color: #DEDEDE;
  277. // position: absolute;
  278. // top: 0rpx;
  279. // left: 660rpx;
  280. // display: flex;
  281. // align-items: center;
  282. // z-index: 1000;
  283. // .sehoimg {
  284. // display: block;
  285. // width: 40rpx;
  286. // height: 40rpx;
  287. // }
  288. // }
  289. // }
  290. .tab-box {
  291. width: 100%;
  292. .tab-item-wrap {
  293. height: 88rpx;
  294. line-height: 88rpx;
  295. display: flex;
  296. justify-content: space-around;
  297. font-size: 4vw;
  298. background: linear-gradient(180deg, #e5e5e5, #e5e5e5, rgba(229, 229, 229, 0)) bottom left no-repeat;
  299. background-size: 100% 1px;
  300. color: #959dad;
  301. }
  302. }
  303. .bottom {
  304. color: #209fff;
  305. position: relative;
  306. }
  307. .bottomLine {
  308. position: absolute;
  309. width: 156rpx;
  310. height: 6rpx;
  311. top: 80rpx;
  312. background-color: #298dff;
  313. border-radius: 8rpx 8rpx 0rpx 0rpx;
  314. left: 16rpx;
  315. }
  316. .infoet {
  317. width: 100%;
  318. .infoviewbox {
  319. width: 690rpx;
  320. padding-bottom: 20rpx;
  321. background: #FFFFFF;
  322. box-shadow: 0px 0px 8rpx 6rpx rgba(0, 0, 0, 0.06);
  323. border-radius: 20rpx;
  324. margin: 0 auto;
  325. margin-top: 20rpx;
  326. .infobox1 {
  327. width: 652rpx;
  328. height: 88rpx;
  329. border-bottom: 1rpx solid #D9D9D9;
  330. margin: 0 auto;
  331. display: flex;
  332. .box1-zuo {
  333. width: 50%;
  334. height: 100%;
  335. font-size: 30rpx;
  336. color: #333333;
  337. line-height: 88rpx;
  338. }
  339. .box1-you {
  340. width: 50%;
  341. height: 100%;
  342. display: flex;
  343. align-items: center;
  344. .you1 {
  345. width: 20rpx;
  346. height: 28rpx;
  347. margin-left: 32rpx;
  348. background-image: url(../../../static/images/newimg/dianliang.png);
  349. background-size: 100% 100%;
  350. display: flex;
  351. flex-direction: column-reverse;
  352. .youimg {
  353. width: 100%;
  354. background-color: #333333;
  355. }
  356. }
  357. .you11 {
  358. width: 20rpx;
  359. height: 28rpx;
  360. margin-left: 32rpx;
  361. background-image: url(../../../static/images/newimg/dianliang456.png);
  362. background-size: 100% 100%;
  363. display: flex;
  364. flex-direction: column-reverse;
  365. .youimg {
  366. width: 100%;
  367. background-color: red;
  368. }
  369. }
  370. .you2 {
  371. width: 114rpx;
  372. height: 30rpx;
  373. // border: 1rpx solid red;
  374. font-size: 20rpx;
  375. color: #333333;
  376. margin-left: 6rpx;
  377. }
  378. .you22 {
  379. width: 114rpx;
  380. height: 30rpx;
  381. // border: 1rpx solid red;
  382. font-size: 20rpx;
  383. color: red;
  384. margin-left: 6rpx;
  385. }
  386. .you3 {
  387. width: 30rpx;
  388. height: 28rpx;
  389. margin-left: 16rpx;
  390. .youimg {
  391. display: block;
  392. width: 30rpx;
  393. height: 28rpx;
  394. }
  395. }
  396. .you4 {
  397. width: 100rpx;
  398. height: 30rpx;
  399. // border: 1rpx solid red;
  400. font-size: 20rpx;
  401. color: #333333;
  402. margin-left: 6rpx;
  403. }
  404. }
  405. }
  406. .infobox2 {
  407. width: 652rpx;
  408. height: 33rpx;
  409. margin: 0 auto;
  410. display: flex;
  411. margin-top: 19rpx;
  412. .box2-zuo {
  413. width: 40%;
  414. height: 100%;
  415. line-height: 33rpx;
  416. font-size: 24rpx;
  417. color: #333333;
  418. text-indent: 6rpx;
  419. }
  420. .box2-you {
  421. width: 60%;
  422. height: 100%;
  423. line-height: 33rpx;
  424. font-size: 24rpx;
  425. color: #333333;
  426. text-indent: 30rpx;
  427. .stayupload {
  428. color: #F41313;
  429. }
  430. }
  431. }
  432. }
  433. }
  434. </style>