123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- <template>
- <view class="container">
- <view v-if="!menushow" class="main">
- <view class="u-page">
- <div class="flcard">
- <div class="btns">
- <u-button
- type="primary"
- shape="circle"
- :text="StartTime ? StartTime : '起始时间'"
- @click="dataShow = true"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- :text="EndTime ? EndTime : '结束时间'"
- @click="dataShow1 = true"
- ></u-button>
- <u-icon
- size="30"
- color="#3c9cff"
- name="search"
- @click="checkHistoryData"
- ></u-icon>
- </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>
- <view class="content flcard">
- <view class="datacard user">
- <view style="margin: 20rpx 20rpx">
- <text class="text-style">{{ item.realname }}</text>
- </view>
- <view style="margin: 20rpx 20rpx; font-size: small"
- >用户</view
- >
- </view>
- <view class="datacard device">
- <view style="margin: 20rpx 20rpx">
- <text class="text-style">{{ item.devicename }}</text>
- </view>
- <view style="margin: 20rpx 20rpx; font-size: small"
- >操作设备</view
- >
- </view>
- <view class="datacard record">
- <view style="margin: 20rpx 20rpx">
- <text class="text-style">{{ item.strremark }}</text>
- </view>
- <view style="margin: 20rpx 20rpx; font-size: small"
- >操作记录</view
- >
- </view>
- <view class="datacard time">
- <view style="margin: 20rpx 20rpx">
- <text class="text-style">{{ item.createTime }}</text>
- </view>
- <view style="margin: 20rpx 20rpx; font-size: small"
- >操作时间</view
- >
- </view>
- </view>
- </view>
- </u-list-item>
- </u-list>
- </view>
- </view>
- </view>
- </template>
- <script>
- import api from "@/api/api";
- import dayjs from "dayjs";
- export default {
- data() {
- return {
- menushow: false,
- TabCur: "gate",
- dataShow: false,
- dataShow1: false,
- dataTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
- // deviceType: "gate", //设备类型
- StartTime: "",
- EndTime: "",
- historyData: [],
- };
- },
- props: ["showColum", 'deviceType'],
- watch: {
- showColum(data) {
- this.colums = data;
- },
- deviceType: {
- handler (data) {
- if(data){
- this.TabCur = data;
- // 选择设备分类,重新获取数据
- this.$emit('setMenushow', {
- menushow: false
- });
- }
-
-
- },
- immediate: true
- }
- },
- created() {
- this.colums = this.showColum;
- const startTime =new Date().getTime() - 3600 * 1000 * 24 * 30;
- const endTime = new Date();
- this.StartTime = dayjs(startTime).format("YYYY-MM-DD HH:mm:ss");
- this.EndTime = dayjs(endTime).format("YYYY-MM-DD HH:mm:ss");
- this.checkHistoryData();
- },
- mounted() {
- this.TabCur = this.deviceType;
- },
- 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 = !this.menushow;
- },
- menuClick(id) {
- this.TabCur = id;
- this.menushow = false;
- },
- //查询历史数据
- checkHistoryData() {
- const params = {
- createTime_begin: this.StartTime,
- createTime_end: this.EndTime,
- pageNo: 1,
- pageSize: 10000,
- devicetype: this.TabCur + "*",
- };
- 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 {
- 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;
- }
- .text-style {
- color: #3787fe;
- font-weight: bold;
- }
- .itemback {
- padding: 20rpx;
- background-color: #ffffff;
- margin-bottom: 5rpx;
- }
- .datacard {
- width: 48%;
- margin: 1%;
- float: left;
- height: 120rpx;
- border-radius: 10px;
- }
- .time {
- background: url(/static/operation/operationTime.png),
- linear-gradient(
- to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08)
- );
- background-size: auto 100%;
- background-position: right;
- background-repeat: no-repeat;
- }
- .record {
- background: url(/static/operation/operationRecord.png),
- linear-gradient(
- to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08)
- );
- background-size: auto 100%;
- background-position: right;
- background-repeat: no-repeat;
- }
- .user {
- background: url(/static/operation/user.png),
- linear-gradient(
- to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08)
- );
- background-size: auto 100%;
- background-position: right;
- background-repeat: no-repeat;
- }
- .device {
- background: url(/static/operation/operationDevice.png),
- linear-gradient(
- to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08)
- );
- background-size: auto 100%;
- background-position: right;
- background-repeat: no-repeat;
- }
- </style>
|