AI销管
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.
 
 
 
 

469 lines
11 KiB

  1. <template>
  2. <view class="cented">
  3. <view class="header">
  4. <view style="width: 690rpx;margin: 0 auto;margin-top: 20rpx;">
  5. <u-search @search='shecs()' :show-action='false' placeholder="请输入设备编号或领用人进行搜索" v-model="imei"></u-search>
  6. </view>
  7. <view class="tab-box">
  8. <!-- <view class="tab-item-wrap">
  9. <view v-for="(item, index) in tablist" :key="index" :class="activeClass == index ? 'bottom' : ''" @tap="clocktab(index)">
  10. {{item.names}}( {{item.num}} )
  11. <view class="bottomLine" v-if="activeClass == index"></view>
  12. </view>
  13. </view> -->
  14. <u-tabs-swiper ref="tabs" font-size="30" :bold="true" swiper-width="700" :current="activeClass" @change="clocktab()"
  15. inactive-color="#b1b1b1" active-color="#008ef2" :list="tablist" :is-scroll="true">
  16. </u-tabs-swiper>
  17. </view>
  18. </view>
  19. <view class="infoet">
  20. <view class="infoviewbox" v-for="(item,index) in newListdata" :key="index">
  21. <view class="infobox1">
  22. <view class="box1-zuo">领用人:{{item.accName || '--'}}</view>
  23. <view class="box1-you">
  24. <view class="you1" v-if="item.electricity>20">
  25. <view class="youimg" :style="{ height: item.electricity + '%' }"></view>
  26. </view>
  27. <view class="you11" v-if="item.electricity<20">
  28. <view class="youimg" :style="{ height: item.electricity + '%' }"></view>
  29. </view>
  30. <view class="you2">电量:
  31. <text v-if="item.electricity>20">{{item.electricity}}%</text>
  32. <text v-if="item.electricity<20" style="color: red;">{{item.electricity}}%</text>
  33. </view>
  34. <view class="you3">
  35. <image v-if="item.signalDevice==''" class="youimg" src="../../../static/images/newimg/xinhao0.png" mode=""></image>
  36. <image v-if="item.signalDevice<20 && item.signalDevice>0" class="youimg" src="../../../static/images/newimg/xinhao1.png" mode=""></image>
  37. <image v-if="item.signalDevice<50 && item.signalDevice>20" class="youimg" src="../../../static/images/newimg/xinhao2.png" mode=""></image>
  38. <image v-if="item.signalDevice<70 && item.signalDevice>50" class="youimg" src="../../../static/images/newimg/xinhao3.png" mode=""></image>
  39. <image v-if="item.signalDevice<90 && item.signalDevice>70" class="youimg" src="../../../static/images/newimg/xinhao4.png" mode=""></image>
  40. <image v-if="item.signalDevice<=100 && item.signalDevice>90" class="youimg" src="../../../static/images/newimg/xinhao5.png" mode=""></image>
  41. </view>
  42. <view class="you4" v-if="item.signalDevice=='' ">信号:0</view>
  43. <view class="you4" v-else>信号:{{item.signalDevice}}</view>
  44. </view>
  45. </view>
  46. <view class="infobox2">
  47. <view class="box2-zuo">设备编号</view>
  48. <view class="box2-you">{{item.imei}}</view>
  49. </view>
  50. <view class="infobox2">
  51. <view class="box2-zuo">录音状态</view>
  52. <view class="box2-you" v-if="item.audioStatus=='false'">关闭</view>
  53. <view class="box2-you" v-if="item.audioStatus=='true'">开启</view>
  54. <view class="box2-you" v-if="item.audioStatus=='' ">关闭</view>
  55. </view>
  56. <view class="infobox2">
  57. <view class="box2-zuo">待上传</view>
  58. <template v-if="item.fileCount && item.fileCount > 0">
  59. <text class="stayupload">{{ item.fileCount }}条</text>
  60. </template>
  61. <template v-else>
  62. <text class="box2-you">0</text>
  63. </template>
  64. <!-- <view class="box2-you" v-if="item.audioUploadStatus=='false'">无上传</view>
  65. <view class="box2-you" v-if="item.audioUploadStatus=='true'">上传中</view>
  66. <view class="box2-you" v-if="item.audioUploadStatus=='' ">无上传</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. min-height: 100vh;
  247. background: #FFFFFF;
  248. .header {
  249. position: sticky;
  250. top: var(--window-top);
  251. z-index: 999;
  252. }
  253. }
  254. // .infoinputbox {
  255. // width: 100%;
  256. // height: 61rpx;
  257. // position: relative;
  258. // .infoinput {
  259. // width: 690rpx;
  260. // height: 61rpx;
  261. // background: #DEDEDE;
  262. // border-radius: 31rpx;
  263. // margin: 0 auto;
  264. // color: #999999;
  265. // font-size: 26rpx;
  266. // padding-left: 20rpx;
  267. // }
  268. // .dingweiinfo {
  269. // width: 40rpx;
  270. // height: 61rpx;
  271. // background-color: #DEDEDE;
  272. // position: absolute;
  273. // top: 0rpx;
  274. // left: 660rpx;
  275. // display: flex;
  276. // align-items: center;
  277. // z-index: 1000;
  278. // .sehoimg {
  279. // display: block;
  280. // width: 40rpx;
  281. // height: 40rpx;
  282. // }
  283. // }
  284. // }
  285. .tab-box {
  286. width: 100%;
  287. .tab-item-wrap {
  288. height: 88rpx;
  289. line-height: 88rpx;
  290. display: flex;
  291. justify-content: space-around;
  292. font-size: 4vw;
  293. background: linear-gradient(180deg, #e5e5e5, #e5e5e5, rgba(229, 229, 229, 0)) bottom left no-repeat;
  294. background-size: 100% 1px;
  295. color: #959dad;
  296. }
  297. }
  298. .bottom {
  299. color: #209fff;
  300. position: relative;
  301. }
  302. .bottomLine {
  303. position: absolute;
  304. width: 156rpx;
  305. height: 6rpx;
  306. top: 80rpx;
  307. background-color: #298dff;
  308. border-radius: 8rpx 8rpx 0rpx 0rpx;
  309. left: 16rpx;
  310. }
  311. .infoet {
  312. width: 100%;
  313. .infoviewbox {
  314. width: 690rpx;
  315. padding-bottom: 20rpx;
  316. background: #FFFFFF;
  317. box-shadow: 0px 0px 8rpx 6rpx rgba(0, 0, 0, 0.06);
  318. border-radius: 20rpx;
  319. margin: 0 auto;
  320. margin-top: 20rpx;
  321. .infobox1 {
  322. width: 652rpx;
  323. height: 88rpx;
  324. border-bottom: 1rpx solid #D9D9D9;
  325. margin: 0 auto;
  326. display: flex;
  327. .box1-zuo {
  328. width: 50%;
  329. height: 100%;
  330. font-size: 30rpx;
  331. color: #333333;
  332. line-height: 88rpx;
  333. }
  334. .box1-you {
  335. width: 50%;
  336. height: 100%;
  337. display: flex;
  338. align-items: center;
  339. .you1 {
  340. width: 20rpx;
  341. height: 28rpx;
  342. margin-left: 32rpx;
  343. background-image: url(../../../static/images/newimg/dianliang.png);
  344. background-size: 100% 100%;
  345. display: flex;
  346. flex-direction: column-reverse;
  347. .youimg {
  348. width: 100%;
  349. background-color: #333333;
  350. }
  351. }
  352. .you11 {
  353. width: 20rpx;
  354. height: 28rpx;
  355. margin-left: 32rpx;
  356. background-image: url(../../../static/images/newimg/dianliang456.png);
  357. background-size: 100% 100%;
  358. display: flex;
  359. flex-direction: column-reverse;
  360. .youimg {
  361. width: 100%;
  362. background-color: red;
  363. }
  364. }
  365. .you2 {
  366. width: 114rpx;
  367. height: 30rpx;
  368. // border: 1rpx solid red;
  369. font-size: 20rpx;
  370. color: #333333;
  371. margin-left: 6rpx;
  372. }
  373. .you22 {
  374. width: 114rpx;
  375. height: 30rpx;
  376. // border: 1rpx solid red;
  377. font-size: 20rpx;
  378. color: red;
  379. margin-left: 6rpx;
  380. }
  381. .you3 {
  382. width: 30rpx;
  383. height: 28rpx;
  384. margin-left: 16rpx;
  385. .youimg {
  386. display: block;
  387. width: 30rpx;
  388. height: 28rpx;
  389. }
  390. }
  391. .you4 {
  392. width: 100rpx;
  393. height: 30rpx;
  394. // border: 1rpx solid red;
  395. font-size: 20rpx;
  396. color: #333333;
  397. margin-left: 6rpx;
  398. }
  399. }
  400. }
  401. .infobox2 {
  402. width: 652rpx;
  403. height: 33rpx;
  404. margin: 0 auto;
  405. display: flex;
  406. margin-top: 19rpx;
  407. .box2-zuo {
  408. width: 40%;
  409. height: 100%;
  410. line-height: 33rpx;
  411. font-size: 24rpx;
  412. color: #333333;
  413. text-indent: 6rpx;
  414. }
  415. .box2-you {
  416. width: 60%;
  417. height: 100%;
  418. line-height: 33rpx;
  419. font-size: 24rpx;
  420. color: #333333;
  421. text-indent: 30rpx;
  422. .stayupload {
  423. color: #F41313;
  424. }
  425. }
  426. }
  427. }
  428. }
  429. </style>