添加图片报表
parent
4e6242e191
commit
d9fe04421d
@ -0,0 +1,307 @@
|
|||||||
|
<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>
|
||||||
|
<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="线路"> {{ 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: "48",
|
||||||
|
norGraphRate: "100%",
|
||||||
|
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;
|
||||||
|
})
|
||||||
|
.catch((err) => {});
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
})
|
||||||
|
.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…
Reference in New Issue