添加历史报表

jcbranch
fanluyan 10 months ago
parent 1f04bd7b15
commit b27f2d11ae

@ -1,10 +1,47 @@
<template>
<div class="sidebarBox">
<ul class="menuBoxUl">
<li class="menuItem" v-for="(item, index) in routeItem" :key="index">
<router-link :to="item.path"> {{ item.name }} </router-link>
</li>
</ul>
<el-menu
:default-active="activeIndex"
class="sidebar-el-menu"
mode="horizontal"
router
>
<template v-for="item in items">
<template v-if="item.subs">
<el-submenu :index="item.index" :key="item.index">
<template slot="title">
<span slot="title">{{ item.title }}</span>
</template>
<template v-for="subItem in item.subs">
<el-submenu
v-if="subItem.subs"
:index="subItem.index"
:key="subItem.index"
>
<template slot="title">{{ subItem.title }}</template>
<el-menu-item
v-for="(threeItem, i) in subItem.subs"
:key="i"
:index="threeItem.index"
>{{ threeItem.title }}</el-menu-item
>
</el-submenu>
<el-menu-item
v-else
:index="subItem.index"
:key="subItem.index"
>{{ subItem.title }}</el-menu-item
>
</template>
</el-submenu>
</template>
<template v-else>
<el-menu-item :index="item.index" :key="item.index">
<span slot="title">{{ item.title }}</span>
</el-menu-item>
</template>
</template>
</el-menu>
</div>
</template>
@ -12,49 +49,68 @@
export default {
data() {
return {
routeItem: [
activeIndex: "/home",
items: [
{
path: "/home",
name: "首页",
index: "/home",
title: "首页",
},
{
path: "/report",
name: "状态报表",
index: "/report",
title: "状态报表",
},
{
path: "/log",
name: "日志列表",
index: "/log",
title: "日志列表",
},
{
path: "/upgradation",
name: "上传APK/OTA",
index: "/upgradation",
title: "上传APK/OTA",
},
// {
// path: "/upgradationOta",
// name: "Ota",
// },
{
path: "/activity",
name: "活动列表",
index: "/activity",
title: "活动列表",
},
{
path: "/msgAuth",
name: "短信授权",
index: "/msgAuth",
title: "短信授权",
},
{
path: "/picReport",
name: "装置图片报表",
index: "/aaa",
title: "运维报表",
subs: [
{
index: "/picReport",
title: "在线率报表",
},
{
index: "/historyReport",
title: "运维历史数据",
},
],
},
// {
// path: "/deviceConfig",
// name: "",
// },
],
};
},
watch: {},
methods: {},
created() {},
watch: {
$route() {
this.setCurrentRoute();
},
},
created() {
this.setCurrentRoute();
},
methods: {
setCurrentRoute() {
console.log(this.$route.path);
this.$nextTick(() => {
this.activeIndex = this.$route.path; //
console.log(this.activeIndex);
localStorage.setItem("menuActive", this.activeIndex);
});
},
},
};
</script>
@ -64,38 +120,137 @@ export default {
// margin: 0 auto;
display: flex;
align-items: center;
.menuBoxUl {
flex: 1;
display: flex;
align-items: center;
justify-content: space-around;
.menuItem {
list-style: none;
display: flex;
height: 40px;
justify-content: center;
align-items: center;
cursor: pointer;
.el-menu--horizontal {
background: #169e8c;
.el-menu-item {
height: 56px;
line-height: 56px;
}
.el-submenu .el-submenu__title {
height: 56px;
line-height: 56px;
}
.el-submenu__title {
padding: 0 10px;
.iconfont {
margin-right: 5px;
}
}
.el-dropdown-menu__item,
.el-menu-item,
.el-submenu__title {
font-size: 14px;
margin-right: 32px;
a {
color: #fff;
//background: #e8f5f4;
height: 40px;
line-height: 40px;
padding: 0 12px;
background-size: 100% 100%;
background-repeat: no-repeat;
overflow: hidden;
border-radius: 8px;
&:hover {
background: #128071;
}
}
.el-menu-item i {
color: #666;
}
.el-menu-item.is-active {
i {
color: #169e8c;
}
.router-link-active {
background: #128071;
}
.el-submenu.is-active .el-submenu__title > i {
&:first-child {
color: #333;
}
}
}
.el-menu {
background: #169e8c;
i {
color: #fff !important;
}
.el-menu-item {
color: #fff;
}
.el-submenu .el-submenu__title {
color: #fff;
}
.el-menu-item:not(.is-disabled):focus,
.el-menu-item:not(.is-disabled):hover {
color: #fff;
background-color: #128071;
border-bottom: 2px solid #128071;
i {
color: #fff !important;
}
}
.el-submenu:focus .el-submenu__title,
.el-submenu:hover .el-submenu__title {
color: #fff !important;
background-color: #128071;
border-bottom: 2px solid #128071;
i {
color: #fff !important;
}
}
}
.el-menu--horizontal > .el-menu-item.is-active {
border-bottom: 2px solid #128071 !important;
color: #fff !important;
background-color: #128071 !important;
i {
color: #fff !important;
}
}
.el-submenu.is-active {
.el-submenu__title {
border-bottom: 2px solid #128071 !important;
color: #fff !important;
background-color: #128071;
i {
color: #fff !important;
}
}
}
.gallery-thumbs .swiper-slide-active {
border: 3px solid #169e8c !important;
}
.tags-li.active {
border: 1px solid #169e8c;
background-color: #169e8c;
}
.el-menu-item [class^="iconfont"] {
margin-right: 5px;
width: 24px;
text-align: center;
font-size: 18px;
vertical-align: middle;
}
// .menuBoxUl {
// flex: 1;
// display: flex;
// align-items: center;
// justify-content: space-around;
// .menuItem {
// list-style: none;
// display: flex;
// height: 40px;
// justify-content: center;
// align-items: center;
// cursor: pointer;
// font-size: 14px;
// margin-right: 32px;
// a {
// color: #fff;
// //background: #e8f5f4;
// height: 40px;
// line-height: 40px;
// padding: 0 12px;
// background-size: 100% 100%;
// background-repeat: no-repeat;
// overflow: hidden;
// border-radius: 8px;
// &:hover {
// background: #128071;
// }
// }
// .router-link-active {
// background: #128071;
// }
// }
// }
}
</style>

@ -93,19 +93,28 @@ const routes = [
component: () => import("../views/picReport/index.vue"),
name: "picReport",
meta: {
title: "装置图片报表",
title: "在线率报表",
keepAlive: true,
},
},
{
path: "/userlist",
component: () => import("../views/userList/index.vue"),
name: "userList",
path: "/historyReport",
component: () => import("../views/historyReport/index.vue"),
name: "historyReport",
meta: {
title: "用户列表",
title: "运维历史数据",
keepAlive: true,
},
},
// {
// path: "/userlist",
// component: () => import("../views/userList/index.vue"),
// name: "userList",
// meta: {
// title: "用户列表",
// keepAlive: true,
// },
// },
],
},
];

@ -0,0 +1,341 @@
<template>
<el-dialog
class="cmdMsgDialog"
title="历史信息"
:visible.sync="isShow"
:close-on-click-modal="false"
>
<div class="cmdBoxMain">
<el-button
type="primary"
icon="el-icon-refresh"
class="refresh"
@click="refresh"
>刷新</el-button
>
<el-table
:data="gridData"
style="width: 100%"
border
stripe
height="calc(100% - 40px)"
v-loading="girdloading"
>
<el-table-column type="index" width="50" label="序号">
</el-table-column>
<el-table-column prop="createTime" label="时间">
<template slot-scope="scope">
{{
$moment(scope.row.createTime * 1000).format("YYYY-MM-DD HH:mm:ss")
}}
</template>
</el-table-column>
<el-table-column label="id">
<template slot-scope="scope">
{{ scope.row.reportMap.id }}
</template>
</el-table-column>
<el-table-column label="i1服务器">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.cma }}</span>
</template>
</el-table-column>
<el-table-column label="心跳间隔" width="70">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.heartbeatDuration }}</span>
</template>
</el-table-column>
<el-table-column label="电池">
<template slot-scope="scope">
<span
v-if="
scope.row.reportMap !== null &&
scope.row.reportMap.hasOwnProperty('batteryVoltage') &&
scope.row.reportMap.hasOwnProperty('batteryChargingVoltage') &&
scope.row.reportMap.hasOwnProperty('batteryPower')
"
>
{{ scope.row.reportMap.batteryVoltage }}V/{{
scope.row.reportMap.batteryChargingVoltage
}}V/{{ scope.row.reportMap.batteryPower }}
</span>
<span v-else>{{ scope.row.reportMap.battery }}</span>
</template>
</el-table-column>
<el-table-column label="电池温度" width="70">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.batteryTmp }}</span>
</template>
</el-table-column>
<el-table-column label="主板温度" width="70">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.mainBoardTmp }}</span>
</template>
</el-table-column>
<el-table-column label="系统重启" width="70">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.rebootTimes }}</span>
</template>
</el-table-column>
<el-table-column label="i1重启" width="70">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.i1RebootTimes }}</span>
</template>
</el-table-column>
<el-table-column label="收" width="70">
<template slot-scope="scope">
<span
v-if="
scope.row.reportMap !== null &&
scope.row.reportMap.hasOwnProperty('XyDev')
"
>
<el-tooltip class="item" effect="dark" placement="top">
<div slot="content">
lastHbTime
{{
$moment(scope.row.reportMap.lastHbTime * 1000).format(
"YYYY-MM-DD HH:mm:ss"
)
}}
<br />
lastHbRespTime
{{
$moment(scope.row.reportMap.lastHbRespTime * 1000).format(
"YYYY-MM-DD HH:mm:ss"
)
}}
</div>
<span>
{{
$moment(scope.row.reportMap.lastRecvTime * 1000).format(
"HH:mm"
)
}}</span
>
</el-tooltip>
</span>
<span v-else> {{ scope.row.reportMap.recv }}</span>
</template>
</el-table-column>
<el-table-column label="传图" width="70">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.uploads }}</span>
</template>
</el-table-column>
<el-table-column label="拍" width="60">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.photoTimes }}</span>
</template>
</el-table-column>
<el-table-column label="成/败/传" width="70">
<template slot-scope="scope">
<span>
{{ scope.row.reportMap.success }}/{{
scope.row.reportMap.failure
}}/{{ scope.row.reportMap.uploads }}</span
>
</template>
</el-table-column>
<el-table-column label="心跳累计" width="80">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.numberOfHb }}</span>
</template>
</el-table-column>
<el-table-column label="网络异常" width="80">
<template slot-scope="scope">
<span>{{ scope.row.reportMap.networkError }}</span>
</template>
</el-table-column>
<el-table-column label="信号1" width="60">
<template slot-scope="scope">
<span
v-if="
scope.row.reportMap !== null &&
scope.row.reportMap.hasOwnProperty('XyDev')
"
>
{{ scope.row.reportMap.signalLevel1 }}</span
>
<span v-else> {{ scope.row.reportMap.signature1 }}</span>
</template>
</el-table-column>
<el-table-column label="信号2" width="60">
<template slot-scope="scope">
<span
v-if="
scope.row.reportMap !== null &&
scope.row.reportMap.hasOwnProperty('XyDev')
"
>
{{ scope.row.reportMap.signalLevel2 }}</span
>
<span v-else> {{ scope.row.reportMap.signature2 }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="其他">
<template slot-scope="scope">
{{ scope.row.raw_report.msgs.id }}
</template>
</el-table-column> -->
<el-table-column prop="content" label="其他" class-name="msgClass">
<template slot-scope="scope">
<el-tooltip
:open-delay="600"
popper-class="msgTootip"
placement="top"
effect="light"
>
<div slot="content">
<p v-html="cutout(scope.row)"></p>
</div>
<p>
{{ scope.row.content }}
</p>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<div class="pageNation">
<el-pagination
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
:current-page="page"
:page-size="pageSize"
layout="sizes, prev, pager, next, jumper,total"
:total="total"
>
</el-pagination>
</div>
</div>
</el-dialog>
</template>
<script>
import { heartListApi } from "@/utils/api/index";
export default {
props: {},
data() {
return {
gridData: [],
girdloading: true,
isShow: false,
page: 1, //
pageSize: 50, //
total: 0, //
termid: "",
};
},
methods: {
//tootip
cutout(cellValue) {
var aString = cellValue.content
.replace(/\,/g, "</br>")
.replace(/{|}/g, "")
.replace(/"|"/g, "")
.replace(/msg:/g, "");
return aString;
},
refresh() {
this.getQueryList();
},
getQueryList() {
this.girdloading = true;
this.gridData = [];
heartListApi({
termId: this.termid,
pageNum: this.page,
pageSize: this.pageSize,
})
.then((res) => {
console.log(res);
this.gridData = res.data.list;
this.total = Number(res.data.total);
this.girdloading = false;
})
.catch((err) => {});
},
display(val) {
this.isShow = true;
this.termid = val.id;
this.getQueryList();
},
hide() {
this.isShow = false;
},
handleCurrentChange(val) {
this.page = val;
this.getQueryList();
},
//
handleSizeChange(val) {
this.pageSize = val;
this.getQueryList();
},
},
};
</script>
<style lang="less">
.cmdMsgDialog {
display: flex;
align-items: center;
justify-items: center;
justify-content: center;
.refresh {
position: absolute;
top: 16px;
left: 110px;
}
.el-dialog {
width: 95%;
height: 83%;
margin-top: 0px !important;
.el-dialog__body {
padding: 12px;
width: calc(100% - 24px);
height: calc(100% - 78px);
.cmdBoxMain {
width: 100%;
height: 100%;
.el-table {
.el-table__cell {
text-align: center;
}
.msgClass {
.cell {
p {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
cursor: default;
}
}
}
}
}
.pageNation {
margin-top: 10px;
display: flex;
justify-content: flex-end;
}
}
}
}
.msgTootip {
color: #333;
overflow: auto;
height: 90%;
p {
font-size: 14px;
line-height: 22px;
}
}
</style>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,830 @@
<template>
<div class="homeBox">
<div class="filterBox">
<el-form
v-show="showDiv"
:inline="true"
:model="formdata"
class="demo-form-inline"
>
<div class="topSearch">
<el-form-item label="电压" class="dybox">
<el-select
v-model="formdata.dyId"
@change="getSearchxl"
filterable
@keyup.enter.native="onSubmit()"
>
<el-option
v-for="item in dyOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="线路" class="xlbox">
<el-select
@keyup.enter.native="onSubmit()"
v-model="formdata.lineId"
@change="getSearchgt"
filterable
>
<el-option
v-for="item in xlOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="杆塔" class="gtbox">
<el-select
v-model="formdata.towerId"
filterable
@keyup.enter.native="onSubmit()"
>
<el-option
v-for="item in gtOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="是否在线" class="isonLineClass">
<el-select
v-model="formdata.isonline"
@keyup.enter.native="onSubmit()"
>
<el-option
v-for="item in onlineOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="是否运维" class="ismntClass">
<el-select v-model="formdata.mntn" @keyup.enter.native="onSubmit()">
<el-option
v-for="item in mntendOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="规约" class="gybox">
<el-select
v-model="formdata.protocol"
filterable
@keyup.enter.native="onSubmit()"
>
<el-option
v-for="item in protocolOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
{{ item.name }}-{{ item.id }}
</el-option>
</el-select>
</el-form-item>
<el-form-item label="活动" class="activitybox">
<el-select
@keyup.enter.native="onSubmit()"
v-model="formdata.activityId"
filterable
@change="changeActive"
>
<el-option
v-for="item in activityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="选择日期" class="dateclass">
<el-date-picker
v-model="formdata.endtime"
type="datetime"
placeholder="结束日期"
value-format="timestamp"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item>
</div>
<div class="bottomSearch">
<el-form-item label="出厂ID" class="oidbox">
<el-input
@keyup.enter.native="onSubmit()"
v-model="formdata.oid"
placeholder="请输入出厂ID"
clearable
></el-input>
<el-tooltip
class="item"
effect="dark"
content="反选"
placement="top"
>
<el-checkbox
v-model="formdata.oidExclude"
:checked="formdata.oidExclude == 1 ? true : false"
true-label="1"
false-label="0"
></el-checkbox>
</el-tooltip>
</el-form-item>
<el-form-item label="装置编号" class="cmdibox">
<el-input
@keyup.enter.native="onSubmit()"
v-model="formdata.cmdid"
placeholder="请输入装置编号"
clearable
></el-input>
<el-tooltip
class="item"
effect="dark"
content="反选"
placement="top"
>
<el-checkbox
v-model="formdata.cmdidExclude"
:checked="formdata.cmdidExclude == 1 ? true : false"
true-label="1"
false-label="0"
></el-checkbox>
</el-tooltip>
</el-form-item>
<el-form-item label="CMA服务器" class="cmabox">
<el-input
@keyup.enter.native="onSubmit()"
v-model="formdata.cma"
placeholder="请输入CMA服务器"
clearable
></el-input>
<el-tooltip
class="item"
effect="dark"
content="反选"
placement="top"
>
<el-checkbox
v-model="formdata.cmaExclude"
:checked="formdata.cmaExclude == 1 ? true : false"
true-label="1"
false-label="0"
></el-checkbox>
</el-tooltip>
</el-form-item>
<el-form-item label="版本" class="versionbox">
<el-input
@keyup.enter.native="onSubmit()"
v-model="formdata.version"
placeholder="请输入版本"
clearable
></el-input>
<el-tooltip
class="item"
effect="dark"
content="反选"
placement="top"
>
<el-checkbox
v-model="formdata.versionExclude"
:checked="formdata.versionExclude == 1 ? true : false"
true-label="1"
false-label="0"
></el-checkbox>
</el-tooltip>
</el-form-item>
<el-form-item class="btngrop">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button type="primary" @click="onReset"></el-button>
</el-form-item>
</div>
</el-form>
<el-tooltip
class="item"
effect="dark"
:content="showDiv ? '收起' : '展开'"
placement="top"
>
<el-button
type="primary"
:class="showDiv ? 'toggleClass' : 'toggleClass2'"
:icon="showDiv ? 'el-icon-d-arrow-right' : 'el-icon-d-arrow-left'"
circle
@click="toggleDiv"
></el-button>
</el-tooltip>
</div>
<div class="searchSimple" v-if="!showDiv">
<el-form :inline="true" :model="formdata" class="demo-form-inline">
<el-form-item label="活动" class="activitybox">
<el-select
@keyup.enter.native="onSubmit()"
v-model="formdata.activityId"
filterable
@change="changeActive"
>
<el-option
v-for="item in activityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="装置编号" class="cmdibox">
<el-input
@keyup.enter.native="onSubmit()"
v-model="formdata.cmdid"
placeholder="请输入装置编号"
clearable
></el-input>
</el-form-item>
<el-form-item class="btngrop">
<el-button type="primary" @click="onSubmit"></el-button>
</el-form-item>
</el-form>
</div>
<div
class="tableBox"
:style="{ height: showDiv ? 'calc(100% - 82px)' : 'calc(100% - 2px)' }"
>
<tableMain
ref="tableRef"
:tableData="dataListNew"
:onlineNum="onlineNum"
:offlineNum="offlineNum"
:noPicNum="noPicNum"
:freeNum="freeNum"
:tableLoaidng="tableLoaidng"
:showDiv="showDiv"
></tableMain>
</div>
</div>
</template>
<script>
import {
cmdActlistApi,
getTerminalJoggle,
getActivityApi,
getProtocolList,
getSearchInfo,
exportTerminalApi,
} from "@/utils/api/index";
import tableMain from "./components/tableMain";
export default {
name: "historyReport",
components: {
tableMain,
},
data() {
return {
showDiv: true, // div
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now(); //
},
},
dyOptions: [{ id: -1, name: "全部" }], //
xlOptions: [{ id: -1, name: "全部" }], //线
gtOptions: [{ id: -1, name: "全部" }], //
onlineOptions: [
{ id: -1, name: "全部" },
{ id: 1, name: "在线" },
{ id: 0, name: "离线" },
],
protocolOptions: [{ id: -1, name: "全部" }], //
activityOptions: [{ id: -1, name: "全部" }], //
mntendOptions: [
{ id: -1, name: "全部" },
{ id: 1, name: "运维" },
{ id: 2, name: "未运维" },
], //
formdata: {
dyId: -1,
lineId: -1,
towerId: -1,
isonline: -1,
protocol: -1,
mntn: 1,
activityId: -1,
oid: "",
oidExclude: 0,
cmdid: "",
cmdidExclude: 0,
cma: "",
cmaExclude: 0,
version: "",
versionExclude: 0,
endtime: new Date(new Date().setHours(23, 59, 59, 0)).getTime(), // 23:59:59
},
dataList: [],
dataListNew: [],
tableLoaidng: false,
onlineNum: 0, //线
offlineNum: 0, //线
noPicNum: 0, //
freeNum: 0,
intervalId: null, // ID
activityIdLoc: "",
runCommand: [], //
scrollTop: 0, //
};
},
created() {
this.formdata = {
dyId: -1,
lineId: -1,
towerId: -1,
isonline: -1,
protocol: -1,
mntn: 1,
activityId: -1,
oid: "",
oidExclude: 0,
cmdid: "",
cmdidExclude: 0,
cma: "",
cmaExclude: 0,
version: "",
versionExclude: 0,
endtime: new Date(new Date().setHours(23, 59, 59, 0)).getTime(), // 23:59:59
};
},
mounted() {
this.getSearchdy();
this.getProtocol();
this.getactiveList();
},
watch: {},
methods: {
//
exportTable() {
let params = {
pageindex: 1,
pagesize: 10000,
end: this.formdata.endtime / 1000,
};
//
if (this.formdata.dyId !== -1) {
params.dyId = this.formdata.dyId;
}
if (this.formdata.lineId !== -1) {
params.lineId = this.formdata.lineId;
}
if (this.formdata.towerId !== -1) {
params.towerId = this.formdata.towerId;
}
if (this.formdata.isonline !== -1) {
params.isonline = this.formdata.isonline;
}
if (this.formdata.protocol !== -1) {
params.protocol = this.formdata.protocol;
}
if (this.formdata.mntn !== -1) {
params.mntn = this.formdata.mntn;
}
if (this.formdata.activityId !== -1) {
params.activityId = this.formdata.activityId;
}
if (this.formdata.oid !== "") {
params.oid = this.formdata.oid;
}
console.log(this.formdata.oidExclude);
if (this.formdata.oidExclude !== 0) {
params.oidExclude = this.formdata.oidExclude;
}
if (this.formdata.cma !== "") {
params.cma = this.formdata.cma;
}
if (this.formdata.cmaExclude !== 0) {
params.cmaExclude = this.formdata.cmaExclude;
}
if (this.formdata.cmdid !== "") {
params.cmdid = this.formdata.cmdid;
}
if (this.formdata.cmdidExclude !== 0) {
params.cmdidExclude = this.formdata.cmdidExclude;
}
if (this.formdata.version !== "") {
params.version = this.formdata.version;
}
if (this.formdata.versionExclude !== 0) {
params.versionExclude = this.formdata.versionExclude;
}
console.log(params);
exportTerminalApi(params)
.then((res) => {
console.log(res);
const now = this.$moment(new Date());
const formattedTime = now.format("YYYY年MM月DD日HH时mm分"); // "2023-04-01_15_30_00"
const blob = new Blob([res]);
const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = `运维数据报表_${formattedTime}.xls`;
link.click();
})
.catch((err) => {});
},
//
getSearchdy() {
getSearchInfo({ type: 1 })
.then((res) => {
this.dyOptions = this.dyOptions.concat(res.data.list);
console.log(this.dyOptions);
this.formdata.dyId = this.dyOptions[0].id;
this.getSearchxl();
})
.catch((err) => {});
},
//线
getSearchxl() {
getSearchInfo({ type: 2, id: this.formdata.dyId })
.then((res) => {
this.xlOptions = [{ id: -1, name: "全部" }];
this.xlOptions = this.xlOptions.concat(res.data.list);
this.formdata.lineId = this.xlOptions[0].id;
this.getSearchgt();
})
.catch((err) => {});
},
//
getSearchgt() {
getSearchInfo({ type: 3, id: this.formdata.lineId })
.then((res) => {
this.gtOptions = [{ id: -1, name: "全部" }];
this.gtOptions = this.gtOptions.concat(res.data.list);
this.formdata.towerId = this.gtOptions[0].id;
})
.catch((err) => {});
},
getProtocol() {
//
getProtocolList()
.then((res) => {
console.log(res);
this.protocolOptions = this.protocolOptions.concat(res.data.list);
this.formdata.protocol = this.protocolOptions[0].id;
})
.catch((err) => {});
},
//
getactiveList() {
getActivityApi()
.then((res) => {
console.log(res);
// this.activityOptions = this.activityOptions.concat(res.data.list);
let activeArr = res.data.map((item) => ({
id: item.id,
name: item.title,
}));
this.activityOptions = this.activityOptions.concat(activeArr);
console.log(this.activityOptions);
this.formdata.activityId = this.activityOptions[1].id;
})
.catch((err) => {});
},
changeActive(val) {
console.log(this.activityOptions);
console.log(val);
},
onSubmit() {
this.tableLoaidng = true;
this.dataList = [];
this.fetchData();
},
fetchData() {
console.log(this.$refs.tableRef);
let params = {
pageindex: 1,
pagesize: 10000,
end: this.formdata.endtime / 1000,
};
//
if (this.formdata.dyId !== -1) {
params.dyId = this.formdata.dyId;
}
if (this.formdata.lineId !== -1) {
params.lineId = this.formdata.lineId;
}
if (this.formdata.towerId !== -1) {
params.towerId = this.formdata.towerId;
}
if (this.formdata.isonline !== -1) {
params.isonline = this.formdata.isonline;
}
if (this.formdata.protocol !== -1) {
params.protocol = this.formdata.protocol;
}
if (this.formdata.mntn !== -1) {
params.mntn = this.formdata.mntn;
}
if (this.formdata.activityId !== -1) {
params.activityId = this.formdata.activityId;
}
if (this.formdata.oid !== "") {
params.oid = this.formdata.oid;
}
console.log(this.formdata.oidExclude);
if (Number(this.formdata.oidExclude) !== 0) {
params.oidExclude = this.formdata.oidExclude;
}
if (this.formdata.cma !== "") {
params.cma = this.formdata.cma;
}
if (Number(this.formdata.cmaExclude) !== 0) {
params.cmaExclude = this.formdata.cmaExclude;
}
if (this.formdata.cmdid !== "") {
params.cmdid = this.formdata.cmdid;
}
if (Number(this.formdata.cmdidExclude) !== 0) {
params.cmdidExclude = this.formdata.cmdidExclude;
}
if (this.formdata.version !== "") {
params.version = this.formdata.version;
}
if (Number(this.formdata.versionExclude) !== 0) {
params.versionExclude = this.formdata.versionExclude;
}
console.log(params);
getTerminalJoggle(params)
.then((res) => {
console.log(res);
this.dataList = res.data;
this.getCmdList();
this.onlineNum = this.dataList.filter(
(item) => item.onlinestatus == 1
).length;
this.offlineNum = this.dataList.length - this.onlineNum;
this.tableLoaidng = false;
this.noPicNum = this.dataList.filter(
(item) =>
item.mntnStatus.reportMap == null ||
item.mntnStatus.reportMap.pic == undefined ||
item.mntnStatus.reportMap.pic == 0 ||
item.mntnStatus.reportMap.pic == -1
).length;
this.freeNum = this.dataList.filter((item) => {
// mntnStatusreportMapfreeROMnullundefined
const freeROM = item.mntnStatus?.reportMap?.freeROM;
// freeROM
if (
freeROM !== null &&
freeROM !== undefined &&
!isNaN(parseInt(freeROM, 10))
) {
// 50
return parseInt(freeROM, 10) < 50;
}
// freeROM
return false;
}).length;
console.log("我已经加载完数据");
})
.catch((err) => {});
},
//
getCmdList() {
cmdActlistApi({ p: 1, ps: 10000 })
.then((res) => {
console.log(res);
console.log("我是命令列表");
console.log(this.dataList);
this.runCommand = res.data.list;
// let array1 = [{ id: 0, name: "sss" },{ id: 1, name: "111" }];
// let array2 = [{ termid: 0, time: "aaaa" },{ termid: 1, time: "s1111ss" }];
// array1id
let ids = this.dataList.map((item) => item.id);
// array2termIdarray1id
let filteredArray2 = this.runCommand.filter((item) =>
ids.includes(item.termId)
);
// array1list
this.dataList.forEach((item) => {
let match = filteredArray2.find((i) => i.termId === item.id);
if (match) {
item.list = item.list || []; // list
item.list.push(match);
}
});
this.dataListNew = this.dataList;
console.log(this.dataListNew);
})
.catch((err) => {});
},
//
onReset() {
this.formdata = {
dyId: -1,
lineId: -1,
towerId: -1,
isonline: -1,
protocol: -1,
mntn: 1,
activityId: -1,
oid: "",
oidExclude: 0,
cmdid: "",
cmdidExclude: 0,
cma: "",
cmaExclude: 0,
version: "",
versionExclude: 0,
};
this.onSubmit();
},
//
toggleDiv() {
this.showDiv = !this.showDiv; // showDiv
this.$refs.tableRef.calculateHeight(this.showDiv);
},
},
};
</script>
<style lang="less">
.homeBox {
height: calc(100% - 16px);
width: calc(100% - 24px);
padding: 12px 12px 4px 12px;
.filterBox {
position: relative;
font-size: 12px;
.el-form-item__label {
font-size: 12px;
}
.el-input__inner {
font-size: 12px;
padding: 0px 24px 0px 4px !important;
}
.el-form {
display: flex;
// align-items: center;
// flex-wrap: wrap;
flex-direction: column;
.el-form-item {
margin-bottom: 8px;
}
.topSearch {
display: flex;
}
.bottomSearch {
display: flex;
align-items: center;
.el-form-item--small .el-form-item__label {
white-space: nowrap;
}
.btngrop {
.el-form-item__content {
display: flex;
flex-wrap: nowrap;
}
}
}
.dybox {
.el-select {
width: 120px;
}
}
.ismntClass {
.el-select {
width: 100px;
}
}
.isonLineClass {
.el-select {
width: 80px;
}
}
.gybox {
.el-select {
width: 160px;
}
}
.dateclass {
.el-input__inner {
padding: 0px 32px !important;
}
}
.oidbox,
.cmdibox,
.cmabox,
.versionbox {
display: flex;
align-items: center;
background: #e9e9e9;
padding: 0px 12px;
border-radius: 3px;
.el-form-item__content {
display: flex;
align-items: center;
.el-input {
margin-right: 8px;
width: 162px;
}
}
}
.cmdibox {
background: #d0ece8;
}
.el-form-item__label,
.el-checkbox {
color: #333;
}
}
.toggleClass {
position: absolute;
right: 2px;
top: 82px;
.el-icon-d-arrow-left {
transform: rotate(-90deg);
}
.el-icon-d-arrow-right {
transform: rotate(-90deg);
}
}
.toggleClass2 {
position: absolute;
right: 2px;
top: 0px;
.el-icon-d-arrow-left {
transform: rotate(-90deg);
}
.el-icon-d-arrow-right {
transform: rotate(-90deg);
}
}
}
.searchSimple {
position: absolute;
top: 12px;
left: 435px;
z-index: 2;
.el-form-item {
margin-bottom: 0px;
}
.el-select {
width: 160px;
.el-input {
width: 160px;
}
}
.el-input {
width: 180px;
.el-input__inner {
padding-left: 8px;
padding-right: 15px;
}
}
}
.tableBox {
//height: calc(100% - 102px);
}
}
.el-pagination {
color: #606262;
font-weight: normal;
.el-pager li.active {
font-weight: 800;
}
}
.el-dialog__headerbtn {
top: 18px;
.el-dialog__close {
font-size: 26px;
&:hover {
background: #e2e2e2;
}
}
}
</style>

@ -1,17 +1,19 @@
<template>
<div class="lineBtn">
<el-button type="primary" @click="dialogVisible = true">选择线路</el-button>
<el-dialog title="提示" :visible.sync="dialogVisible" width="1050px">
<el-button type="primary" @click="showDialogFn">线</el-button>
<el-dialog title="选择线路" :visible.sync="dialogVisible" width="470px">
<div class="lineList">
<el-checkbox-group v-model="checkList">
<el-checkbox
v-for="item in lineListData"
:label="item.id"
:key="item.id"
>{{ item.name }}</el-checkbox
>
</el-checkbox-group>
<!-- {{ lineListData }} -->
<el-tree
:data="lineTreeData"
show-checkbox
ref="tree"
node-key="id"
highlight-current
:props="defaultProps"
:default-checked-keys="defaultCheckedKeys"
@check-change="getCheckedNodesData"
>
</el-tree>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
@ -21,40 +23,71 @@
</div>
</template>
<script>
import { getLineListJoggle } from "@/utils/api/index";
import { getPermissionTree } from "@/utils/api/index";
export default {
data() {
return {
dialogVisible: false,
lineTreeData: [],
defaultProps: {
children: "list",
label: "name",
},
checkList: [],
lineListData: [],
total: 0,
defaultCheckedKeys: [], // ID
};
},
mounted() {
this.lineList();
const storedArray = localStorage.getItem("checkListLocal");
if (storedArray) {
// JSON
this.checkList = JSON.parse(storedArray);
}
// this.lineList();
this.getlineTree();
},
methods: {
lineList() {
getLineListJoggle({
pageindex: 1,
pagesize: 100,
})
showDialogFn() {
this.dialogVisible = true;
const storedArray = localStorage.getItem("checkListLocal");
console.log(storedArray);
if (storedArray) {
// JSON
this.checkList = JSON.parse(storedArray);
}
this.defaultCheckedKeys = this.checkList;
},
getlineTree() {
getPermissionTree()
.then((res) => {
this.lineListData = res.data.list;
this.total = res.data.total;
this.lineTreeData = this.preprocessTreeData(res.data);
})
.catch((err) => {});
},
//
preprocessTreeData(data) {
return data.map((node) => {
//
let newNode = { ...node };
//
if (newNode.list && newNode.list.length > 0) {
newNode.list = newNode.list.map((child) => {
//
let newChild = { ...child };
//
newChild.list = [];
return newChild;
});
}
return newNode;
});
},
getCheckedNodesData() {
const checkedNodes = this.$refs.tree.getCheckedNodes(true); // true
const checkedNodeData = checkedNodes.map((node) => node.id);
console.log(checkedNodeData); //
this.checkList = checkedNodeData;
},
saveCheck() {
console.log(this.checkList);
localStorage.setItem("checkListLocal", JSON.stringify(this.checkList));
//
this.dialogVisible = false;
localStorage.setItem("checkListLocal", JSON.stringify(this.checkList));
console.log(this.checkList); //
this.$parent.getTablefun();
},
},
@ -66,6 +99,12 @@ export default {
padding: 10px;
}
.lineList {
height: 500px;
overflow: auto;
.el-dialog__body {
overflow: auto;
}
.el-checkbox-group {
.el-checkbox {
width: 220px;

@ -110,7 +110,7 @@
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
parseInt(scope.row.line.photoRate, 10)) /
100
).length
}}
@ -124,7 +124,7 @@
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
parseInt(scope.row.line.photoRate, 10)) /
100
).length /
scope.row.termList.length) *
@ -191,7 +191,7 @@
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
parseInt(scope.row.line.photoRate, 10)) /
100
).length
}}
@ -205,7 +205,7 @@
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
parseInt(scope.row.line.photoRate, 10)) /
100
).length /
scope.row.termList.length) *
@ -275,7 +275,7 @@
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
parseInt(scope.row.line.photoRate, 10)) /
100
).length
}}
@ -289,7 +289,7 @@
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
parseInt(scope.row.line.photoRate, 10)) /
100
).length /
scope.row.termList.length) *
@ -341,8 +341,7 @@ export default {
computed: {},
created() {},
mounted() {
this.localSelectLine = JSON.parse(localStorage.getItem("checkListLocal"));
console.log(this.localSelectLine);
this.onSubmit();
},
methods: {
//
@ -350,6 +349,8 @@ export default {
htmlToExcel.getExcel("#deciceTable", "运维在线率列表");
},
onSubmit() {
this.localSelectLine = JSON.parse(localStorage.getItem("checkListLocal"));
console.log(this.localSelectLine);
if (this.formdata.starttime > this.formdata.endtime) {
return this.$message({
duration: 1500,

@ -1,323 +0,0 @@
<template>
<div class="picReportClass">
<div class="logTitle">
<!-- <h3>装置图片报表</h3> -->
<el-form :inline="true" :model="formdata" class="demo-form-inline">
<el-form-item label="电压" class="dybox">
<el-select v-model="formdata.dyId" @change="getSearchxl" filterable>
<el-option
v-for="item in dyOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="线路" class="xlbox">
<el-select v-model="formdata.lineId" filterable @change="getlineNum">
<el-option
v-for="item in xlOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="应上图数量" class="pambox">
<el-input v-model="formdata.picNum" clearable></el-input>
</el-form-item>
<el-form-item label="正常上图率" class="pambox">
<el-input v-model="formdata.norGraphRate" clearable></el-input>
</el-form-item>
<el-form-item label="开始日期" class="dateclass">
<el-date-picker
v-model="formdata.starttime"
type="datetime"
placeholder="开始日期"
value-format="timestamp"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期" class="dateclass">
<el-date-picker
v-model="formdata.endtime"
type="datetime"
placeholder="结束日期"
value-format="timestamp"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item>
</el-form>
<el-button type="primary" @click="onSubmit"></el-button>
</div>
<div class="boxLogTable">
<el-table
v-loading="picLoading"
:data="tableData"
border
stripe
style="width: 100%"
height="100%"
>
<el-table-column type="index" width="50" label="序号">
</el-table-column>
<el-table-column label="电压"> {{ dyName }} </el-table-column>
<el-table-column label="线路" show-overflow-tooltip>
{{ xlName }}
</el-table-column>
<el-table-column prop="day" label="日期"> </el-table-column>
<el-table-column label="装置总数"> {{ termTotalNum }} </el-table-column>
<el-table-column label="运维上线数量">
<template slot-scope="scope">
{{ scope.row.termList.length }}
</template>
</el-table-column>
<el-table-column label="运维上线率">
<template slot-scope="scope">
{{
((scope.row.termList.length / termTotalNum) * 100).toFixed(2) +
"%"
}}
</template>
</el-table-column>
<el-table-column label="上图设备数量">
<template slot-scope="scope">
{{
scope.row.termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length
}}
</template>
</el-table-column>
<el-table-column prop="cmdid" label="上图率">
<template slot-scope="scope">
{{
(
(scope.row.termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length /
termTotalNum) *
100
).toFixed(2) + "%"
}}
</template>
</el-table-column>
<el-table-column label="正常上图设备数量">
<template slot-scope="scope">
{{
scope.row.termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(formdata.picNum, 10) *
parseInt(formdata.norGraphRate.replace("%", ""), 10)) /
100
).length
}}
</template>
</el-table-column>
<el-table-column label="正常上图率">
<template slot-scope="scope">
{{
(
(scope.row.termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(formdata.picNum, 10) *
parseInt(formdata.norGraphRate.replace("%", ""), 10)) /
100
).length /
termTotalNum) *
100
).toFixed(2) + "%"
}}
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import { getSearchInfo, picRportApi } from "@/utils/api/index";
export default {
name: "picReport",
components: {},
data() {
return {
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now(); //
},
},
dyOptions: [], //
xlOptions: [], //线
formdata: {
dyId: null,
lineId: null,
picNum: "",
norGraphRate: "",
starttime:
new Date(new Date().setHours(0, 0, 0, 0)).getTime() -
3 * 24 * 60 * 60 * 1000, // 00:00:00
endtime: new Date(new Date().setHours(23, 59, 59, 0)).getTime(), // 23:59:59
},
tableData: [],
picLoading: false,
termTotalNum: 0,
dyName: "",
xlName: "",
};
},
watch: {},
filters: {},
computed: {},
created() {},
mounted() {
this.getSearchdy();
},
methods: {
//
getSearchdy() {
getSearchInfo({ type: 1 })
.then((res) => {
this.dyOptions = this.dyOptions.concat(res.data.list);
console.log(this.dyOptions);
this.formdata.dyId = this.dyOptions[0].id;
this.getSearchxl();
})
.catch((err) => {});
},
//线
getSearchxl() {
getSearchInfo({ type: 2, id: this.formdata.dyId })
.then((res) => {
this.xlOptions = res.data.list;
this.formdata.lineId = this.xlOptions[0].id;
this.getlineNum(this.xlOptions[0].id);
})
.catch((err) => {});
},
getlineNum(val) {
console.log(val);
const lineObj = this.xlOptions.find((item) => item.id == val);
console.log(lineObj);
this.formdata.picNum =
lineObj.photoCount == null ? "0" : lineObj.photoCount;
this.formdata.norGraphRate =
lineObj.photoRate == null ? "0%" : lineObj.photoRate;
},
onSubmit() {
if (this.formdata.starttime > this.formdata.endtime) {
return this.$message({
duration: 1500,
showClose: true,
message: "开始日期不能大于结束日期",
type: "warning",
});
}
let params = {
start: this.formdata.starttime / 1000,
end: this.formdata.endtime / 1000,
};
//
if (this.formdata.dyId !== -1) {
params.dyId = this.formdata.dyId;
}
if (this.formdata.lineId !== -1) {
params.lineId = this.formdata.lineId;
}
//
this.getpicList(params);
},
getpicList(params) {
setTimeout(() => {
this.picLoading = true;
picRportApi(params)
.then((res) => {
this.picLoading = false;
if (res.data.termList.length !== 0) {
console.log(res.data);
this.tableData = res.data.dayList;
this.termTotalNum = res.data.termList.length;
this.dyName = res.data.termList[0].dyName;
this.xlName = res.data.termList[0].lineName;
} else {
this.tableData = [];
}
})
.catch((err) => {});
}, 100);
},
},
};
</script>
<style lang="less">
.picReportClass {
height: calc(100% - 24px);
width: calc(100% - 24px);
padding: 12px;
.logTitle {
display: flex;
align-items: center;
height: 32px;
margin-bottom: 12px;
h3 {
margin-right: 24px;
}
.el-form-item--small.el-form-item {
margin-bottom: 0px;
}
.dybox {
.el-select {
width: 120px;
}
}
.xlbox {
.el-select {
width: 180px;
}
}
.pambox {
.el-input {
width: 70px;
}
.el-input--suffix .el-input__inner {
padding: 8px;
}
}
.dateclass {
.el-date-editor.el-input,
.el-date-editor.el-input__inner {
width: 190px;
}
}
}
.boxLogTable {
height: calc(100% - 44px);
.el-table__cell {
text-align: center;
}
.el-table thead {
th.el-table__cell {
background: #fafafa;
}
}
.buttonText {
cursor: pointer;
white-space: pre-wrap;
&:hover {
text-decoration: underline;
}
}
}
}
</style>
Loading…
Cancel
Save