planrecord.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="container">
  3. <view class="list-item">
  4. <view class="item" v-for="item in chargeList" :key="item.id">
  5. <view class="item-header">
  6. <view class="item-title">
  7. 设备编号:{{ item.deviceId }}
  8. </view>
  9. <view class="item-status">
  10. <uni-tag type="success" text="激活中" v-if="item.status === 1"></uni-tag>
  11. <uni-tag type="error" text="已停用" v-if="item.status === 2"></uni-tag>
  12. </view>
  13. </view>
  14. <view class="item-body">
  15. <view style="font-size: 12px">
  16. 预约类型:
  17. <uni-tag type="primary" text="单次" v-if="item.planType === 1"></uni-tag>
  18. <uni-tag type="warning" text="重复" v-if="item.planType === 2"></uni-tag>
  19. </view>
  20. <view style="font-size: 12px; margin: 5px 0">
  21. 创建时间:{{ item.createTime }}
  22. </view>
  23. <view v-if="item.planType === 2">
  24. <view class="item-time">重复日期:{{ formatRepeatDays(item.repeatDays) }}</view>
  25. <view class="item-time">重复时间:{{ item.repeatTime }}</view>
  26. </view>
  27. <view v-if="item.planType === 1">
  28. <view class="item-time">执行时间:{{ item.runTime }}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <uni-load-more @clickLoadMore="getMore" :content-text="contentText" :status="startText"></uni-load-more>
  34. </view>
  35. </template>
  36. <script>
  37. import { plan } from '@/api/device/plan.js';
  38. export default {
  39. data() {
  40. return {
  41. startText:"more",
  42. search:{
  43. pageNum:1,
  44. pageSize:6,
  45. reasonable:true,
  46. },
  47. contentText: {
  48. contentdown: '点击查看更多',
  49. contentrefresh: '加载中',
  50. contentnomore: '没有更多'
  51. },
  52. chargeList: [],
  53. };
  54. },
  55. methods: {
  56. getMore(){
  57. this.search.pageNum++;
  58. this.planRecord();
  59. },
  60. async planRecord() {
  61. plan(this.search).then(res=>{
  62. if(res.data.length == 0){
  63. this.$modal.showToast("没有更多数据了");
  64. this.startText = "no-more"
  65. }else{
  66. this.startText = "more"
  67. this.chargeList = this.chargeList.concat(res.data);
  68. }
  69. })
  70. },
  71. formatRepeatDays(daysStr) {
  72. const days = daysStr.split(',');
  73. const weekdays = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
  74. const result = [];
  75. for (const day of days) {
  76. const weekday = weekdays[parseInt(day) - 1];
  77. result.push(weekday);
  78. }
  79. return result.join(' ');
  80. },
  81. },
  82. created() {
  83. this.planRecord();
  84. },
  85. };
  86. </script>
  87. <style>
  88. .container {
  89. background: rgb(249, 252, 255);
  90. inset: 0;
  91. position: absolute;
  92. }
  93. .list-item {
  94. margin: 0vw;
  95. }
  96. .item {
  97. box-shadow: 0px 5px 27px 0px rgba(195, 195, 195, 0.4);
  98. border-radius: 4px;
  99. background: #FFFFFF;
  100. margin: 4vw;
  101. padding: 4vw;
  102. }
  103. .item-title {
  104. display: inline-block;
  105. float: left;
  106. }
  107. .item-status {
  108. display: inline-block;
  109. float: right;
  110. }
  111. .item-header {
  112. border-bottom: 1px solid lightgray;
  113. height: 4vh;
  114. font-size: 12px;
  115. }
  116. .item-body {
  117. padding-top: 4vw;
  118. line-height: 3vh;
  119. }
  120. .item-time {
  121. color: #545454;
  122. font-size: 12px;
  123. margin-bottom: 4px
  124. }
  125. </style>