数据统计

menu1.0
fanluyan 3 months ago
parent 0a18645e6e
commit c4f2b1f60f

@ -154,10 +154,17 @@
<span
v-if="
scope.row.lastWeathers !== null &&
scope.row.lastWeathers.avgWindDir10min != 255
scope.row.lastWeathers.avgWindDir10min != 65535
"
>{{ scope.row.lastWeathers.avgWindDir10min }}</span
>
<span
v-else-if="
scope.row.lastWeathers !== null &&
scope.row.lastWeathers.avgWindDir10min > 360
"
>异常</span
>
<span v-else> - </span>
</template>
</el-table-column>
@ -428,9 +435,14 @@
<template slot-scope="scope">
<span
v-if="
scope.row !== null && scope.row.avgWindDir10min != 255
scope.row !== null && scope.row.avgWindDir10min != 65535
"
>{{ scope.row.avgWindDir10min }}</span
><span
v-else-if="
scope.row !== null && scope.row.avgWindDir10min > 360
"
>异常</span
>
<span v-else> - </span>
</template>

@ -2115,8 +2115,6 @@ export default {
];
this.setTermFn(params);
}
this.setTermFn(params);
} else {
this.$message({
duration: 1500,
@ -2162,17 +2160,27 @@ export default {
},
{
name: "text",
value: this.osdParams.textContent,
value:
this.osdParams.textContent == undefined
? ""
: this.osdParams.textContent,
},
{
name: "leftBottom",
value: this.osdParams.leftBottom,
value:
this.osdParams.leftBottom == undefined
? ""
: this.osdParams.leftBottom,
},
{
name: "rightBottom",
value: this.osdParams.rightBottom,
value:
this.osdParams.rightBottom == undefined
? ""
: this.osdParams.rightBottom,
},
];
console.log(params);
this.setTermFn(params);
} else {
let params = [
@ -2419,8 +2427,9 @@ export default {
this.idParameter = JSON.parse(res.data.data);
this.waterForm = JSON.parse(res.data.data);
this.osdParams = JSON.parse(res.data.data);
console.log(this.osdParams);
this.zjidParameter = JSON.parse(res.data.data);
if (this.osdParams.textContent == "null ") {
if (this.osdParams.textContent == "null") {
console.log("我是空");
this.osdParams.textContent = "";
}

@ -482,6 +482,7 @@ export default {
console.log(val);
// const a = this.channelListOption.find((channel) => channel.type === 1);
// console.log(a);
this.yzwVal = "";
if (val != -1) {
console.log(this.channelListOption[val].type);
if (this.channelListOption[val].type == 1) {

@ -16,6 +16,10 @@
<el-radio :label="2">通道2</el-radio>
<el-radio :label="3">通道3</el-radio>
<el-radio :label="4">通道4</el-radio>
<el-radio :label="5">通道5</el-radio>
<el-radio :label="6">通道6</el-radio>
<el-radio :label="7">通道7</el-radio>
<el-radio :label="8">通道8</el-radio>
</el-radio-group>
</div>
<div class="ipContain">

@ -0,0 +1,193 @@
<template>
<el-dialog
class="phototimeDialog"
title="当天图片统计"
:visible.sync="isShowTime"
:close-on-click-modal="false"
@close="hide"
width="100%"
>
<h3>{{ rowData.cmdid }}</h3>
<el-table :data="tableData" style="width: 100%" border>
<el-table-column
prop="channel"
label="通道"
width="120"
></el-table-column>
<el-table-column
prop="totalCount"
label="总数"
width="120"
></el-table-column>
<el-table-column
prop="presetId"
label="预置位"
width="120"
></el-table-column>
<el-table-column prop="anomalies" label="异常时间点"></el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import { getphotoApi } from "@/utils/api/reportApi";
export default {
data() {
return {
isShowTime: false,
rowData: {},
paramsData: {},
picListData: [],
picloading: false,
radio: "-1",
page: 1,
pageSize: 400,
total: 0,
tableData: [],
};
},
methods: {
//
display(row, params) {
this.isShowTime = true;
this.rowData = row;
this.paramsData = params;
this.radio = params.channelid;
this.getPhotoList();
},
//
hide() {
this.isShowTime = false;
},
//
getPhotoList() {
this.picloading = true;
getphotoApi({
dyid: this.rowData.dyId,
lineid: this.rowData.lineId,
towerid: this.rowData.towerId,
channelid: this.radio,
termid: this.rowData.id,
starttime: this.paramsData.starttime,
endtime: this.paramsData.endtime,
pageindex: this.page,
pagesize: this.pageSize,
})
.then((res) => {
this.picListData = res.data.list;
this.total = res.data.total;
this.processData();
})
.catch((err) => {
console.error("获取图片数据失败:", err);
})
.finally(() => {
this.picloading = false;
});
},
//
processData() {
const channelPresetMap = {};
//
this.picListData.forEach((photo) => {
const channel = photo.channnelname;
const presetId = photo.presetId;
const hour = new Date(photo.photoTime).getHours();
console.log("我是时间", hour);
const key = `${channel}-${presetId}`;
if (!channelPresetMap[key]) {
channelPresetMap[key] = {
channel: channel,
presetId: presetId,
totalCount: 0,
hourlyData: new Array(24).fill(0),
};
}
channelPresetMap[key].totalCount++;
channelPresetMap[key].hourlyData[hour]++;
});
//
const groupedData = this.groupByChannel(channelPresetMap);
console.log(groupedData);
//
this.tableData = groupedData.flatMap((group) => {
return group.map((item) => {
const anomalies = this.detectAnomalies(item.hourlyData);
return {
channel: item.channel,
presetId: `预置位:${item.presetId}`,
totalCount: item.totalCount,
anomalies: anomalies.join(", "),
};
});
});
},
//
groupByChannel(channelPresetMap) {
const grouped = {};
Object.values(channelPresetMap).forEach((item) => {
const channel = item.channel;
if (!grouped[channel]) {
grouped[channel] = [];
}
grouped[channel].push(item);
});
return Object.keys(grouped)
.sort()
.map((channel) => grouped[channel]);
},
//
detectAnomalies(hourlyData) {
const anomalies = [];
const now = new Date(); //
const currentHour = now.getHours(); //
hourlyData.forEach((count, hour) => {
//
if (hour <= currentHour) {
if (count > 2) {
anomalies.push(`${hour}:00 - 多${count - 2}`);
} else if (count < 2) {
anomalies.push(`${hour}:00 - 少${2 - count}`);
}
}
});
return anomalies;
},
//
handleCurrentChange(val) {
this.page = val;
this.getPhotoList();
},
handleSizeChange(val) {
this.pageSize = val;
this.getPhotoList();
},
},
};
</script>
<style lang="less">
.phototimeDialog {
h3 {
margin-bottom: 20px;
}
.el-dialog {
height: 100%;
margin: 0px;
.el-dialog__body {
height: calc(100% - 70px);
padding: 8px;
}
}
}
</style>

@ -242,7 +242,12 @@
:sort-method="picSort"
>
<template slot-scope="scope">
{{ scope.row.photoInfo.photoCount }}
<el-link
type="primary"
@click.native.stop="handleShowtime(scope.row)"
>
{{ scope.row.photoInfo.photoCount }}</el-link
>
</template>
</el-table-column>
</el-table>
@ -263,6 +268,7 @@
<ipDialog ref="ipDialogref"></ipDialog>
<photoDialog ref="photoDialogref"></photoDialog>
<photoTimeList ref="phototimeDialogref"></photoTimeList>
</div>
</template>
<script>
@ -273,11 +279,14 @@ import {
} from "@/utils/api/reportApi";
import ipDialog from "./components/ipDialog";
import photoDialog from "./components/photoList";
import photoTimeList from "./components/photoTimeList";
export default {
name: "photoStatisBox",
components: {
ipDialog,
photoDialog,
photoTimeList,
},
data() {
return {
@ -297,6 +306,10 @@ export default {
{ id: 2, name: "通道2" },
{ id: 3, name: "通道3" },
{ id: 4, name: "通道4" },
{ id: 5, name: "通道5" },
{ id: 6, name: "通道6" },
{ id: 7, name: "通道7" },
{ id: 8, name: "通道8" },
], //
formdata: {
dyid: -1,
@ -534,6 +547,10 @@ export default {
let params = this.formdata;
this.$refs.photoDialogref.display(row, params);
},
handleShowtime(row) {
let params = this.formdata;
this.$refs.phototimeDialogref.display(row, params);
},
// ip
handleShowIp(row) {
this.$refs.ipDialogref.display(row);

Loading…
Cancel
Save