Pārlūkot izejas kodu

设备日志功能加上

newStyle
douzhuo pirms 2 gadiem
vecāks
revīzija
68f1b9dcd9
4 mainītis faili ar 265 papildinājumiem un 20 dzēšanām
  1. +18
    -1
      src/api/modules/api.js
  2. +12
    -1
      src/router/views/index.js
  3. +196
    -0
      src/views/Equipment/equlog.vue
  4. +39
    -18
      src/views/Equipment/state.vue

+ 18
- 1
src/api/modules/api.js Parādīt failu

@@ -1247,4 +1247,21 @@ export function findByProjectId(data) {
url: `/autoSR/customer/message/findByProjectId?id=${data}`,
method: 'GET',
})
}
}
// 设备日志
export function findByImeiAndHours(data) {
return request({
url: `/autoSR/zk/equipment/findByImeiAndHours`,
method: 'GET',
params: data
})
}
// 导出设备日志
export function findByImeiExport(data) {
return request({
url: `/autoSR/zk/equipment/findByImeiExport?imei=${data}`,
method: 'GET',
})
}



+ 12
- 1
src/router/views/index.js Parādīt failu

@@ -15,7 +15,7 @@ export default [
{
path: "/help/index",
name: "帮助中心",
component: () => import( "@/views/admin/help/index"),
component: () => import("@/views/admin/help/index"),
},
{
path: "/Statistics/Insightintothedetails",
@@ -58,6 +58,16 @@ export default [
),
name: "更新",
},
{
path: "/Equipment/equlog",
component: () =>
import(
/* webpackChunkName: "views" */ "@/views/Equipment/equlog"
),
name: "设备日志",
},

],
},
{
@@ -72,4 +82,5 @@ export default [
},
],
},

];

+ 196
- 0
src/views/Equipment/equlog.vue Parādīt failu

@@ -0,0 +1,196 @@
<template>
<div class="pages">
<div class="container">
<div class="tableBox">
<div class="header">
<div class="h-left">
<div class="label">
<span>设备编号:</span>
<span>{{ paramsObj.imei }}</span>
</div>
<div class="label">
<span>领用人:</span>
<span>{{ paramsObj.name }}</span>
</div>
</div>

<div class="h-right">
<el-button type="primary" @click="exportMethodPost">导出</el-button>
<el-button type="primary" @click="back">返回</el-button>
</div>
</div>
<div class="tabs">
<el-table :data="tableData" height="100%">
<el-table-column type="index" label="序号"> </el-table-column>
<el-table-column prop="imei" label="设备编号"> </el-table-column>
<el-table-column prop="receptionTime" label="更新时间">
</el-table-column>
<el-table-column prop="electricity" label="设备电量">
</el-table-column>
<el-table-column prop="signalDevice" label="设备信号">
</el-table-column>
<el-table-column prop="stateInterval" label="更新间隔时长">
</el-table-column>
</el-table>
</div>
</div>

<div class="btmpagiation">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="paramsObj.current"
:page-sizes="[10, 50, 100]"
:page-size="paramsObj.size"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</div>
</div>
</div>
</template>

<script>
export default {
data() {
return {
id: "", // 设备号
total: 0, // 总条数
paramsObj: {
imei: "",
// 当前页面的参数
current: 1,
size: 10,
},
tableData: [], // 数据列表数据
};
},

mounted() {
if (this.$route.query.id) this.paramsObj.imei = this.$route.query.id;
if (this.$route.query.names) this.paramsObj.name = this.$route.query.names;
this.getMessageList();
},

methods: {
// 导出.Excel公用方法
exportMethodPost() {
axios({
method: "get",
url: `/autoSR/zk/equipment/findByImeiExport?imei=${this.paramsObj.imei}`,
responseType: "blob",
})
.then((res) => {
let blob = new Blob([res], { type: "application/vnd.ms-excel" });
let date = new Date();
let time = date.toLocaleDateString();
// console.log(time, "时间");
if ("download" in document.createElement("a")) {
const link = document.createElement("a");
link.style.display = "none";
link.href = URL.createObjectURL(blob);
// link.download = res.headers['content-disposition'] //下载后文件名
link.download = (name || "导出文件") + time + ".xlsx"; //下载的文件名
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} else {
// console.log("--------------------jingla")
let fileName = (name || "导出文件") + time + ".xlsx"; //下载的文件名
navigator.msSaveBlob(blob, fileName);
}
})
.catch((error) => {
// Message.error({
// message: '网络连接错误'
// })
console.log(error);
});
},

back() {
this.$router.go(-1);
},
// 获取设备日志
getMessageList() {
this.tableData = [];
this.$api.api.findByImeiAndHours(this.paramsObj).then((res) => {
console.log(res);
if (res.code == 10000) {
this.total = res.data.total;
this.tableData = res.data.records;
}
});
},

// 改变当前分页条数
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.paramsObj.size = val;
this.getMessageList();
},
handleCurrentChange(val) {
this.paramsObj.current = val;
this.getMessageList();
},
},
};
</script>


<style lang="scss" scoped>
.pages {
padding: 10px 20px;
width: 100%;
height: 100%;
.container {
padding: 10px 20px;
width: 100%;
height: 100%;
background: #fff;
border-radius: 8px;
overflow: hidden;
display: flex;
flex-direction: column;

.tableBox {
width: 100%;
height: calc(100% - 72px);

.header {
padding: 20px 0;
display: flex;
align-items: center;

.h-left {
flex-grow: 1;
display: flex;
align-items: center;
.label {
margin-left: 20px;
display: flex;
align-items: baseline;
}
}

.h-right {
flex-shrink: 0;
}
}

.tabs {
height: calc(100% - 72px);
}
}

.btmpagiation {
flex-shrink: 0;
margin: 20px 0;
padding: 0 20px;
display: flex;
justify-content: flex-end;
}
}
}
</style>

+ 39
- 18
src/views/Equipment/state.vue Parādīt failu

@@ -493,7 +493,12 @@
row.recCmd == "start" ? "关闭" : "开启"
}}</el-dropdown-item
>
<el-dropdown-item v-if="getMenuReal('equ_state_equlog')" command="equlog"
>设备日志</el-dropdown-item
>
</el-dropdown-menu>


</el-dropdown>
</template>
</el-table-column>
@@ -668,7 +673,7 @@ import { exportMethodPost } from "@/util/util";
export default {
data() {
return {
isOpen:false,
isOpen: false,
options: [
{
value: "1",
@@ -871,6 +876,11 @@ export default {
},
computed: {
...mapGetters(["permissions"]),
getMenuReal() {
return name => {
return this.permissions[name]
}
}
},
created() {
this.equ_state_open = this.permissions["equ_state_open"];
@@ -896,15 +906,15 @@ export default {
this.searchForm.electricity = this.$route.query.electricity;
}
}
if (this.$route.query.selValue) this.selValue = this.$route.query.selValue
if (this.$route.query.selValue) this.selValue = this.$route.query.selValue;
// asd
this.getList();
// 获取列表
this.zkhousePage();
},
methods: {
isSystoleForm(){
this.isOpen = !this.isOpen
isSystoleForm() {
this.isOpen = !this.isOpen;
},
downLoad() {
let obj = {
@@ -1082,7 +1092,7 @@ export default {
item.electricity = 0;
item.signalDevice = 0;
}
if (item.onLine==0) {
if (item.onLine == 0) {
item.electricity = 0;
item.signalDevice = 0;
}
@@ -1289,6 +1299,17 @@ export default {
this.userList = res.data;
});
},
// 跳转设备日志页面
equlog(row) {
this.$router.push({
path: '/Equipment/equlog',
query: {
id: row.imei,
names: row.userName
}
})
},

voiceOpen(row) {
this.$confirm(
`确认${row.recCmd == "start" ? "关闭" : "开启"}录音吗?`,
@@ -1541,7 +1562,7 @@ export default {
margin-left: 15px;
min-width: 78px;
}
.btn-group{
.btn-group {
margin-left: 20px;
}
.toptimeqhuan {
@@ -1569,27 +1590,27 @@ export default {
.div-inp {
width: 250px;
}
/deep/ .el-table__header-wrapper{
thead{
tr{
th{
background: #F5F7FA;
/deep/ .el-table__header-wrapper {
thead {
tr {
th {
background: #f5f7fa;
color: #333333;
}
}
}
}
/deep/ .el-dialog--center{
/deep/ .el-dialog--center {
border-radius: 8px;
.el-dialog__title{
.el-dialog__title {
font-weight: bold;
}
}
/deep/ .el-button--primary{
background: #2671E2 !important;
border: 1px solid #2671E2 !important;
/deep/ .el-button--primary {
background: #2671e2 !important;
border: 1px solid #2671e2 !important;
}
/deep/ .el-button--text{
color: #2671E2;
/deep/ .el-button--text {
color: #2671e2;
}
</style>

Notiek ielāde…
Atcelt
Saglabāt