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.
 
 
 

463 rivejä
11 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">领用人:{{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. activeClass: 0,
  103. pageNum:1,
  104. pageSize:20,
  105. imei:"",
  106. orgcode:"",
  107. newListdata:[],
  108. buildingID:'',
  109. jump:''
  110. };
  111. },
  112. onReachBottom() {
  113. this.pageNum +=1;
  114. this.init()
  115. },
  116. onLoad(options) {
  117. if(options.active){
  118. this.activeClass=options.active
  119. }else{
  120. this.activeClass=0
  121. }
  122. this.newListdata=[]
  123. this.pageNum=1;
  124. this.pageSize=20;
  125. this.init()
  126. },
  127. filters: {
  128. formatDate: (dateTimeStamp) => {
  129. var newDate = new Date(dateTimeStamp.replace(/-/g, '/')).getTime();
  130. var minute = 1000 * 60;
  131. var hour = minute * 60;
  132. var day = hour * 24;
  133. var halfamonth = day * 15;
  134. var month = day * 30;
  135. var now = new Date().getTime();
  136. var diffValue = now - newDate;
  137. if(diffValue < 0){return;}
  138. var monthC =diffValue/month;
  139. var weekC =diffValue/(7*day);
  140. var dayC =diffValue/day;
  141. var hourC =diffValue/hour;
  142. var minC =diffValue/minute;
  143. var result = '';
  144. if(weekC>=1){
  145. result= "1周前";
  146. }else if(dayC>=1){
  147. result=""+ parseInt(dayC) +"天前";
  148. } else if(hourC>=1){
  149. result=""+ parseInt(hourC) +"小时前";
  150. }
  151. else if(minC>=1){
  152. result=""+ parseInt(minC) +"分钟前";
  153. }else{
  154. result="刚刚";
  155. }
  156. return result;
  157. }
  158. },
  159. methods: {
  160. shecs(){
  161. this.newListdata=[]
  162. this.pageNum=1;
  163. this.pageSize=20;
  164. this.init()
  165. },
  166. // tab
  167. clocktab(index) {
  168. this.activeClass=index;
  169. this.newListdata=[]
  170. this.pageNum=1;
  171. this.pageSize=20;
  172. this.init()
  173. },
  174. init(){
  175. this.buildingID=uni.getStorageSync('buildingID').id;
  176. const parames = {
  177. pageNum: this.pageNum,
  178. pageSize: this.pageSize,
  179. query:{
  180. imei:this.imei,
  181. onLine:this.activeClass,
  182. propertyId:this.buildingID,
  183. orderType:1
  184. }
  185. }
  186. if(this.activeClass==0){
  187. parames.query.onLine=null
  188. }
  189. this.$u.post("/equipment/apiFindByPage", parames).then(res => {
  190. this.tablist[0].name="全部("+res.allCount+")";
  191. this.tablist[1].name="在线("+res.eqOnLineCount+")";
  192. this.tablist[2].name="低电量("+res.lowElectricityCount+")";
  193. this.tablist[3].name="今日活跃("+res.activeCount+")";
  194. this.tablist[4].name="离线("+res.eqOffLineCount+")";
  195. if(res.obj.list.results==null){
  196. if (this.pageNum == 1){
  197. return
  198. }else{
  199. uni.showToast({
  200. title: '已经到底了!',
  201. duration: 2000
  202. });
  203. }
  204. }else{
  205. res.obj.list.results.forEach(item=>{
  206. if(item.onLine==0){
  207. item.signalDevice=0
  208. }
  209. if(item.electricity==''){
  210. item.electricity=0
  211. }
  212. if(item.electricity>100){
  213. item.electricity=100
  214. }
  215. let num=this.ascformatDate(item.updateTime)
  216. if(num>12){
  217. item.electricity=0
  218. }
  219. })
  220. if (this.pageNum == 1) {
  221. this.newListdata=res.obj.list.results
  222. } else {
  223. this.newListdata = [...this.newListdata, ...res.obj.list.results];
  224. }
  225. }
  226. })
  227. },
  228. ascformatDate(dateTimeStamp){
  229. let newDate = new Date(dateTimeStamp.replace(/-/g, '/')).getTime();
  230. let minute = 1000 * 60;
  231. let hour = minute * 60;
  232. let day = hour * 24;
  233. let halfamonth = day * 15;
  234. let month = day * 30;
  235. let now = new Date().getTime();
  236. let diffValue = now - newDate;
  237. let result =diffValue/hour;
  238. return result;
  239. }
  240. },
  241. }
  242. </script>
  243. <style lang="scss">
  244. .cented {
  245. width: 100%;
  246. height: 100vh;
  247. background: #FFFFFF;
  248. }
  249. // .infoinputbox {
  250. // width: 100%;
  251. // height: 61rpx;
  252. // position: relative;
  253. // .infoinput {
  254. // width: 690rpx;
  255. // height: 61rpx;
  256. // background: #DEDEDE;
  257. // border-radius: 31rpx;
  258. // margin: 0 auto;
  259. // color: #999999;
  260. // font-size: 26rpx;
  261. // padding-left: 20rpx;
  262. // }
  263. // .dingweiinfo {
  264. // width: 40rpx;
  265. // height: 61rpx;
  266. // background-color: #DEDEDE;
  267. // position: absolute;
  268. // top: 0rpx;
  269. // left: 660rpx;
  270. // display: flex;
  271. // align-items: center;
  272. // z-index: 1000;
  273. // .sehoimg {
  274. // display: block;
  275. // width: 40rpx;
  276. // height: 40rpx;
  277. // }
  278. // }
  279. // }
  280. .tab-box {
  281. width: 100%;
  282. .tab-item-wrap {
  283. height: 88rpx;
  284. line-height: 88rpx;
  285. display: flex;
  286. justify-content: space-around;
  287. font-size: 4vw;
  288. background: linear-gradient(180deg, #e5e5e5, #e5e5e5, rgba(229, 229, 229, 0)) bottom left no-repeat;
  289. background-size: 100% 1px;
  290. color: #959dad;
  291. }
  292. }
  293. .bottom {
  294. color: #209fff;
  295. position: relative;
  296. }
  297. .bottomLine {
  298. position: absolute;
  299. width: 156rpx;
  300. height: 6rpx;
  301. top: 80rpx;
  302. background-color: #298dff;
  303. border-radius: 8rpx 8rpx 0rpx 0rpx;
  304. left: 16rpx;
  305. }
  306. .infoet {
  307. width: 100%;
  308. .infoviewbox {
  309. width: 690rpx;
  310. padding-bottom: 20rpx;
  311. background: #FFFFFF;
  312. box-shadow: 0px 0px 8rpx 6rpx rgba(0, 0, 0, 0.06);
  313. border-radius: 20rpx;
  314. margin: 0 auto;
  315. margin-top: 20rpx;
  316. .infobox1 {
  317. width: 652rpx;
  318. height: 88rpx;
  319. border-bottom: 1rpx solid #D9D9D9;
  320. margin: 0 auto;
  321. display: flex;
  322. .box1-zuo {
  323. width: 50%;
  324. height: 100%;
  325. font-size: 30rpx;
  326. color: #333333;
  327. line-height: 88rpx;
  328. }
  329. .box1-you {
  330. width: 50%;
  331. height: 100%;
  332. display: flex;
  333. align-items: center;
  334. .you1 {
  335. width: 20rpx;
  336. height: 28rpx;
  337. margin-left: 32rpx;
  338. background-image: url(../../../static/images/newimg/dianliang.png);
  339. background-size: 100% 100%;
  340. display: flex;
  341. flex-direction: column-reverse;
  342. .youimg {
  343. width: 100%;
  344. background-color: #333333;
  345. }
  346. }
  347. .you11 {
  348. width: 20rpx;
  349. height: 28rpx;
  350. margin-left: 32rpx;
  351. background-image: url(../../../static/images/newimg/dianliang456.png);
  352. background-size: 100% 100%;
  353. display: flex;
  354. flex-direction: column-reverse;
  355. .youimg {
  356. width: 100%;
  357. background-color: red;
  358. }
  359. }
  360. .you2 {
  361. width: 114rpx;
  362. height: 30rpx;
  363. // border: 1rpx solid red;
  364. font-size: 20rpx;
  365. color: #333333;
  366. margin-left: 6rpx;
  367. }
  368. .you22 {
  369. width: 114rpx;
  370. height: 30rpx;
  371. // border: 1rpx solid red;
  372. font-size: 20rpx;
  373. color: red;
  374. margin-left: 6rpx;
  375. }
  376. .you3 {
  377. width: 30rpx;
  378. height: 28rpx;
  379. margin-left: 16rpx;
  380. .youimg {
  381. display: block;
  382. width: 30rpx;
  383. height: 28rpx;
  384. }
  385. }
  386. .you4 {
  387. width: 100rpx;
  388. height: 30rpx;
  389. // border: 1rpx solid red;
  390. font-size: 20rpx;
  391. color: #333333;
  392. margin-left: 6rpx;
  393. }
  394. }
  395. }
  396. .infobox2 {
  397. width: 652rpx;
  398. height: 33rpx;
  399. margin: 0 auto;
  400. display: flex;
  401. margin-top: 19rpx;
  402. .box2-zuo {
  403. width: 40%;
  404. height: 100%;
  405. line-height: 33rpx;
  406. font-size: 24rpx;
  407. color: #333333;
  408. text-indent: 6rpx;
  409. }
  410. .box2-you {
  411. width: 60%;
  412. height: 100%;
  413. line-height: 33rpx;
  414. font-size: 24rpx;
  415. color: #333333;
  416. text-indent: 30rpx;
  417. .stayupload {
  418. color: #F41313;
  419. }
  420. }
  421. }
  422. }
  423. }
  424. </style>