You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
353 lines
7.7 KiB
353 lines
7.7 KiB
<template>
|
|
<view class="page">
|
|
<u-navbar back-text="故障日志">
|
|
<view slot="right" style="margin-right: 16px">
|
|
<u-image
|
|
src="@/static/img/operation.png"
|
|
mode="widthFix"
|
|
width="44"
|
|
height="44"
|
|
:show-loading="false"
|
|
@click="showPopup = !showPopup"
|
|
/>
|
|
</view>
|
|
</u-navbar>
|
|
<view class="background">
|
|
<view v-for="item in faultlist" :key="item.eventid" class="log">
|
|
<view class="title">
|
|
<view>设备ID:{{item.control1}}</view>
|
|
<view>故障类型:{{item.type}}</view>
|
|
</view>
|
|
<view class="content">
|
|
<view>
|
|
<u-icon name="map" color="#8D92A6" size="30" />
|
|
{{item.group}}区域
|
|
</view>
|
|
<view>
|
|
<u-icon name="clock" color="#8D92A6" size="30" />
|
|
{{ item.time }}
|
|
</view>
|
|
</view>
|
|
<view class="border" />
|
|
</view>
|
|
<u-empty v-if="faultlist.length===0" />
|
|
</view>
|
|
<u-loadmore :status="loadmore" @loadmore="getFaultlogPage" />
|
|
|
|
<view style="height: 32rpx" />
|
|
<u-popup v-model="showPopup" mode="top" @open="open" @close="close">
|
|
<view class="title">
|
|
<u-subsection
|
|
:list="['筛选日志']"
|
|
mode="subsection"
|
|
height="64"
|
|
active-color="#4E73DF"
|
|
@change="subsectionChange"
|
|
/>
|
|
<view>总共{{total}}条日志记录</view>
|
|
</view>
|
|
<view v-if="showOperation" class="operation">
|
|
|
|
</view>
|
|
<view v-else>
|
|
<view class="input-line">
|
|
<u-field
|
|
v-model="query.filtervalue"
|
|
label="查询内容:"
|
|
:border-bottom="false"
|
|
label-width="150"
|
|
/>
|
|
</view>
|
|
<u-button type="primary" shape="circle" @click="queryFaultlogPage">查询</u-button>
|
|
</view>
|
|
</u-popup>
|
|
<u-select
|
|
v-model="showType1"
|
|
:list="subdevice_type"
|
|
:default-value="[query.subdevice_type]"
|
|
title="设备类型"
|
|
@confirm="selectType1"
|
|
/>
|
|
<u-select
|
|
v-model="showType2"
|
|
:list="fault_type"
|
|
:default-value="[query.fault_type]"
|
|
title="故障类型"
|
|
@confirm="selectType2"
|
|
/>
|
|
<u-modal v-model="showExport" title="保存路径">
|
|
<view class="saveTip">{{filePath}}</view>
|
|
</u-modal>
|
|
<u-modal
|
|
v-model="showDelete"
|
|
:show-title="false"
|
|
content="是否删除全部日志"
|
|
async-close
|
|
show-cancel-button
|
|
@confirm="deletelog"
|
|
/>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getFaultlogPage,
|
|
} from "@/common/network/equipment/faultlog";
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
subdevice_type: [
|
|
{ value: 0, label: "全部类型" },
|
|
{ value: 1, label: "调光灯控器" },
|
|
{ value: 2, label: "单电源色温灯控器" },
|
|
{ value: 3, label: "双电源色温灯控器" },
|
|
{ value: 4, label: "回路控制器" },
|
|
{ value: 5, label: "光传感设备" },
|
|
{ value: 6, label: "电能表" },
|
|
],
|
|
fault_type: [
|
|
{ value: 0, label: "全部类型" },
|
|
{ value: 1, label: "灯具故障" },
|
|
{ value: 2, label: "通讯故障" },
|
|
{ value: 3, label: "温度故障" },
|
|
{ value: 4, label: "回路故障" },
|
|
],
|
|
showPopup: false,
|
|
showOperation: 0,
|
|
showType1: false,
|
|
showType2: false,
|
|
showExport: false,
|
|
showDelete: false,
|
|
device: {},
|
|
page: 1,
|
|
total: 0,
|
|
faultlist: [],
|
|
loadmore: "loadmore",
|
|
query: {
|
|
filtervalue: "",
|
|
fault_subdeviceid: "",
|
|
subdevice_type: 0,
|
|
fault_zone: "",
|
|
fault_type: 0,
|
|
},
|
|
saveQuery: {},
|
|
filePath: "",
|
|
|
|
timeslot: '',
|
|
starttime:'',
|
|
endtime:'',
|
|
};
|
|
},
|
|
created() {},
|
|
mounted() {
|
|
|
|
},
|
|
methods: {
|
|
inittimeslot(){
|
|
//初始化为近1个月操作日志
|
|
const end = new Date();
|
|
const start = new Date();
|
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
|
this.endtime = this.FormatDate(end, "yyyy-MM-dd");
|
|
this.starttime= this.FormatDate(start, "yyyy-MM-dd");
|
|
},
|
|
getFaultlogPage(filtervalue) {
|
|
var that=this;
|
|
this.loadmore = "loading";
|
|
let data = {
|
|
currentPage:this.page,
|
|
perpage:50,
|
|
starttime:this.starttime,
|
|
endtime:this.endtime,
|
|
username: uni.getStorageSync("username"),
|
|
filtervalue: filtervalue
|
|
};
|
|
|
|
getFaultlogPage(data)
|
|
.then((res) => {
|
|
|
|
if (res.data.totalCount > 0) {
|
|
if (that.page === 1) {
|
|
that.faultlist = res.data.list;
|
|
} else {
|
|
that.faultlist.push(...res.data.list);
|
|
}
|
|
that.total = res.data.totalCount;
|
|
if (that.page*50 < res.data.totalCount) {
|
|
that.page++;
|
|
data.currentPage = that.page;
|
|
|
|
that.loadmore = "loadmore";
|
|
} else {
|
|
that.loadmore = "nomore";
|
|
}
|
|
}
|
|
else{
|
|
that.loadmore = "nomore";
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
console.log(err);
|
|
});
|
|
},
|
|
subsectionChange(index) {
|
|
this.showOperation = index;
|
|
},
|
|
selectType1(arr) {
|
|
this.query.subdevice_type = arr[0].value;
|
|
},
|
|
selectType2(arr) {
|
|
this.query.fault_type = arr[0].value;
|
|
},
|
|
open() {
|
|
this.saveQuery = JSON.parse(JSON.stringify(this.query));
|
|
},
|
|
close() {
|
|
//this.query = JSON.parse(JSON.stringify(this.saveQuery));
|
|
//this.showOperation = 0;
|
|
},
|
|
queryFaultlogPage() {
|
|
//this.saveQuery = JSON.parse(JSON.stringify(this.query));
|
|
this.page = 1;
|
|
this.faultlist = [];
|
|
|
|
this.getFaultlogPage(this.query.filtervalue);
|
|
this.showPopup = false;
|
|
},
|
|
},
|
|
onLoad(option) {
|
|
this.inittimeslot();
|
|
this.device = option;
|
|
this.deviceid = this.device.deviceid;
|
|
this.getFaultlogPage(this.deviceid);
|
|
},
|
|
onReachBottom() {
|
|
if (this.loadmore === "loadmore") {
|
|
|
|
if(this.query.filtervalue == '')
|
|
{
|
|
this.getFaultlogPage(this.deviceid);
|
|
}
|
|
else{
|
|
this.getFaultlogPage(this.query.filtervalue);
|
|
}
|
|
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.page {
|
|
min-height: 100vh;
|
|
background: linear-gradient(
|
|
180deg,
|
|
rgba(235, 241, 255, 0.5) 0%,
|
|
#e4ebff 100%
|
|
);
|
|
}
|
|
|
|
.background {
|
|
margin: 32rpx 24rpx;
|
|
padding: 30rpx 24rpx;
|
|
|
|
background: #ffffff;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.log > * {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
font-size: 30rpx;
|
|
}
|
|
.log > .title :last-child {
|
|
color: #ec6a56;
|
|
}
|
|
.log > .content {
|
|
margin-top: 20rpx;
|
|
color: #8d92a6;
|
|
}
|
|
|
|
.border {
|
|
margin: 20rpx 0 24rpx;
|
|
|
|
height: 1px;
|
|
background: #e8e9ed;
|
|
}
|
|
.log:last-child > .border {
|
|
display: none;
|
|
}
|
|
|
|
.u-drawer,
|
|
.u-drawer >>> .u-mask {
|
|
margin-top: calc(var(--status-bar-height) + 44px);
|
|
}
|
|
|
|
.u-drawer .title {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
|
|
margin: 48rpx 32rpx 0;
|
|
}
|
|
.u-drawer .title :first-child >>> .u-item {
|
|
padding: 0 28rpx;
|
|
font-size: 32rpx !important;
|
|
}
|
|
.u-drawer .title :last-child {
|
|
font-size: 30rpx;
|
|
color: #8d92a6;
|
|
}
|
|
|
|
.input-line {
|
|
|
|
|
|
margin: 0 32rpx;
|
|
}
|
|
.input-line:first-child {
|
|
margin-top: 60rpx;
|
|
}
|
|
.input-line + .input-line {
|
|
margin-top: 32rpx;
|
|
}
|
|
.u-field {
|
|
padding: 0;
|
|
|
|
font-size: 32rpx;
|
|
}
|
|
.u-field >>> .fild-body {
|
|
padding: 0 10rpx;
|
|
|
|
width: 180rpx;
|
|
height: 70rpx;
|
|
|
|
border-radius: 10rpx;
|
|
border: 1px solid rgba(141, 146, 166, 0.51);
|
|
}
|
|
|
|
.u-btn {
|
|
margin: 48rpx 64rpx 60rpx;
|
|
}
|
|
|
|
.operation {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
|
|
padding: 0 165rpx;
|
|
height: 420rpx;
|
|
|
|
color: #4e73df;
|
|
}
|
|
.operation .u-image {
|
|
margin: 0 auto 20rpx;
|
|
}
|
|
|
|
.saveTip {
|
|
padding: 0 20rpx;
|
|
word-break: break-all;
|
|
}
|
|
</style>
|
|
|