You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

464 lines
14 KiB
Vue

<template>
<div class="picReportClass">
<div class="logTitle">
<!-- <h3>装置图片报表</h3> -->
<el-form :inline="true" :model="formdata" class="demo-form-inline">
<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>
<selectLine></selectLine>
<el-button type="primary" @click="onSubmit">查询</el-button>
<el-button class="exportBtn" type="primary" @click="deviceExport"
>导出列表</el-button
>
</div>
<div class="boxLogTable">
<el-table
id="deciceTable"
v-loading="picLoading"
:data="tableData"
border
stripe
style="width: 100%"
height="100%"
>
<el-table-column type="index" width="50" label="序号" fixed="left">
</el-table-column>
<el-table-column label="线路" fixed="left">
<template slot-scope="scope">
<el-link
type="primary"
@click="detailFun(scope.row.line.id)"
size="small"
>{{ scope.row.line.name }}</el-link
>
</template>
</el-table-column>
<el-table-column label="日期" fixed="left">
<template slot-scope="scope">
{{ scope.row.dayList[0].day.split(" ")[0] }}
</template>
</el-table-column>
<el-table-column label="装置总数" fixed="left">
<template slot-scope="scope">
{{ scope.row.termList.length }}</template
>
</el-table-column>
<el-table-column label="运维上线数量" width="70px">
<template slot-scope="scope">
{{ scope.row.dayList[0].termList.length }}</template
>
</el-table-column>
<el-table-column label="运维上线率" width="70px">
<template slot-scope="scope">
{{
(
(scope.row.dayList[0].termList.length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}</template
>
</el-table-column>
<el-table-column label="上图设备数量" width="70px">
<template slot-scope="scope">
{{
scope.row.dayList[0].termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length
}}
</template>
</el-table-column>
<el-table-column label="上图率">
<template slot-scope="scope">
{{
(
(scope.row.dayList[0].termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}</template
>
</el-table-column>
<el-table-column label="正常上图设备数量">
<template slot-scope="scope">
{{
scope.row.dayList[0].termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
100
).length
}}
</template>
</el-table-column>
<el-table-column label="正常上图率">
<template slot-scope="scope">
{{
(
(scope.row.dayList[0].termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
100
).length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}
</template>
</el-table-column>
<el-table-column
label="运维上线数量(昨天)"
width="70px"
class-name="yestoday"
>
<template slot-scope="scope">
{{ scope.row.dayList[1].termList.length }}</template
>
</el-table-column>
<el-table-column
label="运维上线率(昨天)"
width="70px"
class-name="yestoday"
>
<template slot-scope="scope">
{{
(
(scope.row.dayList[1].termList.length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}</template
>
</el-table-column>
<el-table-column
label="上图设备数量(昨天)"
width="70px"
class-name="yestoday"
>
<template slot-scope="scope">
{{
scope.row.dayList[1].termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length
}}
</template>
</el-table-column>
<el-table-column label="上图率(昨天)" class-name="yestoday">
<template slot-scope="scope">
{{
(
(scope.row.dayList[1].termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}</template
>
</el-table-column>
<el-table-column label="正常上图设备数量(昨天)" class-name="yestoday">
<template slot-scope="scope">
{{
scope.row.dayList[1].termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
100
).length
}}
</template>
</el-table-column>
<el-table-column label="正常上图率(昨天)" class-name="yestoday">
<template slot-scope="scope">
{{
(
(scope.row.dayList[1].termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
100
).length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}
</template>
</el-table-column>
<el-table-column
label="运维上线数量(前天)"
width="70px"
class-name="beforeday"
>
<template slot-scope="scope">
{{ scope.row.dayList[2].termList.length }}</template
>
</el-table-column>
<el-table-column
label="运维上线率(前天)"
width="70px"
class-name="beforeday"
>
<template slot-scope="scope">
{{
(
(scope.row.dayList[2].termList.length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}</template
>
</el-table-column>
<el-table-column
label="上图设备数量(前天)"
width="70px"
class-name="beforeday"
>
<template slot-scope="scope">
{{
scope.row.dayList[2].termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length
}}
</template>
</el-table-column>
<el-table-column label="上图率(前天)" class-name="beforeday">
<template slot-scope="scope">
{{
(
(scope.row.dayList[2].termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}</template
>
</el-table-column>
<el-table-column
label="正常上图设备数量(前天)"
class-name="beforeday"
>
<template slot-scope="scope">
{{
scope.row.dayList[2].termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
100
).length
}}
</template>
</el-table-column>
<el-table-column label="正常上图率(前天)" class-name="beforeday">
<template slot-scope="scope">
{{
(
(scope.row.dayList[2].termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
100
).length /
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}
</template>
</el-table-column>
</el-table>
</div>
<lineStatusDialog ref="statusLineRef"></lineStatusDialog>
</div>
</template>
<script>
import { picRportApi } from "@/utils/api/index";
import selectLine from "./components/selectLine";
import lineStatusDialog from "./components/lineStatusDialog";
import htmlToExcel from "@/utils/htmlToExcel";
export default {
name: "picReport",
components: { selectLine, lineStatusDialog },
data() {
return {
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now(); // 禁用大于今天的日期
},
},
formdata: {
starttime:
new Date(new Date().setHours(0, 0, 0, 0)).getTime() -
3 * 24 * 60 * 60 * 1000, // 设置开始时间为当天凌晨00:00:00的时间戳, // 设置开始时间为当天凌晨00:00:00的时间戳,
endtime: new Date(new Date().setHours(23, 59, 59, 0)).getTime(), // 设置结束时间为当天夜晚23:59:59的时间戳
},
tableData: [],
picLoading: false,
termTotalNum: 0,
dyName: "",
xlName: "",
//从本地获取选中的线路
localSelectLine: [],
};
},
watch: {},
filters: {},
computed: {},
created() {},
mounted() {
this.localSelectLine = JSON.parse(localStorage.getItem("checkListLocal"));
console.log(this.localSelectLine);
},
methods: {
//导出活动列表表格
deviceExport() {
htmlToExcel.getExcel("#deciceTable", "运维在线率列表");
},
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,
lineIds: this.localSelectLine,
};
this.getpicList(params);
},
getpicList(params) {
setTimeout(() => {
this.picLoading = true;
picRportApi(params)
.then((res) => {
if (res.code == 200) {
this.picLoading = false;
if (res.data.length !== 0) {
console.log(res.data);
this.tableData = res.data;
} else {
this.tableData = [];
}
} else {
this.picLoading = false;
}
})
.catch((err) => {
this.picLoading = false;
});
}, 100);
},
//获取多条线路的信息
getTablefun() {
console.log("我是点击了确定");
this.localSelectLine = JSON.parse(localStorage.getItem("checkListLocal"));
this.onSubmit();
},
//获取详细线路
detailFun(row) {
console.log(row);
this.$refs.statusLineRef.display(row);
},
},
};
</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;
.exportBtn {
margin-left: auto;
}
h3 {
margin-right: 24px;
}
.el-form-item--small.el-form-item {
margin-bottom: 0px;
}
.lineBtn {
margin-right: 12px;
}
.dateclass {
.el-date-editor.el-input,
.el-date-editor.el-input__inner {
width: 190px;
}
}
}
.boxLogTable {
height: calc(100% - 44px);
.yestoday {
background: #b1f5e8 !important;
color: #000;
}
.beforeday {
background: #dfe745 !important;
color: #000;
}
.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>