123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <template>
- <view class="container">
- <!-- 建议放在外层 -->
- <u-navbar
- title="操作记录"
- @leftClick="devicemenuShow"
- :safeAreaInsetTop="false"
- >
- <view class="u-nav-slot" slot="left">
- <u-icon name="list" size="20"> </u-icon>
- </view>
- </u-navbar>
- <view v-show="menushow" class="menupage">
- <DeviceMenu @menuClick="menuClick"></DeviceMenu>
- </view>
- <view v-show="!menushow" class="main">
- <view class="u-page">
- <div class="flcard">
- <div class="btns">
- <u-button
- type="primary"
- shape="circle"
- text="起始时间"
- @click="dataShow = true"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- text="结束时间"
- @click="dataShow1 = true"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- text="查询"
- @click="checkHistoryData"
- ></u-button>
- </div>
- <u-datetime-picker
- :show="dataShow"
- mode="datetime"
- @cancel="dataShow = false"
- @confirm="selectStartTime"
- v-model="dataTime"
- ></u-datetime-picker>
- <u-datetime-picker
- :show="dataShow1"
- mode="datetime"
- @cancel="dataShow1 = false"
- @confirm="selectEndTime"
- v-model="dataTime"
- ></u-datetime-picker>
- </div>
- <u-list>
- <u-list-item
- class="itemback"
- v-for="(item, index) in historyData"
- :key="index"
- >
- <view class="datacard">
- <view class="content flcard">
- <view
- class="demo-layout bg-purple-light"
- style="margin-top: 10rpx; color: #3787fe"
- >用户:{{ item.realname }}</view
- >
- <view
- class="demo-layout bg-purple-light"
- style="margin-top: 10rpx; color: #3787fe"
- >操作设备:{{ item.devicename }}</view
- >
- <view
- class="demo-layout bg-purple-light"
- style="margin-top: 10rpx; color: #3787fe"
- >操作记录:{{ item.strremark }}</view
- >
- <view
- class="demo-layout bg-purple-light"
- style="margin-top: 10rpx; color: #3787fe"
- >操作时间:{{ item.createTime }}</view
- >
- </view>
- </view>
- </u-list-item>
- </u-list>
- </view>
- </view>
- </view>
- </template>
- <script>
- import DeviceMenu from "./devicemenu/devicemenu.vue";
- import api from "@/api/api";
- import dayjs from "dayjs";
- export default {
- data() {
- return {
- menushow: false,
- TabCur: "gate",
- dataShow: false,
- dataShow1: false,
- dataTime: dayjs().toDate(),
- deviceType: "", //设备类型
- StartTime: "",
- EndTime: "",
- historyData: [],
- };
- },
- components: {
- DeviceMenu,
- },
- props: ["showColum"],
- watch: {
- showColum(data) {
- this.colums = data;
- console.log(this.colums);
- },
- },
- created() {
- this.colums = this.showColum;
- },
- mounted() {},
- methods: {
- //选择起始时间
- selectStartTime(e) {
- const startTime = e.value;
- const formattedTime = dayjs(startTime).format("YYYY-MM-DD HH:mm:ss");
- this.StartTime = formattedTime;
- this.dataShow = false;
- },
- //选择起始时间
- selectEndTime(e) {
- const endTime = e.value;
- const formattedTime = dayjs(endTime).format("YYYY-MM-DD HH:mm:ss");
- this.EndTime = formattedTime;
- this.dataShow1 = false;
- },
- devicemenuShow(e) {
- this.menushow = true;
- },
- menuClick(id) {
- this.TabCur = id;
- this.deviceType = this.TabCur;
- this.menushow = false;
- },
- //查询历史数据
- checkHistoryData() {
- const params = {
- createTime_begin: this.StartTime,
- createTime_end: this.EndTime,
- pageNo: 1,
- pageSize: 10000,
- devicetype: this.deviceType + "*",
- };
- new Promise((resolve, reject) => {
- api
- .getOpreateHistory(params)
- .then((response) => {
- if (response.data.code == 200) {
- this.historyData = response.data.result.records;
- } else {
- resolve(response);
- }
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
- },
- destroyed() {},
- };
- </script>
- <style>
- .main {
- margin-top: 100rpx;
- display: flex;
- flex-direction: column;
- }
- .menupage {
- position: absolute;
- z-index: 2;
- top: 40rpx;
- height: calc(100% - 40rpx);
- width: 100%;
- }
- .btns {
- display: flex;
- }
- .flcard {
- padding: 20rpx;
- background-color: #ffffff;
- margin-bottom: 5rpx;
- }
- </style>
|