operationLog.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view>
  3. <u-navbar title="操作日志" title-color="#101010">
  4. </u-navbar>
  5. <!-- 标签 -->
  6. <view class="tabs">
  7. <u-picker v-model="tabsFrom.show1" :default-selector="[tabsFrom.show1Index]"
  8. mode="selector" :range="tabsFrom.selector1" range-key="label"
  9. @confirm="selector1confirm"></u-picker>
  10. <u-picker-select title="日期选择" v-model="tabsFrom.show2" :defaultTime="tabsFrom.show2Index" :endYear="endYear"
  11. mode="time" :params="params" @confirm="selector2confirm" @reset="selector2reset"></u-picker-select>
  12. <view class="tabsItem" @click="tabsFrom.show2=!tabsFrom.show2">{{tabsFrom.show2Text}} <u-icon
  13. name="arrow-up" v-if="tabsFrom.show2"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
  14. <view class="tabsItem" @click="tabsFrom.show1=!tabsFrom.show1">{{tabsFrom.show1Text}} <u-icon
  15. name="arrow-up" v-if="tabsFrom.show1"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
  16. </view>
  17. <!-- 日志 -->
  18. <view class="log">
  19. <view class="log-item" v-for="item in 2">
  20. <view class="item-infos">
  21. <view class="place">
  22. 大厅灯控 <text>(一楼大厅)</text>
  23. </view>
  24. <view class="date">
  25. 2024.02.14 16:00:00
  26. </view>
  27. </view>
  28. <view class="else">
  29. <view class="operation">
  30. 打开
  31. </view>
  32. <view class="from">
  33. 来自 本地操作
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. endYear:'',
  45. queryMonth:"",
  46. params: {
  47. year: true,
  48. month: true,
  49. day: true,
  50. hour: false,
  51. minute: false,
  52. second: false
  53. },
  54. tabsFrom: {
  55. show1: false,
  56. show1Index: 0,
  57. show2Index: '',
  58. show2: false,
  59. show1Text: "全部类型",
  60. show2Text: "全部时间",
  61. selector1: [{
  62. label: '全部类型',
  63. value: '',
  64. },
  65. {
  66. label: '大厅空调',
  67. value: '1',
  68. },
  69. {
  70. label: '大厅灯控',
  71. value: '2',
  72. },
  73. {
  74. label: '道闸',
  75. value: '3',
  76. },
  77. {
  78. label: '地下车库灯控',
  79. value: '4',
  80. },
  81. ]
  82. },
  83. }
  84. },
  85. onLoad() {
  86. this.endYear=new Date().getFullYear()
  87. var date=new Date()
  88. this.formData.startDate=date.getFullYear()+"-"+(date.getMonth() + 1) +"-1"
  89. this.queryMonth=date.getFullYear()+"年"+(date.getMonth() + 1) +"月"
  90. },
  91. methods: {
  92. selector2confirm(e) {
  93. this.tabsFrom.show2Text = e.year + "年" + e.month + "月"
  94. this.tabsFrom.show2Index = e.year + "-" + e.month
  95. if (e.day) {
  96. this.tabsFrom.show2Text += e.day + "日"
  97. this.tabsFrom.show2Index += '-' + e.day
  98. }
  99. if (e.day) {
  100. this.formData.startDate = e.year + "-" + e.month + "-" + e.day
  101. this.queryMonth = e.year + "年" + e.month + "月" + e.day + "日"
  102. this.formData.endDate = this.formData.startDate
  103. } else {
  104. this.queryMonth = e.year + "年" + e.month + "月"
  105. this.formData.startDate = e.year + "-" + e.month + "-1"
  106. this.formData.endDate = nextMonth(e.year, e.month, 1, 1)
  107. }
  108. this.rechargeRecord()
  109. },
  110. selector2reset(e) {
  111. this.tabsFrom.show2Text = '全部时间'
  112. this.tabsFrom.show2Index = '';
  113. this.formData.startDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
  114. this.queryMonth = date.getFullYear() + "年" + (date.getMonth() + 1) + "月"
  115. this.rechargeRecord()
  116. },
  117. selector1confirm(e) {
  118. var index = e[0]
  119. this.tabsFrom.show1Index = index
  120. this.tabsFrom.show1Text = this.tabsFrom.selector1[index].label
  121. this.formData.type = this.tabsFrom.selector1[index].value
  122. this.rechargeRecord()
  123. },
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. // 标签
  129. .tabs {
  130. height: 96rpx;
  131. line-height: 96rpx;
  132. background-color: #fff;
  133. border-top: 1px solid rgba(241, 241, 241, 1);
  134. display: flex;
  135. justify-content: space-around;
  136. }
  137. // 日志
  138. .log{
  139. .log-item{
  140. display: flex;
  141. align-items: center;
  142. justify-content: space-between;
  143. background-color: #fff;
  144. padding: 24rpx 32rpx;
  145. border-bottom: 1px solid rgba(245,245,245,1);
  146. .item-infos{
  147. .place{
  148. color: rgba(51,51,51,1);
  149. font-weight: bold;
  150. text{
  151. color: #777777;
  152. font-weight: normal;
  153. }
  154. }
  155. .date{
  156. color: rgba(119,119,119,1);
  157. font-size: 24rpx;
  158. }
  159. }
  160. .else{
  161. text-align: right;
  162. .operation{
  163. color: rgba(51,51,51,1);
  164. font-weight: bold;
  165. }
  166. .from{
  167. color: rgba(119,119,119,1);
  168. font-size: 24rpx;
  169. }
  170. }
  171. }
  172. }
  173. </style>