|
|
|
@ -0,0 +1,395 @@
|
|
|
|
|
<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>
|
|
|
|
|
<selectLine></selectLine>
|
|
|
|
|
</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="电压">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ scope.row.termList[0].dyName }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="线路" show-overflow-tooltip>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ scope.row.termList[0].lineName }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="day" label="日期">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ scope.row.dayList[0].day }}
|
|
|
|
|
</template>
|
|
|
|
|
</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.dayList[0].termList.length }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="运维上线率">
|
|
|
|
|
<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="上图设备数量">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{
|
|
|
|
|
scope.row.dayList[0].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.dayList[0].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.dayList[0].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";
|
|
|
|
|
import selectLine from "./components/selectLine";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "picReport",
|
|
|
|
|
components: { selectLine },
|
|
|
|
|
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(),
|
|
|
|
|
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.getSearchdy();
|
|
|
|
|
this.localSelectLine = JSON.parse(localStorage.getItem("checkListLocal"));
|
|
|
|
|
console.log(this.localSelectLine);
|
|
|
|
|
},
|
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//获取多条线路的信息
|
|
|
|
|
getTablefun() {
|
|
|
|
|
console.log("我是点击了确定");
|
|
|
|
|
console.log(this.localSelectLine);
|
|
|
|
|
// let arrlist = [];
|
|
|
|
|
// arrlist = this.localSelectLine.map((item) => item.id);
|
|
|
|
|
// console.log(arrlist);
|
|
|
|
|
this.fetchAllPicLists();
|
|
|
|
|
},
|
|
|
|
|
async fetchPicListForLine(lineId, startTime, endTime) {
|
|
|
|
|
try {
|
|
|
|
|
let params = {
|
|
|
|
|
start: startTime,
|
|
|
|
|
end: endTime,
|
|
|
|
|
lineId: lineId,
|
|
|
|
|
};
|
|
|
|
|
const res = await picRportApi(params); // 假设picRportApi返回一个Promise
|
|
|
|
|
return res.data; // 返回接口调用的结果
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error fetching pic list:", error);
|
|
|
|
|
return null; // 或者你可以返回一个错误对象
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async fetchAllPicLists() {
|
|
|
|
|
this.tableDatas = []; // 初始化tableData为空数组
|
|
|
|
|
for (let item of this.localSelectLine) {
|
|
|
|
|
const startTime = this.formdata.starttime / 1000;
|
|
|
|
|
const endTime = this.formdata.endtime / 1000;
|
|
|
|
|
const picList = await this.fetchPicListForLine(
|
|
|
|
|
item.id,
|
|
|
|
|
startTime,
|
|
|
|
|
endTime
|
|
|
|
|
);
|
|
|
|
|
console.log(picList);
|
|
|
|
|
// 假设每个picList是一个数组,我们将其添加到tableData中
|
|
|
|
|
// 如果picList不是数组或者你想要以不同的方式处理它,你需要相应地修改这里
|
|
|
|
|
if (Array.isArray(picList)) {
|
|
|
|
|
this.tableDatas.push(...picList); // 使用扩展运算符来合并数组
|
|
|
|
|
} else if (picList) {
|
|
|
|
|
// 如果picList不是数组但你有其他想要添加到tableData的数据
|
|
|
|
|
this.tableDatas.push(picList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 此时,this.tableData包含了所有从接口获取的数据
|
|
|
|
|
console.log(this.tableDatas);
|
|
|
|
|
this.tableData = this.tableDatas;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</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>
|