This commit is contained in:
Iruka 2024-12-20 17:25:13 +08:00
parent 2d4583ff25
commit 85f64d41f2
4 changed files with 188 additions and 26 deletions

10
api/system/userlog.js Normal file
View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 查询列表
export function getlist(data) {
return request({
url: '/iotlog/userlog/list',
method: 'get',
data: data
})
}

View File

@ -171,23 +171,23 @@
value: data?.date,
unit: null
});
if (data?.latestOperation && data?.latestOperation.length) {
this.items.push({
title: "最近操作",
value: data.latestOperation[0].operContent,
unit: data.latestOperation[0].operResult ? '【成功】' : '【失败】',
});
this.items.push({
title: "最近操作人",
value: data.latestOperation[0].userName,
unit: null,
});
this.items.push({
title: "最近操作时间",
value: timestampFormat(data.latestOperation[0].time),
unit: null,
});
}
// if (data?.latestOperation && data?.latestOperation.length) {
// this.items.push({
// title: "",
// value: data.latestOperation[0].operContent,
// unit: data.latestOperation[0].operResult ? '' : '',
// });
// this.items.push({
// title: "",
// value: data.latestOperation[0].userName,
// unit: null,
// });
// this.items.push({
// title: "",
// value: timestampFormat(data.latestOperation[0].time),
// unit: null,
// });
// }
}
this.open = true;
},

View File

@ -357,19 +357,19 @@
</view>
<view>更多<span class="iconfont icon-you"></span></view>
</view>
<view class="text-list"
v-if="dc.dataObj[pop.item.dataKey] && dc.dataObj[pop.item.dataKey].latestOperation.length">
<view class="text-list" v-if="dc.dataObj[pop.item.dataKey]"
v-for="item in dc.dataObj[pop.item.dataKey].latestOperation">
<view>
<view>
{{dc.dataObj[pop.item.dataKey].latestOperation[0].operContent}}
{{item.operContent}}
</view>
<view class="font-green">
{{dc.dataObj[pop.item.dataKey].latestOperation[0].operResult ? '【成功】' : '【失败】'}}
{{item.operResult ? '【成功】' : '【失败】'}}
</view>
</view>
<view>
<view>操作人{{dc.dataObj[pop.item.dataKey].latestOperation[0].userName}}</view>
<view>{{formatData(dc.dataObj[pop.item.dataKey].latestOperation[0].time)}}</view>
<view>操作人{{item.userName}}</view>
<view>{{formatData(item.time)}}</view>
</view>
</view>
</view>

View File

@ -1,9 +1,161 @@
<template>
<custom-nav-bar :left="true" title="操作日志" />
</template>
<z-paging ref="paging" @query="queryList" v-model="dataList" :default-page-size="queryParams.pageSize"
:auto-show-system-loading="true" empty-view-text="抱歉,暂时还没有相关数据!">
<template #top>
<custom-nav-bar :left="true" title="操作日志"></custom-nav-bar>
<view style="background: #e7fdeb;padding: 5px;">
<u-search v-model="queryParams.searchValue" @search="queryList" />
</view>
</template>
<view class="index-container">
<view class="item-container" v-for="item in dataList">
<view style="display: flex; align-items: center; justify-content: space-between;">
<view class="flex-text" style="margin: 15px;">
<view class="flex-text-one" style="color: black;">出水口</view>
<view>{{ item.woName}}</view>
</view>
<view style="margin-right: 5px;" v-hasPermi="['system:land:edit']">
<u-button text="1开" type="primary" plain plainFill></u-button>
</view>
</view>
<u-gap height="1" bgColor="#D2D2D2"></u-gap>
<view style="display: flex;justify-content: space-between;align-items: center;" @click="openPop(item)">
<view class="data">
<view class="flex-text global-font-size-1">
<view class="flex-text-one">设备名称</view>
<view>{{ item.operSubject}}</view>
</view>
<view class="flex-text global-font-size-1">
<view class="flex-text-one">执行内容</view>
<view>{{ item.operContent}}</view>
</view>
<view class="flex-text global-font-size-1" style="margin-top: 5px;">
<view class="flex-text-one">操作人员</view>
<view>{{ item.operUser}}</view>
</view>
<view class="flex-text global-font-size-1" style="margin-top: 5px;">
<view class="flex-text-one">操作时间</view>
<view>{{ item.occurTime}}</view>
</view>
</view>
<view>
<view v-hasPermi="['land:land:query']" style="margin-right: 10px;">
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
</view>
</view>
</z-paging>
<!-- 图层弹出 -->
<u-popup mode="center" :show="showPop" @close="showPop = false">
<view class="popup-content" style="width: 70vw;height: 50vh;">
<u-steps direction="column" :current="popData.length">
<u-steps-item v-for="item in popData" :title="item.operUser" :desc="item.occurTime" />
</u-steps>
</view>
</u-popup>
</template>
<script>
import {
getlist
} from "@/api/system/userlog.js"
export default {
data() {
return {
dataList: [],
queryParams: {
pageNum: 1,
pageSize: 20,
logType: 1, //1:,2:
landId: -1, //id
operType: "control", //
operSource: 1, //
searchValue: "", //code
},
showPop: false,
popData: [],
}
},
onLoad() {
const cacheData = uni.getStorageSync("cacheData");
if (cacheData) {
this.queryParams.landId = cacheData.land.id;
}
},
onShow() {},
mounted() {},
methods: {
queryList(pageNo, pageSize) {
this.queryParams.pageNum = pageNo;
console.error("queryList:", this.queryParams);
getlist(this.queryParams).then(res => {
console.error("queryList:", res);
this.$refs.paging.completeByTotal(res.rows, res.total);
});
},
openPop(item) {
this.showPop = true;
getlist({
traceId: item.traceId
}).then(res => {
this.popData = res.rows.sort(this.compareDataNew("logNo"));
});
},
//
compareDataNew(file1) {
return function(b, a) {
if (b[file1] < a[file1]) {
return -1;
} else if (b[file1] > a[file1]) {
return 1;
}
}
},
}
}
</script>
<style>
<style lang="scss">
.index-container {
.list {
margin: 0px 10px;
}
.list-size {
display: flex;
padding: 5px 5px;
background: white;
justify-content: center;
}
.search {
background-color: white;
padding: 10px;
}
.item-container {
margin: 10px 10px;
background-color: white;
padding-bottom: 10px;
border-radius: 10px;
box-shadow: 1px 1px 2px 2px rgba(0, 0, 0, 0.05);
}
.flex-text {
display: flex;
align-items: center;
.flex-text-one {
color: #939393;
font-weight: bold;
}
}
.data {
margin: 10px 20px;
}
}
</style>