优化图片在线数量

jcbranch
fanluyan 10 months ago
parent 5038971aec
commit 3d10a75ca0

@ -241,8 +241,11 @@ export function updateAuthApi(data) {
export function picRportApi(data) {
return request({
url: "/xymanager/terminal/statMaintain",
method: "get",
params: data,
method: "post",
data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}

@ -0,0 +1,296 @@
<template>
<div class="statusDialog">
<el-dialog
title="多天数据报表"
:visible.sync="statusdialogVisible"
width="1220px"
>
<div class="lineTableBox" v-loading="picLoading">
<div class="lineLeft">
<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>
<el-button type="primary" @click="onSubmit"></el-button>
</div>
<div class="boxLogTable">
<el-table :data="tableData" border stripe height="calc(100%)">
<el-table-column type="index" width="50" label="序号">
</el-table-column>
<el-table-column label="线路" show-overflow-tooltip>
{{ xlName }}
</el-table-column>
<el-table-column prop="day" label="日期" show-overflow-tooltip>
</el-table-column>
<el-table-column label="装置总数">
<template slot-scope="scope"> {{ termTotalNum }}</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.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 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(picNum, 10) *
parseInt(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(picNum, 10) *
parseInt(norGraphRate.replace("%", ""), 10)) /
100
).length /
termTotalNum) *
100
).toFixed(2) + "%"
}}
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="echartsDiv" id="echartBox"></div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="statusdialogVisible = false"
> </el-button
>
</span>
</el-dialog>
</div>
</template>
<script>
import { picRportApi } from "@/utils/api/index";
export default {
data() {
return {
statusdialogVisible: false,
pickerOptions: {
disabledDate(date) {
return date.getTime() > Date.now(); //
},
},
formdata: {
starttime:
new Date(new Date().setHours(0, 0, 0, 0)).getTime() -
30 * 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,
lineId: "",
termTotalNum: 0,
dyName: "",
xlName: "",
picNum: 0,
norGraphRate: 0,
titleArr: ["运维上线数量", "上图设备数量", "正常上图设备数量"],
};
},
mounted() {},
methods: {
display(row) {
this.statusdialogVisible = true;
this.lineId = row;
this.onSubmit();
},
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.lineId],
};
this.getpicList(params);
},
getpicList(params) {
setTimeout(() => {
this.picLoading = true;
picRportApi(params)
.then((res) => {
this.picLoading = false;
if (res.data.length !== 0) {
console.log(res.data);
//this.tableData = res.data;
this.tableData = res.data[0].dayList;
console.log(this.tableData);
this.termTotalNum = res.data[0].termList.length;
this.picNum = res.data[0].line.photoCount;
this.norGraphRate = res.data[0].line.photoRate;
this.xlName = res.data[0].line.name;
this.getEchart();
} else {
this.tableData = [];
}
})
.catch((err) => {});
}, 100);
},
//
getEchart() {
this.$nextTick(() => {
console.log(this.termDataNum);
let that = this;
that.$echarts.init(document.getElementById("echartBox")).dispose();
that.myChart = this.$echarts.init(document.getElementById("echartBox"));
let option = {
tooltip: {
trigger: "axis",
},
legend: {
data: this.titleArr,
},
grid: {
left: "5%",
right: "5%",
bottom: "5%",
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: false,
data: this.tableData.map((item) => item.day),
},
yAxis: {
type: "value",
},
series: [
{
name: "运维上线数量",
type: "line",
stack: "Total",
data: this.tableData.map((item) => item.termList.length),
},
{
name: "上图设备数量",
type: "line",
stack: "Total",
data: this.tableData.map(
(item) =>
item.termList.filter((term) => parseInt(term.uploads, 10) > 0)
.length
),
},
{
name: "正常上图设备数量",
type: "line",
stack: "Total",
data: this.tableData.map(
(item) =>
item.termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(this.picNum, 10) *
parseInt(this.norGraphRate.replace("%", ""), 10)) /
100
).length
),
},
],
};
that.myChart.setOption(option);
window.addEventListener("resize", () => {
that.myChart.resize();
});
});
},
},
};
</script>
<style lang="less">
.statusDialog {
.el-dialog__body {
padding: 10px;
}
.lineLeft {
width: 800px;
}
.echartsDiv {
width: 400px;
height: 400px;
margin-top: 35px;
}
.lineTableBox {
height: 420px;
display: flex;
}
}
</style>

@ -36,7 +36,7 @@ export default {
const storedArray = localStorage.getItem("checkListLocal");
if (storedArray) {
// JSON
this.checkList = JSON.parse(storedArray).map((item) => item.id);
this.checkList = JSON.parse(storedArray);
}
},
methods: {
@ -53,20 +53,7 @@ export default {
},
saveCheck() {
console.log(this.checkList);
const filteredItems = this.lineListData.filter((item) =>
this.checkList.includes(item.id)
);
const combinedItems = filteredItems.map((item) => ({
photoCount: item.photoCount,
photoRate: item.photoRate,
id: item.id,
dyLevelName: item.dyLevelName,
name: item.name,
}));
// combinedItemsdata
console.log(combinedItems);
const arrayAsString = JSON.stringify(combinedItems);
localStorage.setItem("checkListLocal", arrayAsString);
localStorage.setItem("checkListLocal", JSON.stringify(this.checkList));
this.dialogVisible = false;
this.$parent.getTablefun();
},

@ -2,35 +2,8 @@
<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"
@ -52,6 +25,7 @@
</el-date-picker>
</el-form-item>
</el-form>
<selectLine></selectLine>
<el-button type="primary" @click="onSubmit"></el-button>
</div>
@ -66,29 +40,47 @@
>
<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 }}
<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 prop="day" label="日期"> </el-table-column>
<el-table-column label="装置总数"> {{ termTotalNum }} </el-table-column>
<el-table-column label="运维上线数量">
<el-table-column prop="day" label="日期">
<template slot-scope="scope">
{{ scope.row.termList.length }}
{{ 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.termList.length / termTotalNum) * 100).toFixed(2) +
"%"
}}
</template>
(
(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.termList.filter(
scope.row.dayList[0].termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length
}}
@ -98,23 +90,23 @@
<template slot-scope="scope">
{{
(
(scope.row.termList.filter(
(scope.row.dayList[0].termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length /
termTotalNum) *
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}
</template>
}}</template
>
</el-table-column>
<el-table-column label="正常上图设备数量">
<template slot-scope="scope">
{{
scope.row.termList.filter(
scope.row.dayList[0].termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(formdata.picNum, 10) *
parseInt(formdata.norGraphRate.replace("%", ""), 10)) /
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
100
).length
}}
@ -124,14 +116,14 @@
<template slot-scope="scope">
{{
(
(scope.row.termList.filter(
(scope.row.dayList[0].termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(formdata.picNum, 10) *
parseInt(formdata.norGraphRate.replace("%", ""), 10)) /
(parseInt(scope.row.line.photoCount, 10) *
parseInt(scope.row.line.photoRate.replace("%", ""), 10)) /
100
).length /
termTotalNum) *
scope.row.termList.length) *
100
).toFixed(2) + "%"
}}
@ -139,13 +131,17 @@
</el-table-column>
</el-table>
</div>
<lineStatusDialog ref="statusLineRef"></lineStatusDialog>
</div>
</template>
<script>
import { getSearchInfo, picRportApi } from "@/utils/api/index";
import { picRportApi } from "@/utils/api/index";
import selectLine from "./components/selectLine";
import lineStatusDialog from "./components/lineStatusDialog";
export default {
name: "picReport",
components: {},
components: { selectLine, lineStatusDialog },
data() {
return {
pickerOptions: {
@ -153,16 +149,9 @@ export default {
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
starttime: new Date(new Date().setHours(0, 0, 0, 0)).getTime(), // 00:00:00,
endtime: new Date(new Date().setHours(23, 59, 59, 0)).getTime(), // 23:59:59
},
tableData: [],
@ -170,6 +159,8 @@ export default {
termTotalNum: 0,
dyName: "",
xlName: "",
//线
localSelectLine: [],
};
},
watch: {},
@ -177,40 +168,10 @@ export default {
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({
@ -223,16 +184,8 @@ export default {
let params = {
start: this.formdata.starttime / 1000,
end: this.formdata.endtime / 1000,
lineIds: this.localSelectLine,
};
//
if (this.formdata.dyId !== -1) {
params.dyId = this.formdata.dyId;
}
if (this.formdata.lineId !== -1) {
params.lineId = this.formdata.lineId;
}
//
this.getpicList(params);
},
@ -242,12 +195,9 @@ export default {
picRportApi(params)
.then((res) => {
this.picLoading = false;
if (res.data.termList.length !== 0) {
if (res.data.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;
this.tableData = res.data;
} else {
this.tableData = [];
}
@ -255,6 +205,18 @@ export default {
.catch((err) => {});
}, 100);
},
//线
getTablefun() {
console.log("我是点击了确定");
this.localSelectLine = JSON.parse(localStorage.getItem("checkListLocal"));
this.onSubmit();
},
//线
detailFun(row) {
console.log(row);
this.$refs.statusLineRef.display(row);
},
},
};
</script>
@ -275,23 +237,9 @@ export default {
.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;
}
.lineBtn {
margin-right: 12px;
}
.dateclass {
.el-date-editor.el-input,

@ -53,7 +53,6 @@
</el-form-item>
</el-form>
<el-button type="primary" @click="onSubmit"></el-button>
<selectLine></selectLine>
</div>
<div class="boxLogTable">
@ -67,46 +66,29 @@
>
<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="电压"> {{ dyName }} </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>
{{ 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.dayList[0].termList.length }}
{{ scope.row.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) + "%"
((scope.row.termList.length / termTotalNum) * 100).toFixed(2) +
"%"
}}
</template>
</el-table-column>
<el-table-column label="上图设备数量">
<template slot-scope="scope">
{{
scope.row.dayList[0].termList.filter(
scope.row.termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length
}}
@ -116,7 +98,7 @@
<template slot-scope="scope">
{{
(
(scope.row.dayList[0].termList.filter(
(scope.row.termList.filter(
(term) => parseInt(term.uploads, 10) > 0
).length /
termTotalNum) *
@ -128,7 +110,7 @@
<el-table-column label="正常上图设备数量">
<template slot-scope="scope">
{{
scope.row.dayList[0].termList.filter(
scope.row.termList.filter(
(term) =>
parseInt(term.uploads, 10) >=
(parseInt(formdata.picNum, 10) *
@ -161,11 +143,9 @@
</template>
<script>
import { getSearchInfo, picRportApi } from "@/utils/api/index";
import selectLine from "./components/selectLine";
export default {
name: "picReport",
components: { selectLine },
components: {},
data() {
return {
pickerOptions: {
@ -180,7 +160,9 @@ export default {
lineId: null,
picNum: "",
norGraphRate: "",
starttime: new Date(new Date().setHours(0, 0, 0, 0)).getTime(),
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: [],
@ -188,8 +170,6 @@ export default {
termTotalNum: 0,
dyName: "",
xlName: "",
//线
localSelectLine: [],
};
},
watch: {},
@ -198,8 +178,6 @@ export default {
created() {},
mounted() {
this.getSearchdy();
this.localSelectLine = JSON.parse(localStorage.getItem("checkListLocal"));
console.log(this.localSelectLine);
},
methods: {
//
@ -277,56 +255,6 @@ export default {
.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); // picRportApiPromise
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);
// picListtableData
// picList
if (Array.isArray(picList)) {
this.tableDatas.push(...picList); // 使
} else if (picList) {
// picListtableData
this.tableDatas.push(picList);
}
}
// this.tableData
console.log(this.tableDatas);
this.tableData = this.tableDatas;
},
},
};
</script>
Loading…
Cancel
Save