operationModel.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class="container">
  3. <!-- 建议放在外层 -->
  4. <u-navbar
  5. title="操作记录"
  6. @leftClick="devicemenuShow"
  7. :safeAreaInsetTop="false"
  8. style="margin-top: 30px"
  9. >
  10. <view class="u-nav-slot" slot="left">
  11. <u-icon name="list" size="20"> </u-icon>
  12. </view>
  13. </u-navbar>
  14. <view v-show="menushow" class="menupage">
  15. <DeviceMenu @menuClick="menuClick"></DeviceMenu>
  16. </view>
  17. <view v-show="!menushow" class="main">
  18. <view class="u-page">
  19. <div class="flcard">
  20. <div class="btns">
  21. <u-button
  22. type="primary"
  23. shape="circle"
  24. :text="StartTime ? StartTime : '起始时间'"
  25. @click="dataShow = true"
  26. ></u-button>
  27. <u-button
  28. type="primary"
  29. shape="circle"
  30. :text="EndTime ? EndTime : '结束时间'"
  31. @click="dataShow1 = true"
  32. ></u-button>
  33. <u-icon
  34. size="30"
  35. color="#3c9cff"
  36. name="search"
  37. @click="checkHistoryData"
  38. ></u-icon>
  39. </div>
  40. <u-datetime-picker
  41. :show="dataShow"
  42. mode="datetime"
  43. @cancel="dataShow = false"
  44. @confirm="selectStartTime"
  45. v-model="dataTime"
  46. ></u-datetime-picker>
  47. <u-datetime-picker
  48. :show="dataShow1"
  49. mode="datetime"
  50. @cancel="dataShow1 = false"
  51. @confirm="selectEndTime"
  52. v-model="dataTime"
  53. ></u-datetime-picker>
  54. </div>
  55. <u-list>
  56. <u-list-item
  57. class="itemback"
  58. v-for="(item, index) in historyData"
  59. :key="index"
  60. >
  61. <view>
  62. <view class="content flcard">
  63. <view class="datacard user">
  64. <view style="margin: 20rpx 20rpx">
  65. <text class="text-style">{{ item.realname }}</text>
  66. </view>
  67. <view style="margin: 20rpx 20rpx; font-size: small"
  68. >用户</view
  69. >
  70. </view>
  71. <view class="datacard device">
  72. <view style="margin: 20rpx 20rpx">
  73. <text class="text-style">{{ item.devicename }}</text>
  74. </view>
  75. <view style="margin: 20rpx 20rpx; font-size: small"
  76. >操作设备</view
  77. >
  78. </view>
  79. <view class="datacard record">
  80. <view style="margin: 20rpx 20rpx">
  81. <text class="text-style">{{ item.strremark }}</text>
  82. </view>
  83. <view style="margin: 20rpx 20rpx; font-size: small"
  84. >操作记录</view
  85. >
  86. </view>
  87. <view class="datacard time">
  88. <view style="margin: 20rpx 20rpx">
  89. <text class="text-style">{{ item.createTime }}</text>
  90. </view>
  91. <view style="margin: 20rpx 20rpx; font-size: small"
  92. >操作时间</view
  93. >
  94. </view>
  95. </view>
  96. </view>
  97. </u-list-item>
  98. </u-list>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import DeviceMenu from "./devicemenu/devicemenu.vue";
  105. import api from "@/api/api";
  106. import dayjs from "dayjs";
  107. export default {
  108. data() {
  109. return {
  110. menushow: false,
  111. TabCur: "gate",
  112. dataShow: false,
  113. dataShow1: false,
  114. dataTime: dayjs().toDate(),
  115. deviceType: "", //设备类型
  116. StartTime: "",
  117. EndTime: "",
  118. historyData: [],
  119. };
  120. },
  121. components: {
  122. DeviceMenu,
  123. },
  124. props: ["showColum"],
  125. watch: {
  126. showColum(data) {
  127. this.colums = data;
  128. console.log(this.colums);
  129. },
  130. },
  131. created() {
  132. this.colums = this.showColum;
  133. },
  134. mounted() {},
  135. methods: {
  136. //选择起始时间
  137. selectStartTime(e) {
  138. const startTime = e.value;
  139. const formattedTime = dayjs(startTime).format("YYYY-MM-DD HH:mm:ss");
  140. this.StartTime = formattedTime;
  141. this.dataShow = false;
  142. },
  143. //选择起始时间
  144. selectEndTime(e) {
  145. const endTime = e.value;
  146. const formattedTime = dayjs(endTime).format("YYYY-MM-DD HH:mm:ss");
  147. this.EndTime = formattedTime;
  148. this.dataShow1 = false;
  149. },
  150. devicemenuShow(e) {
  151. this.menushow = true;
  152. },
  153. menuClick(id) {
  154. this.TabCur = id;
  155. this.deviceType = this.TabCur;
  156. this.menushow = false;
  157. },
  158. //查询历史数据
  159. checkHistoryData() {
  160. const params = {
  161. createTime_begin: this.StartTime,
  162. createTime_end: this.EndTime,
  163. pageNo: 1,
  164. pageSize: 10000,
  165. devicetype: this.deviceType + "*",
  166. };
  167. new Promise((resolve, reject) => {
  168. api
  169. .getOpreateHistory(params)
  170. .then((response) => {
  171. if (response.data.code == 200) {
  172. this.historyData = response.data.result.records;
  173. } else {
  174. resolve(response);
  175. }
  176. })
  177. .catch((error) => {
  178. reject(error);
  179. });
  180. });
  181. },
  182. },
  183. destroyed() {},
  184. };
  185. </script>
  186. <style>
  187. >>> .u-navbar--fixed {
  188. margin-top: 20px;
  189. }
  190. .main {
  191. margin-top: 100rpx;
  192. display: flex;
  193. flex-direction: column;
  194. }
  195. .menupage {
  196. position: absolute;
  197. z-index: 2;
  198. top: 40rpx;
  199. height: calc(100% - 40rpx);
  200. width: 100%;
  201. }
  202. .btns {
  203. display: flex;
  204. }
  205. .flcard {
  206. padding: 20rpx;
  207. background-color: #ffffff;
  208. margin-bottom: 5rpx;
  209. }
  210. .text-style {
  211. color: #3787fe;
  212. font-weight: bold;
  213. }
  214. .itemback {
  215. padding: 20rpx;
  216. background-color: #ffffff;
  217. margin-bottom: 5rpx;
  218. }
  219. .datacard {
  220. width: 48%;
  221. margin: 1%;
  222. float: left;
  223. height: 120rpx;
  224. border-radius: 10px;
  225. }
  226. .time {
  227. background: url(/static/operation/operationTime.png),
  228. linear-gradient(
  229. to right,
  230. rgba(55, 135, 254, 0.08),
  231. rgba(4, 184, 255, 0.08),
  232. rgba(60, 161, 237, 0.08)
  233. );
  234. background-size: auto 100%;
  235. background-position: right;
  236. background-repeat: no-repeat;
  237. }
  238. .record {
  239. background: url(/static/operation/operationRecord.png),
  240. linear-gradient(
  241. to right,
  242. rgba(55, 135, 254, 0.08),
  243. rgba(4, 184, 255, 0.08),
  244. rgba(60, 161, 237, 0.08)
  245. );
  246. background-size: auto 100%;
  247. background-position: right;
  248. background-repeat: no-repeat;
  249. }
  250. .user {
  251. background: url(/static/operation/user.png),
  252. linear-gradient(
  253. to right,
  254. rgba(55, 135, 254, 0.08),
  255. rgba(4, 184, 255, 0.08),
  256. rgba(60, 161, 237, 0.08)
  257. );
  258. background-size: auto 100%;
  259. background-position: right;
  260. background-repeat: no-repeat;
  261. }
  262. .device {
  263. background: url(/static/operation/operationDevice.png),
  264. linear-gradient(
  265. to right,
  266. rgba(55, 135, 254, 0.08),
  267. rgba(4, 184, 255, 0.08),
  268. rgba(60, 161, 237, 0.08)
  269. );
  270. background-size: auto 100%;
  271. background-position: right;
  272. background-repeat: no-repeat;
  273. }
  274. </style>