upLineRecord.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view v-show="show">
  3. <view class="item" hover-class="navigator-hover" v-for="item in list" :key="item.rowindex">
  4. <view class="title">{{ item.createdate || ' --' }}</view>
  5. <view class="row u-line-3">
  6. {{ item.action == 'off' ? '离线' : '在线' }}
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. let paging = {}
  13. export default {
  14. name: "uploadRecord",
  15. props: {
  16. w_deviceid: String
  17. },
  18. data() {
  19. return {
  20. show: false,
  21. uninitialized: true,
  22. list: [],
  23. "where": {
  24. "begindate": "",
  25. "enddate": ""
  26. }
  27. }
  28. },
  29. methods: {
  30. getList(init = false) {
  31. if (init) paging = {
  32. pageNumber: 1,
  33. pageTotal: 1,
  34. };
  35. return new Promise((resolve) => {
  36. if (paging.pageNumber > paging.pageTotal) return resolve()
  37. this.$Http.basic({
  38. "id": 20231123163602,
  39. "content": {
  40. "type": 1,
  41. "w_deviceid": this.w_deviceid,
  42. ...paging,
  43. "where": this.where
  44. }
  45. }).then(res => {
  46. console.log('上线记录', res)
  47. resolve(!this.cutoff(res.msg));
  48. if (this.cutoff(res.msg)) return;
  49. paging.pageNumber = res.pageNumber + 1;
  50. paging.pageTotal = res.pageTotal;
  51. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data)
  52. })
  53. })
  54. }
  55. },
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .item {
  60. width: 355px;
  61. margin: 0 auto 10px;
  62. padding: 10px;
  63. background: #fff;
  64. border-radius: 4px;
  65. box-sizing: border-box;
  66. .title {
  67. line-height: 21px;
  68. font-size: 15px;
  69. font-family: PingFang SC-Medium, PingFang SC;
  70. font-weight: bold;
  71. color: #333333;
  72. margin-bottom: 10px;
  73. }
  74. .row {
  75. line-height: 17px;
  76. font-size: 12px;
  77. color: #666666;
  78. margin-bottom: 5px;
  79. }
  80. }
  81. /deep/.u-empty {
  82. z-index: 1 !important;
  83. }
  84. </style>