operationModel.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="container">
  3. <!-- 建议放在外层 -->
  4. <u-navbar
  5. title="操作记录"
  6. @leftClick="devicemenuShow"
  7. :safeAreaInsetTop="false"
  8. >
  9. <view class="u-nav-slot" slot="left">
  10. <u-icon name="list" size="20"> </u-icon>
  11. </view>
  12. </u-navbar>
  13. <view v-show="menushow" class="menupage">
  14. <DeviceMenu @menuClick="menuClick"></DeviceMenu>
  15. </view>
  16. <view v-show="!menushow" class="main">
  17. <view class="u-page">
  18. <div class="flcard">
  19. <div class="btns">
  20. <u-button
  21. type="primary"
  22. shape="circle"
  23. text="起始时间"
  24. @click="dataShow = true"
  25. ></u-button>
  26. <u-button
  27. type="primary"
  28. shape="circle"
  29. text="结束时间"
  30. @click="dataShow1 = true"
  31. ></u-button>
  32. <u-button
  33. type="primary"
  34. shape="circle"
  35. text="查询"
  36. @click="checkHistoryData"
  37. ></u-button>
  38. </div>
  39. <u-datetime-picker
  40. :show="dataShow"
  41. mode="datetime"
  42. @cancel="dataShow = false"
  43. @confirm="selectStartTime"
  44. v-model="dataTime"
  45. ></u-datetime-picker>
  46. <u-datetime-picker
  47. :show="dataShow1"
  48. mode="datetime"
  49. @cancel="dataShow1 = false"
  50. @confirm="selectEndTime"
  51. v-model="dataTime"
  52. ></u-datetime-picker>
  53. </div>
  54. <u-list>
  55. <u-list-item
  56. class="itemback"
  57. v-for="(item, index) in historyData"
  58. :key="index"
  59. >
  60. <view class="datacard">
  61. <view class="content flcard">
  62. <view
  63. class="demo-layout bg-purple-light"
  64. style="margin-top: 10rpx; color: #3787fe"
  65. >用户:{{ item.realname }}</view
  66. >
  67. <view
  68. class="demo-layout bg-purple-light"
  69. style="margin-top: 10rpx; color: #3787fe"
  70. >操作设备:{{ item.devicename }}</view
  71. >
  72. <view
  73. class="demo-layout bg-purple-light"
  74. style="margin-top: 10rpx; color: #3787fe"
  75. >操作记录:{{ item.strremark }}</view
  76. >
  77. <view
  78. class="demo-layout bg-purple-light"
  79. style="margin-top: 10rpx; color: #3787fe"
  80. >操作时间:{{ item.createTime }}</view
  81. >
  82. </view>
  83. </view>
  84. </u-list-item>
  85. </u-list>
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import DeviceMenu from "./devicemenu/devicemenu.vue";
  92. import api from "@/api/api";
  93. import dayjs from "dayjs";
  94. export default {
  95. data() {
  96. return {
  97. menushow: false,
  98. TabCur: "gate",
  99. dataShow: false,
  100. dataShow1: false,
  101. dataTime: dayjs().toDate(),
  102. deviceType: "", //设备类型
  103. StartTime: "",
  104. EndTime: "",
  105. historyData: [],
  106. };
  107. },
  108. components: {
  109. DeviceMenu,
  110. },
  111. props: ["showColum"],
  112. watch: {
  113. showColum(data) {
  114. this.colums = data;
  115. console.log(this.colums);
  116. },
  117. },
  118. created() {
  119. this.colums = this.showColum;
  120. },
  121. mounted() {},
  122. methods: {
  123. //选择起始时间
  124. selectStartTime(e) {
  125. const startTime = e.value;
  126. const formattedTime = dayjs(startTime).format("YYYY-MM-DD HH:mm:ss");
  127. this.StartTime = formattedTime;
  128. this.dataShow = false;
  129. },
  130. //选择起始时间
  131. selectEndTime(e) {
  132. const endTime = e.value;
  133. const formattedTime = dayjs(endTime).format("YYYY-MM-DD HH:mm:ss");
  134. this.EndTime = formattedTime;
  135. this.dataShow1 = false;
  136. },
  137. devicemenuShow(e) {
  138. this.menushow = true;
  139. },
  140. menuClick(id) {
  141. this.TabCur = id;
  142. this.deviceType = this.TabCur;
  143. this.menushow = false;
  144. },
  145. //查询历史数据
  146. checkHistoryData() {
  147. const params = {
  148. createTime_begin: this.StartTime,
  149. createTime_end: this.EndTime,
  150. pageNo: 1,
  151. pageSize: 10000,
  152. devicetype: this.deviceType + "*",
  153. };
  154. new Promise((resolve, reject) => {
  155. api
  156. .getOpreateHistory(params)
  157. .then((response) => {
  158. if (response.data.code == 200) {
  159. this.historyData = response.data.result.records;
  160. } else {
  161. resolve(response);
  162. }
  163. })
  164. .catch((error) => {
  165. reject(error);
  166. });
  167. });
  168. },
  169. },
  170. destroyed() {},
  171. };
  172. </script>
  173. <style>
  174. .main {
  175. margin-top: 100rpx;
  176. display: flex;
  177. flex-direction: column;
  178. }
  179. .menupage {
  180. position: absolute;
  181. z-index: 2;
  182. top: 40rpx;
  183. height: calc(100% - 40rpx);
  184. width: 100%;
  185. }
  186. .btns {
  187. display: flex;
  188. }
  189. .flcard {
  190. padding: 20rpx;
  191. background-color: #ffffff;
  192. margin-bottom: 5rpx;
  193. }
  194. </style>