planrecord.vue 3.9 KB

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