AI销管
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

442 linhas
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">
  6. </u-search>
  7. </view>
  8. <view class="tab-box">
  9. <u-tabs-swiper ref="tabs" font-size="30" :bold="true" swiper-width="700" :current="activeClass"
  10. @change="clocktab()" inactive-color="#b1b1b1" active-color="#008ef2" :list="tablist"
  11. :is-scroll="true">
  12. </u-tabs-swiper>
  13. </view>
  14. </view>
  15. <view class="infoet">
  16. <view class="infoviewbox" v-for="(item,index) in newListdata" :key="index">
  17. <view class="infobox1">
  18. <view class="box1-zuo">领用人:{{item.accName || '--'}}</view>
  19. <view class="box1-you">
  20. <view class="you1" v-if="item.electricity>20">
  21. <view class="youimg" :style="{ height: item.electricity + '%' }"></view>
  22. </view>
  23. <view class="you11" v-if="item.electricity<20">
  24. <view class="youimg" :style="{ height: item.electricity + '%' }"></view>
  25. </view>
  26. <view class="you2">电量:
  27. <text v-if="item.electricity>20">{{item.electricity}}%</text>
  28. <text v-if="item.electricity<20" style="color: red;">{{item.electricity}}%</text>
  29. </view>
  30. <view class="you3">
  31. <image v-if="item.signalDevice==''" class="youimg"
  32. src="../../../static/images/newimg/xinhao0.png" mode=""></image>
  33. <image v-if="item.signalDevice<20 && item.signalDevice>0" class="youimg"
  34. src="../../../static/images/newimg/xinhao1.png" mode=""></image>
  35. <image v-if="item.signalDevice<50 && item.signalDevice>20" class="youimg"
  36. src="../../../static/images/newimg/xinhao2.png" mode=""></image>
  37. <image v-if="item.signalDevice<70 && item.signalDevice>50" class="youimg"
  38. src="../../../static/images/newimg/xinhao3.png" mode=""></image>
  39. <image v-if="item.signalDevice<90 && item.signalDevice>70" class="youimg"
  40. src="../../../static/images/newimg/xinhao4.png" mode=""></image>
  41. <image v-if="item.signalDevice<=100 && item.signalDevice>90" class="youimg"
  42. src="../../../static/images/newimg/xinhao5.png" mode=""></image>
  43. </view>
  44. <view class="you4" v-if="item.signalDevice=='' ">信号:0</view>
  45. <view class="you4" v-else>信号:{{item.signalDevice}}</view>
  46. </view>
  47. </view>
  48. <view class="infobox2">
  49. <view class="box2-zuo">设备编号</view>
  50. <view class="box2-you">{{item.imei}}</view>
  51. </view>
  52. <view class="infobox2">
  53. <view class="box2-zuo">录音状态</view>
  54. <view class="box2-you" v-if="item.audioStatus=='false'">关闭</view>
  55. <view class="box2-you" v-if="item.audioStatus=='true'">开启</view>
  56. <view class="box2-you" v-if="!item.audioStatus">关闭</view>
  57. </view>
  58. <view class="infobox2">
  59. <view class="box2-zuo">待上传</view>
  60. <template v-if="item.fileCount && item.fileCount > 0">
  61. <text class="stayupload box2-you">{{ item.fileCount }}条</text>
  62. </template>
  63. <template v-else>
  64. <text class="box2-you">0</text>
  65. </template>
  66. <!-- <view class="box2-you" v-if="item.audioUploadStatus=='false'">无上传</view>
  67. <view class="box2-you" v-if="item.audioUploadStatus=='true'">上传中</view>
  68. <view class="box2-you" v-if="item.audioUploadStatus=='' ">无上传</view> -->
  69. </view>
  70. <view class="infobox2">
  71. <view class="box2-zuo">更新时间</view>
  72. <view class="box2-you">{{item.updateTime}}</view>
  73. </view>
  74. <view class="infobox2" v-if="activeClass==1">
  75. <view class="box2-zuo">最后在线时间</view>
  76. <view class="box2-you" style="font-size: 28rpx;color: red;">{{item.updateTime | formatDate}}</view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. var util = require("../../../utils/util.js");
  84. export default {
  85. data() {
  86. return {
  87. tablist: [{
  88. name: "全部(0)",
  89. },
  90. {
  91. name: "在线(0)",
  92. },
  93. {
  94. name: "低电量(0)",
  95. },
  96. {
  97. name: "今日活跃(0)",
  98. },
  99. {
  100. name: "离线(0)",
  101. }
  102. ],
  103. activeClass: 0,
  104. pageNum: 1,
  105. pageSize: 20,
  106. imei: "",
  107. orgcode: "",
  108. newListdata: [],
  109. buildingID: '',
  110. jump: ''
  111. };
  112. },
  113. onReachBottom() {
  114. this.pageNum += 1;
  115. this.init()
  116. },
  117. onPullDownRefresh() {
  118. this.init()
  119. setTimeout(function() {
  120. uni.stopPullDownRefresh();
  121. }, 1000);
  122. },
  123. onLoad(options) {
  124. if (options.active) {
  125. this.activeClass = options.active
  126. } else {
  127. this.activeClass = 0
  128. }
  129. this.newListdata = []
  130. this.pageNum = 1;
  131. this.pageSize = 20;
  132. this.init()
  133. },
  134. filters: {
  135. formatDate: (dateTimeStamp) => {
  136. var newDate = new Date(dateTimeStamp.replace(/-/g, '/')).getTime();
  137. var minute = 1000 * 60;
  138. var hour = minute * 60;
  139. var day = hour * 24;
  140. var halfamonth = day * 15;
  141. var month = day * 30;
  142. var now = new Date().getTime();
  143. var diffValue = now - newDate;
  144. if (diffValue < 0) {
  145. return;
  146. }
  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. } else if (minC >= 1) {
  160. result = "" + parseInt(minC) + "分钟前";
  161. } else {
  162. result = "刚刚";
  163. }
  164. return result;
  165. }
  166. },
  167. methods: {
  168. shecs() {
  169. this.newListdata = []
  170. this.pageNum = 1;
  171. this.pageSize = 20;
  172. this.init()
  173. },
  174. // tab
  175. clocktab(index) {
  176. this.activeClass = index;
  177. this.newListdata = []
  178. this.pageNum = 1;
  179. this.pageSize = 20;
  180. this.init()
  181. },
  182. init() {
  183. this.buildingID = uni.getStorageSync('buildingID').id;
  184. const parames = {
  185. pageNum: this.pageNum,
  186. pageSize: this.pageSize,
  187. query: {
  188. imei: this.imei,
  189. onLine: this.activeClass,
  190. propertyId: this.buildingID,
  191. orderType: 1,
  192. accountId: uni.getStorageSync('weapp_session_userInfo_data').accountId,
  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. if (res.obj.list.results == null) {
  205. if (this.pageNum == 1) {
  206. return
  207. } else {
  208. uni.showToast({
  209. title: '已经到底了!',
  210. icon: 'none',
  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. min-height: 100vh;
  257. background: #FFFFFF;
  258. .header {
  259. position: sticky;
  260. top: var(--window-top);
  261. z-index: 999;
  262. }
  263. }
  264. .tab-box {
  265. width: 100%;
  266. .tab-item-wrap {
  267. height: 88rpx;
  268. line-height: 88rpx;
  269. display: flex;
  270. justify-content: space-around;
  271. font-size: 4vw;
  272. background: linear-gradient(180deg, #e5e5e5, #e5e5e5, rgba(229, 229, 229, 0)) bottom left no-repeat;
  273. background-size: 100% 1px;
  274. color: #959dad;
  275. }
  276. }
  277. .bottom {
  278. color: #209fff;
  279. position: relative;
  280. }
  281. .bottomLine {
  282. position: absolute;
  283. width: 156rpx;
  284. height: 6rpx;
  285. top: 80rpx;
  286. background-color: #298dff;
  287. border-radius: 8rpx 8rpx 0rpx 0rpx;
  288. left: 16rpx;
  289. }
  290. .infoet {
  291. width: 100%;
  292. .infoviewbox {
  293. width: 690rpx;
  294. padding-bottom: 20rpx;
  295. background: #FFFFFF;
  296. box-shadow: 0px 0px 8rpx 6rpx rgba(0, 0, 0, 0.06);
  297. border-radius: 20rpx;
  298. margin: 0 auto;
  299. margin-top: 20rpx;
  300. .infobox1 {
  301. width: 652rpx;
  302. height: 88rpx;
  303. border-bottom: 1rpx solid #D9D9D9;
  304. margin: 0 auto;
  305. display: flex;
  306. .box1-zuo {
  307. width: 50%;
  308. height: 100%;
  309. font-size: 30rpx;
  310. color: #333333;
  311. line-height: 88rpx;
  312. }
  313. .box1-you {
  314. width: 50%;
  315. height: 100%;
  316. display: flex;
  317. align-items: center;
  318. .you1 {
  319. width: 20rpx;
  320. height: 28rpx;
  321. margin-left: 32rpx;
  322. background-image: url(../../../static/images/newimg/dianliang.png);
  323. background-size: 100% 100%;
  324. display: flex;
  325. flex-direction: column-reverse;
  326. .youimg {
  327. width: 100%;
  328. background-color: #333333;
  329. }
  330. }
  331. .you11 {
  332. width: 20rpx;
  333. height: 28rpx;
  334. margin-left: 32rpx;
  335. background-image: url(../../../static/images/newimg/dianliang456.png);
  336. background-size: 100% 100%;
  337. display: flex;
  338. flex-direction: column-reverse;
  339. .youimg {
  340. width: 100%;
  341. background-color: red;
  342. }
  343. }
  344. .you2 {
  345. width: 114rpx;
  346. height: 30rpx;
  347. font-size: 20rpx;
  348. color: #333333;
  349. margin-left: 6rpx;
  350. }
  351. .you22 {
  352. width: 114rpx;
  353. height: 30rpx;
  354. font-size: 20rpx;
  355. color: red;
  356. margin-left: 6rpx;
  357. }
  358. .you3 {
  359. width: 30rpx;
  360. height: 28rpx;
  361. margin-left: 16rpx;
  362. .youimg {
  363. display: block;
  364. width: 30rpx;
  365. height: 28rpx;
  366. }
  367. }
  368. .you4 {
  369. width: 100rpx;
  370. height: 30rpx;
  371. font-size: 20rpx;
  372. color: #333333;
  373. margin-left: 6rpx;
  374. }
  375. }
  376. }
  377. .infobox2 {
  378. width: 652rpx;
  379. height: 33rpx;
  380. margin: 0 auto;
  381. display: flex;
  382. margin-top: 19rpx;
  383. .box2-zuo {
  384. width: 40%;
  385. height: 100%;
  386. line-height: 33rpx;
  387. font-size: 24rpx;
  388. color: #333333;
  389. }
  390. .box2-you {
  391. width: 60%;
  392. height: 100%;
  393. line-height: 33rpx;
  394. font-size: 24rpx;
  395. color: #333333;
  396. .stayupload {
  397. display: block;
  398. color: #F41313;
  399. }
  400. }
  401. }
  402. }
  403. }
  404. </style>