planrecord.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. methods: {
  58. i18(text){
  59. return i18(text)
  60. },
  61. getMore(){
  62. this.search.pageNum++;
  63. this.planRecord();
  64. },
  65. async planRecord() {
  66. plan(this.search).then(res=>{
  67. if(res.data.length == 0){
  68. this.$modal.showToast("没有更多数据了");
  69. this.startText = "no-more"
  70. }else{
  71. this.startText = "more"
  72. this.chargeList = this.chargeList.concat(res.data);
  73. }
  74. })
  75. },
  76. formatRepeatDays(daysStr) {
  77. const days = daysStr.split(',');
  78. const weekdays = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
  79. const result = [];
  80. for (const day of days) {
  81. const weekday = weekdays[parseInt(day) - 1];
  82. result.push(i18(weekday));
  83. }
  84. return result.join(' ');
  85. },
  86. },
  87. created() {
  88. this.planRecord();
  89. },
  90. };
  91. </script>
  92. <style>
  93. .container {
  94. background: rgb(249, 252, 255);
  95. inset: 0;
  96. position: absolute;
  97. }
  98. .list-item {
  99. margin: 0vw;
  100. }
  101. .item {
  102. box-shadow: 0px 5px 27px 0px rgba(195, 195, 195, 0.4);
  103. border-radius: 4px;
  104. background: #FFFFFF;
  105. margin: 4vw;
  106. padding: 4vw;
  107. }
  108. .item-title {
  109. display: inline-block;
  110. float: left;
  111. }
  112. .item-status {
  113. display: inline-block;
  114. float: right;
  115. }
  116. .item-header {
  117. border-bottom: 1px solid lightgray;
  118. height: 4vh;
  119. font-size: 12px;
  120. }
  121. .item-body {
  122. padding-top: 4vw;
  123. line-height: 3vh;
  124. }
  125. .item-time {
  126. color: #545454;
  127. font-size: 12px;
  128. margin-bottom: 4px
  129. }
  130. </style>