Commit 53469680 authored by ninglx's avatar ninglx

wj-smartcity 修正绿波时间线问题 处理优化数据查询页面逻辑

parent e735e9b7
...@@ -106,4 +106,10 @@ export const initLaneSort = (data) => request({ ...@@ -106,4 +106,10 @@ export const initLaneSort = (data) => request({
url:`${baseUrl}/trend/laneIdList`, url:`${baseUrl}/trend/laneIdList`,
method:'post', method:'post',
data: data data: data
})
// 事件查询 溢出事件
export const overFlowEvent = (data) => request({
url:`${baseUrl}/trend/overFlowEvent`,
method:'post',
data: data
}) })
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<label class="custom-form-label">时段选择: </label> <label class="custom-form-label">时段选择: </label>
<el-date-picker <el-date-picker
:clearable="false" :clearable="false"
@change="getData" @change="dateChange"
v-model="dateTimeRange" v-model="dateTimeRange"
type="datetimerange" type="datetimerange"
range-separator="至" range-separator="至"
...@@ -243,6 +243,13 @@ export default { ...@@ -243,6 +243,13 @@ export default {
} }
}, },
methods: { methods: {
dateChange(){
if(new Date(this.dateTimeRange[1]).getTime() - new Date(this.dateTimeRange[0]).getTime() > 30*24*60*60*1000){
this.$message('选择时段需小于30天')
return
}
this.getData()
},
downloadFileExcel(response){ downloadFileExcel(response){
let blob = new Blob([response.data], { type: "application/x-xls" }); let blob = new Blob([response.data], { type: "application/x-xls" });
let a = document.createElement("a"); let a = document.createElement("a");
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<el-date-picker <el-date-picker
style="margin-right: 10px" style="margin-right: 10px"
:clearable="false" :clearable="false"
@change="getData" @change="dateChange"
v-model="dateTimeRange" v-model="dateTimeRange"
type="datetimerange" type="datetimerange"
range-separator="至" range-separator="至"
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
show-overflow-tooltip show-overflow-tooltip
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ occupancyValue(scope.row.time) }} {{ occupancyValue(scope.row.startTime) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
show-overflow-tooltip show-overflow-tooltip
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ occupancyValue(scope.row.xxx) }} {{ occupancyValue(scope.row.endTime) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
show-overflow-tooltip show-overflow-tooltip
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ occupancyValue(scope.row.xxx) }} {{ occupancyValue(scope.row.duration) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="位置" show-overflow-tooltip> <el-table-column align="center" label="位置" show-overflow-tooltip>
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
show-overflow-tooltip show-overflow-tooltip
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ occupancyValue(scope.row.laneSort) }} {{ occupancyValue(scope.row.dir) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -257,6 +257,7 @@ import { ...@@ -257,6 +257,7 @@ import {
getHoloEventList, getHoloEventList,
initLaneSort, initLaneSort,
getLaneSnapshotIndex, getLaneSnapshotIndex,
overFlowEvent,
} from "@/dao/optApi"; } from "@/dao/optApi";
import { occupancyValue } from "../../../utils"; import { occupancyValue } from "../../../utils";
...@@ -292,6 +293,17 @@ export default { ...@@ -292,6 +293,17 @@ export default {
} }
}, },
methods: { methods: {
dateChange() {
if (
new Date(this.dateTimeRange[1]).getTime() -
new Date(this.dateTimeRange[0]).getTime() >
30 * 24 * 60 * 60 * 1000
) {
this.$message("选择时段需小于30天");
return;
}
this.getData();
},
exportLaneExcel() { exportLaneExcel() {
if (!this.eventTypeValue) { if (!this.eventTypeValue) {
this.$message("请选择要导出数据的事件类型"); this.$message("请选择要导出数据的事件类型");
...@@ -334,15 +346,28 @@ export default { ...@@ -334,15 +346,28 @@ export default {
}); });
}); });
// 溢出事件 // 溢出事件
getLaneSnapshotIndex({ // getLaneSnapshotIndex({
// crossId: this.crossData.crossId,
// end: this.dateTimeRange[1].toLocaleString().replaceAll("/", "-"),
// start: this.dateTimeRange[0].toLocaleString().replaceAll("/", "-"),
// // end: '2024-06-24 18:00:00',
// // start: '2024-06-24 00:00:00',
// overFlow: true,
// }).then((res) => {
// console.log("溢出 (复用快照", res);
// this.overTableData = res.content.map((item, index) => {
// item.index = index + 1;
// return item;
// });
// });
overFlowEvent({
crossId: this.crossData.crossId, crossId: this.crossData.crossId,
end: this.dateTimeRange[1].toLocaleString().replaceAll("/", "-"), end: this.dateTimeRange[1].toLocaleString().replaceAll("/", "-"),
start: this.dateTimeRange[0].toLocaleString().replaceAll("/", "-"),
// end: '2024-06-24 18:00:00',
// start: '2024-06-24 00:00:00',
overFlow: true, overFlow: true,
pageNum: 0,
start: this.dateTimeRange[0].toLocaleString().replaceAll("/", "-"),
}).then((res) => { }).then((res) => {
console.log("溢出 (复用快照", res); console.log("溢出事件", res);
this.overTableData = res.content.map((item, index) => { this.overTableData = res.content.map((item, index) => {
item.index = index + 1; item.index = index + 1;
return item; return item;
......
<template> <template>
<div class="full-w-h" style="display: flex;flex-direction: column"> <div class="full-w-h" style="display: flex; flex-direction: column">
<div class="custom-tab-header"> <div class="custom-tab-header">
<div @click="clickTab(item)" class="c-tab-item" <div
:class="`${activeTab===Object.keys(item)[0]?'active':''}`" v-for="item of tabs">{{ @click="clickTab(item)"
item[Object.keys(item)[0]] class="c-tab-item"
}} :class="`${activeTab === Object.keys(item)[0] ? 'active' : ''}`"
v-for="item of tabs"
>
{{ item[Object.keys(item)[0]] }}
</div> </div>
</div> </div>
<div class="custom-tab-content"> <div class="custom-tab-content">
<div class="tab-item" v-if="activeTab==='1'"> <div class="tab-item" v-if="activeTab === '1'">
<cycle-data ref="tab1" :crossData="crossData"/> <cycle-data ref="tab1" :crossData="crossData" />
</div> </div>
<div class="tab-item" v-if="activeTab==='2'"> <div class="tab-item" v-if="activeTab === '2'">
<snapshot-data ref="tab2" :crossData="crossData"/> <snapshot-data ref="tab2" :crossData="crossData" />
</div> </div>
<div class="tab-item" v-if="activeTab==='3'"> <div class="tab-item" v-if="activeTab === '3'">
<event-data ref="tab3" :crossData="crossData"/> <event-data ref="tab3" :crossData="crossData" />
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {getLanePeriodTurnData, getLaneTrafficIndex} from "@/dao/optApi"; import { getLanePeriodTurnData, getLaneTrafficIndex } from "@/dao/optApi";
import {noDataTitle} from "@/utils/chartStyle"; import { noDataTitle } from "@/utils/chartStyle";
import {getFontSize} from "@/config/holo/fontSize"; import { getFontSize } from "@/config/holo/fontSize";
import CycleData from "@/views/dataQueries/rightForm/cycleData.vue"; import CycleData from "@/views/dataQueries/rightForm/cycleData.vue";
import SnapshotData from "@/views/dataQueries/rightForm/snapshotData.vue"; import SnapshotData from "@/views/dataQueries/rightForm/snapshotData.vue";
import EventData from "@/views/dataQueries/rightForm/eventData.vue"; import EventData from "@/views/dataQueries/rightForm/eventData.vue";
export default { export default {
name: 'rightForm', name: "rightForm",
components: {EventData, SnapshotData, CycleData}, components: { EventData, SnapshotData, CycleData },
props: ['crossData'], props: ["crossData"],
data() { data() {
return { return {
activeTab: '1', activeTab: "1",
tabs: [ tabs: [{ 1: "周期数据" }, { 2: "快照数据" },
{'1': '周期数据'}, // { 3: "事件数据" }
{'2': '快照数据'}, ],
// {'3': '事件数据'}, };
],
}
}, },
computed: {}, computed: {},
mounted() { mounted() {},
},
methods: { methods: {
clickTab(item){ clickTab(item) {
// if(Object.keys(item)[0]==='3') return // if(Object.keys(item)[0]==='3') return
this.activeTab=Object.keys(item)[0] this.activeTab = Object.keys(item)[0];
}, },
getData() { getData() {
let queue = []; let queue = [];
let needDicts = [ let needDicts = ["Direction"];
'Direction'
];
for (let item of needDicts) { for (let item of needDicts) {
queue.push( queue.push(
this.$store.dispatch("QUERY_DICT", { this.$store.dispatch("QUERY_DICT", {
type: item, type: item,
}) })
); );
} }
Promise.all(queue).then(() => { Promise.all(queue).then(() => {
this.$refs[`tab${this.activeTab}`].getData() this.$refs[`tab${this.activeTab}`].getData();
}) });
}, },
} },
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import url("../../../assets/less/elementTable.less"); @import url("../../../assets/less/elementTable.less");
::v-deep .el-input__inner, ::v-deep .el-range-input { ::v-deep .el-input__inner,
::v-deep .el-range-input {
color: white; color: white;
background-color: transparent; background-color: transparent;
} }
...@@ -86,8 +82,7 @@ export default { ...@@ -86,8 +82,7 @@ export default {
height: 45px; height: 45px;
display: flex; display: flex;
width: 100%; width: 100%;
background: linear-gradient( 90deg, #043A70 0%, rgba(4,59,113,0.2) 100%); background: linear-gradient(90deg, #043a70 0%, rgba(4, 59, 113, 0.2) 100%);
.c-tab-item { .c-tab-item {
width: 140px; width: 140px;
...@@ -99,9 +94,6 @@ export default { ...@@ -99,9 +94,6 @@ export default {
align-items: center; align-items: center;
font-size: 16px; font-size: 16px;
} }
.c-tab-item:last-child{
//cursor: not-allowed;
}
.active { .active {
background-color: #1f93ff; background-color: #1f93ff;
...@@ -118,6 +110,4 @@ export default { ...@@ -118,6 +110,4 @@ export default {
height: 100%; height: 100%;
} }
} }
</style>
</style>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<label class="custom-form-label">时段选择: </label> <label class="custom-form-label">时段选择: </label>
<el-date-picker <el-date-picker
:clearable="false" :clearable="false"
@change="getData()" @change="dateChange"
v-model="dateTimeRange" v-model="dateTimeRange"
type="datetimerange" type="datetimerange"
range-separator="至" range-separator="至"
...@@ -348,6 +348,13 @@ export default { ...@@ -348,6 +348,13 @@ export default {
this.getData(); this.getData();
}, },
methods: { methods: {
dateChange(){
if(new Date(this.dateTimeRange[1]).getTime() - new Date(this.dateTimeRange[0]).getTime() > 30*24*60*60*1000){
this.$message('选择时段需小于30天')
return
}
this.getData()
},
downloadFileExcel(response) { downloadFileExcel(response) {
let blob = new Blob([response.data], { type: "application/x-xls" }); let blob = new Blob([response.data], { type: "application/x-xls" });
let a = document.createElement("a"); let a = document.createElement("a");
......
...@@ -32,9 +32,7 @@ ...@@ -32,9 +32,7 @@
<div <div
class="time-run-dash" class="time-run-dash"
v-if="contentData.areaDetailFlag" v-if="contentData.areaDetailFlag"
:style="{ :style="runLineStyle"
left: (770 / contentData.cycle) * contentData.pointerSecond - 10 + 'px',
}"
> >
<div class="dash-line"></div> <div class="dash-line"></div>
<div class="dash-secend">{{ contentData.pointerSecond }}s</div> <div class="dash-secend">{{ contentData.pointerSecond }}s</div>
...@@ -63,7 +61,6 @@ ...@@ -63,7 +61,6 @@
</template> </template>
<script> <script>
import { api_phaseByTimeList } from "@/common/api/crossControl.js";
import wsMixins from "@/common/mixin/wsMixins.js"; import wsMixins from "@/common/mixin/wsMixins.js";
export default { export default {
...@@ -110,27 +107,28 @@ export default { ...@@ -110,27 +107,28 @@ export default {
mounted() { mounted() {
console.log("contentData", this.contentData); console.log("contentData", this.contentData);
this.getCrossWs(); //赋值第一路口的crossId this.getCrossWs(); //赋值第一路口的crossId
// this.contentData.pointerSecond = 235;
this.timeInterval = setInterval(() => { this.timeInterval = setInterval(() => {
if (this.contentData.pointerSecond < this.contentData.cycle) { if (this.contentData.pointerSecond < this.contentData.cycle) {
++this.contentData.pointerSecond; ++this.contentData.pointerSecond;
} else { } else {
this.contentData.pointerSecond = 0; this.contentData.pointerSecond = 0;
} }
// this.waveData = this.waveOldData.map((item) => {
// let data = this.setSecondsData(
// item.greenwavePhaseList,
// this.contentData.pointerSecond
// );
// return {
// ...item,
// greenwavePhaseList: data,
// };
// });
}, 1000); }, 1000);
// this.getPhase();
this.getData(); this.getData();
}, },
computed: {
runLineStyle() {
if (document.getElementsByClassName("wave-phase-box")?.length) {
const div = document.getElementsByClassName("wave-phase-box")[0];
return `left: ${
(div.getBoundingClientRect().width / this.contentData.cycle) *
this.contentData.pointerSecond -
10
}px`;
}
},
},
methods: { methods: {
setItemHeight() { setItemHeight() {
const boxHeight = this.$refs.greenWave.offsetHeight; const boxHeight = this.$refs.greenWave.offsetHeight;
...@@ -161,7 +159,6 @@ export default { ...@@ -161,7 +159,6 @@ export default {
}px`; }px`;
}); });
setTimeout(() => { setTimeout(() => {
// this.draw();
this.setGreenWaveLine(); this.setGreenWaveLine();
}, 1000); }, 1000);
}, },
...@@ -200,6 +197,11 @@ export default { ...@@ -200,6 +197,11 @@ export default {
} }
if (data) { if (data) {
const startXEachSecondW = startDivRect.width / this.contentData.cycle; const startXEachSecondW = startDivRect.width / this.contentData.cycle;
console.log(
"startXEachSecondW",
startXEachSecondW,
data[i].offsetToStart
);
const startX = const startX =
startDivRect.left + startXEachSecondW * data[i].offsetToStart; startDivRect.left + startXEachSecondW * data[i].offsetToStart;
const startY = startDivRect.top; const startY = startDivRect.top;
...@@ -247,29 +249,14 @@ export default { ...@@ -247,29 +249,14 @@ export default {
return item; return item;
}); });
this.waveOldData = JSON.parse(JSON.stringify(this.waveData)); this.waveOldData = JSON.parse(JSON.stringify(this.waveData));
// this.waveData = this.waveOldData.map((item, index) => {
// let data = this.setSecondsData(
// item.greenwavePhaseList,
// this.contentData.pointerSecond
// );
// return {
// ...item,
// greenwavePhaseList: data,
// };
// // item.greenwavePhaseList = JSON.parse(JSON.stringify(data));
// // return item;
// });
this.$nextTick(() => { this.$nextTick(() => {
this.setItemHeight(); this.setItemHeight();
}); });
}, },
setSecondsData(datas, val) { setSecondsData(datas, val) {
const data = JSON.parse(JSON.stringify(datas)); const data = JSON.parse(JSON.stringify(datas));
// console.log(val);
// console.log(data);
const dataIndex = data.length - 1; const dataIndex = data.length - 1;
let index = 0; let index = 0;
function contrastFun() { function contrastFun() {
if (data[index].seconds >= val) { if (data[index].seconds >= val) {
data[index].seconds -= val; data[index].seconds -= val;
...@@ -292,61 +279,11 @@ export default { ...@@ -292,61 +279,11 @@ export default {
} }
} }
} }
if (index <= dataIndex) { if (index <= dataIndex) {
contrastFun(); contrastFun();
} }
return data; return data;
}, },
getPhase() {
const params = {
crossId: "12F6S08J7P0",
datetime: "2023-06-09 17:15:42",
};
api_phaseByTimeList(params).then((res) => {
if (res.data) {
const data = res.data.content;
this.waveData[0].phaseData = this.waveData[1].phaseData = data.map(
(item, index) => {
item.phaseLen = 0;
this.timeAllKey.forEach((key) => {
item.phaseLen += item[key];
});
this.allCyclelen += item.phaseLen;
return {
phaseNo: item.phaseNo,
phaseLen: item.phaseLen,
coordPhaseNo: index,
};
}
);
setTimeout(() => {
this.setGreenWaveLine();
}, 1000);
}
});
},
//爱心
draw() {
var canvas = document.getElementById("waveCanvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
if (canvas.getContext) {
var ctx = canvas.getContext("2d");
//三次贝塞尔曲线
ctx.beginPath();
ctx.moveTo(75, 40);
ctx.bezierCurveTo(75, 37, 70, 25, 50, 25);
ctx.bezierCurveTo(20, 25, 20, 62.5, 20, 62.5);
ctx.bezierCurveTo(20, 80, 40, 102, 75, 120);
ctx.bezierCurveTo(110, 102, 130, 80, 130, 62.5);
ctx.bezierCurveTo(130, 62.5, 130, 25, 100, 25);
ctx.bezierCurveTo(85, 25, 75, 37, 75, 40);
ctx.fillStyle = "rgb(247, 150,167)";
ctx.fill();
}
},
}, },
}; };
</script> </script>
...@@ -381,8 +318,10 @@ export default { ...@@ -381,8 +318,10 @@ export default {
background-size: 100% 100%; background-size: 100% 100%;
} }
.dash-secend { .dash-secend {
height: 20px; height: 23px;
line-height: 20px; line-height: 23px;
width: 20px;
background-color: #0f2645;
} }
} }
......
...@@ -257,7 +257,7 @@ export default { ...@@ -257,7 +257,7 @@ export default {
}, },
kipActive: { name: "", type: null }, kipActive: { name: "", type: null },
radio: "", radio: "",
loading: false, loading: true,
}; };
}, },
methods: { methods: {
...@@ -317,6 +317,7 @@ export default { ...@@ -317,6 +317,7 @@ export default {
status: this.kipActive.type, status: this.kipActive.type,
type: null, type: null,
}).then((res) => { }).then((res) => {
this.loading = false
console.log("res right", res); console.log("res right", res);
if (res && res.code === 200) { if (res && res.code === 200) {
const data = res.content; const data = res.content;
...@@ -397,6 +398,7 @@ export default { ...@@ -397,6 +398,7 @@ export default {
status: null, status: null,
type: null, type: null,
}).then((res) => { }).then((res) => {
this.loading = false
if (res && res.code === 200) { if (res && res.code === 200) {
const data = res.content; const data = res.content;
this.kipData = [ this.kipData = [
......
<template> <template>
<msg-card class="item-keyCross" :title="`${crossName}监测`"> <msg-card class="item-keyCross" :title="`${crossName}监测`">
<div class="full-w-h" style="position: relative"> <div class="full-w-h" v-loading="loading"
element-loading-spinner="el-icon-loading"
element-loading-text="数据加载中..."
element-loading-background="rgba(3, 11, 25, 0.8)" style="position: relative">
<div class="keyCrossTitle">排队长度(m)</div> <div class="keyCrossTitle">排队长度(m)</div>
<v-chart autoresize :option="option"/> <v-chart autoresize :option="option"/>
</div> </div>
...@@ -22,7 +25,7 @@ export default { ...@@ -22,7 +25,7 @@ export default {
}, },
data() { data() {
return { return {
tabsLoading: true, loading: true,
charts: {}, charts: {},
xData:[], xData:[],
chartResult:{}, chartResult:{},
...@@ -178,6 +181,7 @@ export default { ...@@ -178,6 +181,7 @@ export default {
getData(){ getData(){
// 13NF80B5QN0 // 13NF80B5QN0
getKeyCross({crossId:''}).then(res=>{ getKeyCross({crossId:''}).then(res=>{
this.loading = false
console.log('key cross...',res) console.log('key cross...',res)
if(res.content){ if(res.content){
if(res.content.length){ if(res.content.length){
...@@ -235,7 +239,6 @@ export default { ...@@ -235,7 +239,6 @@ export default {
); );
} }
Promise.all(queue).then(() => { Promise.all(queue).then(() => {
this.fullscreenLoading = false;
this.getData() this.getData()
}); });
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment