Browse Source

更改气象

wangqin
zhangzhang 8 months ago
parent
commit
5feec62fb1
  1. 13
      ruoyi-ui/src/api/commandDispatch/index.js
  2. 125
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/commandDispatch/Cards/CrowdnessIndicatorRankings/index.vue
  3. 71
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/commandDispatch/index.vue

13
ruoyi-ui/src/api/commandDispatch/index.js

@ -0,0 +1,13 @@
import request from "@/utils/request";
// 查询事件气象
export function WeatherForecast(lng, lat) {
return request({
url:
"/weatherForecast/queryTheSpecifiedLatitudeAndLongitudeWeather/" +
lng +
"/" +
lat,
method: "get",
});
}

125
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/commandDispatch/Cards/CrowdnessIndicatorRankings/index.vue

@ -1,17 +1,36 @@
<template> <template>
<Card class='CrowdnessIndicatorRankings border' title="拥挤度指标排名情况"> <Card class="CrowdnessIndicatorRankings border" title="拥挤度指标排名情况">
<div class="map"> <div class="map">
<AMapContainer v-if="delayLoad" style="z-index: 9;" /> <AMapContainer v-if="delayLoad" style="z-index: 9" />
</div> </div>
<div class="right border"> <div class="right border">
<div :class="['item', { active: isActive(item) }]" v-for="item in operation" :key="item.key" <div
@click="handleClick(item)"> :class="['item', { active: isActive(item) }]"
<ElPopover trigger="manual" :value="isActive(item)" :disabled="item.key !== 'weather'" placement="left"> v-for="item in operation"
<div v-if="item.key === 'weather'"> :key="item.key"
天气 能见度 风向西南 风力1 @click="handleClick(item)"
>
<ElPopover
trigger="manual"
:value="isActive(item)"
:disabled="item.key !== 'weather'"
placement="left"
>
<div v-if="item.key === 'weather'" class="weather">
<span>天气{{ weatherData.text }}</span>
<span>能见度{{ weatherData.vis }}公里</span>
<span>风向{{ weatherData.windDir }}</span>
<span>风力{{ weatherData.windScale }}</span>
</div> </div>
<div class="label" slot="reference" <div
:style="{ backgroundImage: `url(${require(`./images/${item.key}${isActive(item) ? '-active' : ''}.svg`)})` }" /> class="label"
slot="reference"
:style="{
backgroundImage: `url(${require(`./images/${item.key}${
isActive(item) ? '-active' : ''
}.svg`)})`,
}"
/>
</ElPopover> </ElPopover>
</div> </div>
</div> </div>
@ -19,15 +38,16 @@
</template> </template>
<script> <script>
import Card from "@screen/components/Card2/Card.vue";; import Card from "@screen/components/Card2/Card.vue";
import AMapContainer from "@screen/pages/Home/components/AMapContainer/index.vue" import AMapContainer from "@screen/pages/Home/components/AMapContainer/index.vue";
import { provideMixin } from "./../../mixin" import { provideMixin } from "./../../mixin";
import { WeatherForecast } from "@/api/commandDispatch";
export default { export default {
name: 'CrowdnessIndicatorRankings', name: "CrowdnessIndicatorRankings",
components: { components: {
Card, Card,
AMapContainer AMapContainer,
}, },
mixins: [provideMixin], mixins: [provideMixin],
data() { data() {
@ -35,58 +55,71 @@ export default {
active: [], active: [],
operation: [ operation: [
{ {
key: 'weather', key: "weather",
label: "天气" label: "天气",
}, },
{ {
key: 'camera', key: "camera",
label: "摄像机" label: "摄像机",
}, },
{ {
key: 'bar', key: "bar",
label: "柱状图" label: "柱状图",
}, },
{ {
key: 'level', key: "level",
label: "天气" label: "天气",
}, },
{ {
key: 'car', key: "car",
label: "天气" label: "天气",
}, },
{ {
key: 'pie', key: "pie",
label: "天气" label: "天气",
}, },
], ],
delayLoad: false delayLoad: true,
} weatherData: {},
};
}, },
computed: { computed: {
isActive() { isActive() {
return item => this.active.includes(item.key) return (item) => this.active.includes(item.key);
} },
}, },
methods: { methods: {
handleClick(item) { handleClick(item) {
const findIndex = this.active.indexOf(item.key); const findIndex = this.active.indexOf(item.key);
if (findIndex === -1) this.active.push(item.key); if (findIndex === -1) this.active.push(item.key);
else else this.active.splice(findIndex, 1);
this.active.splice(findIndex, 1) },
} getWeatherForecast() {
WeatherForecast(117.2, 36.65).then((res) => {
this.weatherData =
res.data.weatherInTheAreaWhereTheIncidentOccurred.now;
console.log("气象", res);
});
},
}, },
mounted() { mounted() {
setTimeout(() => { this.getWeatherForecast();
this.delayLoad = true // setTimeout(() => {
}, 240); // this.delayLoad = true;
// }, 240);
}, },
} };
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.border { .border {
border: 1px solid; border: 1px solid;
border-image: linear-gradient(360deg, rgba(55, 231, 255, .42), rgba(55, 231, 255, 0)) 1 1; border-image: linear-gradient(
360deg,
rgba(55, 231, 255, 0.42),
rgba(55, 231, 255, 0)
)
1 1;
} }
.CrowdnessIndicatorRankings { .CrowdnessIndicatorRankings {
@ -108,7 +141,11 @@ export default {
height: 100%; height: 100%;
top: 0; top: 0;
width: 34px; width: 34px;
background: linear-gradient(180deg, rgba(25, 40, 52, .6) 0%, rgba(28, 50, 60, .6) 100%); background: linear-gradient(
180deg,
rgba(25, 40, 52, 0.6) 0%,
rgba(28, 50, 60, 0.6) 100%
);
border-right: 0; border-right: 0;
border-bottom: 0; border-bottom: 0;
@ -125,7 +162,7 @@ export default {
div { div {
width: 100%; width: 100%;
height: 100%; height: 100%;
transition: all .15s linear; transition: all 0.15s linear;
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
@ -133,8 +170,12 @@ export default {
} }
.active { .active {
background: linear-gradient(180deg, #005C79 0%, #009BCC 100%); background: linear-gradient(180deg, #005c79 0%, #009bcc 100%);
} }
} }
} }
.weather span {
margin-right: 20px;
display: inline-block;
}
</style> </style>

71
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/commandDispatch/index.vue

@ -1,14 +1,20 @@
<template> <template>
<div class='CommandDispatch' :style="{ '--row': row }"> <div class="CommandDispatch" :style="{ '--row': row }">
<component :is="key" v-for="(_, key) in gridAreaMap" :key="key" :ref="key" :style="{ gridArea: gridAreaMap[key] }" <component
@fullHeight="opacityKey => handleFullHeight(key, opacityKey)" /> :is="key"
v-for="(_, key) in gridAreaMap"
:key="key"
:ref="key"
:style="{ gridArea: gridAreaMap[key] }"
@fullHeight="(opacityKey) => handleFullHeight(key, opacityKey)"
/>
</div> </div>
</template> </template>
<script> <script>
import request from "@/utils/request"; import request from "@/utils/request";
const files = require.context('./Cards', true, /[^/]+\/index\.vue$/); const files = require.context("./Cards", true, /[^/]+\/index\.vue$/);
const components = files.keys().reduce((components, key) => { const components = files.keys().reduce((components, key) => {
components[key.match(/[^/]+/g)[1]] = files(key).default; components[key.match(/[^/]+/g)[1]] = files(key).default;
@ -25,34 +31,34 @@ const originGridArea = {
RealTimeVideo: "1 / 3 / span 6 / 3", RealTimeVideo: "1 / 3 / span 6 / 3",
ReleaseInformation: "7 / 3 / span 14 / 3", ReleaseInformation: "7 / 3 / span 14 / 3",
TrafficControl: "21 / 3 / span 5 / 3", TrafficControl: "21 / 3 / span 5 / 3",
} };
export default { export default {
name: 'CommandDispatch', name: "CommandDispatch",
components: { components: {
...components, ...components,
}, },
props: { props: {
detailId: { detailId: {
type: [String, Number], type: [String, Number],
default: 2 default: 2,
} },
}, },
provide() { provide() {
return { return {
provideData: this.provideData, provideData: this.provideData,
} };
}, },
data() { data() {
return { return {
gridAreaMap: { gridAreaMap: {
...originGridArea ...originGridArea,
}, },
row: 24, row: 24,
provideData: { provideData: {
detail: null detail: null,
} },
} };
}, },
created() { created() {
this.getDetail(); this.getDetail();
@ -66,9 +72,10 @@ export default {
.then((result) => { .then((result) => {
if (result.code != 200) return; if (result.code != 200) return;
this.provideData.detail = result.data this.provideData.detail = result.data;
console.log("事件详情", this.provideData.detail);
}) })
.catch((err) => { }); .catch((err) => {});
}, },
handleFullHeight(key, opacityKey) { handleFullHeight(key, opacityKey) {
if (this.gridAreaMap[key] !== originGridArea[key]) { if (this.gridAreaMap[key] !== originGridArea[key]) {
@ -76,30 +83,32 @@ export default {
if (this.$refs[opacityKey]?.[0]) { if (this.$refs[opacityKey]?.[0]) {
this.$refs[opacityKey][0].$el.style.opacity = 1; this.$refs[opacityKey][0].$el.style.opacity = 1;
this.$refs[opacityKey][0].$el.style.pointerEvents = "auto"; this.$refs[opacityKey][0].$el.style.pointerEvents = "auto";
}; }
} else { } else {
let index = 0; let index = 0;
if (this.$refs[opacityKey]?.[0]) { if (this.$refs[opacityKey]?.[0]) {
this.$refs[opacityKey][0].$el.style.opacity = 0; this.$refs[opacityKey][0].$el.style.opacity = 0;
this.$refs[opacityKey][0].$el.style.pointerEvents = "none"; this.$refs[opacityKey][0].$el.style.pointerEvents = "none";
}; }
this.gridAreaMap[key] = originGridArea[key].replace(/[0-9]+/g, (num) => { this.gridAreaMap[key] = originGridArea[key].replace(
try { /[0-9]+/g,
return { 0: '1', 2: this.row + 1 }[index] || num; (num) => {
} catch (error) { try {
return { 0: "1", 2: this.row + 1 }[index] || num;
} finally { } catch (error) {
index++; } finally {
index++;
}
} }
}); );
} }
} },
} },
} };
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.CommandDispatch { .CommandDispatch {
padding: 24px 12px 21px 12px; padding: 24px 12px 21px 12px;
display: grid; display: grid;
@ -107,8 +116,8 @@ export default {
grid-template-rows: repeat(var(--row), 1fr); grid-template-rows: repeat(var(--row), 1fr);
gap: 18px; gap: 18px;
>div { > div {
transition: all .18s linear; transition: all 0.18s linear;
} }
::v-deep { ::v-deep {

Loading…
Cancel
Save